IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
io.hpp
Go to the documentation of this file.
1
11
12
13#pragma once
14
15
16// C++
17#include <concepts>
18// IgrOS-Kernel arch
19#include <arch/types.hpp>
20
21#if defined(IGROS_ARCH_i386) || defined(IGROS_ARCH_x86_64)
22
23// IgrOS-Kernel arch x86
24#include <arch/x86/io.hpp>
25
26#else
27
28#error "Unknown architecture!"
29
30#endif
31
32
33// Arch namespace
34namespace igros::arch {
35
36
38 template<class T, class P>
39 concept PortIO = requires(const P port, const igros_byte_t byte, const igros_word_t word, const igros_dword_t dword) {
40 { T::readPort8(port) } -> std::same_as<igros_byte_t>;
41 { T::readPort16(port) } -> std::same_as<igros_word_t>;
42 { T::readPort32(port) } -> std::same_as<igros_dword_t>;
43 { T::writePort8(port, byte) } -> std::same_as<void>;
44 { T::writePort16(port, word) } -> std::same_as<void>;
45 { T::writePort32(port, dword) } -> std::same_as<void>;
46 };
47
48
49#if defined(IGROS_ARCH_i386) || defined(IGROS_ARCH_x86_64)
50
52 using x86::port_t;
54 using x86::io;
55
56#endif
57
58
59 static_assert(PortIO<io, port_t>, "Architecture I/O doesn't provide port I/O interface!");
60
61
62} // namespace igros::arch
63
I/O structure.
Definition io.hpp:80
Port I/O every architecture must provide.
Definition io.hpp:39
std::uint16_t igros_word_t
16-bit unsigned integer
Definition types.hpp:42
std::uint8_t igros_byte_t
8-bit unsigned integer
Definition types.hpp:41
std::uint32_t igros_dword_t
32-bit unsigned integer
Definition types.hpp:43
Architecture-independent interface: drivers and aliases of current architecture types.
igros_word_t port_t
Define port data type which is 16bit word.
Definition io.hpp:25
Common C++ types redefinition.
IO low-level port operations.