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.3 2005/03/05 18:08:50 swildner Exp $ 30 */ 31 32 #ifndef _SYS_CONSIO_H_ 33 #define _SYS_CONSIO_H_ 34 35 #ifndef _KERNEL 36 #include <sys/types.h> 37 #endif 38 #include <sys/ioccom.h> 39 40 /* 41 * Console ioctl commands. Some commands are named as KDXXXX, GIO_XXX, and 42 * PIO_XXX, rather than CONS_XXX, for historical and compatibility reasons. 43 * Some other CONS_XXX commands are works as wrapper around frame buffer 44 * ioctl commands FBIO_XXX. Do not try to change all these commands, 45 * otherwise we shall have compatibility problems. 46 */ 47 48 /* get/set video mode */ 49 #define KD_TEXT 0 /* set text mode restore fonts */ 50 #define KD_TEXT0 0 /* ditto */ 51 #define KD_GRAPHICS 1 /* set graphics mode */ 52 #define KD_TEXT1 2 /* set text mode !restore fonts */ 53 #define KD_PIXEL 3 /* set pixel mode */ 54 #define KDGETMODE _IOR('K', 9, int) 55 #define KDSETMODE _IO('K', 10 /*, int */) 56 57 /* set border color */ 58 #define KDSBORDER _IO('K', 13 /*, int */) 59 60 /* set up raster(pixel) text mode */ 61 struct _scr_size { 62 int scr_size[3]; 63 }; 64 typedef struct _scr_size scr_size_t; 65 66 #define KDRASTER _IOW('K', 100, scr_size_t) 67 68 /* get/set screen char map */ 69 struct _scrmap { 70 char scrmap[256]; 71 }; 72 typedef struct _scrmap scrmap_t; 73 74 #define GIO_SCRNMAP _IOR('k', 2, scrmap_t) 75 #define PIO_SCRNMAP _IOW('k', 3, scrmap_t) 76 77 /* get the current text attribute */ 78 #define GIO_ATTR _IOR('a', 0, int) 79 80 /* get the current text color */ 81 #define GIO_COLOR _IOR('c', 0, int) 82 83 /* get the adapter type (equivalent to FBIO_ADPTYPE) */ 84 #define CONS_CURRENT _IOR('c', 1, int) 85 86 /* get the current video mode (equivalent to FBIO_GETMODE) */ 87 #define CONS_GET _IOR('c', 2, int) 88 89 /* not supported? */ 90 #define CONS_IO _IO('c', 3) 91 92 /* set blank time interval */ 93 #define CONS_BLANKTIME _IOW('c', 4, int) 94 95 /* set/get the screen saver (these ioctls are current noop) */ 96 struct ssaver { 97 #define MAXSSAVER 16 98 char name[MAXSSAVER]; 99 int num; 100 long time; 101 }; 102 typedef struct ssaver ssaver_t; 103 104 #define CONS_SSAVER _IOW('c', 5, ssaver_t) 105 #define CONS_GSAVER _IOWR('c', 6, ssaver_t) 106 107 /* set the text cursor shape */ 108 #define CONS_BLINK_CURSOR (1 << 0) 109 #define CONS_CHAR_CURSOR (1 << 1) 110 #define CONS_CURSORTYPE _IOW('c', 7, int) 111 112 /* set the bell type to audible or visual */ 113 #define CONS_VISUAL_BELL (1 << 0) 114 #define CONS_QUIET_BELL (1 << 1) 115 #define CONS_BELLTYPE _IOW('c', 8, int) 116 117 /* set the history (scroll back) buffer size (in lines) */ 118 #define CONS_HISTORY _IOW('c', 9, int) 119 120 /* clear the history (scroll back) buffer */ 121 #define CONS_CLRHIST _IO('c', 10) 122 123 /* mouse cursor ioctl */ 124 struct mouse_data { 125 int x; 126 int y; 127 int z; 128 int buttons; 129 }; 130 typedef struct mouse_data mouse_data_t; 131 132 struct mouse_mode { 133 int mode; 134 int signal; 135 }; 136 typedef struct mouse_mode mouse_mode_t; 137 138 struct mouse_event { 139 int id; /* one based */ 140 int value; 141 }; 142 typedef struct mouse_event mouse_event_t; 143 144 struct mouse_info { 145 int operation; 146 #define MOUSE_SHOW 0x01 147 #define MOUSE_HIDE 0x02 148 #define MOUSE_MOVEABS 0x03 149 #define MOUSE_MOVEREL 0x04 150 #define MOUSE_GETINFO 0x05 151 #define MOUSE_MODE 0x06 152 #define MOUSE_ACTION 0x07 153 #define MOUSE_MOTION_EVENT 0x08 154 #define MOUSE_BUTTON_EVENT 0x09 155 #define MOUSE_MOUSECHAR 0x0a 156 union { 157 mouse_data_t data; 158 mouse_mode_t mode; 159 mouse_event_t event; 160 int mouse_char; 161 } u; 162 }; 163 typedef struct mouse_info mouse_info_t; 164 165 #define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t) 166 167 /* see if the vty has been idle */ 168 #define CONS_IDLE _IOR('c', 11, int) 169 170 /* set the screen saver mode */ 171 #define CONS_NO_SAVER (-1) 172 #define CONS_LKM_SAVER 0 173 #define CONS_USR_SAVER 1 174 #define CONS_SAVERMODE _IOW('c', 12, int) 175 176 /* start the screen saver */ 177 #define CONS_SAVERSTART _IOW('c', 13, int) 178 179 /* set/get font data */ 180 struct fnt8 { 181 char fnt8x8[8*256]; 182 }; 183 typedef struct fnt8 fnt8_t; 184 185 struct fnt14 { 186 char fnt8x14[14*256]; 187 }; 188 typedef struct fnt14 fnt14_t; 189 190 struct fnt16 { 191 char fnt8x16[16*256]; 192 }; 193 typedef struct fnt16 fnt16_t; 194 195 #define PIO_FONT8x8 _IOW('c', 64, fnt8_t) 196 #define GIO_FONT8x8 _IOR('c', 65, fnt8_t) 197 #define PIO_FONT8x14 _IOW('c', 66, fnt14_t) 198 #define GIO_FONT8x14 _IOR('c', 67, fnt14_t) 199 #define PIO_FONT8x16 _IOW('c', 68, fnt16_t) 200 #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) 201 202 /* get video mode information */ 203 struct colors { 204 char fore; 205 char back; 206 }; 207 208 struct vid_info { 209 short size; 210 short m_num; 211 u_short font_size; 212 u_short mv_row, mv_col; 213 u_short mv_rsz, mv_csz; 214 struct colors mv_norm, 215 mv_rev, 216 mv_grfc; 217 u_char mv_ovscan; 218 u_char mk_keylock; 219 }; 220 typedef struct vid_info vid_info_t; 221 222 #define CONS_GETINFO _IOWR('c', 73, vid_info_t) 223 224 /* get version */ 225 #define CONS_GETVERS _IOR('c', 74, int) 226 227 /* get the video adapter index (equivalent to FBIO_ADAPTER) */ 228 #define CONS_CURRENTADP _IOR('c', 100, int) 229 230 /* get the video adapter information (equivalent to FBIO_ADPINFO) */ 231 #define CONS_ADPINFO _IOWR('c', 101, video_adapter_info_t) 232 233 /* get the video mode information (equivalent to FBIO_MODEINFO) */ 234 #define CONS_MODEINFO _IOWR('c', 102, video_info_t) 235 236 /* find a video mode (equivalent to FBIO_FINDMODE) */ 237 #define CONS_FINDMODE _IOWR('c', 103, video_info_t) 238 239 /* set the frame buffer window origin (equivalent to FBIO_SETWINORG) */ 240 #define CONS_SETWINORG _IO('c', 104 /*, u_int */) 241 242 /* use the specified keyboard */ 243 #define CONS_SETKBD _IO('c', 110 /*, int */) 244 245 /* release the current keyboard */ 246 #define CONS_RELKBD _IO('c', 111) 247 248 /* Snapshot the current video buffer */ 249 #define CONS_SCRSHOT _IOWR('c', 105, scrshot_t) 250 251 struct scrshot { 252 int xsize; 253 int ysize; 254 u_int16_t* buf; 255 }; 256 typedef struct scrshot scrshot_t; 257 258 /* get/set the current terminal emulator info. */ 259 #define TI_NAME_LEN 32 260 #define TI_DESC_LEN 64 261 262 struct term_info { 263 int ti_index; 264 int ti_flags; 265 u_char ti_name[TI_NAME_LEN]; 266 u_char ti_desc[TI_DESC_LEN]; 267 }; 268 typedef struct term_info term_info_t; 269 270 #define CONS_GETTERM _IOWR('c', 112, term_info_t) 271 #define CONS_SETTERM _IOW('c', 113, term_info_t) 272 273 /* 274 * Vty switching ioctl commands. 275 */ 276 277 /* get the next available vty */ 278 #define VT_OPENQRY _IOR('v', 1, int) 279 280 /* set/get vty switching mode */ 281 #ifndef _VT_MODE_DECLARED 282 #define _VT_MODE_DECLARED 283 struct vt_mode { 284 char mode; 285 #define VT_AUTO 0 /* switching is automatic */ 286 #define VT_PROCESS 1 /* switching controlled by prog */ 287 #define VT_KERNEL 255 /* switching controlled in kernel */ 288 char waitv; /* not implemented yet SOS */ 289 short relsig; 290 short acqsig; 291 short frsig; /* not implemented yet SOS */ 292 }; 293 typedef struct vt_mode vtmode_t; 294 #endif /* !_VT_MODE_DECLARED */ 295 296 #define VT_SETMODE _IOW('v', 2, vtmode_t) 297 #define VT_GETMODE _IOR('v', 3, vtmode_t) 298 299 /* acknowledge release or acquisition of a vty */ 300 #define VT_FALSE 0 301 #define VT_TRUE 1 302 #define VT_ACKACQ 2 303 #define VT_RELDISP _IO('v', 4 /*, int */) 304 305 /* activate the specified vty */ 306 #define VT_ACTIVATE _IO('v', 5 /*, int */) 307 308 /* wait until the specified vty is activate */ 309 #define VT_WAITACTIVE _IO('v', 6 /*, int */) 310 311 /* get the currently active vty */ 312 #define VT_GETACTIVE _IOR('v', 7, int) 313 314 /* get the index of the vty */ 315 #define VT_GETINDEX _IOR('v', 8, int) 316 317 /* prevent switching vtys */ 318 #define VT_LOCKSWITCH _IOW('v', 9, int) 319 320 /* 321 * Video mode switching ioctl. See sys/fbio.h for mode numbers. 322 */ 323 324 #define SW_B40x25 _IO('S', M_B40x25) 325 #define SW_C40x25 _IO('S', M_C40x25) 326 #define SW_B80x25 _IO('S', M_B80x25) 327 #define SW_C80x25 _IO('S', M_C80x25) 328 #define SW_BG320 _IO('S', M_BG320) 329 #define SW_CG320 _IO('S', M_CG320) 330 #define SW_BG640 _IO('S', M_BG640) 331 #define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25) 332 #define SW_CG320_D _IO('S', M_CG320_D) 333 #define SW_CG640_E _IO('S', M_CG640_E) 334 #define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA) 335 #define SW_CG640x350 _IO('S', M_CG640x350) 336 #define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2) 337 #define SW_ENH_CG640 _IO('S', M_ENH_CG640) 338 #define SW_ENH_B40x25 _IO('S', M_ENH_B40x25) 339 #define SW_ENH_C40x25 _IO('S', M_ENH_C40x25) 340 #define SW_ENH_B80x25 _IO('S', M_ENH_B80x25) 341 #define SW_ENH_C80x25 _IO('S', M_ENH_C80x25) 342 #define SW_ENH_B80x43 _IO('S', M_ENH_B80x43) 343 #define SW_ENH_C80x43 _IO('S', M_ENH_C80x43) 344 #define SW_MCAMODE _IO('S', M_MCA_MODE) 345 #define SW_VGA_C40x25 _IO('S', M_VGA_C40x25) 346 #define SW_VGA_C80x25 _IO('S', M_VGA_C80x25) 347 #define SW_VGA_C80x30 _IO('S', M_VGA_C80x30) 348 #define SW_VGA_C80x50 _IO('S', M_VGA_C80x50) 349 #define SW_VGA_C80x60 _IO('S', M_VGA_C80x60) 350 #define SW_VGA_M80x25 _IO('S', M_VGA_M80x25) 351 #define SW_VGA_M80x30 _IO('S', M_VGA_M80x30) 352 #define SW_VGA_M80x50 _IO('S', M_VGA_M80x50) 353 #define SW_VGA_M80x60 _IO('S', M_VGA_M80x60) 354 #define SW_VGA11 _IO('S', M_VGA11) 355 #define SW_BG640x480 _IO('S', M_VGA11) 356 #define SW_VGA12 _IO('S', M_VGA12) 357 #define SW_CG640x480 _IO('S', M_VGA12) 358 #define SW_VGA13 _IO('S', M_VGA13) 359 #define SW_VGA_CG320 _IO('S', M_VGA13) 360 #define SW_VGA_CG640 _IO('S', M_VGA_CG640) 361 #define SW_VGA_MODEX _IO('S', M_VGA_MODEX) 362 363 #define SW_VGA_C90x25 _IO('S', M_VGA_C90x25) 364 #define SW_VGA_M90x25 _IO('S', M_VGA_M90x25) 365 #define SW_VGA_C90x30 _IO('S', M_VGA_C90x30) 366 #define SW_VGA_M90x30 _IO('S', M_VGA_M90x30) 367 #define SW_VGA_C90x43 _IO('S', M_VGA_C90x43) 368 #define SW_VGA_M90x43 _IO('S', M_VGA_M90x43) 369 #define SW_VGA_C90x50 _IO('S', M_VGA_C90x50) 370 #define SW_VGA_M90x50 _IO('S', M_VGA_M90x50) 371 #define SW_VGA_C90x60 _IO('S', M_VGA_C90x60) 372 #define SW_VGA_M90x60 _IO('S', M_VGA_M90x60) 373 374 #define SW_TEXT_80x25 _IO('S', M_TEXT_80x25) 375 #define SW_TEXT_80x30 _IO('S', M_TEXT_80x30) 376 #define SW_TEXT_80x43 _IO('S', M_TEXT_80x43) 377 #define SW_TEXT_80x50 _IO('S', M_TEXT_80x50) 378 #define SW_TEXT_80x60 _IO('S', M_TEXT_80x60) 379 #define SW_TEXT_132x25 _IO('S', M_TEXT_132x25) 380 #define SW_TEXT_132x30 _IO('S', M_TEXT_132x30) 381 #define SW_TEXT_132x43 _IO('S', M_TEXT_132x43) 382 #define SW_TEXT_132x50 _IO('S', M_TEXT_132x50) 383 #define SW_TEXT_132x60 _IO('S', M_TEXT_132x60) 384 385 #define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE) 386 #define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE) 387 #define SW_VESA_800x600 _IO('V', M_VESA_800x600 - M_VESA_BASE) 388 #define SW_VESA_CG800x600 _IO('V', M_VESA_CG800x600 - M_VESA_BASE) 389 #define SW_VESA_1024x768 _IO('V', M_VESA_1024x768 - M_VESA_BASE) 390 #define SW_VESA_CG1024x768 _IO('V', M_VESA_CG1024x768 - M_VESA_BASE) 391 #define SW_VESA_1280x1024 _IO('V', M_VESA_1280x1024 - M_VESA_BASE) 392 #define SW_VESA_CG1280x1024 _IO('V', M_VESA_CG1280x1024 - M_VESA_BASE) 393 #define SW_VESA_C80x60 _IO('V', M_VESA_C80x60 - M_VESA_BASE) 394 #define SW_VESA_C132x25 _IO('V', M_VESA_C132x25 - M_VESA_BASE) 395 #define SW_VESA_C132x43 _IO('V', M_VESA_C132x43 - M_VESA_BASE) 396 #define SW_VESA_C132x50 _IO('V', M_VESA_C132x50 - M_VESA_BASE) 397 #define SW_VESA_C132x60 _IO('V', M_VESA_C132x60 - M_VESA_BASE) 398 #define SW_VESA_32K_320 _IO('V', M_VESA_32K_320 - M_VESA_BASE) 399 #define SW_VESA_64K_320 _IO('V', M_VESA_64K_320 - M_VESA_BASE) 400 #define SW_VESA_FULL_320 _IO('V', M_VESA_FULL_320 - M_VESA_BASE) 401 #define SW_VESA_32K_640 _IO('V', M_VESA_32K_640 - M_VESA_BASE) 402 #define SW_VESA_64K_640 _IO('V', M_VESA_64K_640 - M_VESA_BASE) 403 #define SW_VESA_FULL_640 _IO('V', M_VESA_FULL_640 - M_VESA_BASE) 404 #define SW_VESA_32K_800 _IO('V', M_VESA_32K_800 - M_VESA_BASE) 405 #define SW_VESA_64K_800 _IO('V', M_VESA_64K_800 - M_VESA_BASE) 406 #define SW_VESA_FULL_800 _IO('V', M_VESA_FULL_800 - M_VESA_BASE) 407 #define SW_VESA_32K_1024 _IO('V', M_VESA_32K_1024 - M_VESA_BASE) 408 #define SW_VESA_64K_1024 _IO('V', M_VESA_64K_1024 - M_VESA_BASE) 409 #define SW_VESA_FULL_1024 _IO('V', M_VESA_FULL_1024 - M_VESA_BASE) 410 #define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE) 411 #define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE) 412 #define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE) 413 414 #endif /* !_SYS_CONSIO_H_ */ 415