blob: 92f3f08d8b0c172de951e02d9b02815e800460a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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));
*/
}
|