aboutsummaryrefslogtreecommitdiff
path: root/src/ports.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ports.h')
-rw-r--r--src/ports.h43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/ports.h b/src/ports.h
deleted file mode 100644
index 0371bcc..0000000
--- a/src/ports.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#pragma once
-
-template <typename T>
-concept port_data_t = (is_same<T, uint8_t>::value || is_same<T, uint16_t>::value || is_same<T, uint32_t>::value);
-
-template <uint16_t port_num, port_data_t T>
-class Port {
-public:
- [[nodiscard]] T read() {
- T result;
-
- switch (sizeof(T)) {
- case 1:
- asm volatile("inb %1, %0" : "=a"(result) : "Nd"(port_num));
- break;
- case 2:
- asm volatile("inw %1, %0" : "=a"(result) : "Nd"(port_num));
- break;
- case 4:
- asm volatile("inl %1, %0" : "=a"(result) : "Nd"(port_num));
- break;
- }
-
- return result;
- }
-
- void write(T data) {
- switch (sizeof(T)) {
- case 1:
- asm volatile("outb %0, %1" : : "a"(data), "Nd"(port_num));
- break;
- case 2:
- asm volatile("outw %0, %1" : : "a"(data), "Nd"(port_num));
- break;
- case 4:
- asm volatile("outl %0, %1" : : "a"(data), "Nd"(port_num));
- break;
- }
- }
-};
-
-typedef Port<0x3d4, uint8_t> vga_horizontal_total;
-typedef Port<0x3d5, uint8_t> vga_horizontal_display_enable_end;