1 // Basic ps2 port (keyboard/mouse) command handling.
5 #include "types.h" // u8
8 #define I8042_CMD_CTL_RCTR 0x0120
9 #define I8042_CMD_CTL_WCTR 0x1060
10 #define I8042_CMD_CTL_TEST 0x01aa
12 #define I8042_CMD_KBD_TEST 0x01ab
13 #define I8042_CMD_KBD_DISABLE 0x00ad
14 #define I8042_CMD_KBD_ENABLE 0x00ae
16 #define I8042_CMD_AUX_DISABLE 0x00a7
17 #define I8042_CMD_AUX_ENABLE 0x00a8
18 #define I8042_CMD_AUX_SEND 0x10d4
21 #define ATKBD_CMD_SETLEDS 0x10ed
22 #define ATKBD_CMD_SSCANSET 0x10f0
23 #define ATKBD_CMD_GETID 0x02f2
24 #define ATKBD_CMD_ENABLE 0x00f4
25 #define ATKBD_CMD_RESET_DIS 0x00f5
26 #define ATKBD_CMD_RESET_BAT 0x02ff
29 #define PSMOUSE_CMD_SETSCALE11 0x00e6
30 #define PSMOUSE_CMD_SETSCALE21 0x00e7
31 #define PSMOUSE_CMD_SETRES 0x10e8
32 #define PSMOUSE_CMD_GETINFO 0x03e9
33 #define PSMOUSE_CMD_GETID 0x02f2
34 #define PSMOUSE_CMD_SETRATE 0x10f3
35 #define PSMOUSE_CMD_ENABLE 0x00f4
36 #define PSMOUSE_CMD_DISABLE 0x00f5
37 #define PSMOUSE_CMD_RESET_BAT 0x02ff
39 // Status register bits.
40 #define I8042_STR_PARITY 0x80
41 #define I8042_STR_TIMEOUT 0x40
42 #define I8042_STR_AUXDATA 0x20
43 #define I8042_STR_KEYLOCK 0x10
44 #define I8042_STR_CMDDAT 0x08
45 #define I8042_STR_MUXERR 0x04
46 #define I8042_STR_IBF 0x02
47 #define I8042_STR_OBF 0x01
49 // Control register bits.
50 #define I8042_CTR_KBDINT 0x01
51 #define I8042_CTR_AUXINT 0x02
52 #define I8042_CTR_IGNKEYLOCK 0x08
53 #define I8042_CTR_KBDDIS 0x10
54 #define I8042_CTR_AUXDIS 0x20
55 #define I8042_CTR_XLATE 0x40
58 void i8042_reboot(void);
59 int ps2_kbd_command(int command, u8 *param);
60 int ps2_mouse_command(int command, u8 *param);
61 void ps2port_setup(void);