1 |
30 |
unneback |
/*
|
2 |
|
|
* COPYRIGHT (c) 1998 by Radstone Technology
|
3 |
|
|
*
|
4 |
|
|
*
|
5 |
|
|
* THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
|
6 |
|
|
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
7 |
|
|
* IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
|
8 |
|
|
* AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
|
9 |
|
|
*
|
10 |
|
|
* You are hereby granted permission to use, copy, modify, and distribute
|
11 |
|
|
* this file, provided that this notice, plus the above copyright notice
|
12 |
|
|
* and disclaimer, appears in all copies. Radstone Technology will provide
|
13 |
|
|
* no support for this code.
|
14 |
|
|
*
|
15 |
|
|
*/
|
16 |
|
|
|
17 |
|
|
#ifndef _I8042_P_H_
|
18 |
|
|
#define _I8042_P_H_
|
19 |
|
|
|
20 |
|
|
#ifdef __cplusplus
|
21 |
|
|
extern "C" {
|
22 |
|
|
#endif
|
23 |
|
|
|
24 |
|
|
#define KBD_CTR_WRITE_COMMAND 0x60
|
25 |
|
|
#define KBD_CTR_READ_COMMAND 0x20
|
26 |
|
|
#define KBD_CTR_TEST_PASSWORD 0xA4
|
27 |
|
|
#define KBD_CTR_LOAD_PASSWORD 0xA5
|
28 |
|
|
#define KBD_CTR_ENABLE_PASSWORD 0xA6
|
29 |
|
|
#define KBD_CTR_DISABLE_AUX 0xA7
|
30 |
|
|
#define KBD_CTR_ENABLE_AUX 0xA8
|
31 |
|
|
#define KBD_CTR_AUXLINES_TEST 0xA9
|
32 |
|
|
#define KBD_CTR_SELFTEST 0xAA
|
33 |
|
|
#define KBD_CTR_KBDLINES_TEST 0xAB
|
34 |
|
|
#define KBD_CTR_DISABLE_KBD 0xAD
|
35 |
|
|
#define KBD_CTR_ENABLE_KBD 0xAE
|
36 |
|
|
#define KBD_CTR_WRITE_AUX 0xD4
|
37 |
|
|
#define KBD_CTR_READ_REV 0xD5
|
38 |
|
|
#define KBD_CTR_READ_VER 0xD6
|
39 |
|
|
#define KBD_CTR_READ_MODEL 0xD7
|
40 |
|
|
|
41 |
|
|
/* Keyboard Controller Data */
|
42 |
|
|
#define KBD_CTR_SELFTEST_PASSED 0x55
|
43 |
|
|
#define KBD_CTR_PASSWORD_INSTALLED 0xFA
|
44 |
|
|
#define KBD_CTR_PASSWORD_NOT_INSTALLED 0xF1
|
45 |
|
|
|
46 |
|
|
/* Controller Command Byte bit definitions. */
|
47 |
|
|
#define KBD_CMD_BYTE_DISABLE_AUX 0x20
|
48 |
|
|
#define KBD_CMD_BYTE_DISABLE_KBD 0x10
|
49 |
|
|
#define KBD_CMD_ENABLE_AUX_INT 0x02
|
50 |
|
|
#define KBD_CMD_ENABLE_KBD_INT 0x01
|
51 |
|
|
|
52 |
|
|
/* Keyboard Controller Status byte masks */
|
53 |
|
|
#define KBD_OBF_MASK 0x1 /* Output buffer full */
|
54 |
|
|
#define KBD_IBF_MASK 0x2 /* Input buffer full */
|
55 |
|
|
#define KBD_FROM_AUX_MASK 0x20 /* Byte from Aux Port. */
|
56 |
|
|
|
57 |
|
|
/* Interface Test Results */
|
58 |
|
|
#define INTERFACE_NO_ERROR 0x00
|
59 |
|
|
#define CLOCK_STUCK_LOW 0x01
|
60 |
|
|
#define CLOCK_STUCK_HIGH 0x02
|
61 |
|
|
#define DATA_STUCK_LOW 0x03
|
62 |
|
|
#define DATA_STUCK_HIGH 0x04
|
63 |
|
|
|
64 |
|
|
/* Timeout */
|
65 |
|
|
#define KBD_TIMEOUT 500000 /* Effectively ISA read access times */
|
66 |
|
|
|
67 |
|
|
/* Keyboard Commands */
|
68 |
|
|
#define KBD_CMD_SET_LEDS 0xed /* Set/Reset LEDs */
|
69 |
|
|
#define KBD_CMD_ECHO 0xee /* request keyboard echo resp. "EE" */
|
70 |
|
|
#define KBD_CMD_SEL_SCAN_CODE 0xf0 /* Scan codes 1,2,3 or 0 = rquest current. */
|
71 |
|
|
#define KBD_CMD_READ_ID 0xf2 /* Request for two byte response */
|
72 |
|
|
#define KBD_CMD_SET_RATE 0xf3 /* Set tellematic Rate */
|
73 |
|
|
#define KBD_CMD_ENABLE 0xf4 /* Clears Buffer and Starts Scanning. */
|
74 |
|
|
#define KBD_CMD_DISABLE 0xf5 /* reset to power up */
|
75 |
|
|
|
76 |
|
|
#define KBD_CMD_SET_DEFAULT 0xf6
|
77 |
|
|
#define KBD_CMD_SET_ALL_TLMTIC 0xf7 /* Set all keys telematic */
|
78 |
|
|
#define KBD_CMD_SET_ALL_MKBR 0xf8 /* Set all keys Make /Break */
|
79 |
|
|
#define KBD_CMD_SET_ALL_MAKE 0xf9 /* Set all keys Make only */
|
80 |
|
|
#define KBD_CMD_SET_KEY_TLMTIC 0xfb /* Set individual key telemativ */
|
81 |
|
|
#define KBD_CMD_SET_KEY_MKBR 0xfc /* set individual key make/break */
|
82 |
|
|
#define KBD_CMD_SET_KEY_MK 0xfd /* set individual key make only */
|
83 |
|
|
#define KBD_CMD_RESEND 0xfe /* request to resend last transfer */
|
84 |
|
|
#define KBD_CMD_RESET 0xff /* request to start a program reset */
|
85 |
|
|
#define KBD_CMD_ACK 0xfa /* keyboard ack after reset */
|
86 |
|
|
#define KBD_CMD_BAT 0xaa /* Keyboard Bat completion Response */
|
87 |
|
|
|
88 |
|
|
/*
|
89 |
|
|
* Define LED encodings for use with the KbdSetLEDs command
|
90 |
|
|
*/
|
91 |
|
|
#define KBD_LED_CAPS 0x04
|
92 |
|
|
#define KBD_LED_NUM 0x02
|
93 |
|
|
#define KBD_LED_SCROLL 0x01
|
94 |
|
|
|
95 |
|
|
/*
|
96 |
|
|
* Define two code scan codes in keycode order
|
97 |
|
|
*/
|
98 |
|
|
#define KEY_TWO_KEY 0xe0
|
99 |
|
|
#define KEY_ALT 0x38
|
100 |
|
|
#define KEY_CONTROL 0x1d
|
101 |
|
|
#define KEY_INSERT 0x52
|
102 |
|
|
#define KEY_DELETE 0x53
|
103 |
|
|
#define KEY_LEFT_ARROW 0x4b
|
104 |
|
|
#define KEY_HOME 0x47
|
105 |
|
|
#define KEY_END 0x4F
|
106 |
|
|
#define KEY_UP_ARROW 0x48
|
107 |
|
|
#define KEY_DOWN_ARROW 0x50
|
108 |
|
|
#define KEY_PAGE_UP 0x49
|
109 |
|
|
#define KEY_PAGE_DOWN 0x51
|
110 |
|
|
#define KEY_RIGHT_ARROW 0x4d
|
111 |
|
|
#define KEY_KEYPAD_SLASH 0x35
|
112 |
|
|
#define KEY_KEYPAD_ENTER 0x1c
|
113 |
|
|
#define KEY_SYS_REQUEST 0x2a
|
114 |
|
|
#define KEY_PRINT_SCREEN 0x37
|
115 |
|
|
|
116 |
|
|
#define KEY_LEFT_SHIFT 0x2a
|
117 |
|
|
#define KEY_RIGHT_SHIFT 0x36
|
118 |
|
|
#define KEY_TAB 0x0f
|
119 |
|
|
#define KEY_CAPS_LOCK 0x3a
|
120 |
|
|
#define KEY_NUM_LOCK 0x45
|
121 |
|
|
#define KEY_SCROLL_LOCK 0x46
|
122 |
|
|
#define KEY_ESC 0x01
|
123 |
|
|
#define KEY_F1 0x3b
|
124 |
|
|
#define KEY_F2 0x3c
|
125 |
|
|
#define KEY_F3 0x3d
|
126 |
|
|
#define KEY_F4 0x3e
|
127 |
|
|
#define KEY_F5 0x3f
|
128 |
|
|
#define KEY_F6 0x40
|
129 |
|
|
#define KEY_F7 0x41
|
130 |
|
|
#define KEY_F8 0x42
|
131 |
|
|
#define KEY_F9 0x43
|
132 |
|
|
#define KEY_F10 0x44
|
133 |
|
|
#define KEY_F11 0x57
|
134 |
|
|
#define KEY_F12 0x58
|
135 |
|
|
|
136 |
|
|
/*
|
137 |
|
|
* ASCII control codes
|
138 |
|
|
*/
|
139 |
|
|
#define ASCII_NUL 0x00
|
140 |
|
|
#define ASCII_SOH 0x01
|
141 |
|
|
#define ASCII_STX 0x02
|
142 |
|
|
#define ASCII_ETX 0x03
|
143 |
|
|
#define ASCII_EOT 0x04
|
144 |
|
|
#define ASCII_ENQ 0x05
|
145 |
|
|
#define ASCII_ACK 0x06
|
146 |
|
|
#define ASCII_BEL 0x07
|
147 |
|
|
#define ASCII_BS 0x08
|
148 |
|
|
#define ASCII_HT 0x09
|
149 |
|
|
#define ASCII_LF 0x0a
|
150 |
|
|
#define ASCII_VT 0x0b
|
151 |
|
|
#define ASCII_FF 0x0c
|
152 |
|
|
#define ASCII_CR 0x0d
|
153 |
|
|
#define ASCII_SO 0x0e
|
154 |
|
|
#define ASCII_SI 0x0f
|
155 |
|
|
#define ASCII_DLE 0x10
|
156 |
|
|
#define ASCII_XON 0x11
|
157 |
|
|
#define ASCII_DC1 0x11
|
158 |
|
|
#define ASCII_DC2 0x12
|
159 |
|
|
#define ASCII_XOFF 0x13
|
160 |
|
|
#define ASCII_DC3 0x13
|
161 |
|
|
#define ASCII_DC4 0x14
|
162 |
|
|
#define ASCII_NAK 0x15
|
163 |
|
|
#define ASCII_SYN 0x16
|
164 |
|
|
#define ASCII_ETB 0x17
|
165 |
|
|
#define ASCII_CAN 0x18
|
166 |
|
|
#define ASCII_EM 0x19
|
167 |
|
|
#define ASCII_SUB 0x1a
|
168 |
|
|
#define ASCII_ESC 0x1b
|
169 |
|
|
#define ASCII_FS 0x1c
|
170 |
|
|
#define ASCII_GS 0x1d
|
171 |
|
|
#define ASCII_RS 0x1e
|
172 |
|
|
#define ASCII_US 0x1f
|
173 |
|
|
#define ASCII_DEL 0x7f
|
174 |
|
|
#define ASCII_SYSRQ 0x80
|
175 |
|
|
#define ASCII_CSI 0x9b
|
176 |
|
|
|
177 |
|
|
/*
|
178 |
|
|
* Exported functions
|
179 |
|
|
*/
|
180 |
|
|
extern boolean i8042_probe(int minor);
|
181 |
|
|
|
182 |
|
|
extern void i8042_init(int minor);
|
183 |
|
|
#if CONSOLE_USE_INTERRUPTS
|
184 |
|
|
extern void i8042_initialize_interrupts(int minor);
|
185 |
|
|
|
186 |
|
|
#else
|
187 |
|
|
extern int i8042_inbyte_nonblocking_polled(
|
188 |
|
|
int minor
|
189 |
|
|
);
|
190 |
|
|
#endif /* CONSOLE_USE_INTERRUPTS */
|
191 |
|
|
|
192 |
|
|
#ifdef __cplusplus
|
193 |
|
|
}
|
194 |
|
|
#endif
|
195 |
|
|
|
196 |
|
|
#endif /* _I8042_P_H_ */
|