1 /*- 2 * Copyright (c) 1995-1998 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 * without modification, immediately at the beginning of the file. 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 _DEV_SYSCONS_SYSCONS_H_ 32 #define _DEV_SYSCONS_SYSCONS_H_ 33 34 /* machine-dependent part of the header */ 35 36 #ifdef PC98 37 #include <pc98/pc98/sc_machdep.h> 38 #elif defined(__i386__) 39 /* nothing for the moment */ 40 #elif defined(__alpha__) 41 /* nothing for the moment */ 42 #endif 43 44 /* default values for configuration options */ 45 46 #ifndef MAXCONS 47 #define MAXCONS 16 48 #endif 49 50 #ifdef SC_NO_SYSMOUSE 51 #undef SC_NO_CUTPASTE 52 #define SC_NO_CUTPASTE 1 53 #endif 54 55 #ifdef SC_NO_MODE_CHANGE 56 #undef SC_PIXEL_MODE 57 #endif 58 59 #ifndef SC_CURSOR_CHAR 60 #define SC_CURSOR_CHAR (0x07) 61 #endif 62 63 #ifndef SC_MOUSE_CHAR 64 #define SC_MOUSE_CHAR (0xd0) 65 #endif 66 67 #if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4) 68 #undef SC_CURSOR_CHAR 69 #define SC_CURSOR_CHAR (SC_MOUSE_CHAR + 4) 70 #endif 71 72 #ifndef SC_DEBUG_LEVEL 73 #define SC_DEBUG_LEVEL 0 74 #endif 75 76 #define DPRINTF(l, p) if (SC_DEBUG_LEVEL >= (l)) printf p 77 78 #define SC_DRIVER_NAME "sc" 79 #define SC_VTY(dev) minor(dev) 80 #define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) 81 #define SC_STAT(dev) ((scr_stat *)(dev)->si_drv1) 82 83 /* printable chars */ 84 #ifndef PRINTABLE 85 #define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 86 || (ch) < 0x07) 87 #endif 88 89 /* macros for "intelligent" screen update */ 90 #define mark_for_update(scp, x) {\ 91 if ((x) < scp->start) scp->start = (x);\ 92 else if ((x) > scp->end) scp->end = (x);\ 93 } 94 #define mark_all(scp) {\ 95 scp->start = 0;\ 96 scp->end = scp->xsize * scp->ysize - 1;\ 97 } 98 99 /* vty status flags (scp->status) */ 100 #define UNKNOWN_MODE 0x00010 /* unknown video mode */ 101 #define SWITCH_WAIT_REL 0x00080 /* waiting for vty release */ 102 #define SWITCH_WAIT_ACQ 0x00100 /* waiting for vty ack */ 103 #define BUFFER_SAVED 0x00200 /* vty buffer is saved */ 104 #define CURSOR_ENABLED 0x00400 /* text cursor is enabled */ 105 #define MOUSE_MOVED 0x01000 /* mouse cursor has moved */ 106 #define MOUSE_CUTTING 0x02000 /* mouse cursor is cutting text */ 107 #define MOUSE_VISIBLE 0x04000 /* mouse cursor is showing */ 108 #define GRAPHICS_MODE 0x08000 /* vty is in a graphics mode */ 109 #define PIXEL_MODE 0x10000 /* vty is in a raster text mode */ 110 #define SAVER_RUNNING 0x20000 /* screen saver is running */ 111 #define VR_CURSOR_BLINK 0x40000 /* blinking text cursor */ 112 #define VR_CURSOR_ON 0x80000 /* text cursor is on */ 113 #define MOUSE_HIDDEN 0x100000 /* mouse cursor is temporarily hidden */ 114 115 /* misc defines */ 116 #define FALSE 0 117 #define TRUE 1 118 #define COL 80 119 #define ROW 25 120 #define PCBURST 128 121 122 #ifndef BELL_DURATION 123 #define BELL_DURATION ((5 * hz + 99) / 100) 124 #define BELL_PITCH 800 125 #endif 126 127 /* virtual terminal buffer */ 128 typedef struct sc_vtb { 129 int vtb_flags; 130 #define VTB_VALID (1 << 0) 131 #define VTB_ALLOCED (1 << 1) 132 int vtb_type; 133 #define VTB_INVALID 0 134 #define VTB_MEMORY 1 135 #define VTB_FRAMEBUFFER 2 136 #define VTB_RINGBUFFER 3 137 int vtb_cols; 138 int vtb_rows; 139 int vtb_size; 140 vm_offset_t vtb_buffer; 141 int vtb_tail; /* valid for VTB_RINGBUFFER only */ 142 } sc_vtb_t; 143 144 /* softc */ 145 146 struct keyboard; 147 struct video_adapter; 148 struct scr_stat; 149 struct tty; 150 151 typedef struct sc_softc { 152 int unit; /* unit # */ 153 int config; /* configuration flags */ 154 #define SC_VESA800X600 (1 << 7) 155 #define SC_AUTODETECT_KBD (1 << 8) 156 #define SC_KERNEL_CONSOLE (1 << 9) 157 158 int flags; /* status flags */ 159 #define SC_VISUAL_BELL (1 << 0) 160 #define SC_QUIET_BELL (1 << 1) 161 #define SC_BLINK_CURSOR (1 << 2) 162 #define SC_CHAR_CURSOR (1 << 3) 163 #define SC_MOUSE_ENABLED (1 << 4) 164 #define SC_SCRN_IDLE (1 << 5) 165 #define SC_SCRN_BLANKED (1 << 6) 166 #define SC_SAVER_FAILED (1 << 7) 167 168 #define SC_INIT_DONE (1 << 16) 169 #define SC_SPLASH_SCRN (1 << 17) 170 171 int keyboard; /* -1 if unavailable */ 172 struct keyboard *kbd; 173 174 int adapter; 175 struct video_adapter *adp; 176 int initial_mode; /* initial video mode */ 177 178 int first_vty; 179 int vtys; 180 dev_t *dev; 181 struct scr_stat *cur_scp; 182 struct scr_stat *new_scp; 183 struct scr_stat *old_scp; 184 int delayed_next_scr; 185 186 char font_loading_in_progress; 187 char switch_in_progress; 188 char videoio_in_progress; 189 char write_in_progress; 190 char blink_in_progress; 191 192 long scrn_time_stamp; 193 194 char cursor_base; 195 char cursor_height; 196 197 u_char scr_map[256]; 198 u_char scr_rmap[256]; 199 200 #ifdef _SC_MD_SOFTC_DECLARED_ 201 sc_md_softc_t md; /* machine dependent vars */ 202 #endif 203 204 #ifndef SC_NO_PALETTE_LOADING 205 u_char palette[256*3]; 206 #endif 207 208 #ifndef SC_NO_FONT_LOADING 209 int fonts_loaded; 210 #define FONT_8 2 211 #define FONT_14 4 212 #define FONT_16 8 213 u_char *font_8; 214 u_char *font_14; 215 u_char *font_16; 216 #endif 217 218 u_char cursor_char; 219 u_char mouse_char; 220 221 } sc_softc_t; 222 223 /* virtual screen */ 224 typedef struct scr_stat { 225 int index; /* index of this vty */ 226 struct sc_softc *sc; /* pointer to softc */ 227 struct sc_rndr_sw *rndr; /* renderer */ 228 sc_vtb_t scr; 229 sc_vtb_t vtb; 230 231 int xpos; /* current X position */ 232 int ypos; /* current Y position */ 233 int xsize; /* X text size */ 234 int ysize; /* Y text size */ 235 int xpixel; /* X graphics size */ 236 int ypixel; /* Y graphics size */ 237 int xoff; /* X offset in pixel mode */ 238 int yoff; /* Y offset in pixel mode */ 239 240 u_char *font; /* current font */ 241 int font_size; /* fontsize in Y direction */ 242 243 int start; /* modified area start */ 244 int end; /* modified area end */ 245 246 struct sc_term_sw *tsw; 247 void *ts; 248 249 int status; /* status (bitfield) */ 250 int kbd_mode; /* keyboard I/O mode */ 251 252 int cursor_pos; /* cursor buffer position */ 253 int cursor_oldpos; /* cursor old buffer position */ 254 u_short cursor_saveunder_char; /* saved char under cursor */ 255 u_short cursor_saveunder_attr; /* saved attr under cursor */ 256 char cursor_base; /* cursor base line # */ 257 char cursor_height; /* cursor height */ 258 259 int mouse_pos; /* mouse buffer position */ 260 int mouse_oldpos; /* mouse old buffer position */ 261 short mouse_xpos; /* mouse x coordinate */ 262 short mouse_ypos; /* mouse y coordinate */ 263 short mouse_oldxpos; /* mouse previous x coordinate */ 264 short mouse_oldypos; /* mouse previous y coordinate */ 265 short mouse_buttons; /* mouse buttons */ 266 int mouse_cut_start; /* mouse cut start pos */ 267 int mouse_cut_end; /* mouse cut end pos */ 268 struct proc *mouse_proc; /* proc* of controlling proc */ 269 pid_t mouse_pid; /* pid of controlling proc */ 270 int mouse_signal; /* signal # to report with */ 271 272 u_short bell_duration; 273 u_short bell_pitch; 274 275 u_char border; /* border color */ 276 int mode; /* mode */ 277 pid_t pid; /* pid of controlling proc */ 278 struct proc *proc; /* proc* of controlling proc */ 279 struct vt_mode smode; /* switch mode */ 280 281 sc_vtb_t *history; /* circular history buffer */ 282 int history_pos; /* position shown on screen */ 283 int history_size; /* size of history buffer */ 284 285 int splash_save_mode; /* saved mode for splash screen */ 286 int splash_save_status; /* saved status for splash screen */ 287 #ifdef _SCR_MD_STAT_DECLARED_ 288 scr_md_stat_t md; /* machine dependent vars */ 289 #endif 290 } scr_stat; 291 292 #ifndef SC_NORM_ATTR 293 #define SC_NORM_ATTR (FG_LIGHTGREY | BG_BLACK) 294 #endif 295 #ifndef SC_NORM_REV_ATTR 296 #define SC_NORM_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 297 #endif 298 #ifndef SC_KERNEL_CONS_ATTR 299 #define SC_KERNEL_CONS_ATTR (FG_WHITE | BG_BLACK) 300 #endif 301 #ifndef SC_KERNEL_CONS_REV_ATTR 302 #define SC_KERNEL_CONS_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 303 #endif 304 305 /* terminal emulator */ 306 307 #ifndef SC_DFLT_TERM 308 #define SC_DFLT_TERM "*" /* any */ 309 #endif 310 311 typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); 312 #define SC_TE_COLD_INIT 0 313 #define SC_TE_WARM_INIT 1 314 typedef int sc_term_term_t(scr_stat *scp, void **tcp); 315 typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); 316 typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, 317 caddr_t data, int flag, struct proc *p); 318 typedef int sc_term_reset_t(scr_stat *scp, int code); 319 #define SC_TE_HARD_RESET 0 320 #define SC_TE_SOFT_RESET 1 321 typedef void sc_term_default_attr_t(scr_stat *scp, int norm, int rev); 322 typedef void sc_term_clear_t(scr_stat *scp); 323 typedef void sc_term_notify_t(scr_stat *scp, int event); 324 #define SC_TE_NOTIFY_VTSWITCH_IN 0 325 #define SC_TE_NOTIFY_VTSWITCH_OUT 1 326 typedef int sc_term_input_t(scr_stat *scp, int c, struct tty *tp); 327 328 typedef struct sc_term_sw { 329 LIST_ENTRY(sc_term_sw) link; 330 char *te_name; /* name of the emulator */ 331 char *te_desc; /* description */ 332 char *te_renderer; /* matching renderer */ 333 size_t te_size; /* size of internal buffer */ 334 int te_refcount; /* reference counter */ 335 sc_term_init_t *te_init; 336 sc_term_term_t *te_term; 337 sc_term_puts_t *te_puts; 338 sc_term_ioctl_t *te_ioctl; 339 sc_term_reset_t *te_reset; 340 sc_term_default_attr_t *te_default_attr; 341 sc_term_clear_t *te_clear; 342 sc_term_notify_t *te_notify; 343 sc_term_input_t *te_input; 344 } sc_term_sw_t; 345 346 #define SCTERM_MODULE(name, sw) \ 347 DATA_SET(scterm_set, sw); \ 348 static int \ 349 scterm_##name##_event(module_t mod, int type, void *data) \ 350 { \ 351 switch (type) { \ 352 case MOD_LOAD: \ 353 return sc_term_add(&sw); \ 354 case MOD_UNLOAD: \ 355 if (sw.te_refcount > 0) \ 356 return EBUSY; \ 357 return sc_term_remove(&sw); \ 358 default: \ 359 break; \ 360 } \ 361 return 0; \ 362 } \ 363 static moduledata_t scterm_##name##_mod = { \ 364 "scterm-" #name, \ 365 scterm_##name##_event, \ 366 NULL, \ 367 }; \ 368 DECLARE_MODULE(scterm_##name, scterm_##name##_mod, \ 369 SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 370 371 /* renderer function table */ 372 typedef void vr_clear_t(scr_stat *scp, int c, int attr); 373 typedef void vr_draw_border_t(scr_stat *scp, int color); 374 typedef void vr_draw_t(scr_stat *scp, int from, int count, int flip); 375 typedef void vr_set_cursor_t(scr_stat *scp, int base, int height, int blink); 376 typedef void vr_draw_cursor_t(scr_stat *scp, int at, int blink, 377 int on, int flip); 378 typedef void vr_blink_cursor_t(scr_stat *scp, int at, int flip); 379 typedef void vr_set_mouse_t(scr_stat *scp); 380 typedef void vr_draw_mouse_t(scr_stat *scp, int x, int y, int on); 381 382 typedef struct sc_rndr_sw { 383 vr_clear_t *clear; 384 vr_draw_border_t *draw_border; 385 vr_draw_t *draw; 386 vr_set_cursor_t *set_cursor; 387 vr_draw_cursor_t *draw_cursor; 388 vr_blink_cursor_t *blink_cursor; 389 vr_set_mouse_t *set_mouse; 390 vr_draw_mouse_t *draw_mouse; 391 } sc_rndr_sw_t; 392 393 typedef struct sc_renderer { 394 char *name; 395 int mode; 396 sc_rndr_sw_t *rndrsw; 397 LIST_ENTRY(sc_renderer) link; 398 } sc_renderer_t; 399 400 #define RENDERER(name, mode, sw, set) \ 401 static struct sc_renderer scrndr_##name##_##mode## = { \ 402 #name, mode, &sw \ 403 }; \ 404 DATA_SET(scrndr_set, scrndr_##name##_##mode##); \ 405 DATA_SET(set, scrndr_##name##_##mode##) 406 407 #define RENDERER_MODULE(name, set) \ 408 SET_DECLARE(set, sc_renderer_t); \ 409 static int \ 410 scrndr_##name##_event(module_t mod, int type, void *data) \ 411 { \ 412 sc_renderer_t **list; \ 413 int error = 0; \ 414 switch (type) { \ 415 case MOD_LOAD: \ 416 SET_FOREACH(list, set) { \ 417 error = sc_render_add(*list); \ 418 if (error) \ 419 break; \ 420 } \ 421 break; \ 422 case MOD_UNLOAD: \ 423 SET_FOREACH(list, set) { \ 424 error = sc_render_remove(*list);\ 425 if (error) \ 426 break; \ 427 } \ 428 break; \ 429 default: \ 430 break; \ 431 } \ 432 return error; \ 433 } \ 434 static moduledata_t scrndr_##name##_mod = { \ 435 "scrndr-" #name, \ 436 scrndr_##name##_event, \ 437 NULL, \ 438 }; \ 439 DECLARE_MODULE(scrndr_##name##, scrndr_##name##_mod, \ 440 SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 441 442 typedef struct { 443 int cursor_start; 444 int cursor_end; 445 int shift_state; 446 int bell_pitch; 447 } bios_values_t; 448 449 /* other macros */ 450 #define ISTEXTSC(scp) (!((scp)->status \ 451 & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))) 452 #define ISGRAPHSC(scp) (((scp)->status \ 453 & (UNKNOWN_MODE | GRAPHICS_MODE))) 454 #define ISPIXELSC(scp) (((scp)->status \ 455 & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\ 456 == PIXEL_MODE) 457 #define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE) 458 459 #ifndef ISMOUSEAVAIL 460 #ifdef SC_ALT_MOUSE_IMAGE 461 #define ISMOUSEAVAIL(af) (1) 462 #else 463 #define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT) 464 #endif /* SC_ALT_MOUSE_IMAGE */ 465 #define ISFONTAVAIL(af) ((af) & V_ADP_FONT) 466 #define ISPALAVAIL(af) ((af) & V_ADP_PALETTE) 467 #endif /* ISMOUSEAVAIL */ 468 469 #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) 470 471 #define kbd_read_char(kbd, wait) \ 472 (*kbdsw[(kbd)->kb_index]->read_char)((kbd), (wait)) 473 #define kbd_check_char(kbd) \ 474 (*kbdsw[(kbd)->kb_index]->check_char)((kbd)) 475 #define kbd_enable(kbd) \ 476 (*kbdsw[(kbd)->kb_index]->enable)((kbd)) 477 #define kbd_disable(kbd) \ 478 (*kbdsw[(kbd)->kb_index]->disable)((kbd)) 479 #define kbd_lock(kbd, lockf) \ 480 (*kbdsw[(kbd)->kb_index]->lock)((kbd), (lockf)) 481 #define kbd_ioctl(kbd, cmd, arg) \ 482 (((kbd) == NULL) ? \ 483 ENODEV : (*kbdsw[(kbd)->kb_index]->ioctl)((kbd), (cmd), (arg))) 484 #define kbd_clear_state(kbd) \ 485 (*kbdsw[(kbd)->kb_index]->clear_state)((kbd)) 486 #define kbd_get_fkeystr(kbd, fkey, len) \ 487 (*kbdsw[(kbd)->kb_index]->get_fkeystr)((kbd), (fkey), (len)) 488 #define kbd_poll(kbd, on) \ 489 (*kbdsw[(kbd)->kb_index]->poll)((kbd), (on)) 490 491 /* syscons.c */ 492 extern int (*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data, 493 int flag, struct proc *p); 494 495 int sc_probe_unit(int unit, int flags); 496 int sc_attach_unit(int unit, int flags); 497 498 int set_mode(scr_stat *scp); 499 500 void sc_set_border(scr_stat *scp, int color); 501 void sc_load_font(scr_stat *scp, int page, int size, u_char *font, 502 int base, int count); 503 void sc_save_font(scr_stat *scp, int page, int size, u_char *font, 504 int base, int count); 505 void sc_show_font(scr_stat *scp, int page); 506 507 void sc_touch_scrn_saver(void); 508 void sc_puts(scr_stat *scp, u_char *buf, int len); 509 void sc_draw_cursor_image(scr_stat *scp); 510 void sc_remove_cursor_image(scr_stat *scp); 511 void sc_set_cursor_image(scr_stat *scp); 512 int sc_clean_up(scr_stat *scp); 513 int sc_switch_scr(sc_softc_t *sc, u_int next_scr); 514 void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); 515 int sc_init_emulator(scr_stat *scp, char *name); 516 void sc_paste(scr_stat *scp, u_char *p, int count); 517 void sc_bell(scr_stat *scp, int pitch, int duration); 518 519 /* schistory.c */ 520 #ifndef SC_NO_HISTORY 521 int sc_alloc_history_buffer(scr_stat *scp, int lines, 522 int prev_ysize, int wait); 523 void sc_free_history_buffer(scr_stat *scp, int prev_ysize); 524 void sc_hist_save(scr_stat *scp); 525 #define sc_hist_save_one_line(scp, from) \ 526 sc_vtb_append(&(scp)->vtb, (from), (scp)->history, (scp)->xsize) 527 int sc_hist_restore(scr_stat *scp); 528 void sc_hist_home(scr_stat *scp); 529 void sc_hist_end(scr_stat *scp); 530 int sc_hist_up_line(scr_stat *scp); 531 int sc_hist_down_line(scr_stat *scp); 532 int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, 533 int flag, struct proc *p); 534 #endif /* SC_NO_HISTORY */ 535 536 /* scmouse.c */ 537 #ifndef SC_NO_CUTPASTE 538 void sc_alloc_cut_buffer(scr_stat *scp, int wait); 539 void sc_draw_mouse_image(scr_stat *scp); 540 void sc_remove_mouse_image(scr_stat *scp); 541 int sc_inside_cutmark(scr_stat *scp, int pos); 542 void sc_remove_cutmarking(scr_stat *scp); 543 void sc_remove_all_cutmarkings(sc_softc_t *scp); 544 void sc_remove_all_mouse(sc_softc_t *scp); 545 void sc_mouse_paste(scr_stat *scp); 546 #else 547 #define sc_draw_mouse_image(scp) 548 #define sc_remove_mouse_image(scp) 549 #define sc_inside_cutmark(scp, pos) FALSE 550 #define sc_remove_cutmarking(scp) 551 #define sc_remove_all_cutmarkings(scp) 552 #define sc_remove_all_mouse(scp) 553 #define sc_mouse_paste(scp) 554 #endif /* SC_NO_CUTPASTE */ 555 #ifndef SC_NO_SYSMOUSE 556 void sc_mouse_move(scr_stat *scp, int x, int y); 557 int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, 558 int flag, struct proc *p); 559 #endif /* SC_NO_SYSMOUSE */ 560 561 /* scvidctl.c */ 562 int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, 563 int xsize, int ysize, int fontsize); 564 int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); 565 int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, 566 int xsize, int ysize, int fontsize); 567 int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, 568 struct proc *p); 569 570 int sc_render_add(sc_renderer_t *rndr); 571 int sc_render_remove(sc_renderer_t *rndr); 572 sc_rndr_sw_t *sc_render_match(scr_stat *scp, char *name, int mode); 573 574 /* scvtb.c */ 575 void sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, 576 void *buffer, int wait); 577 void sc_vtb_destroy(sc_vtb_t *vtb); 578 size_t sc_vtb_size(int cols, int rows); 579 void sc_vtb_clear(sc_vtb_t *vtb, int c, int attr); 580 581 int sc_vtb_getc(sc_vtb_t *vtb, int at); 582 int sc_vtb_geta(sc_vtb_t *vtb, int at); 583 void sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a); 584 vm_offset_t sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a); 585 vm_offset_t sc_vtb_pointer(sc_vtb_t *vtb, int at); 586 int sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset); 587 588 #define sc_vtb_tail(vtb) ((vtb)->vtb_tail) 589 #define sc_vtb_rows(vtb) ((vtb)->vtb_rows) 590 #define sc_vtb_cols(vtb) ((vtb)->vtb_cols) 591 592 void sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, 593 int count); 594 void sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, 595 int count); 596 void sc_vtb_seek(sc_vtb_t *vtb, int pos); 597 void sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr); 598 void sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count); 599 void sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr); 600 void sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr); 601 602 /* sysmouse.c */ 603 int sysmouse_event(mouse_info_t *info); 604 605 /* scterm.c */ 606 void sc_move_cursor(scr_stat *scp, int x, int y); 607 void sc_clear_screen(scr_stat *scp); 608 int sc_term_add(sc_term_sw_t *sw); 609 int sc_term_remove(sc_term_sw_t *sw); 610 sc_term_sw_t *sc_term_match(char *name); 611 sc_term_sw_t *sc_term_match_by_number(int index); 612 613 /* machine dependent functions */ 614 int sc_max_unit(void); 615 sc_softc_t *sc_get_softc(int unit, int flags); 616 sc_softc_t *sc_find_softc(struct video_adapter *adp, struct keyboard *kbd); 617 int sc_get_cons_priority(int *unit, int *flags); 618 void sc_get_bios_values(bios_values_t *values); 619 int sc_tone(int herz); 620 621 #endif /* !_DEV_SYSCONS_SYSCONS_H_ */ 622