1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
/*-
* Copyright (c) 1991-1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: console.h,v 1.14 1995/01/12 11:42:58 sos Exp $
*/
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <sys/types.h>
#include <sys/ioccom.h>
#define KDGKBMODE _IOR('K', 6, int)
#define KDSKBMODE _IO('K', 7)
#define KDMKTONE _IO('K', 8)
#define KDGETMODE _IOR('K', 9, int)
#define KDSETMODE _IO('K', 10)
#define KDSBORDER _IO('K', 13)
#define KDGKBSTATE _IOR('K', 19, int)
#define KDSKBSTATE _IO('K', 20)
#define KDENABIO _IO('K', 60)
#define KDDISABIO _IO('K', 61)
#define KIOCSOUND _IO('K', 63)
#define KDGKBTYPE _IOR('K', 64, int)
#define KDGETLED _IOR('K', 65, int)
#define KDSETLED _IO('K', 66)
#define KDSETRAD _IO('K', 67)
#define GETFKEY _IOWR('k', 0, fkeyarg_t)
#define SETFKEY _IOWR('k', 1, fkeyarg_t)
#define GIO_SCRNMAP _IOR('k', 2, scrmap_t)
#define PIO_SCRNMAP _IOW('k', 3, scrmap_t)
#define GIO_KEYMAP _IOR('k', 6, keymap_t)
#define PIO_KEYMAP _IOW('k', 7, keymap_t)
#define GIO_ATTR _IOR('a', 0, int)
#define GIO_COLOR _IOR('c', 0, int)
#define CONS_CURRENT _IOR('c', 1, int)
#define CONS_GET _IOR('c', 2, int)
#define CONS_IO _IO('c', 3)
#define CONS_BLANKTIME _IOW('c', 4, int)
#define CONS_SSAVER _IOW('c', 5, ssaver_t)
#define CONS_GSAVER _IOWR('c', 6, ssaver_t)
#define CONS_CURSORTYPE _IOW('c', 7, int)
#define CONS_BELLTYPE _IOW('c', 8, int)
#define CONS_HISTORY _IOW('c', 9, int)
#define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t)
#define PIO_FONT8x8 _IOW('c', 64, fnt8_t)
#define GIO_FONT8x8 _IOR('c', 65, fnt8_t)
#define PIO_FONT8x14 _IOW('c', 66, fnt14_t)
#define GIO_FONT8x14 _IOR('c', 67, fnt14_t)
#define PIO_FONT8x16 _IOW('c', 68, fnt16_t)
#define GIO_FONT8x16 _IOR('c', 69, fnt16_t)
#define CONS_GETINFO _IOWR('c', 73, vid_info_t)
#define CONS_GETVERS _IOR('c', 74, int)
#define VT_OPENQRY _IOR('v', 1, int)
#define VT_SETMODE _IOW('v', 2, vtmode_t)
#define VT_GETMODE _IOR('v', 3, vtmode_t)
#define VT_RELDISP _IO('v', 4)
#define VT_ACTIVATE _IO('v', 5)
#define VT_WAITACTIVE _IO('v', 6)
#define VT_GETACTIVE _IOR('v', 7, int)
#define VT_FALSE 0
#define VT_TRUE 1
#define VT_ACKACQ 2
#define VT_AUTO 0 /* switching is automatic */
#define VT_PROCESS 1 /* switching controlled by prog */
struct vt_mode {
char mode;
char waitv; /* not implemented yet SOS */
short relsig;
short acqsig;
short frsig; /* not implemented yet SOS */
};
#define MOUSE_SHOW 0x01
#define MOUSE_HIDE 0x02
#define MOUSE_MOVEABS 0x03
#define MOUSE_MOVEREL 0x04
#define MOUSE_GETPOS 0x05
struct mouse_info {
int operation;
int x;
int y;
};
#define KD_MONO 1 /* monochrome adapter */
#define KD_HERCULES 2 /* hercules adapter */
#define KD_CGA 3 /* color graphics adapter */
#define KD_EGA 4 /* enhanced graphics adapter */
#define KD_VGA 5 /* video graohics adapter */
#define KD_TEXT 0 /* set text mode restore fonts */
#define KD_TEXT0 0 /* ditto */
#define KD_TEXT1 2 /* set text mode !restore fonts */
#define KD_GRAPHICS 1 /* set graphics mode */
#define K_RAW 0 /* keyboard returns scancodes */
#define K_XLATE 1 /* keyboard returns ascii */
#define KB_84 1 /* 'old' 84 key AT-keyboard */
#define KB_101 2 /* MF-101 or MF-102 keyboard */
#define KB_OTHER 3 /* keyboard not known */
#define CLKED 1 /* Caps locked */
#define NLKED 2 /* Num locked */
#define SLKED 4 /* Scroll locked */
#define ALKED 8 /* AltGr locked */
#define LED_CAP 1 /* Caps lock LED */
#define LED_NUM 2 /* Num lock LED */
#define LED_SCR 4 /* Scroll lock LED */
/* possible flag values */
#define FLAG_LOCK_O 0
#define FLAG_LOCK_C 1
#define FLAG_LOCK_N 2
#define NUM_KEYS 256 /* number of keys in table */
#define NUM_STATES 8 /* states per key */
#define ALTGR_OFFSET 128 /* offset for altlock keys */
struct key_t {
u_char map[NUM_STATES];
u_char spcl;
u_char flgs;
};
struct keymap {
u_short n_keys;
struct key_t key[NUM_KEYS];
};
#define MAXFK 16
#define NUM_FKEYS 60
struct fkeytab {
u_char str[MAXFK];
u_char len;
};
struct fkeyarg {
u_short keynum;
char keydef[MAXFK];
char flen;
};
struct colors {
char fore;
char back;
};
struct vid_info {
short size;
short m_num;
u_short mv_row, mv_col;
u_short mv_rsz, mv_csz;
struct colors mv_norm,
mv_rev,
mv_grfc;
u_char mv_ovscan;
u_char mk_keylock;
};
#define MAXSSAVER 16
struct ssaver {
char name[MAXSSAVER];
int num;
long time;
};
typedef struct keymap keymap_t;
typedef struct fkeytab fkeytab_t;
typedef struct fkeyarg fkeyarg_t;
typedef struct vid_info vid_info_t;
typedef struct vt_mode vtmode_t;
typedef struct mouse_info mouse_info_t;
typedef struct {char scrmap[256];} scrmap_t;
typedef struct {char fnt8x8[8*256];} fnt8_t;
typedef struct {char fnt8x14[14*256];} fnt14_t;
typedef struct {char fnt8x16[16*256];} fnt16_t;
typedef struct ssaver ssaver_t;
/* defines for "special" keys (spcl bit set in keymap) */
#define NOP 0x00 /* nothing (dead key) */
#define LSH 0x02 /* left shift key */
#define RSH 0x03 /* right shift key */
#define CLK 0x04 /* caps lock key */
#define NLK 0x05 /* num lock key */
#define SLK 0x06 /* scroll lock key */
#define LALT 0x07 /* left alt key */
#define BTAB 0x08 /* backwards tab */
#define LCTR 0x09 /* left control key */
#define NEXT 0x0a /* switch to next screen */
#define F_SCR 0x0b /* switch to first screen */
#define L_SCR 0x1a /* switch to last screen */
#define F_FN 0x1b /* first function key */
#define L_FN 0x7a /* last function key */
#define RCTR 0x7b /* right control key */
#define RALT 0x7c /* right alt (altgr) key */
#define ALK 0x7d /* alt lock key */
#define ASH 0x7e /* alt shift key */
#define META 0x7f /* meta key */
#define RBT 0x80 /* boot machine */
#define DBG 0x81 /* call debugger */
#define SUSP 0x82 /* suspend power (APM BIOS) */
#define F(x) ((x)+F_FN-1)
#define S(x) ((x)+F_SCR-1)
#define NOKEY 0x100 /* no key pressed marker */
#define FKEY 0x200 /* funtion key marker */
#define MKEY 0x400 /* meta key marker (prepend ESC)*/
#define KB_DATA 0x60 /* kbd data port */
#define KB_STAT 0x64 /* kbd status port */
#define KB_BUF_FULL 0x01 /* kbd has char pending */
#define KB_READY 0x02 /* kbd ready for command */
#define KB_MODE 0x4D /* kbd mode (trans, ints enable)*/
#define KB_WRITE 0x60 /* kbd write command */
#define KB_RESET_DONE 0xAA /* kbd reset command completed */
#define KB_SETLEDS 0xED /* kbd set leds */
#define KB_ECHO 0xEE /* kbd set leds */
#define KB_SETRAD 0xF3 /* kbd set repeat&delay command */
#define KB_ACK 0xFA /* kbd acknowledge answer */
#define KB_RESEND 0xFE /* kbd resend cmd answer */
#define KB_RESET 0xFF /* kbd reset */
/* video mode definitions */
#define M_B40x25 0 /* black & white 40 columns */
#define M_C40x25 1 /* color 40 columns */
#define M_B80x25 2 /* black & white 80 columns */
#define M_C80x25 3 /* color 80 columns */
#define M_BG320 4 /* black & white graphics 320x200 */
#define M_CG320 5 /* color graphics 320x200 */
#define M_BG640 6 /* black & white graphics 640x200 hi-res */
#define M_EGAMONO80x25 7 /* ega-mono 80x25 */
#define M_CG320_D 13 /* ega mode D */
#define M_CG640_E 14 /* ega mode E */
#define M_EGAMONOAPA 15 /* ega mode F */
#define M_CG640x350 16 /* ega mode 10 */
#define M_ENHMONOAPA2 17 /* ega mode F with extended memory */
#define M_ENH_CG640 18 /* ega mode 10* */
#define M_ENH_B40x25 19 /* ega enhanced black & white 40 columns */
#define M_ENH_C40x25 20 /* ega enhanced color 40 columns */
#define M_ENH_B80x25 21 /* ega enhanced black & white 80 columns */
#define M_ENH_C80x25 22 /* ega enhanced color 80 columns */
#define M_VGA_C40x25 23 /* vga 8x16 font on color */
#define M_VGA_C80x25 24 /* vga 8x16 font on color */
#define M_VGA_M80x25 25 /* vga 8x16 font on mono */
#define M_VGA11 26 /* vga 640x480 2 colors */
#define M_BG640x480 26
#define M_VGA12 27 /* vga 640x480 16 colors */
#define M_CG640x480 27
#define M_VGA13 28 /* vga 640x200 256 colors */
#define M_VGA_CG320 28
#define M_VGA_C80x50 30 /* vga 8x8 font on color */
#define M_VGA_M80x50 31 /* vga 8x8 font on color */
#define M_VGA_C80x30 32 /* vga 8x16 font on color */
#define M_VGA_M80x30 33 /* vga 8x16 font on color */
#define M_VGA_C80x60 34 /* vga 8x8 font on color */
#define M_VGA_M80x60 35 /* vga 8x8 font on color */
#define M_ENH_B80x43 0x70 /* ega black & white 80x43 */
#define M_ENH_C80x43 0x71 /* ega color 80x43 */
#define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */
#define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */
#define M_MCA_MODE 0xff /* monochrome adapter mode */
#define SW_B40x25 _IO('S', M_B40x25)
#define SW_C40x25 _IO('S', M_C40x25)
#define SW_B80x25 _IO('S', M_B80x25)
#define SW_C80x25 _IO('S', M_C80x25)
#define SW_BG320 _IO('S', M_BG320)
#define SW_CG320 _IO('S', M_CG320)
#define SW_BG640 _IO('S', M_BG640)
#define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25)
#define SW_CG320_D _IO('S', M_CG320_D)
#define SW_CG640_E _IO('S', M_CG640_E)
#define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA)
#define SW_CG640x350 _IO('S', M_CG640x350)
#define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2)
#define SW_ENH_CG640 _IO('S', M_ENH_CG640)
#define SW_ENH_B40x25 _IO('S', M_ENH_B40x25)
#define SW_ENH_C40x25 _IO('S', M_ENH_C40x25)
#define SW_ENH_B80x25 _IO('S', M_ENH_B80x25)
#define SW_ENH_C80x25 _IO('S', M_ENH_C80x25)
#define SW_ENH_B80x43 _IO('S', M_ENH_B80x43)
#define SW_ENH_C80x43 _IO('S', M_ENH_C80x43)
#define SW_MCAMODE _IO('S', M_MCA_MODE)
#define SW_VGA_C40x25 _IO('S', M_VGA_C40x25)
#define SW_VGA_C80x25 _IO('S', M_VGA_C80x25)
#define SW_VGA_C80x30 _IO('S', M_VGA_C80x30)
#define SW_VGA_C80x50 _IO('S', M_VGA_C80x50)
#define SW_VGA_C80x60 _IO('S', M_VGA_C80x60)
#define SW_VGA_M80x25 _IO('S', M_VGA_M80x25)
#define SW_VGA_M80x30 _IO('S', M_VGA_M80x30)
#define SW_VGA_M80x50 _IO('S', M_VGA_M80x50)
#define SW_VGA_M80x60 _IO('S', M_VGA_M80x60)
#define SW_VGA11 _IO('S', M_VGA11)
#define SW_BG640x480 _IO('S', M_VGA11)
#define SW_VGA12 _IO('S', M_VGA12)
#define SW_CG640x480 _IO('S', M_VGA12)
#define SW_VGA13 _IO('S', M_VGA13)
#define SW_VGA_CG320 _IO('S', M_VGA13)
#endif
|