diff options
author | Marvin Borner | 2021-04-14 13:39:42 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-14 13:39:42 +0200 |
commit | 212582f69dea4c99c292081b15ea526014b9ad44 (patch) | |
tree | c4fc1643c5acb8821fc0cfbd1b9c0983a50afe97 /kernel/inc | |
parent | 9ded3a2bde80eede5fd887812d70c2f834b53c84 (diff) |
Even more I/O - started new PS/2 driver
Diffstat (limited to 'kernel/inc')
-rw-r--r-- | kernel/inc/io.h | 17 | ||||
-rw-r--r-- | kernel/inc/keyboard.h | 9 | ||||
-rw-r--r-- | kernel/inc/mouse.h | 8 | ||||
-rw-r--r-- | kernel/inc/ps2.h | 46 |
4 files changed, 51 insertions, 29 deletions
diff --git a/kernel/inc/io.h b/kernel/inc/io.h index e05a419..fc294f1 100644 --- a/kernel/inc/io.h +++ b/kernel/inc/io.h @@ -6,25 +6,18 @@ #include <def.h> #include <sys.h> -enum io_type { - IO_MIN, - IO_FRAMEBUFFER, - IO_NETWORK, - IO_KEYBOARD, - IO_MOUSE, - IO_BUS, - IO_MAX, -}; - struct io_dev { const char *name; + res (*read)(void *buf, u32 offset, u32 count) NONNULL; + res (*write)(void *buf, u32 offset, u32 count) NONNULL; + res (*control)(u32 request, void *arg1, void *arg2, void *arg3); }; void io_install(void); -res io_control(); +res io_control(enum io_type io, u32 request, void *arg1, void *arg2, void *arg3); res io_write(enum io_type io, void *buf, u32 offset, u32 count); res io_read(enum io_type io, void *buf, u32 offset, u32 count); -res io_poll(); +res io_poll(u32 *devs); #endif diff --git a/kernel/inc/keyboard.h b/kernel/inc/keyboard.h deleted file mode 100644 index 22120e5..0000000 --- a/kernel/inc/keyboard.h +++ /dev/null @@ -1,9 +0,0 @@ -// MIT License, Copyright (c) 2020 Marvin Borner - -#ifndef KEYBOARD_H -#define KEYBOARD_H - -void keyboard_install(void); -void keyboard_reset(void); - -#endif diff --git a/kernel/inc/mouse.h b/kernel/inc/mouse.h deleted file mode 100644 index e8072aa..0000000 --- a/kernel/inc/mouse.h +++ /dev/null @@ -1,8 +0,0 @@ -// MIT License, Copyright (c) 2020 Marvin Borner - -#ifndef MOUSE_H -#define MOUSE_H - -void mouse_install(void); - -#endif diff --git a/kernel/inc/ps2.h b/kernel/inc/ps2.h new file mode 100644 index 0000000..fb923bf --- /dev/null +++ b/kernel/inc/ps2.h @@ -0,0 +1,46 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef PS2_H +#define PS2_H + +#include <def.h> + +#define PS2_ACK 0xfa +#define PS2_RESEND 0xfe + +struct ps2_status { + u8 in_full : 1; + u8 out_full : 1; + u8 system : 1; + u8 command : 1; + u8 reserved : 2; + u8 error_time : 1; + u8 error_parity : 1; +}; + +struct ps2_config { + u8 first_int : 1; + u8 second_int : 1; + u8 running : 1; + u8 zero1 : 1; + u8 first_clock_disabled : 1; + u8 second_clock_disabled : 1; + u8 first_translation : 1; + u8 zero2 : 1; +}; + +u8 ps2_read_data(void); +u8 ps2_write_data(u8 byte); +struct ps2_status ps2_read_status(void); +u8 ps2_write_command(u8 byte); + +void ps2_detect(void); +u8 ps2_keyboard_support(void); +u8 ps2_mouse_support(void); + +void ps2_keyboard_install(void); +void ps2_keyboard_reset(void); + +void ps2_mouse_install(void); + +#endif |