From fc13fb2ba5993d06d9d6ae5e80bc337aebbdc119 Mon Sep 17 00:00:00 2001 From: aqua Date: Sun, 8 Oct 2023 19:50:00 +0300 Subject: Use meson build system --- devices/include/keyboard.h | 4 ++++ devices/include/mouse.h | 3 +++ devices/include/pic.h | 5 +++++ devices/include/ps2_controller.h | 5 +++++ devices/include/uart.h | 32 ++++++++++++++++++++++++++++++++ devices/include/vga.h | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 devices/include/keyboard.h create mode 100644 devices/include/mouse.h create mode 100644 devices/include/pic.h create mode 100644 devices/include/ps2_controller.h create mode 100644 devices/include/uart.h create mode 100644 devices/include/vga.h (limited to 'devices/include') 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 +#include + +#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 + +/** 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); -- cgit v1.2.1