diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-07-24 16:15:31 +0000 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-07-24 16:15:31 +0000 |
| commit | 3b9bbbb4be529f2365b8bc2e43c1c8e9a65b1a07 (patch) | |
| tree | 4b4eba0cd68e4044e82277e23df2ae2f7d5cc461 | |
| parent | f00a0149b55a0fd57cc731b015c6f425bc720aba (diff) | |
| download | teachos-3b9bbbb4be529f2365b8bc2e43c1c8e9a65b1a07.tar.xz teachos-3b9bbbb4be529f2365b8bc2e43c1c8e9a65b1a07.zip | |
x86_64: clean up vga hierarchy
| -rw-r--r-- | arch/x86_64/include/x86_64/device_io/port_io.hpp (renamed from arch/x86_64/include/x86_64/io/port_io.hpp) | 0 | ||||
| -rw-r--r-- | arch/x86_64/include/x86_64/vga/crtc.hpp | 35 | ||||
| -rw-r--r-- | arch/x86_64/include/x86_64/vga/io.hpp | 39 | ||||
| -rw-r--r-- | arch/x86_64/src/vga/text.cpp | 6 |
4 files changed, 38 insertions, 42 deletions
diff --git a/arch/x86_64/include/x86_64/io/port_io.hpp b/arch/x86_64/include/x86_64/device_io/port_io.hpp index 4cf0b65..4cf0b65 100644 --- a/arch/x86_64/include/x86_64/io/port_io.hpp +++ b/arch/x86_64/include/x86_64/device_io/port_io.hpp diff --git a/arch/x86_64/include/x86_64/vga/crtc.hpp b/arch/x86_64/include/x86_64/vga/crtc.hpp new file mode 100644 index 0000000..4b4eac5 --- /dev/null +++ b/arch/x86_64/include/x86_64/vga/crtc.hpp @@ -0,0 +1,35 @@ +#ifndef TEACHOS_X86_64_VGA_IO_HPP +#define TEACHOS_X86_64_VGA_IO_HPP + +#include "x86_64/device_io/port_io.hpp" + +#include <cstddef> + +namespace teachos::x86_64::vga::crtc +{ + /** + * @brief The address port of the CRT Controller. + */ + using address = x86_64::io::port<0x3d4, 1>; + + /** + * @brief The data port of the CRT Controller. + */ + using data = x86_64::io::port<0x3d5, 1>; + + namespace registers + { + /** + * @brief The address of the Cursor Start register of the CRTC. + */ + [[maybe_unused]] auto constexpr cursor_start = std::byte{0x0a}; + + /** + * @brief The address of the Cursor End register of the CRTC. + */ + [[maybe_unused]] auto constexpr cursor_end = std::byte{0x0b}; + } // namespace registers + +} // namespace teachos::x86_64::vga::crtc + +#endif
\ No newline at end of file diff --git a/arch/x86_64/include/x86_64/vga/io.hpp b/arch/x86_64/include/x86_64/vga/io.hpp deleted file mode 100644 index 4d99788..0000000 --- a/arch/x86_64/include/x86_64/vga/io.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef TEACHOS_X86_64_VGA_IO_HPP -#define TEACHOS_X86_64_VGA_IO_HPP - -#include "x86_64/io/port_io.hpp" - -#include <cstddef> - -namespace teachos::x86_64::vga::io -{ - namespace crtc - { - /** - * @brief The address port of the CRT Controller. - */ - using address_port = x86_64::io::port<0x3d4, 1>; - - /** - * @brief The data port of the CRT Controller. - */ - using data_port = x86_64::io::port<0x3d5, 1>; - - namespace registers - { - /** - * @brief The address of the Cursor Start register of the CRTC. - */ - [[maybe_unused]] auto constexpr cursor_start = std::byte{0x0a}; - - /** - * @brief The address of the Cursor End register of the CRTC. - */ - [[maybe_unused]] auto constexpr cursor_end = std::byte{0x0b}; - } // namespace registers - - }; // namespace crtc - -} // namespace teachos::x86_64::vga::io - -#endif
\ No newline at end of file diff --git a/arch/x86_64/src/vga/text.cpp b/arch/x86_64/src/vga/text.cpp index dcfdb6b..5c94b84 100644 --- a/arch/x86_64/src/vga/text.cpp +++ b/arch/x86_64/src/vga/text.cpp @@ -1,7 +1,7 @@ #include "x86_64/vga/text.hpp" #include "x86_64/boot/boot.hpp" -#include "x86_64/vga/io.hpp" +#include "x86_64/vga/crtc.hpp" #include <algorithm> #include <bit> @@ -29,8 +29,8 @@ namespace teachos::x86_64::vga::text { auto cursor_disable_byte = std::byte{!enabled} << 5; - io::crtc::address_port::write(io::crtc::registers::cursor_start); - io::crtc::data_port::write(io::crtc::data_port::read() | cursor_disable_byte); + crtc::address::write(crtc::registers::cursor_start); + crtc::data::write(crtc::data::read() | cursor_disable_byte); } auto newline() -> void |
