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