xref: /linux/include/uapi/linux/kd.h (revision 607ca46e97a1b6594b29647d98a32d545c24bdff)
1*607ca46eSDavid Howells #ifndef _UAPI_LINUX_KD_H
2*607ca46eSDavid Howells #define _UAPI_LINUX_KD_H
3*607ca46eSDavid Howells #include <linux/types.h>
4*607ca46eSDavid Howells #include <linux/compiler.h>
5*607ca46eSDavid Howells 
6*607ca46eSDavid Howells /* 0x4B is 'K', to avoid collision with termios and vt */
7*607ca46eSDavid Howells 
8*607ca46eSDavid Howells #define GIO_FONT	0x4B60	/* gets font in expanded form */
9*607ca46eSDavid Howells #define PIO_FONT	0x4B61	/* use font in expanded form */
10*607ca46eSDavid Howells 
11*607ca46eSDavid Howells #define GIO_FONTX	0x4B6B	/* get font using struct consolefontdesc */
12*607ca46eSDavid Howells #define PIO_FONTX	0x4B6C	/* set font using struct consolefontdesc */
13*607ca46eSDavid Howells struct consolefontdesc {
14*607ca46eSDavid Howells 	unsigned short charcount;	/* characters in font (256 or 512) */
15*607ca46eSDavid Howells 	unsigned short charheight;	/* scan lines per character (1-32) */
16*607ca46eSDavid Howells 	char __user *chardata;		/* font data in expanded form */
17*607ca46eSDavid Howells };
18*607ca46eSDavid Howells 
19*607ca46eSDavid Howells #define PIO_FONTRESET   0x4B6D	/* reset to default font */
20*607ca46eSDavid Howells 
21*607ca46eSDavid Howells #define GIO_CMAP	0x4B70	/* gets colour palette on VGA+ */
22*607ca46eSDavid Howells #define PIO_CMAP	0x4B71	/* sets colour palette on VGA+ */
23*607ca46eSDavid Howells 
24*607ca46eSDavid Howells #define KIOCSOUND	0x4B2F	/* start sound generation (0 for off) */
25*607ca46eSDavid Howells #define KDMKTONE	0x4B30	/* generate tone */
26*607ca46eSDavid Howells 
27*607ca46eSDavid Howells #define KDGETLED	0x4B31	/* return current led state */
28*607ca46eSDavid Howells #define KDSETLED	0x4B32	/* set led state [lights, not flags] */
29*607ca46eSDavid Howells #define 	LED_SCR		0x01	/* scroll lock led */
30*607ca46eSDavid Howells #define 	LED_NUM		0x02	/* num lock led */
31*607ca46eSDavid Howells #define 	LED_CAP		0x04	/* caps lock led */
32*607ca46eSDavid Howells 
33*607ca46eSDavid Howells #define KDGKBTYPE	0x4B33	/* get keyboard type */
34*607ca46eSDavid Howells #define 	KB_84		0x01
35*607ca46eSDavid Howells #define 	KB_101		0x02 	/* this is what we always answer */
36*607ca46eSDavid Howells #define 	KB_OTHER	0x03
37*607ca46eSDavid Howells 
38*607ca46eSDavid Howells #define KDADDIO		0x4B34	/* add i/o port as valid */
39*607ca46eSDavid Howells #define KDDELIO		0x4B35	/* del i/o port as valid */
40*607ca46eSDavid Howells #define KDENABIO	0x4B36	/* enable i/o to video board */
41*607ca46eSDavid Howells #define KDDISABIO	0x4B37	/* disable i/o to video board */
42*607ca46eSDavid Howells 
43*607ca46eSDavid Howells #define KDSETMODE	0x4B3A	/* set text/graphics mode */
44*607ca46eSDavid Howells #define		KD_TEXT		0x00
45*607ca46eSDavid Howells #define		KD_GRAPHICS	0x01
46*607ca46eSDavid Howells #define		KD_TEXT0	0x02	/* obsolete */
47*607ca46eSDavid Howells #define		KD_TEXT1	0x03	/* obsolete */
48*607ca46eSDavid Howells #define KDGETMODE	0x4B3B	/* get current mode */
49*607ca46eSDavid Howells 
50*607ca46eSDavid Howells #define KDMAPDISP	0x4B3C	/* map display into address space */
51*607ca46eSDavid Howells #define KDUNMAPDISP	0x4B3D	/* unmap display from address space */
52*607ca46eSDavid Howells 
53*607ca46eSDavid Howells typedef char scrnmap_t;
54*607ca46eSDavid Howells #define		E_TABSZ		256
55*607ca46eSDavid Howells #define GIO_SCRNMAP	0x4B40	/* get screen mapping from kernel */
56*607ca46eSDavid Howells #define PIO_SCRNMAP	0x4B41	/* put screen mapping table in kernel */
57*607ca46eSDavid Howells #define GIO_UNISCRNMAP  0x4B69	/* get full Unicode screen mapping */
58*607ca46eSDavid Howells #define PIO_UNISCRNMAP  0x4B6A  /* set full Unicode screen mapping */
59*607ca46eSDavid Howells 
60*607ca46eSDavid Howells #define GIO_UNIMAP	0x4B66	/* get unicode-to-font mapping from kernel */
61*607ca46eSDavid Howells struct unipair {
62*607ca46eSDavid Howells 	unsigned short unicode;
63*607ca46eSDavid Howells 	unsigned short fontpos;
64*607ca46eSDavid Howells };
65*607ca46eSDavid Howells struct unimapdesc {
66*607ca46eSDavid Howells 	unsigned short entry_ct;
67*607ca46eSDavid Howells 	struct unipair __user *entries;
68*607ca46eSDavid Howells };
69*607ca46eSDavid Howells #define PIO_UNIMAP	0x4B67	/* put unicode-to-font mapping in kernel */
70*607ca46eSDavid Howells #define PIO_UNIMAPCLR	0x4B68	/* clear table, possibly advise hash algorithm */
71*607ca46eSDavid Howells struct unimapinit {
72*607ca46eSDavid Howells 	unsigned short advised_hashsize;  /* 0 if no opinion */
73*607ca46eSDavid Howells 	unsigned short advised_hashstep;  /* 0 if no opinion */
74*607ca46eSDavid Howells 	unsigned short advised_hashlevel; /* 0 if no opinion */
75*607ca46eSDavid Howells };
76*607ca46eSDavid Howells 
77*607ca46eSDavid Howells #define UNI_DIRECT_BASE 0xF000	/* start of Direct Font Region */
78*607ca46eSDavid Howells #define UNI_DIRECT_MASK 0x01FF	/* Direct Font Region bitmask */
79*607ca46eSDavid Howells 
80*607ca46eSDavid Howells #define		K_RAW		0x00
81*607ca46eSDavid Howells #define		K_XLATE		0x01
82*607ca46eSDavid Howells #define		K_MEDIUMRAW	0x02
83*607ca46eSDavid Howells #define		K_UNICODE	0x03
84*607ca46eSDavid Howells #define		K_OFF		0x04
85*607ca46eSDavid Howells #define KDGKBMODE	0x4B44	/* gets current keyboard mode */
86*607ca46eSDavid Howells #define KDSKBMODE	0x4B45	/* sets current keyboard mode */
87*607ca46eSDavid Howells 
88*607ca46eSDavid Howells #define		K_METABIT	0x03
89*607ca46eSDavid Howells #define		K_ESCPREFIX	0x04
90*607ca46eSDavid Howells #define KDGKBMETA	0x4B62	/* gets meta key handling mode */
91*607ca46eSDavid Howells #define KDSKBMETA	0x4B63	/* sets meta key handling mode */
92*607ca46eSDavid Howells 
93*607ca46eSDavid Howells #define		K_SCROLLLOCK	0x01
94*607ca46eSDavid Howells #define		K_NUMLOCK	0x02
95*607ca46eSDavid Howells #define		K_CAPSLOCK	0x04
96*607ca46eSDavid Howells #define	KDGKBLED	0x4B64	/* get led flags (not lights) */
97*607ca46eSDavid Howells #define	KDSKBLED	0x4B65	/* set led flags (not lights) */
98*607ca46eSDavid Howells 
99*607ca46eSDavid Howells struct kbentry {
100*607ca46eSDavid Howells 	unsigned char kb_table;
101*607ca46eSDavid Howells 	unsigned char kb_index;
102*607ca46eSDavid Howells 	unsigned short kb_value;
103*607ca46eSDavid Howells };
104*607ca46eSDavid Howells #define		K_NORMTAB	0x00
105*607ca46eSDavid Howells #define		K_SHIFTTAB	0x01
106*607ca46eSDavid Howells #define		K_ALTTAB	0x02
107*607ca46eSDavid Howells #define		K_ALTSHIFTTAB	0x03
108*607ca46eSDavid Howells 
109*607ca46eSDavid Howells #define KDGKBENT	0x4B46	/* gets one entry in translation table */
110*607ca46eSDavid Howells #define KDSKBENT	0x4B47	/* sets one entry in translation table */
111*607ca46eSDavid Howells 
112*607ca46eSDavid Howells struct kbsentry {
113*607ca46eSDavid Howells 	unsigned char kb_func;
114*607ca46eSDavid Howells 	unsigned char kb_string[512];
115*607ca46eSDavid Howells };
116*607ca46eSDavid Howells #define KDGKBSENT	0x4B48	/* gets one function key string entry */
117*607ca46eSDavid Howells #define KDSKBSENT	0x4B49	/* sets one function key string entry */
118*607ca46eSDavid Howells 
119*607ca46eSDavid Howells struct kbdiacr {
120*607ca46eSDavid Howells         unsigned char diacr, base, result;
121*607ca46eSDavid Howells };
122*607ca46eSDavid Howells struct kbdiacrs {
123*607ca46eSDavid Howells         unsigned int kb_cnt;    /* number of entries in following array */
124*607ca46eSDavid Howells 	struct kbdiacr kbdiacr[256];    /* MAX_DIACR from keyboard.h */
125*607ca46eSDavid Howells };
126*607ca46eSDavid Howells #define KDGKBDIACR      0x4B4A  /* read kernel accent table */
127*607ca46eSDavid Howells #define KDSKBDIACR      0x4B4B  /* write kernel accent table */
128*607ca46eSDavid Howells 
129*607ca46eSDavid Howells struct kbdiacruc {
130*607ca46eSDavid Howells 	unsigned int diacr, base, result;
131*607ca46eSDavid Howells };
132*607ca46eSDavid Howells struct kbdiacrsuc {
133*607ca46eSDavid Howells         unsigned int kb_cnt;    /* number of entries in following array */
134*607ca46eSDavid Howells 	struct kbdiacruc kbdiacruc[256];    /* MAX_DIACR from keyboard.h */
135*607ca46eSDavid Howells };
136*607ca46eSDavid Howells #define KDGKBDIACRUC    0x4BFA  /* read kernel accent table - UCS */
137*607ca46eSDavid Howells #define KDSKBDIACRUC    0x4BFB  /* write kernel accent table - UCS */
138*607ca46eSDavid Howells 
139*607ca46eSDavid Howells struct kbkeycode {
140*607ca46eSDavid Howells 	unsigned int scancode, keycode;
141*607ca46eSDavid Howells };
142*607ca46eSDavid Howells #define KDGETKEYCODE	0x4B4C	/* read kernel keycode table entry */
143*607ca46eSDavid Howells #define KDSETKEYCODE	0x4B4D	/* write kernel keycode table entry */
144*607ca46eSDavid Howells 
145*607ca46eSDavid Howells #define KDSIGACCEPT	0x4B4E	/* accept kbd generated signals */
146*607ca46eSDavid Howells 
147*607ca46eSDavid Howells struct kbd_repeat {
148*607ca46eSDavid Howells 	int delay;	/* in msec; <= 0: don't change */
149*607ca46eSDavid Howells 	int period;	/* in msec; <= 0: don't change */
150*607ca46eSDavid Howells 			/* earlier this field was misnamed "rate" */
151*607ca46eSDavid Howells };
152*607ca46eSDavid Howells 
153*607ca46eSDavid Howells #define KDKBDREP        0x4B52  /* set keyboard delay/repeat rate;
154*607ca46eSDavid Howells 				 * actually used values are returned */
155*607ca46eSDavid Howells 
156*607ca46eSDavid Howells #define KDFONTOP	0x4B72	/* font operations */
157*607ca46eSDavid Howells 
158*607ca46eSDavid Howells struct console_font_op {
159*607ca46eSDavid Howells 	unsigned int op;	/* operation code KD_FONT_OP_* */
160*607ca46eSDavid Howells 	unsigned int flags;	/* KD_FONT_FLAG_* */
161*607ca46eSDavid Howells 	unsigned int width, height;	/* font size */
162*607ca46eSDavid Howells 	unsigned int charcount;
163*607ca46eSDavid Howells 	unsigned char __user *data;	/* font data with height fixed to 32 */
164*607ca46eSDavid Howells };
165*607ca46eSDavid Howells 
166*607ca46eSDavid Howells struct console_font {
167*607ca46eSDavid Howells 	unsigned int width, height;	/* font size */
168*607ca46eSDavid Howells 	unsigned int charcount;
169*607ca46eSDavid Howells 	unsigned char *data;	/* font data with height fixed to 32 */
170*607ca46eSDavid Howells };
171*607ca46eSDavid Howells 
172*607ca46eSDavid Howells #define KD_FONT_OP_SET		0	/* Set font */
173*607ca46eSDavid Howells #define KD_FONT_OP_GET		1	/* Get font */
174*607ca46eSDavid Howells #define KD_FONT_OP_SET_DEFAULT	2	/* Set font to default, data points to name / NULL */
175*607ca46eSDavid Howells #define KD_FONT_OP_COPY		3	/* Copy from another console */
176*607ca46eSDavid Howells 
177*607ca46eSDavid Howells #define KD_FONT_FLAG_DONT_RECALC 	1	/* Don't recalculate hw charcell size [compat] */
178*607ca46eSDavid Howells 
179*607ca46eSDavid Howells /* note: 0x4B00-0x4B4E all have had a value at some time;
180*607ca46eSDavid Howells    don't reuse for the time being */
181*607ca46eSDavid Howells /* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */
182*607ca46eSDavid Howells 
183*607ca46eSDavid Howells #endif /* _UAPI_LINUX_KD_H */
184