diff options
author | Marvin Borner | 2021-04-26 16:49:49 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-26 16:49:49 +0200 |
commit | 6ab6e1d1568380f87bf0276cfac4487db553245b (patch) | |
tree | cce0fad7a4711f9d26c27d066da54eae6e0c9ca9 /kernel | |
parent | 6b71accbaf4be52a1e2d3a696675c5e610a4c9b3 (diff) |
PS/2 mouse aah
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/drivers/ps2/mouse.c | 10 | ||||
-rw-r--r-- | kernel/drivers/ps2/ps2.c | 6 | ||||
-rw-r--r-- | kernel/drivers/vmware.c | 9 | ||||
-rw-r--r-- | kernel/inc/ps2.h | 6 |
4 files changed, 15 insertions, 16 deletions
diff --git a/kernel/drivers/ps2/mouse.c b/kernel/drivers/ps2/mouse.c index 7154eef..7748c99 100644 --- a/kernel/drivers/ps2/mouse.c +++ b/kernel/drivers/ps2/mouse.c @@ -98,7 +98,7 @@ CLEAR static void mouse_rate(u8 device, u8 rate) ps2_write_device(device, rate); } -CLEAR void ps2_mouse_install(u8 device) +CLEAR void ps2_mouse_enable(u8 device) { // Enable auxiliary mouse device ps2_write_device(device, 0xa8); @@ -133,7 +133,13 @@ CLEAR void ps2_mouse_install(u8 device) extra_buttons = 1; } - // Setup the mouse handler + mouse_rate(device, 20); +} + +CLEAR void ps2_mouse_install(u8 device) +{ + ps2_mouse_enable(device); + irq_install_handler(12, mouse_handler); queue = stack_new(); diff --git a/kernel/drivers/ps2/ps2.c b/kernel/drivers/ps2/ps2.c index bc93b03..076a0bf 100644 --- a/kernel/drivers/ps2/ps2.c +++ b/kernel/drivers/ps2/ps2.c @@ -6,7 +6,7 @@ #include <print.h> #include <ps2.h> -#define PS2_TIMEOUT 100000 +#define PS2_TIMEOUT 100 static struct ps2_status ps2_read_status(void) { @@ -24,7 +24,7 @@ static u8 ps2_wait_readable(void) return 0; } -static u8 ps2_wait_writable(void) +CLEAR static u8 ps2_wait_writable(void) { u32 time_out = PS2_TIMEOUT; while (time_out--) @@ -43,7 +43,7 @@ u8 ps2_read_data(void) } } -u8 ps2_write_data(u8 byte) +CLEAR u8 ps2_write_data(u8 byte) { if (ps2_wait_writable()) { outb(0x60, byte); diff --git a/kernel/drivers/vmware.c b/kernel/drivers/vmware.c index 795eb79..c82042f 100644 --- a/kernel/drivers/vmware.c +++ b/kernel/drivers/vmware.c @@ -147,14 +147,7 @@ static res vmware_mouse_read(void *buf, u32 offset, u32 count) CLEAR void vmware_mouse_install(u8 device) { - // Enable auxiliary mouse device - ps2_write_device(device, 0xa8); - - // Use default settings - ps2_write_device(device, 0xf6); - - // Enable mouse - ps2_write_device(device, 0xf4); + ps2_mouse_enable(device); vmware_mouse_enable(); irq_install_handler(12, vmware_mouse_handler); diff --git a/kernel/inc/ps2.h b/kernel/inc/ps2.h index b81d1f8..5db8b57 100644 --- a/kernel/inc/ps2.h +++ b/kernel/inc/ps2.h @@ -50,10 +50,10 @@ u8 ps2_write_device(u8 device, u8 data); void ps2_detect(void); u8 ps2_keyboard_detect(void); u8 ps2_mouse_detect(void); +void ps2_mouse_enable(u8 device); +void ps2_mouse_install(u8 device); -void ps2_keyboard_install(u8 device); void ps2_keyboard_reset(void); - -void ps2_mouse_install(u8 device); +void ps2_keyboard_install(u8 device); #endif |