1 // Basic ps2 port (keyboard/mouse) command handling. 2 #ifndef __PS2PORT_H 3 #define __PS2PORT_H 4 5 #include "types.h" // u8 6 7 #define PORT_PS2_DATA 0x0060 8 #define PORT_PS2_STATUS 0x0064 9 10 // Standard commands. 11 #define I8042_CMD_CTL_RCTR 0x0120 12 #define I8042_CMD_CTL_WCTR 0x1060 13 #define I8042_CMD_CTL_TEST 0x01aa 14 15 #define I8042_CMD_KBD_TEST 0x01ab 16 #define I8042_CMD_KBD_DISABLE 0x00ad 17 #define I8042_CMD_KBD_ENABLE 0x00ae 18 19 #define I8042_CMD_AUX_DISABLE 0x00a7 20 #define I8042_CMD_AUX_ENABLE 0x00a8 21 #define I8042_CMD_AUX_SEND 0x10d4 22 23 // Keyboard commands 24 #define ATKBD_CMD_SETLEDS 0x10ed 25 #define ATKBD_CMD_SSCANSET 0x10f0 26 #define ATKBD_CMD_GETID 0x02f2 27 #define ATKBD_CMD_ENABLE 0x00f4 28 #define ATKBD_CMD_RESET_DIS 0x00f5 29 #define ATKBD_CMD_RESET_BAT 0x01ff 30 31 // Mouse commands 32 #define PSMOUSE_CMD_SETSCALE11 0x00e6 33 #define PSMOUSE_CMD_SETSCALE21 0x00e7 34 #define PSMOUSE_CMD_SETRES 0x10e8 35 #define PSMOUSE_CMD_GETINFO 0x03e9 36 #define PSMOUSE_CMD_GETID 0x02f2 37 #define PSMOUSE_CMD_SETRATE 0x10f3 38 #define PSMOUSE_CMD_ENABLE 0x00f4 39 #define PSMOUSE_CMD_DISABLE 0x00f5 40 #define PSMOUSE_CMD_RESET_BAT 0x02ff 41 42 // Status register bits. 43 #define I8042_STR_PARITY 0x80 44 #define I8042_STR_TIMEOUT 0x40 45 #define I8042_STR_AUXDATA 0x20 46 #define I8042_STR_KEYLOCK 0x10 47 #define I8042_STR_CMDDAT 0x08 48 #define I8042_STR_MUXERR 0x04 49 #define I8042_STR_IBF 0x02 50 #define I8042_STR_OBF 0x01 51 52 // Control register bits. 53 #define I8042_CTR_KBDINT 0x01 54 #define I8042_CTR_AUXINT 0x02 55 #define I8042_CTR_IGNKEYLOCK 0x08 56 #define I8042_CTR_KBDDIS 0x10 57 #define I8042_CTR_AUXDIS 0x20 58 #define I8042_CTR_XLATE 0x40 59 60 // ps2port.c 61 void i8042_reboot(void); 62 int ps2_kbd_command(int command, u8 *param); 63 int ps2_mouse_command(int command, u8 *param); 64 void ps2_check_event(void); 65 void ps2port_setup(void); 66 67 #endif // ps2port.h 68