|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 3.2
3: * Copyright (c) 1982, 1991 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.0, 06/01/91
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:
152: /*
153: * table entry definition
154: */
155: typedef struct {
156: unsigned char k_key; /* Scan code set 3 key value */
157: unsigned char k_val[9]; /* key value for each mode */
158: unsigned char k_flags; /* flags and mode bits */
159: } KBTBL;
160:
161: /*
162: * Index values for k_val[] array.
163: * These are computed in the driver based upon the following weighting:
164: *
165: * Shift Keys bit 0
166: * Control Keys bit 1
167: * Alt Keys bit 2
168: * Alt Graphic Key bit 3
169: *
170: * Use of the Alt Graphic key ignores other shift modes.
171: */
172: #define BASE 0
173: #define SHIFT 1
174: #define CTRL 2
175: #define CTRL_SHIFT 3
176: #define ALT 4
177: #define ALT_SHIFT 5
178: #define ALT_CTRL 6
179: #define ALT_CTRL_SHIFT 7
180: #define ALT_GR 8
181:
182: /*
183: * Keyboard responses to system
184: */
185: #define K_BREAK 0xF0 /* break code prefix byte */
186: #define K_ACK 0xFA /* Acknowledgement */
187: #define K_BAT_OK 0xAA /* BAT Completion code */
188: #define K_BAT_BAD 0xFC /* BAT Failure code */
189: #define K_ECHO_R 0xEE /* Echo response */
190: #define K_DETECT_1 0xFF /* Key detect error, code set 1 */
191: #define K_DETECT_23 0x00 /* Key detect error, code sets 2 & 3 */
192: #define K_OVERRUN_1 0xFF /* Buffer overrun, code set 1 */
193: #define K_OVERRUN_23 0x00 /* Buffer overrun, code sets 2 & 3 */
194: #define K_RESEND 0xFE /* Resend prior command */
195:
196: /*
197: * Keyboard commands
198: */
199: #define K_LED_CMD 0xED /* Set/reset LEDs */
200: #define K_ECHO_CMD 0xEE /* Echo */
201: #define K_SCANCODE_CMD 0xF0 /* Select scan code set */
202: #define K_RATE_CMD 0xF3 /* Set typematic rate/delay */
203: #define K_ENABLE_CMD 0xF4 /* Enable keyboard */
204: #define K_DEFAULT_CMD 0xF6 /* Set defaults */
205: #define K_ALL_T_CMD 0xF7 /* Set all keys typematic */
206: #define K_ALL_MB_CMD 0xF8 /* Set all keys make/break */
207: #define K_ALL_M_CMD 0xF9 /* Set all keys make */
208: #define K_ALL_TMB_CMD 0xFA /* Set all keys typematic/make/break */
209: #define K_KEY_T_CMD 0xFB /* Set key as typematic */
210: #define K_KEY_MB_CMD 0xFC /* Set key as make/break */
211: #define K_KEY_M_CMD 0xFD /* Set key as make */
212: #define K_RESEND_CMD 0xFE /* Resend */
213: #define K_RESET_CMD 0xFF /* Reset keyboard */
214:
215: /*
216: * function key definitions
217: *
218: * Struct member k_fnval contains the actual function key values.
219: * Entries are delimited by DELIM (0xFF or '\377') to allow NUL characters to
220: * be embedded in function strings.
221: */
222: typedef struct {
223: unsigned char k_nfkeys; /* number of function keys */
224: unsigned char k_fnval[]; /* linear array of values */
225: } FNKEY;
226:
227: #define MAX_KEYS 256 /* all that can fit in a char */
228: #define MAX_TABLE_SIZE (MAX_KEYS * sizeof(KBTBL)) /* worst case table size */
229: #define MAX_FKEYS 75
230: #define MAX_FCHAR 2048 /* default Fn key arena size */
231: #define DELIM 0xFF /* function key delimiter */
232:
233: #endif
234: /* end of kb.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.