Kevin O'Connor | 3b89719 | 2008-07-20 10:08:59 -0400 | [diff] [blame] | 1 | // 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'Connor | b44a852 | 2009-01-17 23:30:01 -0500 | [diff] [blame] | 22 | #define ATKBD_CMD_SSCANSET 0x10f0 |
Kevin O'Connor | 3b89719 | 2008-07-20 10:08:59 -0400 | [diff] [blame] | 23 | #define ATKBD_CMD_GETID 0x02f2 |
| 24 | #define ATKBD_CMD_ENABLE 0x00f4 |
| 25 | #define ATKBD_CMD_RESET_DIS 0x00f5 |
Kevin O'Connor | 7481a30 | 2008-07-21 23:42:34 -0400 | [diff] [blame] | 26 | #define ATKBD_CMD_RESET_BAT 0x02ff |
Kevin O'Connor | 3b89719 | 2008-07-20 10:08:59 -0400 | [diff] [blame] | 27 | |
| 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 |
| 58 | int i8042_flush(void); |
| 59 | int i8042_command(int command, u8 *param); |
| 60 | int kbd_command(int command, u8 *param); |
| 61 | int aux_command(int command, u8 *param); |
| 62 | |
| 63 | #endif // ps2port.h |