1 /*-
2 * Copyright (c) 1991-1996 Søren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer
10 * in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: src/sys/i386/include/console.h,v 1.25.2.7 1999/09/05 08:11:42 peter Exp $
29 */
30
31 #ifndef _MACHINE_CONSOLE_H_
32 #define _MACHINE_CONSOLE_H_
33
34 #ifndef KERNEL
35 #include <sys/types.h>
36 #endif
37 #include <sys/ioccom.h>
38
39 #define KDGKBMODE _IOR('K', 6, int)
40 #define KDSKBMODE _IO('K', 7)
41 #define KDMKTONE _IO('K', 8)
42 #define KDGETMODE _IOR('K', 9, int)
43 #define KDSETMODE _IO('K', 10)
44 #define KDSBORDER _IO('K', 13)
45 #define KDGKBSTATE _IOR('K', 19, int)
46 #define KDSKBSTATE _IO('K', 20)
47 #define KDENABIO _IO('K', 60)
48 #define KDDISABIO _IO('K', 61)
49 #define KIOCSOUND _IO('K', 63)
50 #define KDGKBTYPE _IOR('K', 64, int)
51 #define KDGETLED _IOR('K', 65, int)
52 #define KDSETLED _IO('K', 66)
53 #define KDSETRAD _IO('K', 67)
54
55 #define GETFKEY _IOWR('k', 0, fkeyarg_t)
56 #define SETFKEY _IOWR('k', 1, fkeyarg_t)
57 #define GIO_SCRNMAP _IOR('k', 2, scrmap_t)
58 #define PIO_SCRNMAP _IOW('k', 3, scrmap_t)
59 #define GIO_KEYMAP _IOR('k', 6, keymap_t)
60 #define PIO_KEYMAP _IOW('k', 7, keymap_t)
61 #define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t)
62 #define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t)
63
64 #define GIO_ATTR _IOR('a', 0, int)
65 #define GIO_COLOR _IOR('c', 0, int)
66 #define CONS_CURRENT _IOR('c', 1, int)
67 #define CONS_GET _IOR('c', 2, int)
68 #define CONS_IO _IO('c', 3)
69 #define CONS_BLANKTIME _IOW('c', 4, int)
70 #define CONS_SSAVER _IOW('c', 5, ssaver_t)
71 #define CONS_GSAVER _IOWR('c', 6, ssaver_t)
72 #define CONS_CURSORTYPE _IOW('c', 7, int)
73 #define CONS_BELLTYPE _IOW('c', 8, int)
74 #define CONS_HISTORY _IOW('c', 9, int)
75 #define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t)
76 #define PIO_FONT8x8 _IOW('c', 64, fnt8_t)
77 #define GIO_FONT8x8 _IOR('c', 65, fnt8_t)
78 #define PIO_FONT8x14 _IOW('c', 66, fnt14_t)
79 #define GIO_FONT8x14 _IOR('c', 67, fnt14_t)
80 #define PIO_FONT8x16 _IOW('c', 68, fnt16_t)
81 #define GIO_FONT8x16 _IOR('c', 69, fnt16_t)
82 #define CONS_GETINFO _IOWR('c', 73, vid_info_t)
83 #define CONS_GETVERS _IOR('c', 74, int)
84
85 #ifdef PC98
86 #define ADJUST_CLOCK _IO('t',100) /* for 98note resume */
87 #endif
88
89 #define VT_OPENQRY _IOR('v', 1, int)
90 #define VT_SETMODE _IOW('v', 2, vtmode_t)
91 #define VT_GETMODE _IOR('v', 3, vtmode_t)
92 #define VT_RELDISP _IO('v', 4)
93 #define VT_ACTIVATE _IO('v', 5)
94 #define VT_WAITACTIVE _IO('v', 6)
95 #define VT_GETACTIVE _IOR('v', 7, int)
96
97 #define VT_FALSE 0
98 #define VT_TRUE 1
99 #define VT_ACKACQ 2
100
101 #define VT_AUTO 0 /* switching is automatic */
102 #define VT_PROCESS 1 /* switching controlled by prog */
103 #define VT_KERNEL 255 /* switching controlled in kernel */
104
105 struct vt_mode {
106 char mode;
107 char waitv; /* not implemented yet SOS */
108 short relsig;
109 short acqsig;
110 short frsig; /* not implemented yet SOS */
111 };
112
113 struct mouse_data {
114 int x;
115 int y;
116 int z;
117 int buttons;
118 };
119
120 struct mouse_mode {
121 int mode;
122 int signal;
123 };
124
125 struct mouse_event {
126 int id; /* one based */
127 int value;
128 };
129
130 #define MOUSE_SHOW 0x01
131 #define MOUSE_HIDE 0x02
132 #define MOUSE_MOVEABS 0x03
133 #define MOUSE_MOVEREL 0x04
134 #define MOUSE_GETINFO 0x05
135 #define MOUSE_MODE 0x06
136 #define MOUSE_ACTION 0x07
137 #define MOUSE_MOTION_EVENT 0x08
138 #define MOUSE_BUTTON_EVENT 0x09
139
140 struct mouse_info {
141 int operation;
142 union {
143 struct mouse_data data;
144 struct mouse_mode mode;
145 struct mouse_event event;
146 }u;
147 };
148
149 #define KD_MONO 1 /* monochrome adapter */
150 #define KD_HERCULES 2 /* hercules adapter */
151 #define KD_CGA 3 /* color graphics adapter */
152 #define KD_EGA 4 /* enhanced graphics adapter */
153 #define KD_VGA 5 /* video graphics adapter */
154 #define KD_PC98 6 /* PC-98 display */
155
156 #define KD_TEXT 0 /* set text mode restore fonts */
157 #define KD_TEXT0 0 /* ditto */
158 #define KD_TEXT1 2 /* set text mode !restore fonts */
159 #define KD_GRAPHICS 1 /* set graphics mode */
160
161 #define K_RAW 0 /* keyboard returns scancodes */
162 #define K_XLATE 1 /* keyboard returns ascii */
163 #define K_CODE 2 /* keyboard returns keycodes */
164
165 #define KB_84 1 /* 'old' 84 key AT-keyboard */
166 #define KB_101 2 /* MF-101 or MF-102 keyboard */
167 #define KB_OTHER 3 /* keyboard not known */
168
169 #define CLKED 1 /* Caps locked */
170 #define NLKED 2 /* Num locked */
171 #define SLKED 4 /* Scroll locked */
172 #define ALKED 8 /* AltGr locked */
173 #define LED_CAP 1 /* Caps lock LED */
174 #define LED_NUM 2 /* Num lock LED */
175 #define LED_SCR 4 /* Scroll lock LED */
176
177 /* possible flag values */
178 #define FLAG_LOCK_O 0
179 #define FLAG_LOCK_C 1
180 #define FLAG_LOCK_N 2
181
182 #define NUM_KEYS 256 /* number of keys in table */
183 #define NUM_STATES 8 /* states per key */
184 #define ALTGR_OFFSET 128 /* offset for altlock keys */
185
186 struct key_t {
187 u_char map[NUM_STATES];
188 u_char spcl;
189 u_char flgs;
190 };
191
192 struct keymap {
193 u_short n_keys;
194 struct key_t key[NUM_KEYS];
195 };
196
197 #define NUM_DEADKEYS 15 /* number of accent keys */
198 #define NUM_ACCENTCHARS 52 /* max number of accent chars */
199
200 struct acc_t {
201 u_char accchar;
202 u_char map[NUM_ACCENTCHARS][2];
203 };
204
205 struct accentmap {
206 u_short n_accs;
207 struct acc_t acc[NUM_DEADKEYS];
208 };
209
210 #define MAXFK 16
211 #define NUM_FKEYS 96
212
213 struct fkeytab {
214 u_char str[MAXFK];
215 u_char len;
216 };
217
218 struct fkeyarg {
219 u_short keynum;
220 char keydef[MAXFK];
221 char flen;
222 };
223
224 struct colors {
225 char fore;
226 char back;
227 };
228
229 struct vid_info {
230 short size;
231 short m_num;
232 u_short mv_row, mv_col;
233 u_short mv_rsz, mv_csz;
234 struct colors mv_norm,
235 mv_rev,
236 mv_grfc;
237 u_char mv_ovscan;
238 u_char mk_keylock;
239 };
240
241 #define MAXSSAVER 16
242
243 struct ssaver {
244 char name[MAXSSAVER];
245 int num;
246 long time;
247 };
248
249 typedef struct keymap keymap_t;
250 typedef struct accentmap accentmap_t;
251 typedef struct fkeytab fkeytab_t;
252 typedef struct fkeyarg fkeyarg_t;
253 typedef struct vid_info vid_info_t;
254 typedef struct vt_mode vtmode_t;
255 typedef struct mouse_info mouse_info_t;
256 typedef struct {char scrmap[256];} scrmap_t;
257 typedef struct {char fnt8x8[8*256];} fnt8_t;
258 typedef struct {char fnt8x14[14*256];} fnt14_t;
259 typedef struct {char fnt8x16[16*256];} fnt16_t;
260 typedef struct ssaver ssaver_t;
261
262 /* defines for "special" keys (spcl bit set in keymap) */
263 #define NOP 0x00 /* nothing (dead key) */
264 #define LSH 0x02 /* left shift key */
265 #define RSH 0x03 /* right shift key */
266 #define CLK 0x04 /* caps lock key */
267 #define NLK 0x05 /* num lock key */
268 #define SLK 0x06 /* scroll lock key */
269 #define LALT 0x07 /* left alt key */
270 #define BTAB 0x08 /* backwards tab */
271 #define LCTR 0x09 /* left control key */
272 #define NEXT 0x0a /* switch to next screen */
273 #define F_SCR 0x0b /* switch to first screen */
274 #define L_SCR 0x1a /* switch to last screen */
275 #define F_FN 0x1b /* first function key */
276 #define L_FN 0x7a /* last function key */
277 /* 0x7b-0x7f reserved do not use ! */
278 #define RCTR 0x80 /* right control key */
279 #define RALT 0x81 /* right alt (altgr) key */
280 #define ALK 0x82 /* alt lock key */
281 #define ASH 0x83 /* alt shift key */
282 #define META 0x84 /* meta key */
283 #define RBT 0x85 /* boot machine */
284 #define DBG 0x86 /* call debugger */
285 #define SUSP 0x87 /* suspend power (APM) */
286 #define SPSC 0x88 /* toggle splash/text screen */
287
288 #define F_ACC DGRA /* first accent key */
289 #define DGRA 0x89 /* grave */
290 #define DACU 0x8a /* acute */
291 #define DCIR 0x8b /* circumflex */
292 #define DTIL 0x8c /* tilde */
293 #define DMAC 0x8d /* macron */
294 #define DBRE 0x8e /* breve */
295 #define DDOT 0x8f /* dot */
296 #define DUML 0x90 /* umlaut/diaresis */
297 #define DDIA 0x90 /* diaresis */
298 #define DSLA 0x91 /* slash */
299 #define DRIN 0x92 /* ring */
300 #define DCED 0x93 /* cedilla */
301 #define DAPO 0x94 /* apostrophe */
302 #define DDAC 0x95 /* double acute */
303 #define DOGO 0x96 /* ogonek */
304 #define DCAR 0x97 /* caron */
305 #define L_ACC DCAR /* last accent key */
306
307 #define F(x) ((x)+F_FN-1)
308 #define S(x) ((x)+F_SCR-1)
309 #define ACC(x) ((x)+F_ACC)
310 #define NOKEY 0x100 /* no key pressed marker */
311 #define FKEY 0x200 /* function key marker */
312 #define MKEY 0x400 /* meta key marker (prepend ESC)*/
313 #define BKEY 0x800 /* backtab (ESC [ Z) */
314
315 /* video mode definitions */
316 #define M_B40x25 0 /* black & white 40 columns */
317 #define M_C40x25 1 /* color 40 columns */
318 #define M_B80x25 2 /* black & white 80 columns */
319 #define M_C80x25 3 /* color 80 columns */
320 #define M_BG320 4 /* black & white graphics 320x200 */
321 #define M_CG320 5 /* color graphics 320x200 */
322 #define M_BG640 6 /* black & white graphics 640x200 hi-res */
323 #define M_EGAMONO80x25 7 /* ega-mono 80x25 */
324 #define M_CG320_D 13 /* ega mode D */
325 #define M_CG640_E 14 /* ega mode E */
326 #define M_EGAMONOAPA 15 /* ega mode F */
327 #define M_CG640x350 16 /* ega mode 10 */
328 #define M_ENHMONOAPA2 17 /* ega mode F with extended memory */
329 #define M_ENH_CG640 18 /* ega mode 10* */
330 #define M_ENH_B40x25 19 /* ega enhanced black & white 40 columns */
331 #define M_ENH_C40x25 20 /* ega enhanced color 40 columns */
332 #define M_ENH_B80x25 21 /* ega enhanced black & white 80 columns */
333 #define M_ENH_C80x25 22 /* ega enhanced color 80 columns */
334 #define M_VGA_C40x25 23 /* vga 8x16 font on color */
335 #define M_VGA_C80x25 24 /* vga 8x16 font on color */
336 #define M_VGA_M80x25 25 /* vga 8x16 font on mono */
337
338 #define M_VGA11 26 /* vga 640x480 2 colors */
339 #define M_BG640x480 26
340 #define M_VGA12 27 /* vga 640x480 16 colors */
341 #define M_CG640x480 27
342 #define M_VGA13 28 /* vga 640x200 256 colors */
343 #define M_VGA_CG320 28
344
345 #define M_VGA_C80x50 30 /* vga 8x8 font on color */
346 #define M_VGA_M80x50 31 /* vga 8x8 font on color */
347 #define M_VGA_C80x30 32 /* vga 8x16 font on color */
348 #define M_VGA_M80x30 33 /* vga 8x16 font on color */
349 #define M_VGA_C80x60 34 /* vga 8x8 font on color */
350 #define M_VGA_M80x60 35 /* vga 8x8 font on color */
351 #define M_VGA_CG640 36 /* vga 640x400 256 color */
352 #define M_VGA_MODEX 37 /* vga 320x240 256 color */
353
354 #define M_ENH_B80x43 0x70 /* ega black & white 80x43 */
355 #define M_ENH_C80x43 0x71 /* ega color 80x43 */
356
357 #define M_PC98_80x25 98 /* PC98 80x25 */
358 #define M_PC98_80x30 99 /* PC98 80x30 */
359
360 #define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */
361 #define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */
362 #define M_MCA_MODE 0xff /* monochrome adapter mode */
363
364 #define SW_PC98_80x25 _IO('S', M_PC98_80x25)
365 #define SW_PC98_80x30 _IO('S', M_PC98_80x30)
366 #define SW_B40x25 _IO('S', M_B40x25)
367 #define SW_C40x25 _IO('S', M_C40x25)
368 #define SW_B80x25 _IO('S', M_B80x25)
369 #define SW_C80x25 _IO('S', M_C80x25)
370 #define SW_BG320 _IO('S', M_BG320)
371 #define SW_CG320 _IO('S', M_CG320)
372 #define SW_BG640 _IO('S', M_BG640)
373 #define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25)
374 #define SW_CG320_D _IO('S', M_CG320_D)
375 #define SW_CG640_E _IO('S', M_CG640_E)
376 #define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA)
377 #define SW_CG640x350 _IO('S', M_CG640x350)
378 #define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2)
379 #define SW_ENH_CG640 _IO('S', M_ENH_CG640)
380 #define SW_ENH_B40x25 _IO('S', M_ENH_B40x25)
381 #define SW_ENH_C40x25 _IO('S', M_ENH_C40x25)
382 #define SW_ENH_B80x25 _IO('S', M_ENH_B80x25)
383 #define SW_ENH_C80x25 _IO('S', M_ENH_C80x25)
384 #define SW_ENH_B80x43 _IO('S', M_ENH_B80x43)
385 #define SW_ENH_C80x43 _IO('S', M_ENH_C80x43)
386 #define SW_MCAMODE _IO('S', M_MCA_MODE)
387 #define SW_VGA_C40x25 _IO('S', M_VGA_C40x25)
388 #define SW_VGA_C80x25 _IO('S', M_VGA_C80x25)
389 #define SW_VGA_C80x30 _IO('S', M_VGA_C80x30)
390 #define SW_VGA_C80x50 _IO('S', M_VGA_C80x50)
391 #define SW_VGA_C80x60 _IO('S', M_VGA_C80x60)
392 #define SW_VGA_M80x25 _IO('S', M_VGA_M80x25)
393 #define SW_VGA_M80x30 _IO('S', M_VGA_M80x30)
394 #define SW_VGA_M80x50 _IO('S', M_VGA_M80x50)
395 #define SW_VGA_M80x60 _IO('S', M_VGA_M80x60)
396 #define SW_VGA11 _IO('S', M_VGA11)
397 #define SW_BG640x480 _IO('S', M_VGA11)
398 #define SW_VGA12 _IO('S', M_VGA12)
399 #define SW_CG640x480 _IO('S', M_VGA12)
400 #define SW_VGA13 _IO('S', M_VGA13)
401 #define SW_VGA_CG320 _IO('S', M_VGA13)
402 #define SW_VGA_CG640 _IO('S', M_VGA_CG640)
403 #define SW_VGA_MODEX _IO('S', M_VGA_MODEX)
404
405 #endif /* !_MACHINE_CONSOLE_H_ */
Cache object: a9dc458478b6f989dbe27390e0527f81
|