/* ======================================== Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. ======================================== */ #pragma once #include #include #include #include namespace Kernel { template class IOArray final { public: IOArray() = delete; IOArray(nullPtr) = delete; explicit IOArray(Array& ports) : fPorts(ports) {} ~IOArray() {} IOArray& operator=(const IOArray&) = default; IOArray(const IOArray&) = default; operator bool() { return !fPorts.Empty(); } public: template T In(SizeT index); template void Out(SizeT index, T value); private: Array fPorts; }; inline constexpr UInt16 kMaxPorts = 16; using IOArray16 = IOArray; template inline Array make_ports(UShort base) { Array ports; for (UShort i = 0; i < Sz; ++i) { ports[i] = base + i; } return ports; } } // namespace Kernel #ifdef __NE_AMD64__ #include #else #error Please provide platform specific code for the I/O #endif // ifdef __NE_AMD64__