Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* Copyright 1992,1993 by Holger Veit |
2 | * May be freely used with Bill Jolitz's port of | |
3 | * 386bsd and may be included in a 386bsd collection | |
4 | * as long as binary and source are available and reproduce the above | |
5 | * copyright. | |
6 | * | |
7 | * You may freely modify this code and contribute improvements based | |
8 | * on this code as long as you don't claim to be the original author. | |
9 | * Commercial use of this source requires permittance of the copyright | |
10 | * holder. A general license for 386bsd will override this restriction. | |
11 | * | |
12 | * Use at your own risk. The copyright holder or any person who makes | |
13 | * this code available for the public (administrators of public archives | |
14 | * for instance) are not responsible for any harm to hardware or software | |
15 | * that might happen due to wrong application or program faults. | |
16 | * | |
17 | * Addendum: The XFree86 developers and maintainers are hereby granted the | |
18 | * right to distribute this file together with their source distributions | |
19 | * and patchkits of XFree86 without further explicit permission of the | |
20 | * above copyright holder. | |
21 | * This and another file is a necessary include file for the unified | |
22 | * pccons/codrv implementation of XFree86. This file is needed if | |
23 | * someone wants to compile an Xserver on a system which does not have, | |
24 | * for some reasons, the codrv console driver which comes with this file. The | |
25 | * availability of this file avoids a large number of #ifdef's and | |
26 | * allows to make the xserver code easier runtime-configurable. | |
27 | * To make use of this file, it must be installed in /usr/include/sys. | |
28 | * This file is not the complete console device driver, so it is possible | |
29 | * that properties described in this file do not work without having the | |
30 | * complete driver distribution. This is not a fault of the Xserver that | |
31 | * was built with this file. | |
32 | * | |
33 | * | |
34 | * | |
35 | * @(#)$RCSfile$ $Revision$ (Contributed to 386bsd) $Date$ | |
36 | * | |
37 | * Important notice: #defined values are subject to be changed!!! | |
38 | * Don't use the constant, use the name instead! | |
39 | * | |
40 | * codrv1-style uses ioctls 'K': 1-33,255 | |
41 | * 'V': 100-109 | |
42 | * | |
43 | * -hv- Holger Veit, Holger.Veit@gmd.de | |
44 | * -hm Hellmuth Michaelis, hm@hcshh.hcs.de | |
45 | * -vak- Sergey Vakulenko, vak@kiae.su | |
46 | * | |
47 | * 25-07-92 -hv- First version | |
48 | * 16-08-92 -hm adding vga ioctl for cursor shape | |
49 | * 25-10-92 -hv- X11 + video related ioctls | |
50 | * 01/12/92 -vak- 8x16 font loading, beep ioctl, | |
51 | * LED reassignment ioctl. | |
52 | * 22-04-93 -hv- unified most CODRV1/CODRV2 codes | |
53 | * 24-04-93 -hv- revised parts of keymap structures | |
54 | */ | |
55 | ||
56 | #ifndef _IOCTL_PC_H_ | |
57 | #define _IOCTL_PC_H_ | |
58 | ||
59 | #ifdef NOTDEF | |
60 | #if __GNUC__ >= 2 | |
61 | #pragma pack(1) | |
62 | #endif | |
63 | #endif | |
64 | ||
65 | #ifndef KERNEL | |
66 | #include <sys/ioctl.h> | |
67 | #ifndef _TYPES_H_ | |
68 | #include <sys/types.h> | |
69 | #endif | |
70 | #else | |
71 | #include "ioctl.h" | |
72 | #endif | |
73 | ||
74 | \f | |
75 | /*************************************************************************** | |
76 | * Basic definitions | |
77 | ***************************************************************************/ | |
78 | ||
79 | /* Use this data type when manipulating characters, don't use 'char' or 'u_char' | |
80 | * some day this will be changed to 'u_short' or 'u_long' size to allow | |
81 | * characters > 255 | |
82 | */ | |
83 | typedef u_char XCHAR; | |
84 | ||
85 | /*************************************************************************** | |
86 | * driver identification | |
87 | ***************************************************************************/ | |
88 | ||
89 | /* | |
90 | * This defines the CONSOLE INFORMATION data structure, used to | |
91 | * describe console capabilities, to distinguish between different | |
92 | * versions. If this ioctl fail, you probably have an old style "pccons" | |
93 | * driver (or an "improved" console driver, whose writer is not interested | |
94 | * in providing compatibility for anything). | |
95 | * In this case, a considerable number of features may not work as expected, | |
96 | * or do not work at all. | |
97 | */ | |
98 | ||
99 | #define MAXINFOSIZE 16 | |
100 | struct consinfo { | |
101 | u_long info1; | |
102 | u_long __reserved1__; | |
103 | u_long __reserved2__; | |
104 | u_long __reserved3__; | |
105 | XCHAR drv_name[MAXINFOSIZE+1]; | |
106 | XCHAR emul_name[MAXINFOSIZE+1]; | |
107 | XCHAR __reserved1_name__[MAXINFOSIZE+1]; | |
108 | XCHAR __reserved2_name__[MAXINFOSIZE+1]; | |
109 | }; | |
110 | ||
111 | struct oldconsinfo { | |
112 | u_long info1; | |
113 | u_long __reserved__; | |
114 | }; | |
115 | ||
116 | #define CONSGINFO _IOR('K',255,struct consinfo) /* Get console capabilities */ | |
117 | #define OLDCONSGINFO _IOR('K',255,struct oldconsinfo) /* compatibility */ | |
118 | #define CONS_ISPC 0x00000001 /* is derived from old PCCONS */ | |
119 | #define CONS_ISCO 0x00000002 /* is derived from CO driver */ | |
120 | #define CONS_reserved1 0x00000004 /* reserved for other console drivers */ | |
121 | #define CONS_reserved2 0x00000008 /* reserved for other console drivers */ | |
122 | #define CONS_HASKBD 0x00000010 /* has /dev/kbd */ | |
123 | #define CONS_HASSCAN 0x00000020 /* uses Scan codes */ | |
124 | #define CONS_HASKEYNUM 0x00000040 /* uses KEYNUMS */ | |
125 | #define CONS_HASVTY 0x00000080 /* has /dev/vty* */ | |
126 | #define CONS_HASPC3 0x00000100 /* unused, historical */ | |
127 | #define CONS_HASVTHP 0x00000200 /* unused, historical */ | |
128 | #define CONS_reserved3 0x00000400 /* reserved */ | |
129 | #define CONS_reserved4 0x00000800 /* reserved */ | |
130 | #define CONS_HASPX386 0x00001000 /* has X386 probing support +new CONSOLE_X_MODE */ | |
131 | #define CONS_HASOX386 0x00002000 /* has old X386 support CONSOLE_X_MODE_ON/OFF */ | |
132 | #define CONS_reserved5 0x00004000 /* reserved */ | |
133 | #define CONS_reserved6 0x00008000 /* reserved */ | |
134 | #define CONS_HASKCAP 0x00010000 /* has ioctl keycap support */ | |
135 | #define CONS_HASFNT 0x00020000 /* has ioctl font support */ | |
136 | #define CONS_reserved7 0x00040000 /* reserved */ | |
137 | #define CONS_reserved8 0x00080000 /* reserved */ | |
138 | #define CONS_USE7BIT 0x00100000 /* does not support 8bit characters */ | |
139 | #define CONS_USEPC8 0x00200000 /* uses PC8 8-bit mapping */ | |
140 | #define CONS_USELATIN1 0x00400000 /* uses ISO LATIN1 mapping */ | |
141 | #define CONS_HAS10646 0x00800000 /* has /dev/unicode */ | |
142 | #define CONS_PCCONS2 0x01000000 /* modified pccons */ | |
143 | #define CONS_CODRV1 0x02000000 /* old codrv ioctls */ | |
144 | #define CONS_CODRV2 0x04000000 /* codrv ioctls 0.1.2 */ | |
145 | #define CONS_reserved9 0x08000000 /* reserved */ | |
146 | #define CONS_reserved10 0x10000000 /* reserved */ | |
147 | #define CONS_reserved11 0x20000000 /* reserved */ | |
148 | #define CONS_reserved12 0x40000000 /* reserved */ | |
149 | #define CONS_reserved13 0x80000000 /* reserved */ | |
150 | ||
151 | \f | |
152 | /*************************************************************************** | |
153 | * IOCTLs for AT Keyboard | |
154 | ***************************************************************************/ | |
155 | ||
156 | /**** initializing the keyboard ****/ | |
157 | ||
158 | /* reset keyboard, run selftests and set default values: | |
159 | * default keymap, no overloaded keys, default typematic rate | |
160 | * KBD_TPD500|KBD_TPM100, repetition on | |
161 | */ | |
162 | #define KBDCOLDRESET _IO('K', 1) /* reset keyboard and set default | |
163 | * values: | |
164 | * default keymap, no overloaded | |
165 | * keys, default typematic rate | |
166 | * KBD_TPD500|KBD_TPM100 | |
167 | */ | |
168 | /* resets the mode in keyboard controller only */ | |
169 | #define KBDWARMRESET _IO('K', 23) | |
170 | ||
171 | ||
172 | ||
173 | /**** key repetition (typematic) feature ****/ | |
174 | ||
175 | /* get (G) / set (S) key repetition rate and delay | |
176 | * see below for a definition of rate and delay and the necessary | |
177 | * argument | |
178 | */ | |
179 | #define KBDGTPMAT _IOR('K', 2, int) | |
180 | #define KBDSTPMAT _IOW('K', 3, int) | |
181 | ||
182 | /* Typematic rates: | |
183 | * Rate = 1 / Period, with | |
184 | * Period = (8+ (Val&7)) * 2^((Val>>3)&3) * 0.00417 seconds, | |
185 | * and Val the typematic value below | |
186 | * | |
187 | * The typematic delay is determined by | |
188 | * Delay = (1+((Val>>5)&3)) * 250 msec +/- 20 % | |
189 | * | |
190 | * Source IBM/AT reference manual, 1987 | |
191 | * | |
192 | * Note that you have to pass one TPD* and one TPM* value to the KBDSTPMAT | |
193 | * ioctl: they are different flags of the same data word. Also note that | |
194 | * 0x00 is a valid value: KBD_TPD250|KBD_TPM300 which is really fast, instead | |
195 | * of turning off key repetition entirely. You can turn off key repetition | |
196 | * with the ioctls KBDGREPSW/KBDSREPSW. | |
197 | */ | |
198 | ||
199 | #define KBD_TPD250 0x0000 /* 250 ms */ | |
200 | #define KBD_TPD500 0x0020 /* 500 ms */ | |
201 | #define KBD_TPD750 0x0040 /* 750 ms */ | |
202 | #define KBD_TPD1000 0x0060 /* 1000 ms */ | |
203 | ||
204 | #define KBD_TPM300 0x0000 /* 30.0 rate */ | |
205 | #define KBD_TPM267 0x0001 /* 26.7 rate */ | |
206 | #define KBD_TPM240 0x0002 /* 24.0 rate */ | |
207 | #define KBD_TPM218 0x0003 /* 21.8 rate */ | |
208 | #define KBD_TPM200 0x0004 /* 20.0 rate */ | |
209 | #define KBD_TPM185 0x0005 /* 18.5 rate */ | |
210 | #define KBD_TPM171 0x0006 /* 17.1 rate */ | |
211 | #define KBD_TPM160 0x0007 /* 16.0 rate */ | |
212 | #define KBD_TPM150 0x0008 /* 15.0 rate */ | |
213 | #define KBD_TPM133 0x0009 /* 13.3 rate */ | |
214 | #define KBD_TPM120 0x000a /* 12.0 rate */ | |
215 | #define KBD_TPM109 0x000b /* 10.9 rate */ | |
216 | #define KBD_TPM100 0x000c /* 10.0 rate */ | |
217 | #define KBD_TPM92 0x000d /* 9.2 rate */ | |
218 | #define KBD_TPM86 0x000e /* 8.6 rate */ | |
219 | #define KBD_TPM80 0x000f /* 8.0 rate */ | |
220 | #define KBD_TPM75 0x0010 /* 7.5 rate */ | |
221 | #define KBD_TPM67 0x0011 /* 6.7 rate */ | |
222 | #define KBD_TPM60 0x0012 /* 6.0 rate */ | |
223 | #define KBD_TPM55 0x0013 /* 5.5 rate */ | |
224 | #define KBD_TPM50 0x0014 /* 5.0 rate */ | |
225 | #define KBD_TPM46 0x0015 /* 4.6 rate */ | |
226 | #define KBD_TPM43 0x0016 /* 4.3 rate */ | |
227 | #define KBD_TPM40 0x0017 /* 4.0 rate */ | |
228 | #define KBD_TPM37 0x0018 /* 3.7 rate */ | |
229 | #define KBD_TPM33 0x0019 /* 3.3 rate */ | |
230 | #define KBD_TPM30 0x001a /* 3.0 rate */ | |
231 | #define KBD_TPM27 0x001b /* 2.7 rate */ | |
232 | #define KBD_TPM25 0x001c /* 2.5 rate */ | |
233 | #define KBD_TPM23 0x001d /* 2.3 rate */ | |
234 | #define KBD_TPM21 0x001e /* 2.1 rate */ | |
235 | #define KBD_TPM20 0x001f /* 2.0 rate */ | |
236 | ||
237 | ||
238 | /* get (G) / set (S) the key repetition switch */ | |
239 | #define KBD_REPEATOFF 0 | |
240 | #define KBD_REPEATON 1 | |
241 | #define KBDGREPSW _IOR('K', 4, int) | |
242 | #define KBDSREPSW _IOW('K', 5, int) | |
243 | ||
244 | ||
245 | ||
246 | /**** handling keyboard LEDS and Lock keys ****/ | |
247 | ||
248 | /* get (G) / set (S) the keyboard LEDs, | |
249 | * does not influence the state of the lock keys. | |
250 | * Note: if keyboard serves tty console mode (VTYs have keyboard focus), | |
251 | * the lock keys will still modify the state when used | |
252 | */ | |
253 | #define KBDGLEDS _IOR('K', 6, int) | |
254 | #define KBDSLEDS _IOW('K', 7, int) | |
255 | ||
256 | /* get (G) / set (S) the SCROLL, NUM, CAPS ALTGRLOCK keys | |
257 | * (note: ALTGRLOCK or SHIFTLOCK are not necessarily accessible | |
258 | * on your keyboard) | |
259 | */ | |
260 | #define KBD_LOCKSCROLL 0x0001 | |
261 | #define KBD_LOCKNUM 0x0002 | |
262 | #define KBD_LOCKCAPS 0x0004 | |
263 | #define KBD_LOCKALTGR 0x0008 | |
264 | #define KBD_LOCKSHIFT 0x0010 | |
265 | #define KBDGLOCK _IOR('K', 8, int) | |
266 | #define KBDSLOCK _IOW('K', 9, int) | |
267 | ||
268 | ||
269 | ||
270 | /**** making noise ****/ | |
271 | ||
272 | /* get (G) / set (S) the beeper frequency and tone duration | |
273 | * the nr param determines the VTY which parameters are changed | |
274 | * VTY# = 0...n, n < max_vtys | |
275 | * nr = -1: actual vty | |
276 | * nr = -2: Set the system default beep frequency | |
277 | * | |
278 | * in some emulations, you can also set pitch and duration by an ESC code | |
279 | */ | |
280 | #define KBD_ACTVTY -1 | |
281 | #define KBD_DEFLT -2 | |
282 | struct kbd_bell { | |
283 | int pitch; | |
284 | int duration; | |
285 | int nr; | |
286 | }; | |
287 | ||
288 | #define KBDGETBEEP _IOWR('K',28, struct kbd_bell) | |
289 | #define KBDSETBEEP _IOW('K',29, struct kbd_bell) | |
290 | ||
291 | /* do a beep of specified frequency and duration | |
292 | * the argument nr is unused | |
293 | * a NULL arg performs a default system beep | |
294 | */ | |
295 | #define KBDBELL _IOW('K',30, struct kbd_bell) | |
296 | ||
297 | ||
298 | ||
299 | /**** I/O access ****/ | |
300 | ||
301 | /* This call allows programs to access I/O ports. | |
302 | * The ioctl is intended to perform several tasks for the XFree86 Xserver, | |
303 | * but currently has other interesting applications. This is why it is | |
304 | * priviledged and can only be executed by root (or with setuid-root). | |
305 | * In future the ioctl might be restricted to allow access to video ports | |
306 | * only. | |
307 | */ | |
308 | #define X_MODE_ON 1 | |
309 | #define X_MODE_OFF 0 | |
310 | #define CONSOLE_X_MODE _IOW('K',22,int) | |
311 | ||
312 | \f | |
313 | /**** keyboard overloading ****/ | |
314 | ||
315 | /* Codrv allows loading of strings to keys in six layers. | |
316 | * Any string may have a length of up to KBDMAXOVLKEYSIZE XCHARS. | |
317 | * !!! Warning: This ioctl uses the type XCHAR. In future, this may | |
318 | * !!! no longer be a char type, so str*** functions might not work any more | |
319 | * !!! some day. | |
320 | * The available layers are: | |
321 | * | |
322 | * - unshifted | |
323 | * - with shift key | |
324 | * - with ctrl key | |
325 | * - with meta key (usually ALT-left) | |
326 | * - with altgr key (usually ALT-right) | |
327 | * - with shift+altgr key | |
328 | * | |
329 | * There are no combinations: shift-ctrl, ctrl-alt, shift-meta. | |
330 | * The combination ctrl-altleft-somekey is reserved for system purposes. | |
331 | * These keys are usually processed before the above keys. To gain control | |
332 | * over these keys, you must run the keyboard in raw mode (/dev/kbd) and | |
333 | * do ALL the processing yourself. The Xserver for instance does it this way. | |
334 | * The following special keys are currently defined: | |
335 | * | |
336 | * CTRL-ALTLEFT-DELETE: Reboot | |
337 | * CTRL-ALTLEFT-ESCAPE: Call the debugger (if compiled into the kernel) | |
338 | * CTRL-ALTLEFT-KP+: Switch to next resolution (Xserver only) | |
339 | * CTRL-ALTLEFT-KP-: Switch to previous resolution (Xserver only) | |
340 | */ | |
341 | ||
342 | /* values for type field of various kbd_overload ioctls */ | |
343 | #define KBD_NONE 0 /* no function, key is disabled */ | |
344 | #define KBD_SHIFT 1 /* keyboard shift */ | |
345 | #define KBD_META 2 /* (ALT) alternate shift, sets bit8 to ASCII code */ | |
346 | #define KBD_NUM 3 /* numeric shift cursors vs. numeric */ | |
347 | #define KBD_CTL 4 /* control shift -- allows ctl function */ | |
348 | #define KBD_CAPS 5 /* caps shift -- swaps case of letter */ | |
349 | #define KBD_ASCII 6 /* ascii code for this key */ | |
350 | #define KBD_SCROLL 7 /* stop output */ | |
351 | #define KBD_FUNC 8 /* function key */ | |
352 | #define KBD_KP 9 /* Keypad keys */ | |
353 | #define KBD_BREAK 10 /* The damned BREAK key, ignored in ioctl */ | |
354 | #define KBD_ALTGR 11 /* AltGr Translation feature */ | |
355 | #define KBD_SHFTLOCK 12 /* some people are accustomed to this nonsense */ | |
356 | #define KBD_ALTGRLOCK 13 /* Useful for 8-bit national kbds (cyrillic) */ | |
357 | #define KBD_DOALTCAPS 0x0400 /* change by altgr + caps shift */ | |
358 | #define KBD_DOCAPS 0x0800 /* change by caps shift */ | |
359 | #define KBD_DIACPFX 0x4000 /* Key carries a diacritical prefix */ | |
360 | #define KBD_OVERLOAD 0x8000 /* Key is overloaded, ignored in ioctl */ | |
361 | #define KBD_MASK 0x001f /* mask for type */ | |
362 | ||
363 | #define KBDMAXOVLKEYSIZE 15 /* excl. zero byte */ | |
364 | struct kbd_ovlkey { | |
365 | u_short keynum; | |
366 | u_short type; | |
367 | XCHAR unshift[KBDMAXOVLKEYSIZE+1]; | |
368 | XCHAR shift[KBDMAXOVLKEYSIZE+1]; | |
369 | XCHAR ctrl[KBDMAXOVLKEYSIZE+1]; | |
370 | XCHAR meta[KBDMAXOVLKEYSIZE+1]; | |
371 | XCHAR altgr[KBDMAXOVLKEYSIZE+1]; | |
372 | XCHAR shiftaltgr[KBDMAXOVLKEYSIZE+1]; | |
373 | }; | |
374 | ||
375 | ||
376 | /* Get (G) / Set (S) a key assignment. This will influence the current | |
377 | * key value only | |
378 | */ | |
379 | #define KBDGCKEY _IOWR('K',16, struct kbd_ovlkey) | |
380 | #define KBDSCKEY _IOW('K',17, struct kbd_ovlkey) | |
381 | ||
382 | /* Get (G) the default (old) key assignment. You cannot overwrite the | |
383 | * default setting, so this ioctl is unpaired | |
384 | */ | |
385 | #define KBDGOKEY _IOWR('K',18, struct kbd_ovlkey) | |
386 | ||
387 | ||
388 | ||
389 | /* Remove a key assignment for a key, i.e. restore default setting for key | |
390 | * arg = keynum | |
391 | */ | |
392 | #define KBDRMKEY _IOW('K', 19, int) | |
393 | ||
394 | /* Restore the default key setting */ | |
395 | #define KBDDEFAULT _IO('K',20) | |
396 | ||
397 | ||
398 | ||
399 | /* Set behavior of unassigned key layers | |
400 | * Note that there is a hack from further versions which uses | |
401 | * the flags KBD_C0 and KBD_A0 for this. This is still supported, but | |
402 | * is not recommended way to do. It may disappear in future | |
403 | * (what means that it won't :-)) | |
404 | */ | |
405 | #define KBD_CLEARCTRL 2 | |
406 | #define KBD_CLEARMETA 4 | |
407 | #define KBD_CLEARALT 1 | |
408 | #ifdef notyet | |
409 | #define KBD_CLEARNORM 8 | |
410 | #define KBD_CLEARSHIFT 16 | |
411 | #define KBD_CLEARSHALT 32 | |
412 | #endif | |
413 | #define KBDSCLRLYR _IOW('K',31,int) | |
414 | ||
415 | /* get (G) / set (S) CAPSLOCK LED behaviour. | |
416 | * Not all of this keys may be accessible at your keyboard | |
417 | * Note: For compatibility, the S ioctl returns the old state in arg | |
418 | */ | |
419 | #define KBD_CAPSCAPS 0 /* LED follows CAPSLOCK state */ | |
420 | #define KBD_CAPSSHIFT 1 /* LED follows SHIFTLOCK state */ | |
421 | #define KBD_CAPSALTGR 2 /* LED follows ALTGRLOCK state */ | |
422 | #define KBD_CAPSINIT 0x04 /* bit to set to set a default for all VTYs */ | |
423 | #define KBDGCAPSLED _IOR('K',27,int) | |
424 | #define KBDSCAPSLED _IOWR('K',25,int) | |
425 | ||
426 | /* extended functions: functions that are triggered by a keypress | |
427 | * before key is converted to ASCII | |
428 | * | |
429 | * use function KBD_HOTKEYDELETE to remove a hotkey from a key | |
430 | */ | |
431 | struct kbd_hotkey { | |
432 | u_short key; | |
433 | u_short modifier; | |
434 | u_short function; | |
435 | }; | |
436 | #define KBDGSPECF _IOWR('K',32,struct kbd_hotkey) | |
437 | #define KBDSSPECF _IOW('K',33,struct kbd_hotkey) | |
438 | ||
439 | /* extended function prefixes (in modifier field) | |
440 | * bit set triggers a special function on the key layer | |
441 | */ | |
442 | #define KBD_NOEXT 0x00 /* trigger never */ | |
443 | #define KBD_EXT_N 0x01 /* on normal key (normal layer) */ | |
444 | #define KBD_EXT_S 0x02 /* on shift key (shift layer) */ | |
445 | #define KBD_EXT_C 0x04 /* on ctrl key (ctrl layer) */ | |
446 | #define KBD_EXT_A 0x08 /* on alt key (alt layer) */ | |
447 | #define KBD_EXT_SK 0x10 /* on syskey (PRINTSCREEN) (Meta Layer) */ | |
448 | #define KBD_EXT_CA 0x20 /* on ctrl-alt (shift alt layer) */ | |
449 | ||
450 | /* extended functions (in function field) */ | |
451 | #define KBD_VTY0 0 /* select vty 0 */ | |
452 | #define KBD_VTY1 1 /* select vty 1 */ | |
453 | #define KBD_VTY2 2 /* select vty 2 */ | |
454 | #define KBD_VTY3 3 /* select vty 3 */ | |
455 | #define KBD_VTY4 4 /* select vty 4 */ | |
456 | #define KBD_VTY5 5 /* select vty 5 */ | |
457 | #define KBD_VTY6 6 /* select vty 6 */ | |
458 | #define KBD_VTY7 7 /* select vty 7 */ | |
459 | #define KBD_VTY8 8 /* select vty 8 */ | |
460 | #define KBD_VTY9 9 /* select vty 9 */ | |
461 | #define KBD_VTY10 10 /* select vty 10 */ | |
462 | #define KBD_VTY11 11 /* select vty 11 */ | |
463 | #define KBD_VTYUP 0x80 /* select next vty */ | |
464 | #define KBD_VTYDOWN 0x81 /* select previous vty */ | |
465 | #define KBD_RESETKEY 0x82 /* the CTRL-ALT-DEL key (movable) */ | |
466 | #define KBD_DEBUGKEY 0x83 /* the CTRL-ALT-ESC key (debugger) */ | |
467 | ||
468 | #define KBD_HOTKEYDELETE 0xff /* use to delete a hotkey KBDSSPECF */ | |
469 | ||
470 | \f | |
471 | ||
472 | /* These are names used in older versions of keycap/codrv */ | |
473 | /* do not use the following functions any longer in future */ | |
474 | #ifdef COMPAT_CO011 | |
475 | #define KBDRESET KBDCOLDRESET | |
476 | #define KBDRESET8042 KBDWARMRESET | |
477 | #define KBDFORCEASCII _IOW('K', 24, int) /* no op in codrv-0.1.2 */ | |
478 | #define KBD_SCROLLLOCK KBD_LOCKSCROLL | |
479 | #define KBD_NUMLOCK KBD_LOCKNUM | |
480 | #define KBD_CAPSLOCK KBD_LOCKCAPS | |
481 | #define KBDASGNLEDS KBDSCAPSLED | |
482 | #ifndef KERNEL | |
483 | struct kbd_sound { | |
484 | int pitch; /* Frequency in Hz */ | |
485 | int duration; /* Time in msec */ | |
486 | }; | |
487 | #endif | |
488 | #define KBDSETBELL _IOW('K',21, struct kbd_sound) /* do some music */ | |
489 | #define OLDKBDSETBEEP _IOW('K',26, struct kbd_sound) /* change beep settings */ | |
490 | ||
491 | struct oldkbd_ovlkey { | |
492 | u_short keynum; | |
493 | u_short type; | |
494 | char unshift[KBDMAXOVLKEYSIZE+1]; | |
495 | char shift[KBDMAXOVLKEYSIZE+1]; | |
496 | char ctrl[KBDMAXOVLKEYSIZE+1]; | |
497 | char altgr[KBDMAXOVLKEYSIZE+1]; | |
498 | }; | |
499 | #define OLDKBDGCKEY _IOWR('K',16, struct oldkbd_ovlkey) /* get current key values */ | |
500 | ||
501 | ||
502 | ||
503 | #endif /*COMPAT_CO011*/ | |
504 | ||
505 | /*************************************************************************** | |
506 | * IOCTLs for Video Adapter | |
507 | ***************************************************************************/ | |
508 | ||
509 | /* to define the cursor shape for ioctl */ | |
510 | struct cursorshape { | |
511 | int start; /* topmost scanline, range 0...31 */ | |
512 | int end; /* bottom scanline, range 0...31 */ | |
513 | }; | |
514 | ||
515 | #define VGAGCURSOR _IOR('V',100, struct cursorshape) /* get cursor shape */ | |
516 | #define VGASCURSOR _IOW('V',101, struct cursorshape) /* set cursor shape */ | |
517 | ||
518 | ||
519 | ||
520 | /**** information ****/ | |
521 | ||
522 | /* the video information structure for ioctl */ | |
523 | struct videoinfo { | |
524 | char name[20]; /* ASCIZ name of detected card */ | |
525 | short type; /* Adapter type, see below */ | |
526 | short subtype; /* Adapter specific subtype */ | |
527 | short ram; /* in KBytes */ | |
528 | short iobase; /* Address of 6845: 0x3b0 / 0x3d0 */ | |
529 | }; | |
530 | ||
531 | /* Get information about the videoboard */ | |
532 | #define VGAGINFO _IOR('V',102, struct videoinfo) | |
533 | ||
534 | /* recognized Adapter types */ | |
535 | #define VG_UNKNOWN 0 | |
536 | #define VG_MONO 1 | |
537 | #define VG_CGA 2 | |
538 | #define VG_EGA 3 | |
539 | #define VG_VGA 4 | |
540 | #define VG_CHIPS 5 | |
541 | /* CHIPS & TECHNOLOGIES has subtypes: | |
542 | * 0x10 82c451 | |
543 | * 0x11 82c452 | |
544 | * 0x20 82c455 | |
545 | * 0x30 82c453 | |
546 | * 0x50 82c455 | |
547 | */ | |
548 | #define VG_GENOA 6 | |
549 | /* GENOA has subtypes: | |
550 | * 0x33/0x55 5100-5400, ET3000 based | |
551 | * 0x22 6100 | |
552 | * 0x00 6200,6300 | |
553 | * 0x11 6400,6600 | |
554 | */ | |
555 | #define VG_PARADISE 7 | |
556 | /* PARADISE has subtypes: | |
557 | * 01 PVGA1A,WD90C90 | |
558 | * 02 WD90C00 | |
559 | * 03 WD90C10 | |
560 | * 04 WD90C11 | |
561 | */ | |
562 | #define VG_TVGA 8 | |
563 | /* TVGA has subtypes: | |
564 | * 00-02 8800 | |
565 | * 03 8900B | |
566 | * 04 8900C | |
567 | * 13 8900C | |
568 | * 23 9000 | |
569 | */ | |
570 | #define VG_ET3000 9 | |
571 | #define VG_ET4000 10 | |
572 | #define VG_VIDEO7 11 | |
573 | /* VIDEO7 has subtypes: | |
574 | * 0x80-0xfe VEGA VGA | |
575 | * 0x70-0x7e V7VGA FASTWRITE/VRAM | |
576 | * 0x50-0x59 V7VGA version 5 | |
577 | * 0x41-0x49 1024i | |
578 | */ | |
579 | #define VG_ATI 12 | |
580 | /* ATI has subtypes: | |
581 | * 0x01nn 18800 | |
582 | * 0x02nn 18800-1 | |
583 | * 0x03nn 28800-2 | |
584 | * 0x04nn-05nn | |
585 | * with nn: | |
586 | * 0x01 VGA WONDER | |
587 | * 0x02 EGA WONDER800+ | |
588 | * 0x03 VGA BASIC 16+ | |
589 | */ | |
590 | ||
591 | ||
592 | ||
593 | /**** Screen blanking ****/ | |
594 | ||
595 | /* Get (G) / Set (S) screen blanker timeout (seconds), | |
596 | * time=0 disables blanking | |
597 | * | |
598 | * The blanking state is coded in bits 31 and 30 of word returned by get | |
599 | */ | |
600 | #define VGA_BLANKOFF 0x00000000 /* display is on, no blanking */ | |
601 | #define VGA_BLANKON 0x40000000 /* display is on, wait for blank */ | |
602 | #define VGA_BLANKED 0x80000000 /* display is dark */ | |
603 | #define VGAGBLANK _IOR('V',2,int) | |
604 | #define VGASBLANK _IOW('V',3,int) | |
605 | ||
606 | ||
607 | ||
608 | /**** Text/Attribute direct access, block move ****/ | |
609 | ||
610 | struct vga_block { | |
611 | short mode; | |
612 | short pagenum; | |
613 | short x0,y0; /* upper left coordinates 0..x-1, 0..y-1 */ | |
614 | short x1,y1; /* lower right coordinates >= x0,y0 */ | |
615 | u_char *map; /* must be allocated by user process ! */ | |
616 | }; | |
617 | ||
618 | /* mode word */ | |
619 | #define VGA_SCREEN 0x01 /* entire screen, ignore x,y */ | |
620 | #define VGA_WINDOW 0x02 /* use x,y for a rectangular window */ | |
621 | #define VGA_TEXT 0x10 /* copy text information only */ | |
622 | #define VGA_ATTR 0x20 /* copy attribute information only */ | |
623 | #define VGA_BOTH 0x30 /* copy text and attribute */ | |
624 | #define VGA_ALL 0x31 /* copy complete screen */ | |
625 | ||
626 | /* Get (G) / Set (S) a rectangular block of screen | |
627 | * The virtual screen need not be visible. | |
628 | * The buffer must be provided by the user process and must be large enough | |
629 | * use VGAGVRES to find out how many bytes | |
630 | * pagenum: 0..n, n < max_vty, VTY number | |
631 | * -1, actual VTY | |
632 | */ | |
633 | #define VGAGBLOCK _IOWR('V',4,struct vga_block) | |
634 | #define VGASBLOCK _IOW('V',5,struct vga_block) | |
635 | ||
636 | ||
637 | ||
638 | #define VGA_TXTPAGE0 0 | |
639 | #define VGA_TXTPAGE1 1 | |
640 | #ifdef notyet | |
641 | #define VGA_GFXPAGE 2 | |
642 | #endif | |
643 | #define VGA_PC8CODING 0x80 /* obsolete ! */ | |
644 | ||
645 | /* maximum dimension of pixels | |
646 | * Note: this is the space reserved in the fontchar map, but | |
647 | * does not mean, that this resolution is accepted in the current release | |
648 | * codrv-0.1.2 accepts 8x16 / "9x16" fonts only | |
649 | */ | |
650 | #define VGA_MAXX 16 | |
651 | #define VGA_MAXY 16 | |
652 | ||
653 | struct fchar { | |
654 | XCHAR encoding; /* encoding of character */ | |
655 | char _f1_,_f2_,_f3_; /* filler */ | |
656 | u_char map[VGA_MAXX/8*VGA_MAXY]; | |
657 | }; | |
658 | ||
659 | struct fmap { | |
660 | short page; /* page to load */ | |
661 | short nr; /* nr of characters to load */ | |
662 | char x,y; /* x,y pixel width */ | |
663 | XCHAR start; /* first character in sequence (get only) */ | |
664 | struct fchar *fntmap; /* allocated by user process */ | |
665 | }; | |
666 | ||
667 | /* get (G) / set (S) font map. Must provide page,nr,start for get */ | |
668 | #define VGAGFONTMAP _IOWR('V',6,struct fmap) | |
669 | #define VGASFONTMAP _IOW('V',7,struct fmap) | |
670 | ||
671 | ||
672 | ||
673 | /* do not use the following functions any longer in future */ | |
674 | #ifdef COMPAT_CO011 | |
675 | /* miscellaneous functions: */ | |
676 | #define VGA_DIS1 1 /* disable font 1 */ | |
677 | #define VGA_GTENC 2 /* get current encoding */ | |
678 | #define VGA_SBLANK 3 /* set screen blanking timeout (use VGASBLANK!) */ | |
679 | #define VGA_GBLANK 4 /* get screen blanking timeout (use VGAGBLANK!) */ | |
680 | ||
681 | struct miscfcns { | |
682 | u_char cmd; | |
683 | union { | |
684 | short enc[2]; | |
685 | int timeout; | |
686 | } u; | |
687 | }; | |
688 | #define VGAMISCFCNS _IOWR('V',107,struct miscfcns) /* misc functions */ | |
689 | ||
690 | ||
691 | /* Font mapping this needs at least an EGA card (else EINVAL) */ | |
692 | #define VGAFNTLATIN1 0x00 | |
693 | #define VGAFNTEXTEND1 0x01 | |
694 | #define VGAFNTEXTEND2 0x02 | |
695 | #define VGAFNTGREEK 0x03 | |
696 | #define VGAFNTCYRILLIC 0x04 | |
697 | #define VGAFNTHEBREW 0x05 | |
698 | #define VGAFNTARABIAN 0x06 | |
699 | ||
700 | #define VGA_FNTNCHARS 256 | |
701 | #define VGA_FNTCSIZE 15 | |
702 | ||
703 | struct fontchar { | |
704 | u_char page; /* which font page */ | |
705 | u_char idx; /* which char in font page */ | |
706 | u_char cmap[VGA_FNTCSIZE]; /* character bitmap */ | |
707 | }; | |
708 | ||
709 | #define OLDVGAGCHAR _IOWR('V',105,struct fontchar) /* get character of font */ | |
710 | #define OLDVGASCHAR _IOW('V',106,struct fontchar) /* set character in font */ | |
711 | ||
712 | struct fontmap { | |
713 | u_char page; /* page to load */ | |
714 | u_short encoding; /* font encoding */ | |
715 | u_char map[VGA_FNTNCHARS*VGA_FNTCSIZE]; | |
716 | }; | |
717 | ||
718 | #define OLDVGAGFNTMAP _IOWR('V',103,struct fontmap) /* get font */ | |
719 | #define VGAGFNTMAP OLDVGAGFNTMAP | |
720 | #define OLDVGASFNTMAP _IOW('V',104,struct fontmap) /* set font */ | |
721 | #define VGASFNTMAP OLDVGASFNTMAP | |
722 | ||
723 | #endif | |
724 | ||
725 | ||
726 | ||
727 | ||
728 | struct textpage { | |
729 | u_char pagenum; /* note: only page 0 used by vtys */ | |
730 | #define VGA_TEXTATTR 0 | |
731 | #define VGA_TEXTDATA 1 | |
732 | u_char ad; | |
733 | #define VGA_LINES 50 /* only 25 used for now */ | |
734 | #define VGA_COLUMNS 80 | |
735 | u_char map[VGA_LINES*VGA_COLUMNS]; | |
736 | }; | |
737 | ||
738 | #define VGAGPAGE _IOWR('V',108,struct textpage) /* get a data page */ | |
739 | #define VGASPAGE _IOW('V',109,struct textpage) /* set a data page */ | |
740 | ||
741 | /**** Signalling access ****/ | |
742 | ||
743 | /* Use "take control" in an application program to signal the kernel | |
744 | * that the program wants to use video memory (such as Xserver) | |
745 | * before the program switches modes | |
746 | * | |
747 | * Use "give control" to return the control to the kernel. The application | |
748 | * should have restored the original state before giving back control. | |
749 | * Close /dev/vga also returns control. | |
750 | * | |
751 | * However, the kernel remains the master in the house, and reserves the right | |
752 | * to grab control back at any time. (It usually doesn't). | |
753 | * | |
754 | */ | |
755 | #define VGATAKECTRL _IO('V',8) | |
756 | #define VGAGIVECTRL _IO('V',9) | |
757 | ||
758 | /*************************************************************************** | |
759 | * Pandora's box, don't even think of using the following ioctl's | |
760 | * (if you happen to find some; codrv_experimental might not be | |
761 | * available at your system) | |
762 | ***************************************************************************/ | |
763 | ||
764 | #ifdef PANDORA | |
765 | #include "codrv_experimental.h" | |
766 | #endif | |
767 | ||
768 | ||
769 | \f | |
770 | /*************************************************************************** | |
771 | * XFree86 pccons support | |
772 | ***************************************************************************/ | |
773 | ||
774 | #ifdef COMPAT_PCCONS | |
775 | /* The following calls are special to the old pccons driver and are | |
776 | * not understood or supported by codrv. | |
777 | * This file serves as a central definition base for these calls | |
778 | * in order to avoid defining them in applications that want to | |
779 | * use them. | |
780 | * | |
781 | * One word of warning: There are different purpose tty ioctls | |
782 | * with the same encoding, see <sys/ioctl.h> | |
783 | * TIOCSDTR = _IO('t', 121) | |
784 | * TIOCCBRK = _IO('t', 122) | |
785 | * | |
786 | */ | |
787 | #define CONSOLE_X_MODE_ON _IO('t',121) | |
788 | #define CONSOLE_X_MODE_OFF _IO('t',122) | |
789 | #define CONSOLE_X_BELL _IOW('t',123,int[2]) | |
790 | #endif /* COMPAT_PCCONS */ | |
791 | ||
792 | #endif /* _IOCTL_PC_H_ */ | |
793 |