xref: /dragonfly/sys/sys/consio.h (revision cfd1aba3)
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/sys/consio.h,v 1.5.2.7 2002/09/15 22:30:46 dd Exp $
29  * $DragonFly: src/sys/sys/consio.h,v 1.6 2007/08/19 11:39:11 swildner Exp $
30  */
31 
32 #ifndef	_SYS_CONSIO_H_
33 #define	_SYS_CONSIO_H_
34 
35 #ifndef _SYS_TYPES_H_
36 #include <sys/types.h>
37 #endif
38 #ifndef _SYS_IOCCOM_H_
39 #include <sys/ioccom.h>
40 #endif
41 
42 /*
43  * Console ioctl commands.  Some commands are named as KDXXXX, GIO_XXX, and
44  * PIO_XXX, rather than CONS_XXX, for historical and compatibility reasons.
45  * Some other CONS_XXX commands are works as wrapper around frame buffer
46  * ioctl commands FBIO_XXX.  Do not try to change all these commands,
47  * otherwise we shall have compatibility problems.
48  */
49 
50 /* get/set video mode */
51 #define KD_TEXT		0		/* set text mode restore fonts  */
52 #define KD_TEXT0	0		/* ditto			*/
53 #define KD_GRAPHICS	1		/* set graphics mode 		*/
54 #define KD_TEXT1	2		/* set text mode !restore fonts */
55 #define KD_PIXEL	3		/* set pixel mode		*/
56 #define KDGETMODE	_IOR('K', 9, int)
57 #define KDSETMODE	_IO('K', 10 /*, int */)
58 
59 /* set border color */
60 #define KDSBORDER	_IO('K', 13 /*, int */)
61 
62 /* set up raster(pixel) text mode */
63 struct _scr_size {
64 	int		scr_size[3];
65 };
66 typedef struct _scr_size	scr_size_t;
67 
68 #define KDRASTER	_IOW('K', 100, scr_size_t)
69 
70 /* get/set screen char map */
71 struct _scrmap {
72 	char		scrmap[256];
73 };
74 typedef struct _scrmap	scrmap_t;
75 
76 #define GIO_SCRNMAP	_IOR('k', 2, scrmap_t)
77 #define PIO_SCRNMAP	_IOW('k', 3, scrmap_t)
78 
79 /* get the current text attribute */
80 #define GIO_ATTR	_IOR('a', 0, int)
81 
82 /* get the current text color */
83 #define GIO_COLOR	_IOR('c', 0, int)
84 
85 /* get the adapter type (equivalent to FBIO_ADPTYPE) */
86 #define CONS_CURRENT	_IOR('c', 1, int)
87 
88 /* get the current video mode (equivalent to FBIO_GETMODE) */
89 #define CONS_GET	_IOR('c', 2, int)
90 
91 /* set the current video mode (equivalent to FBIO_SETMODE) */
92 #define CONS_SET	_IOW('c', 3, int)
93 
94 /* set blank time interval */
95 #define CONS_BLANKTIME	_IOW('c', 4, int)
96 
97 /* set/get the screen saver (these ioctls are current noop) */
98 struct ssaver	{
99 #define MAXSSAVER	16
100 	char		name[MAXSSAVER];
101 	int		num;
102 	long		time;
103 };
104 typedef struct ssaver	ssaver_t;
105 
106 #define CONS_SSAVER	_IOW('c', 5, ssaver_t)
107 #define CONS_GSAVER	_IOWR('c', 6, ssaver_t)
108 
109 /* set the text cursor shape */
110 #define CONS_BLINK_CURSOR (1 << 0)
111 #define CONS_CHAR_CURSOR (1 << 1)
112 #define CONS_CURSORTYPE	_IOW('c', 7, int)
113 
114 /* set the bell type to audible or visual */
115 #define CONS_VISUAL_BELL (1 << 0)
116 #define CONS_QUIET_BELL	(1 << 1)
117 #define CONS_BELLTYPE	_IOW('c', 8, int)
118 
119 /* set the history (scroll back) buffer size (in lines) */
120 #define CONS_HISTORY	_IOW('c', 9, int)
121 
122 /* clear the history (scroll back) buffer */
123 #define CONS_CLRHIST	_IO('c', 10)
124 
125 /* mouse cursor ioctl */
126 struct mouse_data {
127 	int		x;
128 	int 		y;
129 	int 		z;
130 	int 		buttons;
131 };
132 typedef struct mouse_data mouse_data_t;
133 
134 struct mouse_mode {
135 	int		mode;
136 	int		signal;
137 };
138 typedef struct mouse_mode mouse_mode_t;
139 
140 struct mouse_event {
141 	int		id;			/* one based */
142 	int		value;
143 };
144 typedef struct mouse_event mouse_event_t;
145 
146 struct mouse_info {
147 	int		operation;
148 #define MOUSE_SHOW	0x01
149 #define MOUSE_HIDE	0x02
150 #define MOUSE_MOVEABS	0x03
151 #define MOUSE_MOVEREL	0x04
152 #define MOUSE_GETINFO	0x05
153 #define MOUSE_MODE	0x06
154 #define MOUSE_ACTION	0x07
155 #define MOUSE_MOTION_EVENT	0x08
156 #define MOUSE_BUTTON_EVENT	0x09
157 #define MOUSE_MOUSECHAR	0x0a
158 	union {
159 		mouse_data_t	data;
160 		mouse_mode_t	mode;
161 		mouse_event_t	event;
162 		int		mouse_char;
163 	}		u;
164 };
165 typedef struct mouse_info mouse_info_t;
166 
167 #define CONS_MOUSECTL	_IOWR('c', 10, mouse_info_t)
168 
169 /* see if the vty has been idle */
170 #define CONS_IDLE	_IOR('c', 11, int)
171 
172 /* set the screen saver mode */
173 #define CONS_NO_SAVER	(-1)
174 #define CONS_LKM_SAVER	0
175 #define CONS_USR_SAVER	1
176 #define CONS_SAVERMODE	_IOW('c', 12, int)
177 
178 /* start the screen saver */
179 #define CONS_SAVERSTART	_IOW('c', 13, int)
180 
181 /* set/get font data */
182 struct fnt8 {
183 	char		fnt8x8[8*256];
184 };
185 typedef struct fnt8	fnt8_t;
186 
187 struct fnt14 {
188 	char		fnt8x14[14*256];
189 };
190 typedef struct fnt14	fnt14_t;
191 
192 struct fnt16 {
193 	char		fnt8x16[16*256];
194 };
195 typedef struct fnt16	fnt16_t;
196 
197 #define PIO_FONT8x8	_IOW('c', 64, fnt8_t)
198 #define GIO_FONT8x8	_IOR('c', 65, fnt8_t)
199 #define PIO_FONT8x14	_IOW('c', 66, fnt14_t)
200 #define GIO_FONT8x14	_IOR('c', 67, fnt14_t)
201 #define PIO_FONT8x16	_IOW('c', 68, fnt16_t)
202 #define GIO_FONT8x16	_IOR('c', 69, fnt16_t)
203 
204 /* get video mode information */
205 struct colors	{
206 	char		fore;
207 	char		back;
208 };
209 
210 struct vid_info {
211 	short		size;
212 	short		m_num;
213 	u_short		font_size;
214 	u_short		mv_row, mv_col;
215 	u_short		mv_rsz, mv_csz;
216 	struct colors	mv_norm,
217 			mv_rev,
218 			mv_grfc;
219 	u_char		mv_ovscan;
220 	u_char		mk_keylock;
221 };
222 typedef struct vid_info vid_info_t;
223 
224 #define CONS_GETINFO    _IOWR('c', 73, vid_info_t)
225 
226 /* get version */
227 #define CONS_GETVERS	_IOR('c', 74, int)
228 
229 /* get the video adapter index (equivalent to FBIO_ADAPTER) */
230 #define CONS_CURRENTADP	_IOR('c', 100, int)
231 
232 /* get the video adapter information (equivalent to FBIO_ADPINFO) */
233 #define CONS_ADPINFO	_IOWR('c', 101, video_adapter_info_t)
234 
235 /* get the video mode information (equivalent to FBIO_MODEINFO) */
236 #define CONS_MODEINFO	_IOWR('c', 102, video_info_t)
237 
238 /* find a video mode (equivalent to FBIO_FINDMODE) */
239 #define CONS_FINDMODE	_IOWR('c', 103, video_info_t)
240 
241 /* set the frame buffer window origin (equivalent to FBIO_SETWINORG) */
242 #define CONS_SETWINORG	_IO('c', 104 /*, u_int */)
243 
244 /* use the specified keyboard */
245 #define CONS_SETKBD	_IO('c', 110 /*, int */)
246 
247 /* release the current keyboard */
248 #define CONS_RELKBD	_IO('c', 111)
249 
250 /* Snapshot the current video buffer */
251 #define CONS_SCRSHOT	_IOWR('c', 105, scrshot_t)
252 
253 struct scrshot {
254 	int		xsize;
255 	int		ysize;
256 	u_int16_t*	buf;
257 };
258 typedef struct scrshot scrshot_t;
259 
260 /* get/set the current terminal emulator info. */
261 #define TI_NAME_LEN	32
262 #define TI_DESC_LEN	64
263 
264 struct term_info {
265 	int		ti_index;
266 	int		ti_flags;
267 	u_char		ti_name[TI_NAME_LEN];
268 	u_char		ti_desc[TI_DESC_LEN];
269 };
270 typedef struct term_info term_info_t;
271 
272 #define CONS_GETTERM	_IOWR('c', 112, term_info_t)
273 #define CONS_SETTERM	_IOW('c', 113, term_info_t)
274 
275 /*
276  * Vty switching ioctl commands.
277  */
278 
279 /* get the next available vty */
280 #define VT_OPENQRY	_IOR('v', 1, int)
281 
282 /* set/get vty switching mode */
283 #ifndef _VT_MODE_DECLARED
284 #define	_VT_MODE_DECLARED
285 struct vt_mode {
286 	char		mode;
287 #define VT_AUTO		0		/* switching is automatic 	*/
288 #define VT_PROCESS	1		/* switching controlled by prog */
289 #define VT_KERNEL	255		/* switching controlled in kernel */
290 	char		waitv;		/* not implemented yet 	SOS	*/
291 	short		relsig;
292 	short		acqsig;
293 	short		frsig;		/* not implemented yet	SOS	*/
294 };
295 typedef struct vt_mode vtmode_t;
296 #endif /* !_VT_MODE_DECLARED */
297 
298 #define VT_SETMODE	_IOW('v', 2, vtmode_t)
299 #define VT_GETMODE	_IOR('v', 3, vtmode_t)
300 
301 /* acknowledge release or acquisition of a vty */
302 #define VT_FALSE	0
303 #define VT_TRUE		1
304 #define VT_ACKACQ	2
305 #define VT_RELDISP	_IO('v', 4 /*, int */)
306 
307 /* activate the specified vty */
308 #define VT_ACTIVATE	_IO('v', 5 /*, int */)
309 
310 /* wait until the specified vty is activate */
311 #define VT_WAITACTIVE	_IO('v', 6 /*, int */)
312 
313 /* get the currently active vty */
314 #define VT_GETACTIVE	_IOR('v', 7, int)
315 
316 /* get the index of the vty */
317 #define VT_GETINDEX	_IOR('v', 8, int)
318 
319 /* prevent switching vtys */
320 #define VT_LOCKSWITCH	_IOW('v', 9, int)
321 
322 #ifdef _KERNEL
323 
324 extern int break_to_debugger;
325 extern int alt_break_to_debugger;
326 
327 #endif
328 
329 #endif /* !_SYS_CONSIO_H_ */
330