|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 4.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * kb.h: Keyboard definitions and constants for user configurable
8: * AT keyboard driver.
9: *
10: * Version 1.2, 07/09/92
11: */
12: #ifndef KB_H
13: #define KB_H
14:
15: /*
16: * ASCII Macro Definitions - stolen from <ascii.h>
17: */
18: #define nul 0x00 /* Null */
19: #define soh 0x01 /* Start Of Header */
20: #define stx 0x02 /* Start Of Text */
21: #define etx 0x03 /* End Of Text */
22: #define eot 0x04 /* End Of Transmission */
23: #define enq 0x05 /* Enquiry */
24: #define ack 0x06 /* Acknowledge */
25: #define bel 0x07 /* Bell */
26: #define bs 0x08 /* Backspace */
27: #define ht 0x09 /* Horizontal Tab */
28: #define nl 0x0A /* New Line (line feed) */
29: #define lf 0x0A /* Line Feed (newline) */
30: #define vt 0x0B /* Vertical Tabulation */
31: #define ff 0x0C /* Form Feed */
32: #define cr 0x0D /* Carriage Return */
33: #define so 0x0E /* Stand Out */
34: #define si 0x0F /* Stand In */
35: #define dle 0x10 /* Data Link Escape */
36: #define dc1 0x11 /* Data Ctrl 1 - XON */
37: #define dc2 0x12 /* Data Ctrl 2 */
38: #define dc3 0x13 /* Data Ctrl 3 - XOFF */
39: #define dc4 0x14 /* Data Ctrl 4 */
40: #define nak 0x15 /* Negative Acknowledge */
41: #define syn 0x16 /* Synchronization */
42: #define etb 0x17 /* End of Trans. Block */
43: #define can 0x18 /* Cancel */
44: #define em 0x19 /* End of Medium */
45: #define sub 0x1A /* Substitute */
46: #define esc 0x1B /* Escape */
47: #define fs 0x1C /* Form Sep. */
48: #define gs 0x1D /* Group Sep. */
49: #define rs 0x1E /* Record Sep. */
50: #define us 0x1F /* Unit Sep. */
51: #define del 0x7F /* Delete */
52: #define rub 0x7F /* Rubout (Delete) */
53:
54: /*
55: * special and shift keys
56: */
57: #define none 0xFF /* no key value */
58: #define scroll 1 /* SCROLL lock key */
59: #define num 2 /* NUM lock key */
60: #define caps 3 /* CAPS lock key */
61: #define lalt 4 /* left ALT key */
62: #define ralt 5 /* right ALT key */
63: #define lshift 6 /* left SHIFT key */
64: #define rshift 7 /* right SHIFT key */
65: #define lctrl 8 /* left CTRL key */
66: #define rctrl 9 /* right CTRL key */
67: #define altgr 10 /* ALT GR. key */
68:
69: /*
70: * flag/mode field definitions
71: */
72: #define O 0 /* OFF: no special processing */
73: #define N 0x01 /* NUM lock applies */
74: #define C 0x02 /* CAP lock applies */
75: #define F 0x04 /* programmable function key */
76: #define S 0x08 /* shift key (from above list) */
77: /* 0x10 available */
78: /* 0x20 available */
79: #define TMODE 0xC0 /* key mode mask (T, M, MB, TMB) */
80: #define M 0x00 /* "Make" only */
81: #define T 0x40 /* "Typematic" mode */
82: #define MB 0x80 /* "Make/Break" mode */
83: #define TMB 0xC0 /* "Typematic/Make/Break" mode */
84:
85: /*
86: * function key definitions
87: */
88: #define reboot f0 /* reboot system */
89: #define f0 0 /* function key 0 */
90: #define f1 1 /* function key 1 */
91: #define f2 2 /* function key 2 */
92: #define f3 3 /* function key 3 */
93: #define f4 4 /* function key 4 */
94: #define f5 5 /* function key 5 */
95: #define f6 6 /* function key 6 */
96: #define f7 7 /* function key 7 */
97: #define f8 8 /* function key 8 */
98: #define f9 9 /* function key 9 */
99: #define f10 10 /* function key 10 */
100: #define f11 11 /* function key 11 */
101: #define f12 12 /* function key 12 */
102: #define f13 13 /* function key 13 */
103: #define f14 14 /* function key 14 */
104: #define f15 15 /* function key 15 */
105: #define f16 16 /* function key 16 */
106: #define f17 17 /* function key 17 */
107: #define f18 18 /* function key 18 */
108: #define f19 19 /* function key 19 */
109: #define f20 20 /* function key 20 */
110: #define f21 21 /* function key 21 */
111: #define f22 22 /* function key 22 */
112: #define f23 23 /* function key 23 */
113: #define f24 24 /* function key 24 */
114: #define f25 25 /* function key 25 */
115: #define f26 26 /* function key 26 */
116: #define f27 27 /* function key 27 */
117: #define f28 28 /* function key 28 */
118: #define f29 29 /* function key 29 */
119: #define f30 30 /* function key 30 */
120: #define f31 31 /* function key 31 */
121: #define f32 32 /* function key 32 */
122: #define f33 33 /* function key 33 */
123: #define f34 34 /* function key 34 */
124: #define f35 35 /* function key 35 */
125: #define f36 36 /* function key 36 */
126: #define f37 37 /* function key 37 */
127: #define f38 38 /* function key 38 */
128: #define f39 39 /* function key 39 */
129: #define f40 40 /* function key 40 */
130: #define f41 41 /* function key 41 */
131: #define f42 42 /* function key 42 */
132: #define f43 43 /* function key 43 */
133: #define f44 44 /* function key 44 */
134: #define f45 45 /* function key 45 */
135: #define f46 46 /* function key 46 */
136: #define f47 47 /* function key 47 */
137: #define f48 48 /* function key 48 */
138: #define f49 49 /* function key 49 */
139: #define f50 50 /* function key 50 */
140: #define f51 51 /* function key 51 */
141: #define f52 52 /* function key 52 */
142: #define f53 53 /* function key 53 */
143: #define f54 54 /* function key 54 */
144: #define f55 55 /* function key 55 */
145: #define f56 56 /* function key 56 */
146: #define f57 57 /* function key 57 */
147: #define f58 58 /* function key 58 */
148: #define f59 59 /* function key 59 */
149: #define f60 60 /* function key 60 */
150: #define f61 61 /* function key 61 */
151: #define f62 62 /* function key 62 */
152: #define f63 63 /* function key 63 */
153: #define f64 64 /* function key 64 */
154: #define f65 65 /* function key 65 */
155: #define f66 66 /* function key 66 */
156: #define f67 67 /* function key 67 */
157: #define f68 68 /* function key 68 */
158: #define f69 69 /* function key 69 */
159: #define f70 70 /* function key 70 */
160: #define f71 71 /* function key 71 */
161: #define f72 72 /* function key 72 */
162: #define f73 73 /* function key 73 */
163: #define f74 74 /* function key 74 */
164:
165: /*
166: * table entry definition
167: */
168: typedef struct {
169: unsigned char k_key; /* Scan code set 3 key value */
170: unsigned char k_val[9]; /* key value for each mode */
171: unsigned char k_flags; /* flags and mode bits */
172: } KBTBL;
173:
174: /*
175: * Index values for k_val[] array.
176: * These are computed in the driver based upon the following weighting:
177: *
178: * Shift Keys bit 0
179: * Control Keys bit 1
180: * Alt Keys bit 2
181: * Alt Graphic Key bit 3
182: *
183: * Use of the Alt Graphic key ignores other shift modes.
184: */
185: #define BASE 0
186: #define SHIFT 1
187: #define CTRL 2
188: #define CTRL_SHIFT 3
189: #define ALT 4
190: #define ALT_SHIFT 5
191: #define ALT_CTRL 6
192: #define ALT_CTRL_SHIFT 7
193: #define ALT_GR 8
194:
195: /*
196: * Keyboard responses to system
197: */
198: #define K_BREAK 0xF0 /* break code prefix byte */
199: #define K_ACK 0xFA /* Acknowledgement */
200: #define K_BAT_OK 0xAA /* BAT Completion code */
201: #define K_BAT_BAD 0xFC /* BAT Failure code */
202: #define K_ECHO_R 0xEE /* Echo response */
203: #define K_DETECT_1 0xFF /* Key detect error, code set 1 */
204: #define K_DETECT_23 0x00 /* Key detect error, code sets 2 & 3 */
205: #define K_OVERRUN_1 0xFF /* Buffer overrun, code set 1 */
206: #define K_OVERRUN_23 0x00 /* Buffer overrun, code sets 2 & 3 */
207: #define K_RESEND 0xFE /* Resend prior command */
208:
209: /*
210: * Keyboard commands
211: */
212: #define K_LED_CMD 0xED /* Set/reset LEDs */
213: #define K_ECHO_CMD 0xEE /* Echo */
214: #define K_SCANCODE_CMD 0xF0 /* Select scan code set */
215: #define K_RATE_CMD 0xF3 /* Set typematic rate/delay */
216: #define K_ENABLE_CMD 0xF4 /* Enable keyboard */
217: #define K_DEFAULT_CMD 0xF6 /* Set defaults */
218: #define K_ALL_T_CMD 0xF7 /* Set all keys typematic */
219: #define K_ALL_MB_CMD 0xF8 /* Set all keys make/break */
220: #define K_ALL_M_CMD 0xF9 /* Set all keys make */
221: #define K_ALL_TMB_CMD 0xFA /* Set all keys typematic/make/break */
222: #define K_KEY_T_CMD 0xFB /* Set key as typematic */
223: #define K_KEY_MB_CMD 0xFC /* Set key as make/break */
224: #define K_KEY_M_CMD 0xFD /* Set key as make */
225: #define K_RESEND_CMD 0xFE /* Resend */
226: #define K_RESET_CMD 0xFF /* Reset keyboard */
227:
228: /*
229: * function key definitions
230: *
231: * Struct member k_fnval contains the actual function key values.
232: * Entries are delimited by DELIM (0xFF or '\377') to allow NUL characters to
233: * be embedded in function strings.
234: */
235: typedef struct {
236: unsigned char k_nfkeys; /* number of function keys */
237: unsigned char k_fnval[]; /* linear array of values */
238: } FNKEY;
239:
240: #define MAX_KEYS 256 /* all that can fit in a char */
241: #define MAX_TABLE_SIZE (MAX_KEYS * sizeof(KBTBL)) /* worst case table size */
242: #define MAX_FKEYS 75
243: #define MAX_FCHAR 2048 /* default Fn key arena size */
244: #define DELIM 0xFF /* function key delimiter */
245:
246: /*
247: ================================================================================
248: ================================================================================
249: */
250:
251: /*
252: * Virtual terminal key definitions.
253: * These are byte values, and MUST NOT overlap with f0..fn values above.
254: *
255: * For VTKEY test to work, virtual terminal selector values must be
256: * in a contiguous range from VTKEY_HOME to VTKEY_MAX.
257: */
258:
259: #define vt0 80
260: #define vt1 vt0+1
261: #define vt2 vt0+2
262: #define vt3 vt0+3
263: #define vt4 vt0+4
264: #define vt5 vt0+5
265: #define vt6 vt0+6
266: #define vt7 vt0+7
267: #define vt8 vt0+8
268: #define vt9 vt0+9
269: #define vt10 vt0+10
270: #define vt11 vt0+11
271: #define vt12 vt0+12
272: #define vt13 vt0+13
273: #define vt14 vt0+14
274: #define vt15 vt0+15
275:
276: #define color0 vt0+16
277: #define color1 color0+1
278: #define color2 color0+2
279: #define color3 color0+3
280: #define color4 color0+4
281: #define color5 color0+5
282: #define color6 color0+6
283: #define color7 color0+7
284: #define color8 color0+8
285: #define color9 color0+9
286: #define color10 color0+10
287: #define color11 color0+11
288: #define color12 color0+12
289: #define color13 color0+13
290: #define color14 color0+14
291: #define color15 color0+15
292:
293: #define mono0 vt0+32
294: #define mono1 mono0+1
295: #define mono2 mono0+2
296: #define mono3 mono0+3
297: #define mono4 mono0+4
298: #define mono5 mono0+5
299: #define mono6 mono0+6
300: #define mono7 mono0+7
301: #define mono8 mono0+8
302: #define mono9 mono0+9
303: #define mono10 mono0+10
304: #define mono11 mono0+11
305: #define mono12 mono0+12
306: #define mono13 mono0+13
307: #define mono14 mono0+14
308: #define mono15 mono0+15
309:
310: /*
311: * vtn - next logical session (increasing minor numbers)
312: * vtp - previous logical session (decreasing minor numbers)
313: * vtt - toggle current with latest session
314: */
315: #define vtn vt0+48
316: #define vtp vt0+49
317: #define vtt vt0+50
318:
319: #define VTKEY_HOME vt0
320: #define VTKEY_NEXT vtn
321: #define VTKEY_PREV vtp
322: #define VTKEY_TOGL vtt
323: #define VTKEY_MAX vtt
324:
325: #define VTKEY(x) ((x)>=VTKEY_HOME && (x)<=VTKEY_MAX)
326:
327: /*
328: * function key definitions
329: *
330: * Struct member k_fnval contains the actual function key values.
331: * Entries are delimited by DELIM (0xFF or '\377') to allow NUL characters to
332: * be embedded in function strings.
333: */
334:
335: #define VNKB_FALSE 0
336: #define VNKB_TRUE 1
337: #ifdef KERNEL
338:
339: /*
340: * patchable params for non-standard keyboards
341: */
342: extern int KBDATA; /* Keyboard data */
343: extern int KBCTRL; /* Keyboard control */
344: extern int KBSTS_CMD; /* Keyboard status/command */
345: extern int KBFLAG; /* Keyboard reset flag */
346: extern int KBBOOT; /* 0: disallow reboot from keyboard */
347: extern int KBTIMEOUT; /* shouldn't need this much */
348: extern int KBCMDBYTE; /* no translation */
349:
350: #ifndef _I386
351: extern SEG *kbsegp; /* keyboard table segment */
352: #endif
353: extern int isbusy; /* Raw input conversion busy */
354: extern int vt_kb_state, vt_kb_cmd2, vt_kb_prev_cmd;
355:
356: #if VT_MAJOR != KB_MAJOR
357: extern Ksetivec(), Kisrint();
358: extern Kclrivec();
359: #endif
360:
361: #endif /* KERNEL */
362: /*
363: ================================================================================
364: ================================================================================
365: */
366:
367: #endif /* KB_H */
368: /* end of kb.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.