1 |
/* gxemul: $Id: lk201.h,v 1.4 2005/03/05 12:34:02 debug Exp $ */ |
2 |
|
3 |
/* This file contains two files from netbsd, lk201.h and lk201.c. */ |
4 |
|
5 |
#ifndef LK201_H |
6 |
#define LK201_h |
7 |
|
8 |
/* $NetBSD: lk201.h,v 1.7 1999/03/19 18:34:01 ad Exp $ */ |
9 |
|
10 |
|
11 |
/* |
12 |
* Ascii values of command keys. |
13 |
*/ |
14 |
#define KBD_TAB '\t' |
15 |
#define KBD_DEL 127 |
16 |
#define KBD_RET '\r' |
17 |
|
18 |
/* |
19 |
* Define "hardware-independent" codes for the control, shift, meta and |
20 |
* function keys. Codes start after the last 7-bit ASCII code (127) |
21 |
* and are assigned in an arbitrary order. |
22 |
*/ |
23 |
#define KBD_NOKEY 128 |
24 |
|
25 |
#define KBD_F1 201 |
26 |
#define KBD_F2 202 |
27 |
#define KBD_F3 203 |
28 |
#define KBD_F4 204 |
29 |
#define KBD_F5 205 |
30 |
#define KBD_F6 206 |
31 |
#define KBD_F7 207 |
32 |
#define KBD_F8 208 |
33 |
#define KBD_F9 209 |
34 |
#define KBD_F10 210 |
35 |
#define KBD_F11 211 |
36 |
#define KBD_F12 212 |
37 |
#define KBD_F13 213 |
38 |
#define KBD_F14 214 |
39 |
#define KBD_HELP 215 |
40 |
#define KBD_DO 216 |
41 |
#define KBD_F17 217 |
42 |
#define KBD_F18 218 |
43 |
#define KBD_F19 219 |
44 |
#define KBD_F20 220 |
45 |
|
46 |
#define KBD_FIND 221 |
47 |
#define KBD_INSERT 222 |
48 |
#define KBD_REMOVE 223 |
49 |
#define KBD_SELECT 224 |
50 |
#define KBD_PREVIOUS 225 |
51 |
#define KBD_NEXT 226 |
52 |
|
53 |
#define KBD_KP_ENTER 227 |
54 |
#define KBD_KP_F1 228 |
55 |
#define KBD_KP_F2 229 |
56 |
#define KBD_KP_F3 230 |
57 |
#define KBD_KP_F4 231 |
58 |
#define KBD_LEFT 232 |
59 |
#define KBD_RIGHT 233 |
60 |
#define KBD_DOWN 234 |
61 |
#define KBD_UP 235 |
62 |
|
63 |
#define KBD_CONTROL 236 |
64 |
#define KBD_SHIFT 237 |
65 |
#define KBD_CAPSLOCK 238 |
66 |
#define KBD_ALTERNATE 239 |
67 |
|
68 |
|
69 |
|
70 |
/* |
71 |
* Definitions for the Keyboard and mouse. |
72 |
*/ |
73 |
/* |
74 |
* Special key values. |
75 |
*/ |
76 |
#define KEY_R_SHIFT 0xab |
77 |
#define KEY_SHIFT 0xae |
78 |
#define KEY_CONTROL 0xaf |
79 |
#define KEY_CAPSLOCK 0xb0 |
80 |
#define KEY_R_ALT 0xb2 |
81 |
#define KEY_UP 0xb3 |
82 |
#define KEY_REPEAT 0xb4 |
83 |
#define KEY_F1 0x56 |
84 |
#define KEY_COMMAND KEY_F1 |
85 |
|
86 |
/* |
87 |
* Lk201/301 keyboard |
88 |
*/ |
89 |
#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */ |
90 |
#define LK_AUTODOWN 0x82 |
91 |
#define LK_DOWN 0x80 |
92 |
#define LK_DEFAULTS 0xd3 /* reset mode settings */ |
93 |
#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */ |
94 |
#define LK_CL_ENABLE 0x1b /* keyclick enable */ |
95 |
#define LK_KBD_ENABLE 0x8b /* keyboard enable */ |
96 |
#define LK_BELL_ENABLE 0x23 /* the bell */ |
97 |
#define LK_LED_ENABLE 0x13 /* light led */ |
98 |
#define LK_LED_DISABLE 0x11 /* turn off led */ |
99 |
#define LK_RING_BELL 0xa7 /* ring keyboard bell */ |
100 |
#define LED_1 0x81 /* led bits */ |
101 |
#define LED_2 0x82 |
102 |
#define LED_3 0x84 |
103 |
#define LED_4 0x88 |
104 |
#define LED_ALL 0x8f |
105 |
#define LK_HELP 0x7c /* help key */ |
106 |
#define LK_DO 0x7d /* do key */ |
107 |
#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */ |
108 |
#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/ |
109 |
#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */ |
110 |
#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */ |
111 |
#define LK_LOWEST 0x56 /* lowest significant keycode */ |
112 |
|
113 |
/* max volume is 0, lowest is 0x7 */ |
114 |
#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7)) |
115 |
|
116 |
/* mode command details */ |
117 |
#define LK_CMD_MODE(m,div) ((m)|((div)<<3)) |
118 |
|
119 |
|
120 |
/* |
121 |
* Command characters for the mouse. |
122 |
*/ |
123 |
#define MOUSE_SELF_TEST 'T' |
124 |
#define MOUSE_INCREMENTAL 'R' |
125 |
|
126 |
/* |
127 |
* Mouse output bits. |
128 |
* |
129 |
* MOUSE_START_FRAME Start of report frame bit. |
130 |
* MOUSE_X_SIGN Sign bit for X. |
131 |
* MOUSE_Y_SIGN Sign bit for Y. |
132 |
* MOUSE_X_OFFSET X offset to start cursor at. |
133 |
* MOUSE_Y_OFFSET Y offset to start cursor at. |
134 |
*/ |
135 |
#define MOUSE_START_FRAME 0x80 |
136 |
#define MOUSE_X_SIGN 0x10 |
137 |
#define MOUSE_Y_SIGN 0x08 |
138 |
|
139 |
/* |
140 |
* Definitions for mouse buttons |
141 |
*/ |
142 |
#define EVENT_LEFT_BUTTON 0x01 |
143 |
#define EVENT_MIDDLE_BUTTON 0x02 |
144 |
#define EVENT_RIGHT_BUTTON 0x03 |
145 |
#define RIGHT_BUTTON 0x01 |
146 |
#define MIDDLE_BUTTON 0x02 |
147 |
#define LEFT_BUTTON 0x04 |
148 |
|
149 |
#ifdef _KERNEL |
150 |
extern int LKgetc __P((dev_t dev)); |
151 |
extern void lkdivert __P ((int (*getc_fn)(dev_t dev), dev_t dev)); |
152 |
#endif |
153 |
|
154 |
|
155 |
/* This is also from netbsd, pmax/dev/lk201.c: */ |
156 |
|
157 |
/* |
158 |
* Keyboard to ASCII, unshifted. |
159 |
*/ |
160 |
static u_char unshiftedAscii[] = { |
161 |
/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
162 |
/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
163 |
/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
164 |
/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
165 |
/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
166 |
/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
167 |
/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
168 |
/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
169 |
/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
170 |
/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
171 |
/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
172 |
/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
173 |
/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
174 |
/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
175 |
/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
176 |
/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
177 |
/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
178 |
/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
179 |
/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
180 |
/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
181 |
/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
182 |
/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, |
183 |
/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, |
184 |
/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
185 |
/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
186 |
/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, |
187 |
/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
188 |
/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
189 |
/* 70 */ KBD_NOKEY, '\033', KBD_F12, KBD_F13, |
190 |
/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
191 |
/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
192 |
/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, |
193 |
/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, |
194 |
/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
195 |
/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, |
196 |
/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, |
197 |
/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, |
198 |
/* 94 */ '.', KBD_KP_ENTER, '1', '2', |
199 |
/* 98 */ '3', '4', '5', '6', |
200 |
/* 9c */ ',', '7', '8', '9', |
201 |
/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, |
202 |
/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, |
203 |
/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, |
204 |
/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, |
205 |
/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, |
206 |
/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
207 |
/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
208 |
/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '`', |
209 |
/* c0 */ '1', 'q', 'a', 'z', |
210 |
/* c4 */ KBD_NOKEY, '2', 'w', 's', |
211 |
/* c8 */ 'x', '<', KBD_NOKEY, '3', |
212 |
/* cc */ 'e', 'd', 'c', KBD_NOKEY, |
213 |
/* d0 */ '4', 'r', 'f', 'v', |
214 |
/* d4 */ ' ', KBD_NOKEY, '5', 't', |
215 |
/* d8 */ 'g', 'b', KBD_NOKEY, '6', |
216 |
/* dc */ 'y', 'h', 'n', KBD_NOKEY, |
217 |
/* e0 */ '7', 'u', 'j', 'm', |
218 |
/* e4 */ KBD_NOKEY, '8', 'i', 'k', |
219 |
/* e8 */ ',', KBD_NOKEY, '9', 'o', |
220 |
/* ec */ 'l', '.', KBD_NOKEY, '0', |
221 |
/* f0 */ 'p', KBD_NOKEY, ';', '/', |
222 |
/* f4 */ KBD_NOKEY, '=', ']', '\\', |
223 |
/* f8 */ KBD_NOKEY, '-', '[', '\'', |
224 |
/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
225 |
}; |
226 |
|
227 |
/* |
228 |
* Keyboard to Ascii, shifted. |
229 |
*/ |
230 |
static u_char shiftedAscii[] = { |
231 |
/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
232 |
/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
233 |
/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
234 |
/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
235 |
/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
236 |
/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
237 |
/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
238 |
/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
239 |
/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
240 |
/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
241 |
/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
242 |
/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
243 |
/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
244 |
/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
245 |
/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
246 |
/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
247 |
/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
248 |
/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
249 |
/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
250 |
/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
251 |
/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
252 |
/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, |
253 |
/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, |
254 |
/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
255 |
/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
256 |
/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, |
257 |
/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
258 |
/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
259 |
/* 70 */ KBD_NOKEY, KBD_F11, KBD_F12, KBD_F13, |
260 |
/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
261 |
/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
262 |
/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, |
263 |
/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, |
264 |
/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
265 |
/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, |
266 |
/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, |
267 |
/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, |
268 |
/* 94 */ '.', KBD_KP_ENTER, '1', '2', |
269 |
/* 98 */ '3', '4', '5', '6', |
270 |
/* 9c */ ',', '7', '8', '9', |
271 |
/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, |
272 |
/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, |
273 |
/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, |
274 |
/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, |
275 |
/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, |
276 |
/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
277 |
/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
278 |
/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '~', |
279 |
/* c0 */ '!', 'q', 'a', 'z', |
280 |
/* c4 */ KBD_NOKEY, '@', 'w', 's', |
281 |
/* c8 */ 'x', '>', KBD_NOKEY, '#', |
282 |
/* cc */ 'e', 'd', 'c', KBD_NOKEY, |
283 |
/* d0 */ '$', 'r', 'f', 'v', |
284 |
/* d4 */ ' ', KBD_NOKEY, '%', 't', |
285 |
/* d8 */ 'g', 'b', KBD_NOKEY, '^', |
286 |
/* dc */ 'y', 'h', 'n', KBD_NOKEY, |
287 |
/* e0 */ '&', 'u', 'j', 'm', |
288 |
/* e4 */ KBD_NOKEY, '*', 'i', 'k', |
289 |
/* e8 */ '<', KBD_NOKEY, '(', 'o', |
290 |
/* ec */ 'l', '>', KBD_NOKEY, ')', |
291 |
/* f0 */ 'p', KBD_NOKEY, ':', '?', |
292 |
/* f4 */ KBD_NOKEY, '+', '}', '|', |
293 |
/* f8 */ KBD_NOKEY, '_', '{', '"', |
294 |
/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, |
295 |
}; |
296 |
|
297 |
#endif /* LK201_H */ |
298 |
|
299 |
|