File indexing completed on 2025-05-11 08:23:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #undef KBD_REPORT_ERR
0025 #define KBD_REPORT_UNKN
0026 #define KBD_REPORT_TIMEOUTS
0027 #undef KBD_IS_FOCUS_9000
0028 #undef INITIALIZE_MOUSE
0029
0030 #define KBD_INIT_TIMEOUT 1000
0031 #define KBC_TIMEOUT 250
0032 #define KBD_TIMEOUT 1000
0033
0034
0035
0036
0037
0038 extern unsigned char pckbd_read_mask;
0039 extern unsigned char aux_device_present;
0040
0041
0042
0043
0044
0045 #define KBD_STATUS_REG 0x64
0046 #define KBD_CNTL_REG 0x64
0047 #define KBD_DATA_REG 0x60
0048
0049
0050
0051
0052
0053 #define KBD_CCMD_READ_MODE 0x20
0054 #define KBD_CCMD_WRITE_MODE 0x60
0055 #define KBD_CCMD_GET_VERSION 0xA1
0056 #define KBD_CCMD_MOUSE_DISABLE 0xA7
0057 #define KBD_CCMD_MOUSE_ENABLE 0xA8
0058 #define KBD_CCMD_TEST_MOUSE 0xA9
0059 #define KBD_CCMD_SELF_TEST 0xAA
0060 #define KBD_CCMD_KBD_TEST 0xAB
0061 #define KBD_CCMD_KBD_DISABLE 0xAD
0062 #define KBD_CCMD_KBD_ENABLE 0xAE
0063 #define KBD_CCMD_WRITE_AUX_OBUF 0xD3
0064
0065 #define KBD_CCMD_WRITE_MOUSE 0xD4
0066
0067
0068
0069
0070
0071 #define KBD_CMD_SET_LEDS 0xED
0072 #define KBD_CMD_SET_RATE 0xF3
0073 #define KBD_CMD_ENABLE 0xF4
0074 #define KBD_CMD_DISABLE 0xF5
0075 #define KBD_CMD_RESET 0xFF
0076
0077
0078
0079
0080
0081 #define KBD_REPLY_POR 0xAA
0082 #define KBD_REPLY_ACK 0xFA
0083 #define KBD_REPLY_RESEND 0xFE
0084
0085
0086
0087
0088
0089 #define KBD_STAT_OBF 0x01
0090 #define KBD_STAT_IBF 0x02
0091 #define KBD_STAT_SELFTEST 0x04
0092 #define KBD_STAT_CMD 0x08
0093 #define KBD_STAT_UNLOCKED 0x10
0094 #define KBD_STAT_MOUSE_OBF 0x20
0095 #define KBD_STAT_GTO 0x40
0096 #define KBD_STAT_PERR 0x80
0097
0098 #define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF)
0099
0100
0101
0102
0103
0104 #define KBD_MODE_KBD_INT 0x01
0105 #define KBD_MODE_MOUSE_INT 0x02
0106 #define KBD_MODE_SYS 0x04
0107 #define KBD_MODE_NO_KEYLOCK 0x08
0108 #define KBD_MODE_DISABLE_KBD 0x10
0109 #define KBD_MODE_DISABLE_MOUSE 0x20
0110 #define KBD_MODE_KCC 0x40
0111 #define KBD_MODE_RFU 0x80
0112
0113
0114
0115
0116
0117 #define AUX_SET_RES 0xE8
0118 #define AUX_SET_SCALE11 0xE6
0119 #define AUX_SET_SCALE21 0xE7
0120 #define AUX_GET_SCALE 0xE9
0121 #define AUX_SET_STREAM 0xEA
0122 #define AUX_SET_SAMPLE 0xF3
0123 #define AUX_ENABLE_DEV 0xF4
0124 #define AUX_DISABLE_DEV 0xF5
0125 #define AUX_RESET 0xFF
0126 #define AUX_ACK 0xFA
0127
0128 #define AUX_BUF_SIZE 512
0129
0130
0131
0132
0133 struct aux_queue {
0134 unsigned long head;
0135 unsigned long tail;
0136 struct wait_queue *proc_list;
0137 struct fasync_struct *fasync;
0138 unsigned char buf[AUX_BUF_SIZE];
0139 };
0140
0141
0142 #define kbd_read_input() inb(KBD_DATA_REG)
0143 #define kbd_read_status() inb(KBD_STATUS_REG)
0144 #define kbd_write_output(val) outb(val, KBD_DATA_REG)
0145 #define kbd_write_command(val) outb(val, KBD_CNTL_REG)
0146
0147
0148
0149
0150
0151 #define AUX_IRQ 12