From ccaf2737f82968816c5ec962f936a593686cfb72 Mon Sep 17 00:00:00 2001 From: aqua Date: Wed, 2 Nov 2022 09:34:31 +0200 Subject: Add ps2_ctrl_8042 --- devices/mouse.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 devices/mouse.c (limited to 'devices/mouse.c') 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 +#include +#include + +// 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)); + */ +} -- cgit v1.2.1