blob: dcae391044fc1a9627cca1b6ac010d293c189870 [file] [log] [blame]
Kevin O'Connor3b897192008-07-20 10:08:59 -04001// Basic ps2 port (keyboard/mouse) command handling.
2#ifndef __PS2PORT_H
3#define __PS2PORT_H
4
5#include "types.h" // u8
6
7// Standard commands.
8#define I8042_CMD_CTL_RCTR 0x0120
9#define I8042_CMD_CTL_WCTR 0x1060
10#define I8042_CMD_CTL_TEST 0x01aa
11
12#define I8042_CMD_KBD_TEST 0x01ab
13#define I8042_CMD_KBD_DISABLE 0x00ad
14#define I8042_CMD_KBD_ENABLE 0x00ae
15
16#define I8042_CMD_AUX_DISABLE 0x00a7
17#define I8042_CMD_AUX_ENABLE 0x00a8
18#define I8042_CMD_AUX_SEND 0x10d4
19
20// Keyboard commands
21#define ATKBD_CMD_SETLEDS 0x10ed
Kevin O'Connorb44a8522009-01-17 23:30:01 -050022#define ATKBD_CMD_SSCANSET 0x10f0
Kevin O'Connor3b897192008-07-20 10:08:59 -040023#define ATKBD_CMD_GETID 0x02f2
24#define ATKBD_CMD_ENABLE 0x00f4
25#define ATKBD_CMD_RESET_DIS 0x00f5
Kevin O'Connor7481a302008-07-21 23:42:34 -040026#define ATKBD_CMD_RESET_BAT 0x02ff
Kevin O'Connor3b897192008-07-20 10:08:59 -040027
28// Mouse commands
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
38
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
48
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
56
57// functions
Kevin O'Connoradaf3732010-09-13 20:22:07 -040058void i8042_reboot(void);
Kevin O'Connordd5a8a62010-05-01 19:59:34 -040059int ps2_kbd_command(int command, u8 *param);
60int ps2_mouse_command(int command, u8 *param);
Kevin O'Connor1ca05b02010-01-03 17:43:37 -050061void ps2port_setup(void);
Kevin O'Connor3b897192008-07-20 10:08:59 -040062
63#endif // ps2port.h