aboutsummaryrefslogtreecommitdiff
path: root/devices/mouse.c
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-11-02 09:34:31 +0200
committeraqua <aqua@iserlohn-fortress.net>2022-11-02 09:34:31 +0200
commitccaf2737f82968816c5ec962f936a593686cfb72 (patch)
tree6aa87c45c05e147c56fc4f330780386a608c33c7 /devices/mouse.c
parentEnable interrupts after enabling the PIC (diff)
downloadkernel-ccaf2737f82968816c5ec962f936a593686cfb72.tar.xz
Add ps2_ctrl_8042
Diffstat (limited to 'devices/mouse.c')
-rw-r--r--devices/mouse.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/devices/mouse.c b/devices/mouse.c
new file mode 100644
index 0000000..92f3f08
--- /dev/null
+++ b/devices/mouse.c
@@ -0,0 +1,30 @@
+#include "mouse.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/io.h>
+
+// TODO: All output to port 0x60 or 0x64 must be preceded by waiting for bit 1 (value=2) of port 0x64 to become clear.
+// TODO: Similarly, bytes cannot be read from port 0x60 until bit 0 (value=1) of port 0x64 is set.
+
+void
+mouse_init()
+{
+ // Sending a command or data byte to the mouse (to port 0x60) must be preceded by sending a 0xD4 byte to port 0x64
+ // (with appropriate waits on port 0x64, bit 1, before sending each output byte). Note: this 0xD4 byte does not
+ // generate any ACK, from either the keyboard or mouse.
+
+ // enable second ps/2
+ // outb(0x64, 0xa8);
+
+ // outb(0x64, 0xd4);
+ // outb(0x60, 0xf4);
+ // printf("mouse_init: enable streaming(0xf4): %x\n", inb(0x60));
+
+ /*
+ outb(0x64, 0xd4);
+ while (inb(0x64) & 0x1)
+ ;
+ outb(0x60, 0xf2);
+ printf("mouse_init: mouse_id(0xf2 %x): %x\n", inb(0x60), inb(0x60));
+ */
+}