diff options
author | Marvin Borner | 2021-04-14 14:34:38 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-14 14:34:38 +0200 |
commit | 462eaa9531b9e62916b02ab52759cd070de755d3 (patch) | |
tree | 71bb32daa5f8b4389c9d4ce1e42d66600090485f /kernel/drivers/ps2/keyboard.c | |
parent | 212582f69dea4c99c292081b15ea526014b9ad44 (diff) |
Implemented some I/O interfaces
Diffstat (limited to 'kernel/drivers/ps2/keyboard.c')
-rw-r--r-- | kernel/drivers/ps2/keyboard.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/drivers/ps2/keyboard.c b/kernel/drivers/ps2/keyboard.c index 9a19b5c..3c2cdbb 100644 --- a/kernel/drivers/ps2/keyboard.c +++ b/kernel/drivers/ps2/keyboard.c @@ -3,8 +3,8 @@ #include <cpu.h> #include <def.h> #include <errno.h> -#include <fs.h> #include <interrupts.h> +#include <io.h> #include <mem.h> #include <print.h> #include <proc.h> @@ -14,7 +14,6 @@ #include <sys.h> PROTECTED static struct stack *queue = NULL; -PROTECTED static u32 dev_id = 0; static struct event_keyboard *event = NULL; static int state = 0; @@ -46,9 +45,8 @@ static void keyboard_handler(struct regs *r) merged = 0; } -static res keyboard_read(void *buf, u32 offset, u32 count, struct vfs_dev *dev) +static res keyboard_read(void *buf, u32 offset, u32 count) { - UNUSED(dev); if (stack_empty(queue)) return -EINVAL; @@ -68,16 +66,15 @@ CLEAR void ps2_keyboard_reset(void) stack_clear(queue); } -CLEAR void ps2_keyboard_install(void) +CLEAR void ps2_keyboard_install(u8 device) { - //keyboard_rate(); TODO: Fix keyboard rate? + UNUSED(device); + irq_install_handler(1, keyboard_handler); queue = stack_new(); - struct vfs_dev *dev = zalloc(sizeof(*dev)); - dev->name = strdup("kbd"); - dev->type = DEV_CHAR; + struct io_dev *dev = zalloc(sizeof(*dev)); dev->read = keyboard_read; - /* device_add(dev); */ - dev_id = dev->id; + dev->ready = keyboard_ready; + io_add(IO_KEYBOARD, dev); } |