Add Cserve_Get_VM_Time
[qemu-palcode.git] / ps2port.h
blobb5f54195ef310a088a8e5ebfa078334ea711d1a7
1 /* Basic ps2 port (keyboard/mouse) command handling.
3 This file is copied (mostly) intact from SeaBIOS.
4 It is covered by the GNU Lesser General Public License, v3.
6 You should have received a copy of the GNU Lesser General Public License
7 along with this program; see the file COPYING. If not see
8 <http://www.gnu.org/licenses/>. */
10 #ifndef PS2PORT_H
11 #define PS2PORT_H
13 typedef uint8_t u8;
15 // Standard commands.
16 #define I8042_CMD_CTL_RCTR 0x0120
17 #define I8042_CMD_CTL_WCTR 0x1060
18 #define I8042_CMD_CTL_TEST 0x01aa
20 #define I8042_CMD_KBD_TEST 0x01ab
21 #define I8042_CMD_KBD_DISABLE 0x00ad
22 #define I8042_CMD_KBD_ENABLE 0x00ae
24 #define I8042_CMD_AUX_DISABLE 0x00a7
25 #define I8042_CMD_AUX_ENABLE 0x00a8
26 #define I8042_CMD_AUX_SEND 0x10d4
28 // Keyboard commands
29 #define ATKBD_CMD_SETLEDS 0x10ed
30 #define ATKBD_CMD_SSCANSET 0x10f0
31 #define ATKBD_CMD_GETID 0x02f2
32 #define ATKBD_CMD_ENABLE 0x00f4
33 #define ATKBD_CMD_RESET_DIS 0x00f5
34 #define ATKBD_CMD_RESET_BAT 0x02ff
36 // Mouse commands
37 #define PSMOUSE_CMD_SETSCALE11 0x00e6
38 #define PSMOUSE_CMD_SETSCALE21 0x00e7
39 #define PSMOUSE_CMD_SETRES 0x10e8
40 #define PSMOUSE_CMD_GETINFO 0x03e9
41 #define PSMOUSE_CMD_GETID 0x02f2
42 #define PSMOUSE_CMD_SETRATE 0x10f3
43 #define PSMOUSE_CMD_ENABLE 0x00f4
44 #define PSMOUSE_CMD_DISABLE 0x00f5
45 #define PSMOUSE_CMD_RESET_BAT 0x02ff
47 // Status register bits.
48 #define I8042_STR_PARITY 0x80
49 #define I8042_STR_TIMEOUT 0x40
50 #define I8042_STR_AUXDATA 0x20
51 #define I8042_STR_KEYLOCK 0x10
52 #define I8042_STR_CMDDAT 0x08
53 #define I8042_STR_MUXERR 0x04
54 #define I8042_STR_IBF 0x02
55 #define I8042_STR_OBF 0x01
57 // Control register bits.
58 #define I8042_CTR_KBDINT 0x01
59 #define I8042_CTR_AUXINT 0x02
60 #define I8042_CTR_IGNKEYLOCK 0x08
61 #define I8042_CTR_KBDDIS 0x10
62 #define I8042_CTR_AUXDIS 0x20
63 #define I8042_CTR_XLATE 0x40
65 // functions
66 void i8042_reboot(void);
67 int ps2_kbd_command(int command, u8 *param);
68 int ps2_mouse_command(int command, u8 *param);
69 void ps2port_setup(void);
71 #endif // ps2port.h