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