1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1995-1998 S��ren Schmidt 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The DragonFly Project 8 * by Sascha Wildner <saw@online.de> 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer, 15 * without modification, immediately at the beginning of the file. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * 33 * $FreeBSD$ 34 */ 35 36#ifndef _DEV_SYSCONS_SYSCONS_H_ 37#define _DEV_SYSCONS_SYSCONS_H_ 38 39#include <sys/kdb.h> /* XXX */ 40#include <sys/_lock.h> 41#include <sys/_mutex.h> 42 43/* default values for configuration options */ 44 45#ifndef MAXCONS 46#define MAXCONS 16 47#endif 48 49#ifdef SC_NO_SYSMOUSE 50#undef SC_NO_CUTPASTE 51#define SC_NO_CUTPASTE 1 52#endif 53 54#ifdef SC_NO_MODE_CHANGE 55#undef SC_PIXEL_MODE 56#endif 57 58/* Always load font data if the pixel (raster text) mode is to be used. */ 59#ifdef SC_PIXEL_MODE 60#undef SC_NO_FONT_LOADING 61#endif 62 63/* 64 * If font data is not available, the `arrow'-shaped mouse cursor cannot 65 * be drawn. Use the alternative drawing method. 66 */ 67#ifdef SC_NO_FONT_LOADING 68#undef SC_ALT_MOUSE_IMAGE 69#define SC_ALT_MOUSE_IMAGE 1 70#endif 71 72#ifndef SC_CURSOR_CHAR 73#define SC_CURSOR_CHAR 7 74#endif 75 76#ifndef SC_MOUSE_CHAR 77#define SC_MOUSE_CHAR 8 78#endif 79 80#if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4) 81#undef SC_CURSOR_CHAR 82#define SC_CURSOR_CHAR (SC_MOUSE_CHAR + 4) 83#endif 84 85#ifndef SC_DEBUG_LEVEL 86#define SC_DEBUG_LEVEL 0 87#endif 88 89#define DPRINTF(l, p) if (SC_DEBUG_LEVEL >= (l)) printf p 90 91#define SC_DRIVER_NAME "sc" 92#define SC_VTY(dev) (((sc_ttysoftc *)tty_softc(tp))->st_index) 93#define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) 94#define SC_STAT(tp) (*((scr_stat **)&((sc_ttysoftc *)tty_softc(tp))->st_stat)) 95 96/* printable chars */ 97#ifndef PRINTABLE 98#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 99 || (ch) < 0x07) 100#endif 101 102/* macros for "intelligent" screen update */ 103#define mark_for_update(scp, x) {\ 104 if ((x) < scp->start) scp->start = (x);\ 105 else if ((x) > scp->end) scp->end = (x);\ 106 } 107#define mark_all(scp) {\ 108 scp->start = 0;\ 109 scp->end = scp->xsize * scp->ysize - 1;\ 110 } 111 112/* vty status flags (scp->status) */ 113#define UNKNOWN_MODE 0x00010 /* unknown video mode */ 114#define SWITCH_WAIT_REL 0x00080 /* waiting for vty release */ 115#define SWITCH_WAIT_ACQ 0x00100 /* waiting for vty ack */ 116#define BUFFER_SAVED 0x00200 /* vty buffer is saved */ 117#define CURSOR_ENABLED 0x00400 /* text cursor is enabled */ 118#define MOUSE_MOVED 0x01000 /* mouse cursor has moved */ 119#define MOUSE_CUTTING 0x02000 /* mouse cursor is cutting text */ 120#define MOUSE_VISIBLE 0x04000 /* mouse cursor is showing */ 121#define GRAPHICS_MODE 0x08000 /* vty is in a graphics mode */ 122#define PIXEL_MODE 0x10000 /* vty is in a raster text mode */ 123#define SAVER_RUNNING 0x20000 /* screen saver is running */ 124#define VR_CURSOR_BLINK 0x40000 /* blinking text cursor */ 125#define VR_CURSOR_ON 0x80000 /* text cursor is on */ 126#define MOUSE_HIDDEN 0x100000 /* mouse cursor is temporarily hidden */ 127 128/* misc defines */ 129#define FALSE 0 130#define TRUE 1 131 132/* 133 The following #defines are hard-coded for a maximum text 134 resolution corresponding to a maximum framebuffer 135 resolution of 1920x1200 with an 8x8 font... 136*/ 137#define COL 240 138#define ROW 150 139 140#define PCBURST 128 141 142#ifndef BELL_DURATION 143#define BELL_DURATION ((5 * hz + 99) / 100) 144#define BELL_PITCH 800 145#endif 146 147/* virtual terminal buffer */ 148typedef struct sc_vtb { 149 int vtb_flags; 150#define VTB_VALID (1 << 0) 151#define VTB_ALLOCED (1 << 1) 152 int vtb_type; 153#define VTB_INVALID 0 154#define VTB_MEMORY 1 155#define VTB_FRAMEBUFFER 2 156#define VTB_RINGBUFFER 3 157 int vtb_cols; 158 int vtb_rows; 159 int vtb_size; 160 vm_offset_t vtb_buffer; 161 int vtb_tail; /* valid for VTB_RINGBUFFER only */ 162} sc_vtb_t; 163 164/* text and some mouse cursor attributes */ 165struct cursor_attr { 166 u_char flags; 167 u_char base; 168 u_char height; 169 u_char bg[3]; 170 u_char mouse_ba; 171 u_char mouse_ia; 172}; 173 174/* softc */ 175 176struct keyboard; 177struct video_adapter; 178struct scr_stat; 179struct tty; 180 181struct sc_cnstate { 182 u_char kbd_locked; 183 u_char kdb_locked; 184 u_char mtx_locked; 185 u_char kbd_opened; 186 u_char scr_opened; 187}; 188 189typedef struct sc_softc { 190 int unit; /* unit # */ 191 int config; /* configuration flags */ 192#define SC_VESAMODE (1 << 7) 193#define SC_AUTODETECT_KBD (1 << 8) 194#define SC_KERNEL_CONSOLE (1 << 9) 195 196 int flags; /* status flags */ 197#define SC_VISUAL_BELL (1 << 0) 198#define SC_QUIET_BELL (1 << 1) 199#if 0 /* not used anymore */ 200#define SC_BLINK_CURSOR (1 << 2) 201#define SC_CHAR_CURSOR (1 << 3) 202#endif 203#define SC_MOUSE_ENABLED (1 << 4) 204#define SC_SCRN_IDLE (1 << 5) 205#define SC_SCRN_BLANKED (1 << 6) 206#define SC_SAVER_FAILED (1 << 7) 207#define SC_SCRN_VTYLOCK (1 << 8) 208 209#define SC_INIT_DONE (1 << 16) 210#define SC_SPLASH_SCRN (1 << 17) 211 212 struct keyboard *kbd; /* NULL if unavailable. */ 213 214 int adapter; 215 struct video_adapter *adp; 216 int initial_mode; /* initial video mode */ 217 218 int first_vty; 219 int vtys; 220 struct tty **dev; 221 struct scr_stat *cur_scp; 222 struct scr_stat *new_scp; 223 struct scr_stat *old_scp; 224 int delayed_next_scr; 225 226 char font_loading_in_progress; 227 char switch_in_progress; 228 char write_in_progress; 229 char blink_in_progress; 230 int grab_level; 231 /* 2 is just enough for kdb to grab for stepping normal grabbing: */ 232 struct sc_cnstate grab_state[2]; 233 int kbd_open_level; 234 struct mtx video_mtx; 235 236 long scrn_time_stamp; 237 238 struct cursor_attr dflt_curs_attr; 239 struct cursor_attr curs_attr; 240 241 u_char scr_map[256]; 242 u_char scr_rmap[256]; 243 244#ifdef _SC_MD_SOFTC_DECLARED_ 245 sc_md_softc_t md; /* machine dependent vars */ 246#endif 247 248#ifndef SC_NO_PALETTE_LOADING 249 u_char palette[256 * 3]; 250#ifdef SC_PIXEL_MODE 251 u_char palette2[256 * 3]; 252#endif 253#endif 254 255#ifndef SC_NO_FONT_LOADING 256 int fonts_loaded; 257#define FONT_8 2 258#define FONT_14 4 259#define FONT_16 8 260#define FONT_22 8 261 u_char *font_8; 262 u_char *font_14; 263 u_char *font_16; 264 u_char *font_22; 265#endif 266 267 u_char cursor_char; 268 u_char mouse_char; 269 270#ifdef KDB 271 int sc_altbrk; 272#endif 273 struct callout ctimeout; 274 struct callout cblink; 275} sc_softc_t; 276 277/* virtual screen */ 278typedef struct scr_stat { 279 int index; /* index of this vty */ 280 struct sc_softc *sc; /* pointer to softc */ 281 struct sc_rndr_sw *rndr; /* renderer */ 282 sc_vtb_t scr; 283 sc_vtb_t vtb; 284 285 int xpos; /* current X position */ 286 int ypos; /* current Y position */ 287 int xsize; /* X text size */ 288 int ysize; /* Y text size */ 289 int xpixel; /* X graphics size */ 290 int ypixel; /* Y graphics size */ 291 int xoff; /* X offset in pixel mode */ 292 int yoff; /* Y offset in pixel mode */ 293 294 u_char *font; /* current font */ 295 int font_size; /* fontsize in Y direction */ 296 int font_width; /* fontsize in X direction */ 297 298 int start; /* modified area start */ 299 int end; /* modified area end */ 300 301 struct sc_term_sw *tsw; 302 void *ts; 303 304 int status; /* status (bitfield) */ 305 int kbd_mode; /* keyboard I/O mode */ 306 307 int cursor_pos; /* cursor buffer position */ 308 int cursor_oldpos; /* cursor old buffer position */ 309 struct cursor_attr dflt_curs_attr; 310 struct cursor_attr base_curs_attr; 311 struct cursor_attr curs_attr; 312 313 int mouse_pos; /* mouse buffer position */ 314 int mouse_oldpos; /* mouse old buffer position */ 315 short mouse_xpos; /* mouse x coordinate */ 316 short mouse_ypos; /* mouse y coordinate */ 317 short mouse_oldxpos; /* mouse previous x coordinate */ 318 short mouse_oldypos; /* mouse previous y coordinate */ 319 short mouse_buttons; /* mouse buttons */ 320 int mouse_cut_start; /* mouse cut start pos */ 321 int mouse_cut_end; /* mouse cut end pos */ 322 int mouse_level; /* xterm mouse protocol */ 323 struct proc *mouse_proc; /* proc* of controlling proc */ 324 pid_t mouse_pid; /* pid of controlling proc */ 325 int mouse_signal; /* signal # to report with */ 326 const void *mouse_data; /* renderer (pixmap) data */ 327 328 u_short bell_duration; 329 u_short bell_pitch; 330 331 u_char border; /* border color */ 332 int mode; /* mode */ 333 pid_t pid; /* pid of controlling proc */ 334 struct proc *proc; /* proc* of controlling proc */ 335 struct vt_mode smode; /* switch mode */ 336 337 sc_vtb_t *history; /* circular history buffer */ 338 int history_pos; /* position shown on screen */ 339 int history_size; /* size of history buffer */ 340 341 int splash_save_mode; /* saved mode for splash screen */ 342 int splash_save_status; /* saved status for splash screen */ 343#ifdef _SCR_MD_STAT_DECLARED_ 344 scr_md_stat_t md; /* machine dependent vars */ 345#endif 346} scr_stat; 347 348/* TTY softc. */ 349typedef struct sc_ttysoftc { 350 int st_index; 351 scr_stat *st_stat; 352} sc_ttysoftc; 353 354#ifndef SC_NORM_ATTR 355#define SC_NORM_ATTR (FG_LIGHTGREY | BG_BLACK) 356#endif 357#ifndef SC_NORM_REV_ATTR 358#define SC_NORM_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 359#endif 360#ifndef SC_KERNEL_CONS_ATTR 361#define SC_KERNEL_CONS_ATTR (FG_WHITE | BG_BLACK) 362#endif 363#ifndef SC_KERNEL_CONS_REV_ATTR 364#define SC_KERNEL_CONS_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 365#endif 366 367/* terminal emulator */ 368 369#ifndef SC_DFLT_TERM 370#define SC_DFLT_TERM "scteken" 371#endif 372 373typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); 374#define SC_TE_COLD_INIT 0 375#define SC_TE_WARM_INIT 1 376typedef int sc_term_term_t(scr_stat *scp, void **tcp); 377typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); 378typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, 379 caddr_t data, struct thread *td); 380typedef int sc_term_reset_t(scr_stat *scp, int code); 381#define SC_TE_HARD_RESET 0 382#define SC_TE_SOFT_RESET 1 383typedef void sc_term_default_attr_t(scr_stat *scp, int norm, int rev); 384typedef void sc_term_clear_t(scr_stat *scp); 385typedef void sc_term_notify_t(scr_stat *scp, int event); 386#define SC_TE_NOTIFY_VTSWITCH_IN 0 387#define SC_TE_NOTIFY_VTSWITCH_OUT 1 388typedef int sc_term_input_t(scr_stat *scp, int c, struct tty *tp); 389typedef const char *sc_term_fkeystr_t(scr_stat *scp, int c); 390typedef void sc_term_sync_t(scr_stat *scp); 391 392typedef struct sc_term_sw { 393 LIST_ENTRY(sc_term_sw) link; 394 char *te_name; /* name of the emulator */ 395 char *te_desc; /* description */ 396 char *te_renderer; /* matching renderer */ 397 size_t te_size; /* size of internal buffer */ 398 int te_refcount; /* reference counter */ 399 sc_term_init_t *te_init; 400 sc_term_term_t *te_term; 401 sc_term_puts_t *te_puts; 402 sc_term_ioctl_t *te_ioctl; 403 sc_term_reset_t *te_reset; 404 sc_term_default_attr_t *te_default_attr; 405 sc_term_clear_t *te_clear; 406 sc_term_notify_t *te_notify; 407 sc_term_input_t *te_input; 408 sc_term_fkeystr_t *te_fkeystr; 409 sc_term_sync_t *te_sync; 410} sc_term_sw_t; 411 412#define SCTERM_MODULE(name, sw) \ 413 DATA_SET(scterm_set, sw); \ 414 static int \ 415 scterm_##name##_event(module_t mod, int type, void *data) \ 416 { \ 417 switch (type) { \ 418 case MOD_LOAD: \ 419 return sc_term_add(&sw); \ 420 case MOD_UNLOAD: \ 421 if (sw.te_refcount > 0) \ 422 return EBUSY; \ 423 return sc_term_remove(&sw); \ 424 default: \ 425 return EOPNOTSUPP; \ 426 break; \ 427 } \ 428 return 0; \ 429 } \ 430 static moduledata_t scterm_##name##_mod = { \ 431 "scterm-" #name, \ 432 scterm_##name##_event, \ 433 NULL, \ 434 }; \ 435 DECLARE_MODULE(scterm_##name, scterm_##name##_mod, \ 436 SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 437 438/* renderer function table */ 439typedef void vr_init_t(scr_stat *scp); 440typedef void vr_clear_t(scr_stat *scp, int c, int attr); 441typedef void vr_draw_border_t(scr_stat *scp, int color); 442typedef void vr_draw_t(scr_stat *scp, int from, int count, int flip); 443typedef void vr_set_cursor_t(scr_stat *scp, int base, int height, int blink); 444typedef void vr_draw_cursor_t(scr_stat *scp, int at, int blink, 445 int on, int flip); 446typedef void vr_blink_cursor_t(scr_stat *scp, int at, int flip); 447typedef void vr_set_mouse_t(scr_stat *scp); 448typedef void vr_draw_mouse_t(scr_stat *scp, int x, int y, int on); 449 450typedef struct sc_rndr_sw { 451 vr_init_t *init; 452 vr_clear_t *clear; 453 vr_draw_border_t *draw_border; 454 vr_draw_t *draw; 455 vr_set_cursor_t *set_cursor; 456 vr_draw_cursor_t *draw_cursor; 457 vr_blink_cursor_t *blink_cursor; 458 vr_set_mouse_t *set_mouse; 459 vr_draw_mouse_t *draw_mouse; 460} sc_rndr_sw_t; 461 462typedef struct sc_renderer { 463 char *name; 464 int mode; 465 sc_rndr_sw_t *rndrsw; 466 LIST_ENTRY(sc_renderer) link; 467} sc_renderer_t; 468 469#define RENDERER(name, mode, sw, set) \ 470 static struct sc_renderer scrndr_##name##_##mode = { \ 471 #name, mode, &sw \ 472 }; \ 473 DATA_SET(scrndr_set, scrndr_##name##_##mode); \ 474 DATA_SET(set, scrndr_##name##_##mode) 475 476#define RENDERER_MODULE(name, set) \ 477 SET_DECLARE(set, sc_renderer_t); \ 478 static int \ 479 scrndr_##name##_event(module_t mod, int type, void *data) \ 480 { \ 481 sc_renderer_t **list; \ 482 int error = 0; \ 483 switch (type) { \ 484 case MOD_LOAD: \ 485 SET_FOREACH(list, set) { \ 486 error = sc_render_add(*list); \ 487 if (error) \ 488 break; \ 489 } \ 490 break; \ 491 case MOD_UNLOAD: \ 492 SET_FOREACH(list, set) { \ 493 error = sc_render_remove(*list);\ 494 if (error) \ 495 break; \ 496 } \ 497 break; \ 498 default: \ 499 return EOPNOTSUPP; \ 500 break; \ 501 } \ 502 return error; \ 503 } \ 504 static moduledata_t scrndr_##name##_mod = { \ 505 "scrndr-" #name, \ 506 scrndr_##name##_event, \ 507 NULL, \ 508 }; \ 509 DECLARE_MODULE(scrndr_##name, scrndr_##name##_mod, \ 510 SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 511 512typedef struct { 513 int shift_state; 514 int bell_pitch; 515} bios_values_t; 516 517/* other macros */ 518#define ISTEXTSC(scp) (!((scp)->status \ 519 & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))) 520#define ISGRAPHSC(scp) (((scp)->status \ 521 & (UNKNOWN_MODE | GRAPHICS_MODE))) 522#define ISPIXELSC(scp) (((scp)->status \ 523 & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\ 524 == PIXEL_MODE) 525#define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE) 526 527#define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT) 528#define ISFONTAVAIL(af) ((af) & V_ADP_FONT) 529#define ISPALAVAIL(af) ((af) & V_ADP_PALETTE) 530 531#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) 532 533#define SC_VIDEO_LOCKINIT(sc) \ 534 mtx_init(&(sc)->video_mtx, "syscons video lock", NULL, \ 535 MTX_SPIN | MTX_RECURSE); 536#define SC_VIDEO_LOCK(sc) \ 537 do { \ 538 if (!kdb_active) \ 539 mtx_lock_spin(&(sc)->video_mtx); \ 540 } while(0) 541#define SC_VIDEO_UNLOCK(sc) \ 542 do { \ 543 if (!kdb_active) \ 544 mtx_unlock_spin(&(sc)->video_mtx); \ 545 } while(0) 546 547/* syscons.c */ 548extern int (*sc_user_ioctl)(struct tty *tp, u_long cmd, caddr_t data, 549 struct thread *td); 550 551int sc_probe_unit(int unit, int flags); 552int sc_attach_unit(int unit, int flags); 553 554int set_mode(scr_stat *scp); 555 556void sc_set_border(scr_stat *scp, int color); 557void sc_load_font(scr_stat *scp, int page, int size, int width, 558 u_char *font, int base, int count); 559void sc_save_font(scr_stat *scp, int page, int size, int width, 560 u_char *font, int base, int count); 561void sc_show_font(scr_stat *scp, int page); 562 563void sc_touch_scrn_saver(void); 564void sc_draw_cursor_image(scr_stat *scp); 565void sc_remove_cursor_image(scr_stat *scp); 566void sc_set_cursor_image(scr_stat *scp); 567void sc_change_cursor_shape(scr_stat *scp, int flags, 568 int base, int height); 569int sc_clean_up(scr_stat *scp); 570int sc_switch_scr(sc_softc_t *sc, u_int next_scr); 571void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); 572int sc_init_emulator(scr_stat *scp, char *name); 573void sc_paste(scr_stat *scp, const u_char *p, int count); 574void sc_respond(scr_stat *scp, const u_char *p, 575 int count, int wakeup); 576void sc_bell(scr_stat *scp, int pitch, int duration); 577 578/* schistory.c */ 579#ifndef SC_NO_HISTORY 580int sc_alloc_history_buffer(scr_stat *scp, int lines, 581 int prev_ysize, int wait); 582void sc_free_history_buffer(scr_stat *scp, int prev_ysize); 583void sc_hist_save(scr_stat *scp); 584#define sc_hist_save_one_line(scp, from) \ 585 sc_vtb_append(&(scp)->vtb, (from), (scp)->history, (scp)->xsize) 586int sc_hist_restore(scr_stat *scp); 587void sc_hist_home(scr_stat *scp); 588void sc_hist_end(scr_stat *scp); 589int sc_hist_up_line(scr_stat *scp); 590int sc_hist_down_line(scr_stat *scp); 591int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, 592 struct thread *td); 593#endif /* SC_NO_HISTORY */ 594 595/* scmouse.c */ 596#ifndef SC_NO_CUTPASTE 597void sc_alloc_cut_buffer(scr_stat *scp, int wait); 598void sc_draw_mouse_image(scr_stat *scp); 599void sc_remove_mouse_image(scr_stat *scp); 600int sc_inside_cutmark(scr_stat *scp, int pos); 601void sc_remove_cutmarking(scr_stat *scp); 602void sc_remove_all_cutmarkings(sc_softc_t *scp); 603void sc_remove_all_mouse(sc_softc_t *scp); 604void sc_mouse_paste(scr_stat *scp); 605#else 606#define sc_draw_mouse_image(scp) 607#define sc_remove_mouse_image(scp) 608#define sc_inside_cutmark(scp, pos) FALSE 609#define sc_remove_cutmarking(scp) 610#define sc_remove_all_cutmarkings(scp) 611#define sc_remove_all_mouse(scp) 612#define sc_mouse_paste(scp) 613#endif /* SC_NO_CUTPASTE */ 614#ifndef SC_NO_SYSMOUSE 615void sc_mouse_move(scr_stat *scp, int x, int y); 616int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, 617 struct thread *td); 618#endif /* SC_NO_SYSMOUSE */ 619 620/* scvidctl.c */ 621int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, 622 int xsize, int ysize, int fontsize, 623 int font_width); 624int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); 625int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, 626 int ysize, int fontsize, int font_width); 627int sc_support_pixel_mode(void *arg); 628int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, 629 struct thread *td); 630 631int sc_render_add(sc_renderer_t *rndr); 632int sc_render_remove(sc_renderer_t *rndr); 633sc_rndr_sw_t *sc_render_match(scr_stat *scp, char *name, int mode); 634 635/* scvtb.c */ 636void sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, 637 void *buffer, int wait); 638void sc_vtb_destroy(sc_vtb_t *vtb); 639size_t sc_vtb_size(int cols, int rows); 640void sc_vtb_clear(sc_vtb_t *vtb, int c, int attr); 641 642int sc_vtb_getc(sc_vtb_t *vtb, int at); 643int sc_vtb_geta(sc_vtb_t *vtb, int at); 644void sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a); 645vm_offset_t sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a); 646vm_offset_t sc_vtb_pointer(sc_vtb_t *vtb, int at); 647int sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset); 648 649#define sc_vtb_tail(vtb) ((vtb)->vtb_tail) 650#define sc_vtb_rows(vtb) ((vtb)->vtb_rows) 651#define sc_vtb_cols(vtb) ((vtb)->vtb_cols) 652 653void sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, 654 int count); 655void sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, 656 int count); 657void sc_vtb_seek(sc_vtb_t *vtb, int pos); 658void sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr); 659void sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count); 660void sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr); 661void sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr); 662 663/* sysmouse.c */ 664int sysmouse_event(mouse_info_t *info); 665 666/* scterm.c */ 667void sc_move_cursor(scr_stat *scp, int x, int y); 668void sc_clear_screen(scr_stat *scp); 669int sc_term_add(sc_term_sw_t *sw); 670int sc_term_remove(sc_term_sw_t *sw); 671sc_term_sw_t *sc_term_match(char *name); 672sc_term_sw_t *sc_term_match_by_number(int index); 673 674/* machine dependent functions */ 675int sc_max_unit(void); 676sc_softc_t *sc_get_softc(int unit, int flags); 677sc_softc_t *sc_find_softc(struct video_adapter *adp, struct keyboard *kbd); 678int sc_get_cons_priority(int *unit, int *flags); 679void sc_get_bios_values(bios_values_t *values); 680int sc_tone(int herz); 681 682#endif /* !_DEV_SYSCONS_SYSCONS_H_ */ 683