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