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/features | |
parent | 212582f69dea4c99c292081b15ea526014b9ad44 (diff) |
Implemented some I/O interfaces
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/io.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/kernel/features/io.c b/kernel/features/io.c index 5d69b8e..b8275f9 100644 --- a/kernel/features/io.c +++ b/kernel/features/io.c @@ -2,12 +2,14 @@ #include <assert.h> #include <def.h> +#include <fb.h> #include <io.h> #include <list.h> #include <mm.h> #include <ps2.h> #include <rand.h> #include <str.h> +#include <timer.h> PROTECTED static struct io_dev *io_mappings[IO_MAX] = { 0 }; @@ -30,6 +32,19 @@ CLEAR void io_add(enum io_type io, struct io_dev *dev) io_mappings[io] = dev; } +res io_poll(u32 *devs) +{ + if (!memory_readable(devs)) + return -EFAULT; + + for (u32 *p = devs; p && memory_readable(p) && *p; p++) { + if (!io_get(*p)) + return -ENOENT; + } + + return -EFAULT; +} + res io_control(enum io_type io, u32 request, void *arg1, void *arg2, void *arg3) { struct io_dev *dev; @@ -63,28 +78,20 @@ res io_read(enum io_type io, void *buf, u32 offset, u32 count) return dev->read(buf, offset, count); } -res io_poll(u32 *devs) -{ - if (!memory_readable(devs)) - return -EFAULT; - - for (u32 *p = devs; p && memory_readable(p) && *p; p++) { - if (!io_get(*p)) - return -ENOENT; - } - - return -EFAULT; -} - -CLEAR void io_install(void) +CLEAR void io_install(struct boot_info *boot) { ps2_detect(); - if (ps2_keyboard_support()) { - print("KBD!\n"); + u8 ps2_keyboard = ps2_keyboard_detect(); + if (ps2_keyboard != U8_MAX) { + ps2_keyboard_install(ps2_keyboard); } - if (ps2_mouse_support()) { - print("MOUSE!\n"); + u8 ps2_mouse = ps2_mouse_detect(); + if (ps2_mouse != U8_MAX) { + ps2_mouse_install(ps2_mouse); } + + timer_install(); + fb_install(boot->vid); } |