117ee9d00SSøren Schmidt /*- 2718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3718cf2ccSPedro F. Giffuni * 49a14aa01SUlrich Spörlein * Copyright (c) 1995-1998 Søren Schmidt 517ee9d00SSøren Schmidt * All rights reserved. 617ee9d00SSøren Schmidt * 7f1121206SXin LI * This code is derived from software contributed to The DragonFly Project 8f1121206SXin LI * by Sascha Wildner <[email protected]> 9f1121206SXin LI * 1017ee9d00SSøren Schmidt * Redistribution and use in source and binary forms, with or without 1117ee9d00SSøren Schmidt * modification, are permitted provided that the following conditions 1217ee9d00SSøren Schmidt * are met: 1317ee9d00SSøren Schmidt * 1. Redistributions of source code must retain the above copyright 14a8445737SSøren Schmidt * notice, this list of conditions and the following disclaimer, 15a8445737SSøren Schmidt * without modification, immediately at the beginning of the file. 1617ee9d00SSøren Schmidt * 2. Redistributions in binary form must reproduce the above copyright 1717ee9d00SSøren Schmidt * notice, this list of conditions and the following disclaimer in the 1817ee9d00SSøren Schmidt * documentation and/or other materials provided with the distribution. 1917ee9d00SSøren Schmidt * 3. The name of the author may not be used to endorse or promote products 20a8445737SSøren Schmidt * derived from this software without specific prior written permission. 2117ee9d00SSøren Schmidt * 2217ee9d00SSøren Schmidt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2317ee9d00SSøren Schmidt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2417ee9d00SSøren Schmidt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2517ee9d00SSøren Schmidt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2617ee9d00SSøren Schmidt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2717ee9d00SSøren Schmidt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2817ee9d00SSøren Schmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2917ee9d00SSøren Schmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3017ee9d00SSøren Schmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3117ee9d00SSøren Schmidt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3217ee9d00SSøren Schmidt * 33c3aac50fSPeter Wemm * $FreeBSD$ 3417ee9d00SSøren Schmidt */ 3517ee9d00SSøren Schmidt 362ad872c5SKazutaka YOKOTA #ifndef _DEV_SYSCONS_SYSCONS_H_ 372ad872c5SKazutaka YOKOTA #define _DEV_SYSCONS_SYSCONS_H_ 3877f77631SPaul Traina 39d350ce61SBruce Evans #include <sys/kdb.h> /* XXX */ 40d350ce61SBruce Evans #include <sys/_lock.h> 41d350ce61SBruce Evans #include <sys/_mutex.h> 42988129b8SScott Long 436e8394b8SKazutaka YOKOTA /* default values for configuration options */ 446e8394b8SKazutaka YOKOTA 456e8394b8SKazutaka YOKOTA #ifndef MAXCONS 466e8394b8SKazutaka YOKOTA #define MAXCONS 16 476e8394b8SKazutaka YOKOTA #endif 486e8394b8SKazutaka YOKOTA 496e8394b8SKazutaka YOKOTA #ifdef SC_NO_SYSMOUSE 506e8394b8SKazutaka YOKOTA #undef SC_NO_CUTPASTE 516e8394b8SKazutaka YOKOTA #define SC_NO_CUTPASTE 1 526e8394b8SKazutaka YOKOTA #endif 536e8394b8SKazutaka YOKOTA 546e8394b8SKazutaka YOKOTA #ifdef SC_NO_MODE_CHANGE 556e8394b8SKazutaka YOKOTA #undef SC_PIXEL_MODE 566e8394b8SKazutaka YOKOTA #endif 576e8394b8SKazutaka YOKOTA 5844b37d96SKazutaka YOKOTA /* Always load font data if the pixel (raster text) mode is to be used. */ 5944b37d96SKazutaka YOKOTA #ifdef SC_PIXEL_MODE 6044b37d96SKazutaka YOKOTA #undef SC_NO_FONT_LOADING 6144b37d96SKazutaka YOKOTA #endif 6244b37d96SKazutaka YOKOTA 6344b37d96SKazutaka YOKOTA /* 6444b37d96SKazutaka YOKOTA * If font data is not available, the `arrow'-shaped mouse cursor cannot 6544b37d96SKazutaka YOKOTA * be drawn. Use the alternative drawing method. 6644b37d96SKazutaka YOKOTA */ 6744b37d96SKazutaka YOKOTA #ifdef SC_NO_FONT_LOADING 6844b37d96SKazutaka YOKOTA #undef SC_ALT_MOUSE_IMAGE 6944b37d96SKazutaka YOKOTA #define SC_ALT_MOUSE_IMAGE 1 7044b37d96SKazutaka YOKOTA #endif 7144b37d96SKazutaka YOKOTA 7209132359SKazutaka YOKOTA #ifndef SC_CURSOR_CHAR 7355d26fc0SBruce Evans #define SC_CURSOR_CHAR 7 7409132359SKazutaka YOKOTA #endif 7509132359SKazutaka YOKOTA 76e2f29c6eSKazutaka YOKOTA #ifndef SC_MOUSE_CHAR 7755d26fc0SBruce Evans #define SC_MOUSE_CHAR 8 78e2f29c6eSKazutaka YOKOTA #endif 79e2f29c6eSKazutaka YOKOTA 8009132359SKazutaka YOKOTA #if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4) 8109132359SKazutaka YOKOTA #undef SC_CURSOR_CHAR 8209132359SKazutaka YOKOTA #define SC_CURSOR_CHAR (SC_MOUSE_CHAR + 4) 8309132359SKazutaka YOKOTA #endif 8409132359SKazutaka YOKOTA 856e8394b8SKazutaka YOKOTA #ifndef SC_DEBUG_LEVEL 866e8394b8SKazutaka YOKOTA #define SC_DEBUG_LEVEL 0 876e8394b8SKazutaka YOKOTA #endif 886e8394b8SKazutaka YOKOTA 896e8394b8SKazutaka YOKOTA #define DPRINTF(l, p) if (SC_DEBUG_LEVEL >= (l)) printf p 906e8394b8SKazutaka YOKOTA 916e8394b8SKazutaka YOKOTA #define SC_DRIVER_NAME "sc" 92bc093719SEd Schouten #define SC_VTY(dev) (((sc_ttysoftc *)tty_softc(tp))->st_index) 938c12242cSKazutaka YOKOTA #define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) 94bc093719SEd Schouten #define SC_STAT(tp) (*((scr_stat **)&((sc_ttysoftc *)tty_softc(tp))->st_stat)) 9517ee9d00SSøren Schmidt 9617ee9d00SSøren Schmidt /* printable chars */ 976e8394b8SKazutaka YOKOTA #ifndef PRINTABLE 9838994061SBruce Evans #define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 9938994061SBruce Evans || (ch) < 0x07) 1006e8394b8SKazutaka YOKOTA #endif 10117ee9d00SSøren Schmidt 1028c4344beSSøren Schmidt /* macros for "intelligent" screen update */ 1038c4344beSSøren Schmidt #define mark_for_update(scp, x) {\ 1048c4344beSSøren Schmidt if ((x) < scp->start) scp->start = (x);\ 1058c4344beSSøren Schmidt else if ((x) > scp->end) scp->end = (x);\ 1068c4344beSSøren Schmidt } 1078c4344beSSøren Schmidt #define mark_all(scp) {\ 1088c4344beSSøren Schmidt scp->start = 0;\ 1098a69c85aSPoul-Henning Kamp scp->end = scp->xsize * scp->ysize - 1;\ 1108c4344beSSøren Schmidt } 1118c4344beSSøren Schmidt 1126e8394b8SKazutaka YOKOTA /* vty status flags (scp->status) */ 11309132359SKazutaka YOKOTA #define UNKNOWN_MODE 0x00010 /* unknown video mode */ 11409132359SKazutaka YOKOTA #define SWITCH_WAIT_REL 0x00080 /* waiting for vty release */ 11509132359SKazutaka YOKOTA #define SWITCH_WAIT_ACQ 0x00100 /* waiting for vty ack */ 11609132359SKazutaka YOKOTA #define BUFFER_SAVED 0x00200 /* vty buffer is saved */ 11709132359SKazutaka YOKOTA #define CURSOR_ENABLED 0x00400 /* text cursor is enabled */ 11809132359SKazutaka YOKOTA #define MOUSE_MOVED 0x01000 /* mouse cursor has moved */ 11909132359SKazutaka YOKOTA #define MOUSE_CUTTING 0x02000 /* mouse cursor is cutting text */ 12009132359SKazutaka YOKOTA #define MOUSE_VISIBLE 0x04000 /* mouse cursor is showing */ 12109132359SKazutaka YOKOTA #define GRAPHICS_MODE 0x08000 /* vty is in a graphics mode */ 12209132359SKazutaka YOKOTA #define PIXEL_MODE 0x10000 /* vty is in a raster text mode */ 12309132359SKazutaka YOKOTA #define SAVER_RUNNING 0x20000 /* screen saver is running */ 12409132359SKazutaka YOKOTA #define VR_CURSOR_BLINK 0x40000 /* blinking text cursor */ 12509132359SKazutaka YOKOTA #define VR_CURSOR_ON 0x80000 /* text cursor is on */ 12609132359SKazutaka YOKOTA #define MOUSE_HIDDEN 0x100000 /* mouse cursor is temporarily hidden */ 12717ee9d00SSøren Schmidt 12817ee9d00SSøren Schmidt /* misc defines */ 12917ee9d00SSøren Schmidt #define FALSE 0 13017ee9d00SSøren Schmidt #define TRUE 1 1310301e9c8SDavid E. O'Brien 1320301e9c8SDavid E. O'Brien /* 1330301e9c8SDavid E. O'Brien The following #defines are hard-coded for a maximum text 1340301e9c8SDavid E. O'Brien resolution corresponding to a maximum framebuffer 13550b9fb46SJulio Merino resolution of 1920x1200 with an 8x8 font... 1360301e9c8SDavid E. O'Brien */ 137478b2704SJulio Merino #define COL 240 1380301e9c8SDavid E. O'Brien #define ROW 150 1390301e9c8SDavid E. O'Brien 14017ee9d00SSøren Schmidt #define PCBURST 128 14117ee9d00SSøren Schmidt 1426e8394b8SKazutaka YOKOTA #ifndef BELL_DURATION 143266aa942SPoul-Henning Kamp #define BELL_DURATION ((5 * hz + 99) / 100) 1446e8394b8SKazutaka YOKOTA #define BELL_PITCH 800 1456e8394b8SKazutaka YOKOTA #endif 1466e8394b8SKazutaka YOKOTA 1476e8394b8SKazutaka YOKOTA /* virtual terminal buffer */ 1486e8394b8SKazutaka YOKOTA typedef struct sc_vtb { 1496e8394b8SKazutaka YOKOTA int vtb_flags; 1506e8394b8SKazutaka YOKOTA #define VTB_VALID (1 << 0) 1512317b701SKazutaka YOKOTA #define VTB_ALLOCED (1 << 1) 1526e8394b8SKazutaka YOKOTA int vtb_type; 1536e8394b8SKazutaka YOKOTA #define VTB_INVALID 0 1546e8394b8SKazutaka YOKOTA #define VTB_MEMORY 1 1556e8394b8SKazutaka YOKOTA #define VTB_FRAMEBUFFER 2 1566e8394b8SKazutaka YOKOTA #define VTB_RINGBUFFER 3 1576e8394b8SKazutaka YOKOTA int vtb_cols; 1586e8394b8SKazutaka YOKOTA int vtb_rows; 1596e8394b8SKazutaka YOKOTA int vtb_size; 1606e8394b8SKazutaka YOKOTA vm_offset_t vtb_buffer; 1616e8394b8SKazutaka YOKOTA int vtb_tail; /* valid for VTB_RINGBUFFER only */ 1626e8394b8SKazutaka YOKOTA } sc_vtb_t; 1636e8394b8SKazutaka YOKOTA 1649bc7c363SBruce Evans /* text and some mouse cursor attributes */ 1654866e276SKazutaka YOKOTA struct cursor_attr { 1669bc7c363SBruce Evans u_char flags; 1679bc7c363SBruce Evans u_char base; 1689bc7c363SBruce Evans u_char height; 1699bc7c363SBruce Evans u_char bg[3]; 1709bc7c363SBruce Evans u_char mouse_ba; 1719bc7c363SBruce Evans u_char mouse_ia; 1724866e276SKazutaka YOKOTA }; 1734866e276SKazutaka YOKOTA 1746e8394b8SKazutaka YOKOTA /* softc */ 1756e8394b8SKazutaka YOKOTA 1766e8394b8SKazutaka YOKOTA struct keyboard; 1776e8394b8SKazutaka YOKOTA struct video_adapter; 1786e8394b8SKazutaka YOKOTA struct scr_stat; 1796e8394b8SKazutaka YOKOTA struct tty; 1806e8394b8SKazutaka YOKOTA 181e866ca56SBruce Evans struct sc_cnstate { 182a95582c6SBruce Evans u_char kbd_locked; 18390adad10SBruce Evans u_char kdb_locked; 18490adad10SBruce Evans u_char mtx_locked; 185e866ca56SBruce Evans u_char kbd_opened; 186e866ca56SBruce Evans u_char scr_opened; 187e866ca56SBruce Evans }; 188e866ca56SBruce Evans 1896e8394b8SKazutaka YOKOTA typedef struct sc_softc { 1906e8394b8SKazutaka YOKOTA int unit; /* unit # */ 1916e8394b8SKazutaka YOKOTA int config; /* configuration flags */ 192493d6f54SXin LI #define SC_VESAMODE (1 << 7) 1936e8394b8SKazutaka YOKOTA #define SC_AUTODETECT_KBD (1 << 8) 1946e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONSOLE (1 << 9) 1956e8394b8SKazutaka YOKOTA 1966e8394b8SKazutaka YOKOTA int flags; /* status flags */ 1976e8394b8SKazutaka YOKOTA #define SC_VISUAL_BELL (1 << 0) 1986e8394b8SKazutaka YOKOTA #define SC_QUIET_BELL (1 << 1) 1994866e276SKazutaka YOKOTA #if 0 /* not used anymore */ 2006e8394b8SKazutaka YOKOTA #define SC_BLINK_CURSOR (1 << 2) 2016e8394b8SKazutaka YOKOTA #define SC_CHAR_CURSOR (1 << 3) 2024866e276SKazutaka YOKOTA #endif 2036e8394b8SKazutaka YOKOTA #define SC_MOUSE_ENABLED (1 << 4) 2046e8394b8SKazutaka YOKOTA #define SC_SCRN_IDLE (1 << 5) 2056e8394b8SKazutaka YOKOTA #define SC_SCRN_BLANKED (1 << 6) 2066e8394b8SKazutaka YOKOTA #define SC_SAVER_FAILED (1 << 7) 207ce907d42SDima Dorfman #define SC_SCRN_VTYLOCK (1 << 8) 2086e8394b8SKazutaka YOKOTA 2096e8394b8SKazutaka YOKOTA #define SC_INIT_DONE (1 << 16) 2106e8394b8SKazutaka YOKOTA #define SC_SPLASH_SCRN (1 << 17) 2116e8394b8SKazutaka YOKOTA 212*3322036eSKyle Evans struct keyboard *kbd; /* NULL if unavailable. */ 2136e8394b8SKazutaka YOKOTA 2146e8394b8SKazutaka YOKOTA int adapter; 2156e8394b8SKazutaka YOKOTA struct video_adapter *adp; 2166e8394b8SKazutaka YOKOTA int initial_mode; /* initial video mode */ 2176e8394b8SKazutaka YOKOTA 2186e8394b8SKazutaka YOKOTA int first_vty; 2196e8394b8SKazutaka YOKOTA int vtys; 220bc093719SEd Schouten struct tty **dev; 2216e8394b8SKazutaka YOKOTA struct scr_stat *cur_scp; 2226e8394b8SKazutaka YOKOTA struct scr_stat *new_scp; 2236e8394b8SKazutaka YOKOTA struct scr_stat *old_scp; 2246e8394b8SKazutaka YOKOTA int delayed_next_scr; 2256e8394b8SKazutaka YOKOTA 2266e8394b8SKazutaka YOKOTA char font_loading_in_progress; 2276e8394b8SKazutaka YOKOTA char switch_in_progress; 2286e8394b8SKazutaka YOKOTA char write_in_progress; 2296e8394b8SKazutaka YOKOTA char blink_in_progress; 2301388e8b1SBruce Evans int grab_level; 231e866ca56SBruce Evans /* 2 is just enough for kdb to grab for stepping normal grabbing: */ 232e866ca56SBruce Evans struct sc_cnstate grab_state[2]; 233e866ca56SBruce Evans int kbd_open_level; 234988129b8SScott Long struct mtx video_mtx; 2356e8394b8SKazutaka YOKOTA 2366e8394b8SKazutaka YOKOTA long scrn_time_stamp; 2376e8394b8SKazutaka YOKOTA 2384866e276SKazutaka YOKOTA struct cursor_attr dflt_curs_attr; 2394866e276SKazutaka YOKOTA struct cursor_attr curs_attr; 2406e8394b8SKazutaka YOKOTA 2416e8394b8SKazutaka YOKOTA u_char scr_map[256]; 2426e8394b8SKazutaka YOKOTA u_char scr_rmap[256]; 2436e8394b8SKazutaka YOKOTA 2446e8394b8SKazutaka YOKOTA #ifdef _SC_MD_SOFTC_DECLARED_ 2456e8394b8SKazutaka YOKOTA sc_md_softc_t md; /* machine dependent vars */ 2466e8394b8SKazutaka YOKOTA #endif 2476e8394b8SKazutaka YOKOTA 2486e8394b8SKazutaka YOKOTA #ifndef SC_NO_PALETTE_LOADING 2496e8394b8SKazutaka YOKOTA u_char palette[256 * 3]; 2508d521790SJung-uk Kim #ifdef SC_PIXEL_MODE 2518d521790SJung-uk Kim u_char palette2[256 * 3]; 2528d521790SJung-uk Kim #endif 2536e8394b8SKazutaka YOKOTA #endif 2546e8394b8SKazutaka YOKOTA 2556e8394b8SKazutaka YOKOTA #ifndef SC_NO_FONT_LOADING 2566e8394b8SKazutaka YOKOTA int fonts_loaded; 2572b944ee2SKazutaka YOKOTA #define FONT_8 2 2582b944ee2SKazutaka YOKOTA #define FONT_14 4 2592b944ee2SKazutaka YOKOTA #define FONT_16 8 260b7c96c0dSMarius Strobl #define FONT_22 8 2616e8394b8SKazutaka YOKOTA u_char *font_8; 2626e8394b8SKazutaka YOKOTA u_char *font_14; 2636e8394b8SKazutaka YOKOTA u_char *font_16; 264b7c96c0dSMarius Strobl u_char *font_22; 2656e8394b8SKazutaka YOKOTA #endif 2666e8394b8SKazutaka YOKOTA 26709132359SKazutaka YOKOTA u_char cursor_char; 268e2f29c6eSKazutaka YOKOTA u_char mouse_char; 269e2f29c6eSKazutaka YOKOTA 270a608af78SRobert Watson #ifdef KDB 271a608af78SRobert Watson int sc_altbrk; 272a608af78SRobert Watson #endif 2736b98f115SDavide Italiano struct callout ctimeout; 2746b98f115SDavide Italiano struct callout cblink; 2756e8394b8SKazutaka YOKOTA } sc_softc_t; 2766e8394b8SKazutaka YOKOTA 2776e8394b8SKazutaka YOKOTA /* virtual screen */ 27817ee9d00SSøren Schmidt typedef struct scr_stat { 2796e8394b8SKazutaka YOKOTA int index; /* index of this vty */ 2806e8394b8SKazutaka YOKOTA struct sc_softc *sc; /* pointer to softc */ 2816e8394b8SKazutaka YOKOTA struct sc_rndr_sw *rndr; /* renderer */ 2826e8394b8SKazutaka YOKOTA sc_vtb_t scr; 2836e8394b8SKazutaka YOKOTA sc_vtb_t vtb; 2842b944ee2SKazutaka YOKOTA 28517ee9d00SSøren Schmidt int xpos; /* current X position */ 28617ee9d00SSøren Schmidt int ypos; /* current Y position */ 287a221620cSSøren Schmidt int xsize; /* X text size */ 288a221620cSSøren Schmidt int ysize; /* Y text size */ 289a221620cSSøren Schmidt int xpixel; /* X graphics size */ 290a221620cSSøren Schmidt int ypixel; /* Y graphics size */ 291a8445737SSøren Schmidt int xoff; /* X offset in pixel mode */ 292a8445737SSøren Schmidt int yoff; /* Y offset in pixel mode */ 2932b944ee2SKazutaka YOKOTA 2946e8394b8SKazutaka YOKOTA u_char *font; /* current font */ 295da040b22SSøren Schmidt int font_size; /* fontsize in Y direction */ 29673b0c907SJake Burkholder int font_width; /* fontsize in X direction */ 2972b944ee2SKazutaka YOKOTA 298736277a9SSøren Schmidt int start; /* modified area start */ 299736277a9SSøren Schmidt int end; /* modified area end */ 3002b944ee2SKazutaka YOKOTA 3012b944ee2SKazutaka YOKOTA struct sc_term_sw *tsw; 3022b944ee2SKazutaka YOKOTA void *ts; 3032b944ee2SKazutaka YOKOTA 30417ee9d00SSøren Schmidt int status; /* status (bitfield) */ 3052ad872c5SKazutaka YOKOTA int kbd_mode; /* keyboard I/O mode */ 3062b944ee2SKazutaka YOKOTA 3076e8394b8SKazutaka YOKOTA int cursor_pos; /* cursor buffer position */ 3086e8394b8SKazutaka YOKOTA int cursor_oldpos; /* cursor old buffer position */ 3094866e276SKazutaka YOKOTA struct cursor_attr dflt_curs_attr; 3104ea1f4f5SBruce Evans struct cursor_attr base_curs_attr; 3114866e276SKazutaka YOKOTA struct cursor_attr curs_attr; 3122b944ee2SKazutaka YOKOTA 3136e8394b8SKazutaka YOKOTA int mouse_pos; /* mouse buffer position */ 3146e8394b8SKazutaka YOKOTA int mouse_oldpos; /* mouse old buffer position */ 31517ee9d00SSøren Schmidt short mouse_xpos; /* mouse x coordinate */ 31617ee9d00SSøren Schmidt short mouse_ypos; /* mouse y coordinate */ 31709132359SKazutaka YOKOTA short mouse_oldxpos; /* mouse previous x coordinate */ 31809132359SKazutaka YOKOTA short mouse_oldypos; /* mouse previous y coordinate */ 319ad0c0c78SSøren Schmidt short mouse_buttons; /* mouse buttons */ 3206e8394b8SKazutaka YOKOTA int mouse_cut_start; /* mouse cut start pos */ 3216e8394b8SKazutaka YOKOTA int mouse_cut_end; /* mouse cut end pos */ 32253e69c0cSEd Schouten int mouse_level; /* xterm mouse protocol */ 323ad0c0c78SSøren Schmidt struct proc *mouse_proc; /* proc* of controlling proc */ 324ad0c0c78SSøren Schmidt pid_t mouse_pid; /* pid of controlling proc */ 325ad0c0c78SSøren Schmidt int mouse_signal; /* signal # to report with */ 32628bbe30cSBruce Evans const void *mouse_data; /* renderer (pixmap) data */ 3272b944ee2SKazutaka YOKOTA 32817ee9d00SSøren Schmidt u_short bell_duration; 32917ee9d00SSøren Schmidt u_short bell_pitch; 3302b944ee2SKazutaka YOKOTA 33117ee9d00SSøren Schmidt u_char border; /* border color */ 33288a5f0ccSKazutaka YOKOTA int mode; /* mode */ 33317ee9d00SSøren Schmidt pid_t pid; /* pid of controlling proc */ 33417ee9d00SSøren Schmidt struct proc *proc; /* proc* of controlling proc */ 33517ee9d00SSøren Schmidt struct vt_mode smode; /* switch mode */ 3362b944ee2SKazutaka YOKOTA 3376e8394b8SKazutaka YOKOTA sc_vtb_t *history; /* circular history buffer */ 3386e8394b8SKazutaka YOKOTA int history_pos; /* position shown on screen */ 33917ee9d00SSøren Schmidt int history_size; /* size of history buffer */ 3402b944ee2SKazutaka YOKOTA 341a8445737SSøren Schmidt int splash_save_mode; /* saved mode for splash screen */ 342a8445737SSøren Schmidt int splash_save_status; /* saved status for splash screen */ 3436e8394b8SKazutaka YOKOTA #ifdef _SCR_MD_STAT_DECLARED_ 3446e8394b8SKazutaka YOKOTA scr_md_stat_t md; /* machine dependent vars */ 3456e8394b8SKazutaka YOKOTA #endif 34617ee9d00SSøren Schmidt } scr_stat; 34717ee9d00SSøren Schmidt 348bc093719SEd Schouten /* TTY softc. */ 349bc093719SEd Schouten typedef struct sc_ttysoftc { 350bc093719SEd Schouten int st_index; 351bc093719SEd Schouten scr_stat *st_stat; 352bc093719SEd Schouten } sc_ttysoftc; 353bc093719SEd Schouten 3546e8394b8SKazutaka YOKOTA #ifndef SC_NORM_ATTR 3556e8394b8SKazutaka YOKOTA #define SC_NORM_ATTR (FG_LIGHTGREY | BG_BLACK) 3566e8394b8SKazutaka YOKOTA #endif 3576e8394b8SKazutaka YOKOTA #ifndef SC_NORM_REV_ATTR 3586e8394b8SKazutaka YOKOTA #define SC_NORM_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 3596e8394b8SKazutaka YOKOTA #endif 3606e8394b8SKazutaka YOKOTA #ifndef SC_KERNEL_CONS_ATTR 3616e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONS_ATTR (FG_WHITE | BG_BLACK) 3626e8394b8SKazutaka YOKOTA #endif 3636e8394b8SKazutaka YOKOTA #ifndef SC_KERNEL_CONS_REV_ATTR 3646e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONS_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 3656e8394b8SKazutaka YOKOTA #endif 366a8445737SSøren Schmidt 3672b944ee2SKazutaka YOKOTA /* terminal emulator */ 3682b944ee2SKazutaka YOKOTA 3692b944ee2SKazutaka YOKOTA #ifndef SC_DFLT_TERM 37019dcee25SBruce Evans #define SC_DFLT_TERM "scteken" 3712b944ee2SKazutaka YOKOTA #endif 3722b944ee2SKazutaka YOKOTA 3732b944ee2SKazutaka YOKOTA typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); 3742b944ee2SKazutaka YOKOTA #define SC_TE_COLD_INIT 0 3752b944ee2SKazutaka YOKOTA #define SC_TE_WARM_INIT 1 3762b944ee2SKazutaka YOKOTA typedef int sc_term_term_t(scr_stat *scp, void **tcp); 377d91400bfSBruce Evans typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); 3782b944ee2SKazutaka YOKOTA typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, 379bc093719SEd Schouten caddr_t data, struct thread *td); 3802b944ee2SKazutaka YOKOTA typedef int sc_term_reset_t(scr_stat *scp, int code); 3812b944ee2SKazutaka YOKOTA #define SC_TE_HARD_RESET 0 3822b944ee2SKazutaka YOKOTA #define SC_TE_SOFT_RESET 1 3832b944ee2SKazutaka YOKOTA typedef void sc_term_default_attr_t(scr_stat *scp, int norm, int rev); 3842b944ee2SKazutaka YOKOTA typedef void sc_term_clear_t(scr_stat *scp); 3852b944ee2SKazutaka YOKOTA typedef void sc_term_notify_t(scr_stat *scp, int event); 3862b944ee2SKazutaka YOKOTA #define SC_TE_NOTIFY_VTSWITCH_IN 0 3872b944ee2SKazutaka YOKOTA #define SC_TE_NOTIFY_VTSWITCH_OUT 1 3882b944ee2SKazutaka YOKOTA typedef int sc_term_input_t(scr_stat *scp, int c, struct tty *tp); 3893a8a07eaSEd Schouten typedef const char *sc_term_fkeystr_t(scr_stat *scp, int c); 390912da699SBruce Evans typedef void sc_term_sync_t(scr_stat *scp); 3912b944ee2SKazutaka YOKOTA 3922b944ee2SKazutaka YOKOTA typedef struct sc_term_sw { 393e3975643SJake Burkholder LIST_ENTRY(sc_term_sw) link; 3942b944ee2SKazutaka YOKOTA char *te_name; /* name of the emulator */ 3952b944ee2SKazutaka YOKOTA char *te_desc; /* description */ 3962b944ee2SKazutaka YOKOTA char *te_renderer; /* matching renderer */ 3972b944ee2SKazutaka YOKOTA size_t te_size; /* size of internal buffer */ 3982b944ee2SKazutaka YOKOTA int te_refcount; /* reference counter */ 3992b944ee2SKazutaka YOKOTA sc_term_init_t *te_init; 4002b944ee2SKazutaka YOKOTA sc_term_term_t *te_term; 4012b944ee2SKazutaka YOKOTA sc_term_puts_t *te_puts; 4022b944ee2SKazutaka YOKOTA sc_term_ioctl_t *te_ioctl; 4032b944ee2SKazutaka YOKOTA sc_term_reset_t *te_reset; 4042b944ee2SKazutaka YOKOTA sc_term_default_attr_t *te_default_attr; 4052b944ee2SKazutaka YOKOTA sc_term_clear_t *te_clear; 4062b944ee2SKazutaka YOKOTA sc_term_notify_t *te_notify; 4072b944ee2SKazutaka YOKOTA sc_term_input_t *te_input; 4083a8a07eaSEd Schouten sc_term_fkeystr_t *te_fkeystr; 409912da699SBruce Evans sc_term_sync_t *te_sync; 4102b944ee2SKazutaka YOKOTA } sc_term_sw_t; 4112b944ee2SKazutaka YOKOTA 4122b944ee2SKazutaka YOKOTA #define SCTERM_MODULE(name, sw) \ 4132b944ee2SKazutaka YOKOTA DATA_SET(scterm_set, sw); \ 4142b944ee2SKazutaka YOKOTA static int \ 4152b944ee2SKazutaka YOKOTA scterm_##name##_event(module_t mod, int type, void *data) \ 4162b944ee2SKazutaka YOKOTA { \ 4172b944ee2SKazutaka YOKOTA switch (type) { \ 4182b944ee2SKazutaka YOKOTA case MOD_LOAD: \ 4192b944ee2SKazutaka YOKOTA return sc_term_add(&sw); \ 4202b944ee2SKazutaka YOKOTA case MOD_UNLOAD: \ 4212b944ee2SKazutaka YOKOTA if (sw.te_refcount > 0) \ 4222b944ee2SKazutaka YOKOTA return EBUSY; \ 4232b944ee2SKazutaka YOKOTA return sc_term_remove(&sw); \ 4242b944ee2SKazutaka YOKOTA default: \ 4253e019deaSPoul-Henning Kamp return EOPNOTSUPP; \ 4262b944ee2SKazutaka YOKOTA break; \ 4272b944ee2SKazutaka YOKOTA } \ 4282b944ee2SKazutaka YOKOTA return 0; \ 4292b944ee2SKazutaka YOKOTA } \ 4302b944ee2SKazutaka YOKOTA static moduledata_t scterm_##name##_mod = { \ 4312b944ee2SKazutaka YOKOTA "scterm-" #name, \ 4322b944ee2SKazutaka YOKOTA scterm_##name##_event, \ 4332b944ee2SKazutaka YOKOTA NULL, \ 4342b944ee2SKazutaka YOKOTA }; \ 4352b944ee2SKazutaka YOKOTA DECLARE_MODULE(scterm_##name, scterm_##name##_mod, \ 4362b944ee2SKazutaka YOKOTA SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 4372b944ee2SKazutaka YOKOTA 4386e8394b8SKazutaka YOKOTA /* renderer function table */ 439f1121206SXin LI typedef void vr_init_t(scr_stat *scp); 4406e8394b8SKazutaka YOKOTA typedef void vr_clear_t(scr_stat *scp, int c, int attr); 4416e8394b8SKazutaka YOKOTA typedef void vr_draw_border_t(scr_stat *scp, int color); 4426e8394b8SKazutaka YOKOTA typedef void vr_draw_t(scr_stat *scp, int from, int count, int flip); 4436e8394b8SKazutaka YOKOTA typedef void vr_set_cursor_t(scr_stat *scp, int base, int height, int blink); 4446e8394b8SKazutaka YOKOTA typedef void vr_draw_cursor_t(scr_stat *scp, int at, int blink, 4456e8394b8SKazutaka YOKOTA int on, int flip); 4466e8394b8SKazutaka YOKOTA typedef void vr_blink_cursor_t(scr_stat *scp, int at, int flip); 4476e8394b8SKazutaka YOKOTA typedef void vr_set_mouse_t(scr_stat *scp); 4486e8394b8SKazutaka YOKOTA typedef void vr_draw_mouse_t(scr_stat *scp, int x, int y, int on); 4496e8394b8SKazutaka YOKOTA 4506e8394b8SKazutaka YOKOTA typedef struct sc_rndr_sw { 451f1121206SXin LI vr_init_t *init; 4526e8394b8SKazutaka YOKOTA vr_clear_t *clear; 4536e8394b8SKazutaka YOKOTA vr_draw_border_t *draw_border; 4546e8394b8SKazutaka YOKOTA vr_draw_t *draw; 4556e8394b8SKazutaka YOKOTA vr_set_cursor_t *set_cursor; 4566e8394b8SKazutaka YOKOTA vr_draw_cursor_t *draw_cursor; 4576e8394b8SKazutaka YOKOTA vr_blink_cursor_t *blink_cursor; 4586e8394b8SKazutaka YOKOTA vr_set_mouse_t *set_mouse; 4596e8394b8SKazutaka YOKOTA vr_draw_mouse_t *draw_mouse; 4606e8394b8SKazutaka YOKOTA } sc_rndr_sw_t; 4616e8394b8SKazutaka YOKOTA 4626e8394b8SKazutaka YOKOTA typedef struct sc_renderer { 4636e8394b8SKazutaka YOKOTA char *name; 4646e8394b8SKazutaka YOKOTA int mode; 4656e8394b8SKazutaka YOKOTA sc_rndr_sw_t *rndrsw; 466e3975643SJake Burkholder LIST_ENTRY(sc_renderer) link; 4676e8394b8SKazutaka YOKOTA } sc_renderer_t; 4686e8394b8SKazutaka YOKOTA 4692b944ee2SKazutaka YOKOTA #define RENDERER(name, mode, sw, set) \ 47022c1cd20SPeter Wemm static struct sc_renderer scrndr_##name##_##mode = { \ 4716e8394b8SKazutaka YOKOTA #name, mode, &sw \ 4726e8394b8SKazutaka YOKOTA }; \ 47322c1cd20SPeter Wemm DATA_SET(scrndr_set, scrndr_##name##_##mode); \ 47422c1cd20SPeter Wemm DATA_SET(set, scrndr_##name##_##mode) 4756e8394b8SKazutaka YOKOTA 4762b944ee2SKazutaka YOKOTA #define RENDERER_MODULE(name, set) \ 477f41325dbSPeter Wemm SET_DECLARE(set, sc_renderer_t); \ 4782b944ee2SKazutaka YOKOTA static int \ 4792b944ee2SKazutaka YOKOTA scrndr_##name##_event(module_t mod, int type, void *data) \ 4802b944ee2SKazutaka YOKOTA { \ 4812b944ee2SKazutaka YOKOTA sc_renderer_t **list; \ 4822b944ee2SKazutaka YOKOTA int error = 0; \ 4832b944ee2SKazutaka YOKOTA switch (type) { \ 4842b944ee2SKazutaka YOKOTA case MOD_LOAD: \ 485f41325dbSPeter Wemm SET_FOREACH(list, set) { \ 486f41325dbSPeter Wemm error = sc_render_add(*list); \ 4872b944ee2SKazutaka YOKOTA if (error) \ 4882b944ee2SKazutaka YOKOTA break; \ 4892b944ee2SKazutaka YOKOTA } \ 4902b944ee2SKazutaka YOKOTA break; \ 4912b944ee2SKazutaka YOKOTA case MOD_UNLOAD: \ 492f41325dbSPeter Wemm SET_FOREACH(list, set) { \ 493f41325dbSPeter Wemm error = sc_render_remove(*list);\ 4942b944ee2SKazutaka YOKOTA if (error) \ 4952b944ee2SKazutaka YOKOTA break; \ 4962b944ee2SKazutaka YOKOTA } \ 4972b944ee2SKazutaka YOKOTA break; \ 4982b944ee2SKazutaka YOKOTA default: \ 4993e019deaSPoul-Henning Kamp return EOPNOTSUPP; \ 5002b944ee2SKazutaka YOKOTA break; \ 5012b944ee2SKazutaka YOKOTA } \ 5022b944ee2SKazutaka YOKOTA return error; \ 5032b944ee2SKazutaka YOKOTA } \ 5042b944ee2SKazutaka YOKOTA static moduledata_t scrndr_##name##_mod = { \ 5052b944ee2SKazutaka YOKOTA "scrndr-" #name, \ 5062b944ee2SKazutaka YOKOTA scrndr_##name##_event, \ 5072b944ee2SKazutaka YOKOTA NULL, \ 5082b944ee2SKazutaka YOKOTA }; \ 50922c1cd20SPeter Wemm DECLARE_MODULE(scrndr_##name, scrndr_##name##_mod, \ 5102b944ee2SKazutaka YOKOTA SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 5116e8394b8SKazutaka YOKOTA 5126e8394b8SKazutaka YOKOTA typedef struct { 5136e8394b8SKazutaka YOKOTA int shift_state; 5146e8394b8SKazutaka YOKOTA int bell_pitch; 5156e8394b8SKazutaka YOKOTA } bios_values_t; 5166e8394b8SKazutaka YOKOTA 5176e8394b8SKazutaka YOKOTA /* other macros */ 518a8445737SSøren Schmidt #define ISTEXTSC(scp) (!((scp)->status \ 519a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))) 520a8445737SSøren Schmidt #define ISGRAPHSC(scp) (((scp)->status \ 521a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE))) 522a8445737SSøren Schmidt #define ISPIXELSC(scp) (((scp)->status \ 523a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\ 524a8445737SSøren Schmidt == PIXEL_MODE) 525a8445737SSøren Schmidt #define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE) 526a8445737SSøren Schmidt 527a8445737SSøren Schmidt #define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT) 5286e8394b8SKazutaka YOKOTA #define ISFONTAVAIL(af) ((af) & V_ADP_FONT) 529a8445737SSøren Schmidt #define ISPALAVAIL(af) ((af) & V_ADP_PALETTE) 530a8445737SSøren Schmidt 5316e8394b8SKazutaka YOKOTA #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) 5326e8394b8SKazutaka YOKOTA 533988129b8SScott Long #define SC_VIDEO_LOCKINIT(sc) \ 5341d9c3ad3SJohn Baldwin mtx_init(&(sc)->video_mtx, "syscons video lock", NULL, \ 5351d9c3ad3SJohn Baldwin MTX_SPIN | MTX_RECURSE); 536988129b8SScott Long #define SC_VIDEO_LOCK(sc) \ 537988129b8SScott Long do { \ 538d350ce61SBruce Evans if (!kdb_active) \ 539988129b8SScott Long mtx_lock_spin(&(sc)->video_mtx); \ 540988129b8SScott Long } while(0) 541988129b8SScott Long #define SC_VIDEO_UNLOCK(sc) \ 542988129b8SScott Long do { \ 543d350ce61SBruce Evans if (!kdb_active) \ 544988129b8SScott Long mtx_unlock_spin(&(sc)->video_mtx); \ 545988129b8SScott Long } while(0) 546988129b8SScott Long 547a8445737SSøren Schmidt /* syscons.c */ 548bc093719SEd Schouten extern int (*sc_user_ioctl)(struct tty *tp, u_long cmd, caddr_t data, 549bc093719SEd Schouten struct thread *td); 5506e8394b8SKazutaka YOKOTA 551f359876fSKazutaka YOKOTA int sc_probe_unit(int unit, int flags); 552f359876fSKazutaka YOKOTA int sc_attach_unit(int unit, int flags); 553a8445737SSøren Schmidt 554a8445737SSøren Schmidt int set_mode(scr_stat *scp); 555a8445737SSøren Schmidt 5562b944ee2SKazutaka YOKOTA void sc_set_border(scr_stat *scp, int color); 557b7c96c0dSMarius Strobl void sc_load_font(scr_stat *scp, int page, int size, int width, 558b7c96c0dSMarius Strobl u_char *font, int base, int count); 559b7c96c0dSMarius Strobl void sc_save_font(scr_stat *scp, int page, int size, int width, 560b7c96c0dSMarius Strobl u_char *font, int base, int count); 5612b944ee2SKazutaka YOKOTA void sc_show_font(scr_stat *scp, int page); 562a8445737SSøren Schmidt 5632ad872c5SKazutaka YOKOTA void sc_touch_scrn_saver(void); 5642b944ee2SKazutaka YOKOTA void sc_draw_cursor_image(scr_stat *scp); 5652b944ee2SKazutaka YOKOTA void sc_remove_cursor_image(scr_stat *scp); 5666e8394b8SKazutaka YOKOTA void sc_set_cursor_image(scr_stat *scp); 5674866e276SKazutaka YOKOTA void sc_change_cursor_shape(scr_stat *scp, int flags, 5684866e276SKazutaka YOKOTA int base, int height); 569a8445737SSøren Schmidt int sc_clean_up(scr_stat *scp); 5702b944ee2SKazutaka YOKOTA int sc_switch_scr(sc_softc_t *sc, u_int next_scr); 5716e8394b8SKazutaka YOKOTA void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); 5722b944ee2SKazutaka YOKOTA int sc_init_emulator(scr_stat *scp, char *name); 573b4b1c516SEd Schouten void sc_paste(scr_stat *scp, const u_char *p, int count); 57453e69c0cSEd Schouten void sc_respond(scr_stat *scp, const u_char *p, 57553e69c0cSEd Schouten int count, int wakeup); 5762b944ee2SKazutaka YOKOTA void sc_bell(scr_stat *scp, int pitch, int duration); 5776e8394b8SKazutaka YOKOTA 5786e8394b8SKazutaka YOKOTA /* schistory.c */ 5796e8394b8SKazutaka YOKOTA #ifndef SC_NO_HISTORY 580c4c9400bSKazutaka YOKOTA int sc_alloc_history_buffer(scr_stat *scp, int lines, 581c4c9400bSKazutaka YOKOTA int prev_ysize, int wait); 582c4c9400bSKazutaka YOKOTA void sc_free_history_buffer(scr_stat *scp, int prev_ysize); 5836e8394b8SKazutaka YOKOTA void sc_hist_save(scr_stat *scp); 5846e8394b8SKazutaka YOKOTA #define sc_hist_save_one_line(scp, from) \ 5856e8394b8SKazutaka YOKOTA sc_vtb_append(&(scp)->vtb, (from), (scp)->history, (scp)->xsize) 5866e8394b8SKazutaka YOKOTA int sc_hist_restore(scr_stat *scp); 5876e8394b8SKazutaka YOKOTA void sc_hist_home(scr_stat *scp); 5886e8394b8SKazutaka YOKOTA void sc_hist_end(scr_stat *scp); 5896e8394b8SKazutaka YOKOTA int sc_hist_up_line(scr_stat *scp); 5906e8394b8SKazutaka YOKOTA int sc_hist_down_line(scr_stat *scp); 5916e8394b8SKazutaka YOKOTA int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, 592bc093719SEd Schouten struct thread *td); 5936e8394b8SKazutaka YOKOTA #endif /* SC_NO_HISTORY */ 5946e8394b8SKazutaka YOKOTA 5956e8394b8SKazutaka YOKOTA /* scmouse.c */ 5966e8394b8SKazutaka YOKOTA #ifndef SC_NO_CUTPASTE 5976e8394b8SKazutaka YOKOTA void sc_alloc_cut_buffer(scr_stat *scp, int wait); 5986e8394b8SKazutaka YOKOTA void sc_draw_mouse_image(scr_stat *scp); 5996e8394b8SKazutaka YOKOTA void sc_remove_mouse_image(scr_stat *scp); 6006e8394b8SKazutaka YOKOTA int sc_inside_cutmark(scr_stat *scp, int pos); 6016e8394b8SKazutaka YOKOTA void sc_remove_cutmarking(scr_stat *scp); 6026e8394b8SKazutaka YOKOTA void sc_remove_all_cutmarkings(sc_softc_t *scp); 6036e8394b8SKazutaka YOKOTA void sc_remove_all_mouse(sc_softc_t *scp); 6044629b5e0SAndrey A. Chernov void sc_mouse_paste(scr_stat *scp); 6056e8394b8SKazutaka YOKOTA #else 606c2c86c2bSKazutaka YOKOTA #define sc_draw_mouse_image(scp) 607c2c86c2bSKazutaka YOKOTA #define sc_remove_mouse_image(scp) 6086e8394b8SKazutaka YOKOTA #define sc_inside_cutmark(scp, pos) FALSE 6096e8394b8SKazutaka YOKOTA #define sc_remove_cutmarking(scp) 610c2c86c2bSKazutaka YOKOTA #define sc_remove_all_cutmarkings(scp) 611c2c86c2bSKazutaka YOKOTA #define sc_remove_all_mouse(scp) 6124629b5e0SAndrey A. Chernov #define sc_mouse_paste(scp) 6136e8394b8SKazutaka YOKOTA #endif /* SC_NO_CUTPASTE */ 6146e8394b8SKazutaka YOKOTA #ifndef SC_NO_SYSMOUSE 6156e8394b8SKazutaka YOKOTA void sc_mouse_move(scr_stat *scp, int x, int y); 6166e8394b8SKazutaka YOKOTA int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, 617bc093719SEd Schouten struct thread *td); 6186e8394b8SKazutaka YOKOTA #endif /* SC_NO_SYSMOUSE */ 619a8445737SSøren Schmidt 620a8445737SSøren Schmidt /* scvidctl.c */ 621a8445737SSøren Schmidt int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, 62286330afeSCraig Rodrigues int xsize, int ysize, int fontsize, 62386330afeSCraig Rodrigues int font_width); 624a8445737SSøren Schmidt int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); 62586330afeSCraig Rodrigues int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, 62686330afeSCraig Rodrigues int ysize, int fontsize, int font_width); 6274a9b63a4SJung-uk Kim int sc_support_pixel_mode(void *arg); 628bc093719SEd Schouten int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, 629b40ce416SJulian Elischer struct thread *td); 630a8445737SSøren Schmidt 6312b944ee2SKazutaka YOKOTA int sc_render_add(sc_renderer_t *rndr); 6322b944ee2SKazutaka YOKOTA int sc_render_remove(sc_renderer_t *rndr); 6332b944ee2SKazutaka YOKOTA sc_rndr_sw_t *sc_render_match(scr_stat *scp, char *name, int mode); 6342b944ee2SKazutaka YOKOTA 6356e8394b8SKazutaka YOKOTA /* scvtb.c */ 6366e8394b8SKazutaka YOKOTA void sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, 6376e8394b8SKazutaka YOKOTA void *buffer, int wait); 6386e8394b8SKazutaka YOKOTA void sc_vtb_destroy(sc_vtb_t *vtb); 6396e8394b8SKazutaka YOKOTA size_t sc_vtb_size(int cols, int rows); 6406e8394b8SKazutaka YOKOTA void sc_vtb_clear(sc_vtb_t *vtb, int c, int attr); 6416e8394b8SKazutaka YOKOTA 6426e8394b8SKazutaka YOKOTA int sc_vtb_getc(sc_vtb_t *vtb, int at); 6436e8394b8SKazutaka YOKOTA int sc_vtb_geta(sc_vtb_t *vtb, int at); 6446e8394b8SKazutaka YOKOTA void sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a); 6456e8394b8SKazutaka YOKOTA vm_offset_t sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a); 6466e8394b8SKazutaka YOKOTA vm_offset_t sc_vtb_pointer(sc_vtb_t *vtb, int at); 6476e8394b8SKazutaka YOKOTA int sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset); 6486e8394b8SKazutaka YOKOTA 6496e8394b8SKazutaka YOKOTA #define sc_vtb_tail(vtb) ((vtb)->vtb_tail) 6506e8394b8SKazutaka YOKOTA #define sc_vtb_rows(vtb) ((vtb)->vtb_rows) 651d94eccc2SKazutaka YOKOTA #define sc_vtb_cols(vtb) ((vtb)->vtb_cols) 6526e8394b8SKazutaka YOKOTA 6536e8394b8SKazutaka YOKOTA void sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, 6546e8394b8SKazutaka YOKOTA int count); 6556e8394b8SKazutaka YOKOTA void sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, 6566e8394b8SKazutaka YOKOTA int count); 6576e8394b8SKazutaka YOKOTA void sc_vtb_seek(sc_vtb_t *vtb, int pos); 6586e8394b8SKazutaka YOKOTA void sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr); 6597107ea4aSKazutaka YOKOTA void sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count); 6606e8394b8SKazutaka YOKOTA void sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr); 6616e8394b8SKazutaka YOKOTA void sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr); 6626e8394b8SKazutaka YOKOTA 6632b944ee2SKazutaka YOKOTA /* sysmouse.c */ 6642b944ee2SKazutaka YOKOTA int sysmouse_event(mouse_info_t *info); 6652b944ee2SKazutaka YOKOTA 6662b944ee2SKazutaka YOKOTA /* scterm.c */ 6672b944ee2SKazutaka YOKOTA void sc_move_cursor(scr_stat *scp, int x, int y); 6682b944ee2SKazutaka YOKOTA void sc_clear_screen(scr_stat *scp); 6692b944ee2SKazutaka YOKOTA int sc_term_add(sc_term_sw_t *sw); 6702b944ee2SKazutaka YOKOTA int sc_term_remove(sc_term_sw_t *sw); 6712b944ee2SKazutaka YOKOTA sc_term_sw_t *sc_term_match(char *name); 6722b944ee2SKazutaka YOKOTA sc_term_sw_t *sc_term_match_by_number(int index); 6732b944ee2SKazutaka YOKOTA 6746e8394b8SKazutaka YOKOTA /* machine dependent functions */ 6756e8394b8SKazutaka YOKOTA int sc_max_unit(void); 6766e8394b8SKazutaka YOKOTA sc_softc_t *sc_get_softc(int unit, int flags); 6776e8394b8SKazutaka YOKOTA sc_softc_t *sc_find_softc(struct video_adapter *adp, struct keyboard *kbd); 6786e8394b8SKazutaka YOKOTA int sc_get_cons_priority(int *unit, int *flags); 6796e8394b8SKazutaka YOKOTA void sc_get_bios_values(bios_values_t *values); 6806e8394b8SKazutaka YOKOTA int sc_tone(int herz); 6816e8394b8SKazutaka YOKOTA 6822ad872c5SKazutaka YOKOTA #endif /* !_DEV_SYSCONS_SYSCONS_H_ */ 683