aboutsummaryrefslogtreecommitdiff
path: root/devices/include
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2023-10-08 19:50:00 +0300
committeraqua <aqua@iserlohn-fortress.net>2023-11-27 21:02:22 +0200
commitfc13fb2ba5993d06d9d6ae5e80bc337aebbdc119 (patch)
tree9607ab4d5f1d4069d4f761a0b25eada36088bd6b /devices/include
parentrules.mk: make include paths absolute (diff)
downloadkernel-fc13fb2ba5993d06d9d6ae5e80bc337aebbdc119.tar.xz
Use meson build system
Diffstat (limited to 'devices/include')
-rw-r--r--devices/include/keyboard.h4
-rw-r--r--devices/include/mouse.h3
-rw-r--r--devices/include/pic.h5
-rw-r--r--devices/include/ps2_controller.h5
-rw-r--r--devices/include/uart.h32
-rw-r--r--devices/include/vga.h33
6 files changed, 82 insertions, 0 deletions
diff --git a/devices/include/keyboard.h b/devices/include/keyboard.h
new file mode 100644
index 0000000..5f4fcc2
--- /dev/null
+++ b/devices/include/keyboard.h
@@ -0,0 +1,4 @@
+#pragma once
+
+void ps2_keyboard_init();
+void ps2_keyboard_irq_handler();
diff --git a/devices/include/mouse.h b/devices/include/mouse.h
new file mode 100644
index 0000000..a34ecb4
--- /dev/null
+++ b/devices/include/mouse.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void mouse_init();
diff --git a/devices/include/pic.h b/devices/include/pic.h
new file mode 100644
index 0000000..c545c60
--- /dev/null
+++ b/devices/include/pic.h
@@ -0,0 +1,5 @@
+#pragma once
+
+void pic_init();
+void pic_enable();
+void pic_clear(unsigned char irq);
diff --git a/devices/include/ps2_controller.h b/devices/include/ps2_controller.h
new file mode 100644
index 0000000..d2f7e80
--- /dev/null
+++ b/devices/include/ps2_controller.h
@@ -0,0 +1,5 @@
+#pragma once
+
+void ps2_ctrl_init();
+unsigned char ps2_read_port1();
+unsigned char ps2_read_port2();
diff --git a/devices/include/uart.h b/devices/include/uart.h
new file mode 100644
index 0000000..8b44519
--- /dev/null
+++ b/devices/include/uart.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#ifdef __ARCH__
+#include <stdio.h>
+#include <sys/io.h>
+
+#else
+/* from stdio */
+typedef struct FILE {
+ int id;
+ void (*putc)(const struct FILE *, char);
+ int (*puts)(const struct FILE *, const char *, int);
+ void (*flush)(const struct FILE *);
+} FILE;
+
+/* from sys/io */
+unsigned char inb(unsigned short);
+void outb(unsigned char, unsigned short);
+
+enum UART {
+ COM1 = 0x3f8,
+ COM2 = 0x2f8,
+ COM3 = 0x3e8,
+ COM4 = 0x2e8,
+ COM5 = 0x5f8,
+ COM6 = 0x4f8,
+ COM7 = 0x5e8,
+ COM8 = 0x4e8,
+};
+#endif
+
+FILE *uart_init(unsigned short port);
diff --git a/devices/include/vga.h b/devices/include/vga.h
new file mode 100644
index 0000000..df0d921
--- /dev/null
+++ b/devices/include/vga.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <stdio.h>
+
+/** Hardware text mode color constants. */
+enum vga_color {
+ VGA_COLOR_BLACK = 0,
+ VGA_COLOR_BLUE = 1,
+ VGA_COLOR_GREEN = 2,
+ VGA_COLOR_CYAN = 3,
+ VGA_COLOR_RED = 4,
+ VGA_COLOR_MAGENTA = 5,
+ VGA_COLOR_BROWN = 6,
+ VGA_COLOR_LIGHT_GREY = 7,
+ VGA_COLOR_DARK_GREY = 8,
+ VGA_COLOR_LIGHT_BLUE = 9,
+ VGA_COLOR_LIGHT_GREEN = 10,
+ VGA_COLOR_LIGHT_CYAN = 11,
+ VGA_COLOR_LIGHT_RED = 12,
+ VGA_COLOR_LIGHT_MAGENTA = 13,
+ VGA_COLOR_LIGHT_BROWN = 14,
+ VGA_COLOR_WHITE = 15
+};
+
+FILE *vga_init(void *addr);
+void vga_clear(enum vga_color foreground, enum vga_color background);
+
+/* void vga_putc(char a); */
+/* void vga_puts(const char *string, int len); */
+
+/* void vga_enable_cursor(unsigned char start, unsigned char end); */
+/* void vga_disable_cursor(); */
+void vga_update_cursor(void);