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