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 <saw@online.de> 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 */ 3317ee9d00SSøren Schmidt 342ad872c5SKazutaka YOKOTA #ifndef _DEV_SYSCONS_SYSCONS_H_ 352ad872c5SKazutaka YOKOTA #define _DEV_SYSCONS_SYSCONS_H_ 3677f77631SPaul Traina 37d350ce61SBruce Evans #include <sys/kdb.h> /* XXX */ 38d350ce61SBruce Evans #include <sys/_lock.h> 39d350ce61SBruce Evans #include <sys/_mutex.h> 40988129b8SScott Long 416e8394b8SKazutaka YOKOTA /* default values for configuration options */ 426e8394b8SKazutaka YOKOTA 436e8394b8SKazutaka YOKOTA #ifndef MAXCONS 446e8394b8SKazutaka YOKOTA #define MAXCONS 16 456e8394b8SKazutaka YOKOTA #endif 466e8394b8SKazutaka YOKOTA 476e8394b8SKazutaka YOKOTA #ifdef SC_NO_SYSMOUSE 486e8394b8SKazutaka YOKOTA #undef SC_NO_CUTPASTE 496e8394b8SKazutaka YOKOTA #define SC_NO_CUTPASTE 1 506e8394b8SKazutaka YOKOTA #endif 516e8394b8SKazutaka YOKOTA 526e8394b8SKazutaka YOKOTA #ifdef SC_NO_MODE_CHANGE 536e8394b8SKazutaka YOKOTA #undef SC_PIXEL_MODE 546e8394b8SKazutaka YOKOTA #endif 556e8394b8SKazutaka YOKOTA 5644b37d96SKazutaka YOKOTA /* Always load font data if the pixel (raster text) mode is to be used. */ 5744b37d96SKazutaka YOKOTA #ifdef SC_PIXEL_MODE 5844b37d96SKazutaka YOKOTA #undef SC_NO_FONT_LOADING 5944b37d96SKazutaka YOKOTA #endif 6044b37d96SKazutaka YOKOTA 6144b37d96SKazutaka YOKOTA /* 6244b37d96SKazutaka YOKOTA * If font data is not available, the `arrow'-shaped mouse cursor cannot 6344b37d96SKazutaka YOKOTA * be drawn. Use the alternative drawing method. 6444b37d96SKazutaka YOKOTA */ 6544b37d96SKazutaka YOKOTA #ifdef SC_NO_FONT_LOADING 6644b37d96SKazutaka YOKOTA #undef SC_ALT_MOUSE_IMAGE 6744b37d96SKazutaka YOKOTA #define SC_ALT_MOUSE_IMAGE 1 6844b37d96SKazutaka YOKOTA #endif 6944b37d96SKazutaka YOKOTA 7009132359SKazutaka YOKOTA #ifndef SC_CURSOR_CHAR 7155d26fc0SBruce Evans #define SC_CURSOR_CHAR 7 7209132359SKazutaka YOKOTA #endif 7309132359SKazutaka YOKOTA 74e2f29c6eSKazutaka YOKOTA #ifndef SC_MOUSE_CHAR 7555d26fc0SBruce Evans #define SC_MOUSE_CHAR 8 76e2f29c6eSKazutaka YOKOTA #endif 77e2f29c6eSKazutaka YOKOTA 7809132359SKazutaka YOKOTA #if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4) 7909132359SKazutaka YOKOTA #undef SC_CURSOR_CHAR 8009132359SKazutaka YOKOTA #define SC_CURSOR_CHAR (SC_MOUSE_CHAR + 4) 8109132359SKazutaka YOKOTA #endif 8209132359SKazutaka YOKOTA 836e8394b8SKazutaka YOKOTA #ifndef SC_DEBUG_LEVEL 846e8394b8SKazutaka YOKOTA #define SC_DEBUG_LEVEL 0 856e8394b8SKazutaka YOKOTA #endif 866e8394b8SKazutaka YOKOTA 876e8394b8SKazutaka YOKOTA #define DPRINTF(l, p) if (SC_DEBUG_LEVEL >= (l)) printf p 886e8394b8SKazutaka YOKOTA 896e8394b8SKazutaka YOKOTA #define SC_DRIVER_NAME "sc" 90bc093719SEd Schouten #define SC_VTY(dev) (((sc_ttysoftc *)tty_softc(tp))->st_index) 918c12242cSKazutaka YOKOTA #define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) 92bc093719SEd Schouten #define SC_STAT(tp) (*((scr_stat **)&((sc_ttysoftc *)tty_softc(tp))->st_stat)) 9317ee9d00SSøren Schmidt 9417ee9d00SSøren Schmidt /* printable chars */ 956e8394b8SKazutaka YOKOTA #ifndef PRINTABLE 9638994061SBruce Evans #define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 9738994061SBruce Evans || (ch) < 0x07) 986e8394b8SKazutaka YOKOTA #endif 9917ee9d00SSøren Schmidt 1008c4344beSSøren Schmidt /* macros for "intelligent" screen update */ 1018c4344beSSøren Schmidt #define mark_for_update(scp, x) {\ 1028c4344beSSøren Schmidt if ((x) < scp->start) scp->start = (x);\ 1038c4344beSSøren Schmidt else if ((x) > scp->end) scp->end = (x);\ 1048c4344beSSøren Schmidt } 1058c4344beSSøren Schmidt #define mark_all(scp) {\ 1068c4344beSSøren Schmidt scp->start = 0;\ 1078a69c85aSPoul-Henning Kamp scp->end = scp->xsize * scp->ysize - 1;\ 1088c4344beSSøren Schmidt } 1098c4344beSSøren Schmidt 1106e8394b8SKazutaka YOKOTA /* vty status flags (scp->status) */ 11109132359SKazutaka YOKOTA #define UNKNOWN_MODE 0x00010 /* unknown video mode */ 11209132359SKazutaka YOKOTA #define SWITCH_WAIT_REL 0x00080 /* waiting for vty release */ 11309132359SKazutaka YOKOTA #define SWITCH_WAIT_ACQ 0x00100 /* waiting for vty ack */ 11409132359SKazutaka YOKOTA #define BUFFER_SAVED 0x00200 /* vty buffer is saved */ 11509132359SKazutaka YOKOTA #define CURSOR_ENABLED 0x00400 /* text cursor is enabled */ 11609132359SKazutaka YOKOTA #define MOUSE_MOVED 0x01000 /* mouse cursor has moved */ 11709132359SKazutaka YOKOTA #define MOUSE_CUTTING 0x02000 /* mouse cursor is cutting text */ 11809132359SKazutaka YOKOTA #define MOUSE_VISIBLE 0x04000 /* mouse cursor is showing */ 11909132359SKazutaka YOKOTA #define GRAPHICS_MODE 0x08000 /* vty is in a graphics mode */ 12009132359SKazutaka YOKOTA #define PIXEL_MODE 0x10000 /* vty is in a raster text mode */ 12109132359SKazutaka YOKOTA #define SAVER_RUNNING 0x20000 /* screen saver is running */ 12209132359SKazutaka YOKOTA #define VR_CURSOR_BLINK 0x40000 /* blinking text cursor */ 12309132359SKazutaka YOKOTA #define VR_CURSOR_ON 0x80000 /* text cursor is on */ 12409132359SKazutaka YOKOTA #define MOUSE_HIDDEN 0x100000 /* mouse cursor is temporarily hidden */ 12517ee9d00SSøren Schmidt 12617ee9d00SSøren Schmidt /* misc defines */ 12717ee9d00SSøren Schmidt #define FALSE 0 12817ee9d00SSøren Schmidt #define TRUE 1 1290301e9c8SDavid E. O'Brien 1300301e9c8SDavid E. O'Brien /* 1310301e9c8SDavid E. O'Brien The following #defines are hard-coded for a maximum text 1320301e9c8SDavid E. O'Brien resolution corresponding to a maximum framebuffer 13350b9fb46SJulio Merino resolution of 1920x1200 with an 8x8 font... 1340301e9c8SDavid E. O'Brien */ 135478b2704SJulio Merino #define COL 240 1360301e9c8SDavid E. O'Brien #define ROW 150 1370301e9c8SDavid E. O'Brien 13817ee9d00SSøren Schmidt #define PCBURST 128 13917ee9d00SSøren Schmidt 1406e8394b8SKazutaka YOKOTA #ifndef BELL_DURATION 141266aa942SPoul-Henning Kamp #define BELL_DURATION ((5 * hz + 99) / 100) 1426e8394b8SKazutaka YOKOTA #define BELL_PITCH 800 1436e8394b8SKazutaka YOKOTA #endif 1446e8394b8SKazutaka YOKOTA 1456e8394b8SKazutaka YOKOTA /* virtual terminal buffer */ 1466e8394b8SKazutaka YOKOTA typedef struct sc_vtb { 1476e8394b8SKazutaka YOKOTA int vtb_flags; 1486e8394b8SKazutaka YOKOTA #define VTB_VALID (1 << 0) 1492317b701SKazutaka YOKOTA #define VTB_ALLOCED (1 << 1) 1506e8394b8SKazutaka YOKOTA int vtb_type; 1516e8394b8SKazutaka YOKOTA #define VTB_INVALID 0 1526e8394b8SKazutaka YOKOTA #define VTB_MEMORY 1 1536e8394b8SKazutaka YOKOTA #define VTB_FRAMEBUFFER 2 1546e8394b8SKazutaka YOKOTA #define VTB_RINGBUFFER 3 1556e8394b8SKazutaka YOKOTA int vtb_cols; 1566e8394b8SKazutaka YOKOTA int vtb_rows; 1576e8394b8SKazutaka YOKOTA int vtb_size; 1586e8394b8SKazutaka YOKOTA vm_offset_t vtb_buffer; 1596e8394b8SKazutaka YOKOTA int vtb_tail; /* valid for VTB_RINGBUFFER only */ 1606e8394b8SKazutaka YOKOTA } sc_vtb_t; 1616e8394b8SKazutaka YOKOTA 1629bc7c363SBruce Evans /* text and some mouse cursor attributes */ 1634866e276SKazutaka YOKOTA struct cursor_attr { 1649bc7c363SBruce Evans u_char flags; 1659bc7c363SBruce Evans u_char base; 1669bc7c363SBruce Evans u_char height; 1679bc7c363SBruce Evans u_char bg[3]; 1689bc7c363SBruce Evans u_char mouse_ba; 1699bc7c363SBruce Evans u_char mouse_ia; 1704866e276SKazutaka YOKOTA }; 1714866e276SKazutaka YOKOTA 1726e8394b8SKazutaka YOKOTA /* softc */ 1736e8394b8SKazutaka YOKOTA 1746e8394b8SKazutaka YOKOTA struct keyboard; 1756e8394b8SKazutaka YOKOTA struct video_adapter; 1766e8394b8SKazutaka YOKOTA struct scr_stat; 1776e8394b8SKazutaka YOKOTA struct tty; 1786e8394b8SKazutaka YOKOTA 179e866ca56SBruce Evans struct sc_cnstate { 180a95582c6SBruce Evans u_char kbd_locked; 18190adad10SBruce Evans u_char kdb_locked; 18290adad10SBruce Evans u_char mtx_locked; 183e866ca56SBruce Evans u_char kbd_opened; 184e866ca56SBruce Evans u_char scr_opened; 185e866ca56SBruce Evans }; 186e866ca56SBruce Evans 1876e8394b8SKazutaka YOKOTA typedef struct sc_softc { 1886e8394b8SKazutaka YOKOTA int unit; /* unit # */ 1896e8394b8SKazutaka YOKOTA int config; /* configuration flags */ 190493d6f54SXin LI #define SC_VESAMODE (1 << 7) 1916e8394b8SKazutaka YOKOTA #define SC_AUTODETECT_KBD (1 << 8) 1926e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONSOLE (1 << 9) 1936e8394b8SKazutaka YOKOTA 1946e8394b8SKazutaka YOKOTA int flags; /* status flags */ 1956e8394b8SKazutaka YOKOTA #define SC_VISUAL_BELL (1 << 0) 1966e8394b8SKazutaka YOKOTA #define SC_QUIET_BELL (1 << 1) 1974866e276SKazutaka YOKOTA #if 0 /* not used anymore */ 1986e8394b8SKazutaka YOKOTA #define SC_BLINK_CURSOR (1 << 2) 1996e8394b8SKazutaka YOKOTA #define SC_CHAR_CURSOR (1 << 3) 2004866e276SKazutaka YOKOTA #endif 2016e8394b8SKazutaka YOKOTA #define SC_MOUSE_ENABLED (1 << 4) 2026e8394b8SKazutaka YOKOTA #define SC_SCRN_IDLE (1 << 5) 2036e8394b8SKazutaka YOKOTA #define SC_SCRN_BLANKED (1 << 6) 2046e8394b8SKazutaka YOKOTA #define SC_SAVER_FAILED (1 << 7) 205ce907d42SDima Dorfman #define SC_SCRN_VTYLOCK (1 << 8) 2066e8394b8SKazutaka YOKOTA 2076e8394b8SKazutaka YOKOTA #define SC_INIT_DONE (1 << 16) 2086e8394b8SKazutaka YOKOTA #define SC_SPLASH_SCRN (1 << 17) 2096e8394b8SKazutaka YOKOTA 210*3322036eSKyle Evans struct keyboard *kbd; /* NULL if unavailable. */ 2116e8394b8SKazutaka YOKOTA 2126e8394b8SKazutaka YOKOTA int adapter; 2136e8394b8SKazutaka YOKOTA struct video_adapter *adp; 2146e8394b8SKazutaka YOKOTA int initial_mode; /* initial video mode */ 2156e8394b8SKazutaka YOKOTA 2166e8394b8SKazutaka YOKOTA int first_vty; 2176e8394b8SKazutaka YOKOTA int vtys; 218bc093719SEd Schouten struct tty **dev; 2196e8394b8SKazutaka YOKOTA struct scr_stat *cur_scp; 2206e8394b8SKazutaka YOKOTA struct scr_stat *new_scp; 2216e8394b8SKazutaka YOKOTA struct scr_stat *old_scp; 2226e8394b8SKazutaka YOKOTA int delayed_next_scr; 2236e8394b8SKazutaka YOKOTA 2246e8394b8SKazutaka YOKOTA char font_loading_in_progress; 2256e8394b8SKazutaka YOKOTA char switch_in_progress; 2266e8394b8SKazutaka YOKOTA char write_in_progress; 2276e8394b8SKazutaka YOKOTA char blink_in_progress; 2281388e8b1SBruce Evans int grab_level; 229e866ca56SBruce Evans /* 2 is just enough for kdb to grab for stepping normal grabbing: */ 230e866ca56SBruce Evans struct sc_cnstate grab_state[2]; 231e866ca56SBruce Evans int kbd_open_level; 232988129b8SScott Long struct mtx video_mtx; 2336e8394b8SKazutaka YOKOTA 2346e8394b8SKazutaka YOKOTA long scrn_time_stamp; 2356e8394b8SKazutaka YOKOTA 2364866e276SKazutaka YOKOTA struct cursor_attr dflt_curs_attr; 2374866e276SKazutaka YOKOTA struct cursor_attr curs_attr; 2386e8394b8SKazutaka YOKOTA 2396e8394b8SKazutaka YOKOTA u_char scr_map[256]; 2406e8394b8SKazutaka YOKOTA u_char scr_rmap[256]; 2416e8394b8SKazutaka YOKOTA 2426e8394b8SKazutaka YOKOTA #ifdef _SC_MD_SOFTC_DECLARED_ 2436e8394b8SKazutaka YOKOTA sc_md_softc_t md; /* machine dependent vars */ 2446e8394b8SKazutaka YOKOTA #endif 2456e8394b8SKazutaka YOKOTA 2466e8394b8SKazutaka YOKOTA #ifndef SC_NO_PALETTE_LOADING 2476e8394b8SKazutaka YOKOTA u_char palette[256 * 3]; 2488d521790SJung-uk Kim #ifdef SC_PIXEL_MODE 2498d521790SJung-uk Kim u_char palette2[256 * 3]; 2508d521790SJung-uk Kim #endif 2516e8394b8SKazutaka YOKOTA #endif 2526e8394b8SKazutaka YOKOTA 2536e8394b8SKazutaka YOKOTA #ifndef SC_NO_FONT_LOADING 2546e8394b8SKazutaka YOKOTA int fonts_loaded; 2552b944ee2SKazutaka YOKOTA #define FONT_8 2 2562b944ee2SKazutaka YOKOTA #define FONT_14 4 2572b944ee2SKazutaka YOKOTA #define FONT_16 8 258b7c96c0dSMarius Strobl #define FONT_22 8 2596e8394b8SKazutaka YOKOTA u_char *font_8; 2606e8394b8SKazutaka YOKOTA u_char *font_14; 2616e8394b8SKazutaka YOKOTA u_char *font_16; 262b7c96c0dSMarius Strobl u_char *font_22; 2636e8394b8SKazutaka YOKOTA #endif 2646e8394b8SKazutaka YOKOTA 26509132359SKazutaka YOKOTA u_char cursor_char; 266e2f29c6eSKazutaka YOKOTA u_char mouse_char; 267e2f29c6eSKazutaka YOKOTA 268a608af78SRobert Watson #ifdef KDB 269a608af78SRobert Watson int sc_altbrk; 270a608af78SRobert Watson #endif 2716b98f115SDavide Italiano struct callout ctimeout; 2726b98f115SDavide Italiano struct callout cblink; 2736e8394b8SKazutaka YOKOTA } sc_softc_t; 2746e8394b8SKazutaka YOKOTA 2756e8394b8SKazutaka YOKOTA /* virtual screen */ 27617ee9d00SSøren Schmidt typedef struct scr_stat { 2776e8394b8SKazutaka YOKOTA int index; /* index of this vty */ 2786e8394b8SKazutaka YOKOTA struct sc_softc *sc; /* pointer to softc */ 2796e8394b8SKazutaka YOKOTA struct sc_rndr_sw *rndr; /* renderer */ 2806e8394b8SKazutaka YOKOTA sc_vtb_t scr; 2816e8394b8SKazutaka YOKOTA sc_vtb_t vtb; 2822b944ee2SKazutaka YOKOTA 28317ee9d00SSøren Schmidt int xpos; /* current X position */ 28417ee9d00SSøren Schmidt int ypos; /* current Y position */ 285a221620cSSøren Schmidt int xsize; /* X text size */ 286a221620cSSøren Schmidt int ysize; /* Y text size */ 287a221620cSSøren Schmidt int xpixel; /* X graphics size */ 288a221620cSSøren Schmidt int ypixel; /* Y graphics size */ 289a8445737SSøren Schmidt int xoff; /* X offset in pixel mode */ 290a8445737SSøren Schmidt int yoff; /* Y offset in pixel mode */ 2912b944ee2SKazutaka YOKOTA 2926e8394b8SKazutaka YOKOTA u_char *font; /* current font */ 293da040b22SSøren Schmidt int font_size; /* fontsize in Y direction */ 29473b0c907SJake Burkholder int font_width; /* fontsize in X direction */ 2952b944ee2SKazutaka YOKOTA 296736277a9SSøren Schmidt int start; /* modified area start */ 297736277a9SSøren Schmidt int end; /* modified area end */ 2982b944ee2SKazutaka YOKOTA 2992b944ee2SKazutaka YOKOTA struct sc_term_sw *tsw; 3002b944ee2SKazutaka YOKOTA void *ts; 3012b944ee2SKazutaka YOKOTA 30217ee9d00SSøren Schmidt int status; /* status (bitfield) */ 3032ad872c5SKazutaka YOKOTA int kbd_mode; /* keyboard I/O mode */ 3042b944ee2SKazutaka YOKOTA 3056e8394b8SKazutaka YOKOTA int cursor_pos; /* cursor buffer position */ 3066e8394b8SKazutaka YOKOTA int cursor_oldpos; /* cursor old buffer position */ 3074866e276SKazutaka YOKOTA struct cursor_attr dflt_curs_attr; 3084ea1f4f5SBruce Evans struct cursor_attr base_curs_attr; 3094866e276SKazutaka YOKOTA struct cursor_attr curs_attr; 3102b944ee2SKazutaka YOKOTA 3116e8394b8SKazutaka YOKOTA int mouse_pos; /* mouse buffer position */ 3126e8394b8SKazutaka YOKOTA int mouse_oldpos; /* mouse old buffer position */ 31317ee9d00SSøren Schmidt short mouse_xpos; /* mouse x coordinate */ 31417ee9d00SSøren Schmidt short mouse_ypos; /* mouse y coordinate */ 31509132359SKazutaka YOKOTA short mouse_oldxpos; /* mouse previous x coordinate */ 31609132359SKazutaka YOKOTA short mouse_oldypos; /* mouse previous y coordinate */ 317ad0c0c78SSøren Schmidt short mouse_buttons; /* mouse buttons */ 3186e8394b8SKazutaka YOKOTA int mouse_cut_start; /* mouse cut start pos */ 3196e8394b8SKazutaka YOKOTA int mouse_cut_end; /* mouse cut end pos */ 32053e69c0cSEd Schouten int mouse_level; /* xterm mouse protocol */ 321ad0c0c78SSøren Schmidt struct proc *mouse_proc; /* proc* of controlling proc */ 322ad0c0c78SSøren Schmidt pid_t mouse_pid; /* pid of controlling proc */ 323ad0c0c78SSøren Schmidt int mouse_signal; /* signal # to report with */ 32428bbe30cSBruce Evans const void *mouse_data; /* renderer (pixmap) data */ 3252b944ee2SKazutaka YOKOTA 32617ee9d00SSøren Schmidt u_short bell_duration; 32717ee9d00SSøren Schmidt u_short bell_pitch; 3282b944ee2SKazutaka YOKOTA 32917ee9d00SSøren Schmidt u_char border; /* border color */ 33088a5f0ccSKazutaka YOKOTA int mode; /* mode */ 33117ee9d00SSøren Schmidt pid_t pid; /* pid of controlling proc */ 33217ee9d00SSøren Schmidt struct proc *proc; /* proc* of controlling proc */ 33317ee9d00SSøren Schmidt struct vt_mode smode; /* switch mode */ 3342b944ee2SKazutaka YOKOTA 3356e8394b8SKazutaka YOKOTA sc_vtb_t *history; /* circular history buffer */ 3366e8394b8SKazutaka YOKOTA int history_pos; /* position shown on screen */ 33717ee9d00SSøren Schmidt int history_size; /* size of history buffer */ 3382b944ee2SKazutaka YOKOTA 339a8445737SSøren Schmidt int splash_save_mode; /* saved mode for splash screen */ 340a8445737SSøren Schmidt int splash_save_status; /* saved status for splash screen */ 3416e8394b8SKazutaka YOKOTA #ifdef _SCR_MD_STAT_DECLARED_ 3426e8394b8SKazutaka YOKOTA scr_md_stat_t md; /* machine dependent vars */ 3436e8394b8SKazutaka YOKOTA #endif 34417ee9d00SSøren Schmidt } scr_stat; 34517ee9d00SSøren Schmidt 346bc093719SEd Schouten /* TTY softc. */ 347bc093719SEd Schouten typedef struct sc_ttysoftc { 348bc093719SEd Schouten int st_index; 349bc093719SEd Schouten scr_stat *st_stat; 350bc093719SEd Schouten } sc_ttysoftc; 351bc093719SEd Schouten 3526e8394b8SKazutaka YOKOTA #ifndef SC_NORM_ATTR 3536e8394b8SKazutaka YOKOTA #define SC_NORM_ATTR (FG_LIGHTGREY | BG_BLACK) 3546e8394b8SKazutaka YOKOTA #endif 3556e8394b8SKazutaka YOKOTA #ifndef SC_NORM_REV_ATTR 3566e8394b8SKazutaka YOKOTA #define SC_NORM_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 3576e8394b8SKazutaka YOKOTA #endif 3586e8394b8SKazutaka YOKOTA #ifndef SC_KERNEL_CONS_ATTR 3596e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONS_ATTR (FG_WHITE | BG_BLACK) 3606e8394b8SKazutaka YOKOTA #endif 3616e8394b8SKazutaka YOKOTA #ifndef SC_KERNEL_CONS_REV_ATTR 3626e8394b8SKazutaka YOKOTA #define SC_KERNEL_CONS_REV_ATTR (FG_BLACK | BG_LIGHTGREY) 3636e8394b8SKazutaka YOKOTA #endif 364a8445737SSøren Schmidt 3652b944ee2SKazutaka YOKOTA /* terminal emulator */ 3662b944ee2SKazutaka YOKOTA 3672b944ee2SKazutaka YOKOTA #ifndef SC_DFLT_TERM 36819dcee25SBruce Evans #define SC_DFLT_TERM "scteken" 3692b944ee2SKazutaka YOKOTA #endif 3702b944ee2SKazutaka YOKOTA 3712b944ee2SKazutaka YOKOTA typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); 3722b944ee2SKazutaka YOKOTA #define SC_TE_COLD_INIT 0 3732b944ee2SKazutaka YOKOTA #define SC_TE_WARM_INIT 1 3742b944ee2SKazutaka YOKOTA typedef int sc_term_term_t(scr_stat *scp, void **tcp); 375d91400bfSBruce Evans typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); 3762b944ee2SKazutaka YOKOTA typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, 377bc093719SEd Schouten caddr_t data, struct thread *td); 3782b944ee2SKazutaka YOKOTA typedef int sc_term_reset_t(scr_stat *scp, int code); 3792b944ee2SKazutaka YOKOTA #define SC_TE_HARD_RESET 0 3802b944ee2SKazutaka YOKOTA #define SC_TE_SOFT_RESET 1 3812b944ee2SKazutaka YOKOTA typedef void sc_term_default_attr_t(scr_stat *scp, int norm, int rev); 3822b944ee2SKazutaka YOKOTA typedef void sc_term_clear_t(scr_stat *scp); 3832b944ee2SKazutaka YOKOTA typedef void sc_term_notify_t(scr_stat *scp, int event); 3842b944ee2SKazutaka YOKOTA #define SC_TE_NOTIFY_VTSWITCH_IN 0 3852b944ee2SKazutaka YOKOTA #define SC_TE_NOTIFY_VTSWITCH_OUT 1 3862b944ee2SKazutaka YOKOTA typedef int sc_term_input_t(scr_stat *scp, int c, struct tty *tp); 3873a8a07eaSEd Schouten typedef const char *sc_term_fkeystr_t(scr_stat *scp, int c); 388912da699SBruce Evans typedef void sc_term_sync_t(scr_stat *scp); 3892b944ee2SKazutaka YOKOTA 3902b944ee2SKazutaka YOKOTA typedef struct sc_term_sw { 391e3975643SJake Burkholder LIST_ENTRY(sc_term_sw) link; 3922b944ee2SKazutaka YOKOTA char *te_name; /* name of the emulator */ 3932b944ee2SKazutaka YOKOTA char *te_desc; /* description */ 3942b944ee2SKazutaka YOKOTA char *te_renderer; /* matching renderer */ 3952b944ee2SKazutaka YOKOTA size_t te_size; /* size of internal buffer */ 3962b944ee2SKazutaka YOKOTA int te_refcount; /* reference counter */ 3972b944ee2SKazutaka YOKOTA sc_term_init_t *te_init; 3982b944ee2SKazutaka YOKOTA sc_term_term_t *te_term; 3992b944ee2SKazutaka YOKOTA sc_term_puts_t *te_puts; 4002b944ee2SKazutaka YOKOTA sc_term_ioctl_t *te_ioctl; 4012b944ee2SKazutaka YOKOTA sc_term_reset_t *te_reset; 4022b944ee2SKazutaka YOKOTA sc_term_default_attr_t *te_default_attr; 4032b944ee2SKazutaka YOKOTA sc_term_clear_t *te_clear; 4042b944ee2SKazutaka YOKOTA sc_term_notify_t *te_notify; 4052b944ee2SKazutaka YOKOTA sc_term_input_t *te_input; 4063a8a07eaSEd Schouten sc_term_fkeystr_t *te_fkeystr; 407912da699SBruce Evans sc_term_sync_t *te_sync; 4082b944ee2SKazutaka YOKOTA } sc_term_sw_t; 4092b944ee2SKazutaka YOKOTA 4102b944ee2SKazutaka YOKOTA #define SCTERM_MODULE(name, sw) \ 4112b944ee2SKazutaka YOKOTA DATA_SET(scterm_set, sw); \ 4122b944ee2SKazutaka YOKOTA static int \ 4132b944ee2SKazutaka YOKOTA scterm_##name##_event(module_t mod, int type, void *data) \ 4142b944ee2SKazutaka YOKOTA { \ 4152b944ee2SKazutaka YOKOTA switch (type) { \ 4162b944ee2SKazutaka YOKOTA case MOD_LOAD: \ 4172b944ee2SKazutaka YOKOTA return sc_term_add(&sw); \ 4182b944ee2SKazutaka YOKOTA case MOD_UNLOAD: \ 4192b944ee2SKazutaka YOKOTA if (sw.te_refcount > 0) \ 4202b944ee2SKazutaka YOKOTA return EBUSY; \ 4212b944ee2SKazutaka YOKOTA return sc_term_remove(&sw); \ 4222b944ee2SKazutaka YOKOTA default: \ 4233e019deaSPoul-Henning Kamp return EOPNOTSUPP; \ 4242b944ee2SKazutaka YOKOTA break; \ 4252b944ee2SKazutaka YOKOTA } \ 4262b944ee2SKazutaka YOKOTA return 0; \ 4272b944ee2SKazutaka YOKOTA } \ 4282b944ee2SKazutaka YOKOTA static moduledata_t scterm_##name##_mod = { \ 4292b944ee2SKazutaka YOKOTA "scterm-" #name, \ 4302b944ee2SKazutaka YOKOTA scterm_##name##_event, \ 4312b944ee2SKazutaka YOKOTA NULL, \ 4322b944ee2SKazutaka YOKOTA }; \ 4332b944ee2SKazutaka YOKOTA DECLARE_MODULE(scterm_##name, scterm_##name##_mod, \ 4342b944ee2SKazutaka YOKOTA SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 4352b944ee2SKazutaka YOKOTA 4366e8394b8SKazutaka YOKOTA /* renderer function table */ 437f1121206SXin LI typedef void vr_init_t(scr_stat *scp); 4386e8394b8SKazutaka YOKOTA typedef void vr_clear_t(scr_stat *scp, int c, int attr); 4396e8394b8SKazutaka YOKOTA typedef void vr_draw_border_t(scr_stat *scp, int color); 4406e8394b8SKazutaka YOKOTA typedef void vr_draw_t(scr_stat *scp, int from, int count, int flip); 4416e8394b8SKazutaka YOKOTA typedef void vr_set_cursor_t(scr_stat *scp, int base, int height, int blink); 4426e8394b8SKazutaka YOKOTA typedef void vr_draw_cursor_t(scr_stat *scp, int at, int blink, 4436e8394b8SKazutaka YOKOTA int on, int flip); 4446e8394b8SKazutaka YOKOTA typedef void vr_blink_cursor_t(scr_stat *scp, int at, int flip); 4456e8394b8SKazutaka YOKOTA typedef void vr_set_mouse_t(scr_stat *scp); 4466e8394b8SKazutaka YOKOTA typedef void vr_draw_mouse_t(scr_stat *scp, int x, int y, int on); 4476e8394b8SKazutaka YOKOTA 4486e8394b8SKazutaka YOKOTA typedef struct sc_rndr_sw { 449f1121206SXin LI vr_init_t *init; 4506e8394b8SKazutaka YOKOTA vr_clear_t *clear; 4516e8394b8SKazutaka YOKOTA vr_draw_border_t *draw_border; 4526e8394b8SKazutaka YOKOTA vr_draw_t *draw; 4536e8394b8SKazutaka YOKOTA vr_set_cursor_t *set_cursor; 4546e8394b8SKazutaka YOKOTA vr_draw_cursor_t *draw_cursor; 4556e8394b8SKazutaka YOKOTA vr_blink_cursor_t *blink_cursor; 4566e8394b8SKazutaka YOKOTA vr_set_mouse_t *set_mouse; 4576e8394b8SKazutaka YOKOTA vr_draw_mouse_t *draw_mouse; 4586e8394b8SKazutaka YOKOTA } sc_rndr_sw_t; 4596e8394b8SKazutaka YOKOTA 4606e8394b8SKazutaka YOKOTA typedef struct sc_renderer { 4616e8394b8SKazutaka YOKOTA char *name; 4626e8394b8SKazutaka YOKOTA int mode; 4636e8394b8SKazutaka YOKOTA sc_rndr_sw_t *rndrsw; 464e3975643SJake Burkholder LIST_ENTRY(sc_renderer) link; 4656e8394b8SKazutaka YOKOTA } sc_renderer_t; 4666e8394b8SKazutaka YOKOTA 4672b944ee2SKazutaka YOKOTA #define RENDERER(name, mode, sw, set) \ 46822c1cd20SPeter Wemm static struct sc_renderer scrndr_##name##_##mode = { \ 4696e8394b8SKazutaka YOKOTA #name, mode, &sw \ 4706e8394b8SKazutaka YOKOTA }; \ 47122c1cd20SPeter Wemm DATA_SET(scrndr_set, scrndr_##name##_##mode); \ 47222c1cd20SPeter Wemm DATA_SET(set, scrndr_##name##_##mode) 4736e8394b8SKazutaka YOKOTA 4742b944ee2SKazutaka YOKOTA #define RENDERER_MODULE(name, set) \ 475f41325dbSPeter Wemm SET_DECLARE(set, sc_renderer_t); \ 4762b944ee2SKazutaka YOKOTA static int \ 4772b944ee2SKazutaka YOKOTA scrndr_##name##_event(module_t mod, int type, void *data) \ 4782b944ee2SKazutaka YOKOTA { \ 4792b944ee2SKazutaka YOKOTA sc_renderer_t **list; \ 4802b944ee2SKazutaka YOKOTA int error = 0; \ 4812b944ee2SKazutaka YOKOTA switch (type) { \ 4822b944ee2SKazutaka YOKOTA case MOD_LOAD: \ 483f41325dbSPeter Wemm SET_FOREACH(list, set) { \ 484f41325dbSPeter Wemm error = sc_render_add(*list); \ 4852b944ee2SKazutaka YOKOTA if (error) \ 4862b944ee2SKazutaka YOKOTA break; \ 4872b944ee2SKazutaka YOKOTA } \ 4882b944ee2SKazutaka YOKOTA break; \ 4892b944ee2SKazutaka YOKOTA case MOD_UNLOAD: \ 490f41325dbSPeter Wemm SET_FOREACH(list, set) { \ 491f41325dbSPeter Wemm error = sc_render_remove(*list);\ 4922b944ee2SKazutaka YOKOTA if (error) \ 4932b944ee2SKazutaka YOKOTA break; \ 4942b944ee2SKazutaka YOKOTA } \ 4952b944ee2SKazutaka YOKOTA break; \ 4962b944ee2SKazutaka YOKOTA default: \ 4973e019deaSPoul-Henning Kamp return EOPNOTSUPP; \ 4982b944ee2SKazutaka YOKOTA break; \ 4992b944ee2SKazutaka YOKOTA } \ 5002b944ee2SKazutaka YOKOTA return error; \ 5012b944ee2SKazutaka YOKOTA } \ 5022b944ee2SKazutaka YOKOTA static moduledata_t scrndr_##name##_mod = { \ 5032b944ee2SKazutaka YOKOTA "scrndr-" #name, \ 5042b944ee2SKazutaka YOKOTA scrndr_##name##_event, \ 5052b944ee2SKazutaka YOKOTA NULL, \ 5062b944ee2SKazutaka YOKOTA }; \ 50722c1cd20SPeter Wemm DECLARE_MODULE(scrndr_##name, scrndr_##name##_mod, \ 5082b944ee2SKazutaka YOKOTA SI_SUB_DRIVERS, SI_ORDER_MIDDLE) 5096e8394b8SKazutaka YOKOTA 5106e8394b8SKazutaka YOKOTA typedef struct { 5116e8394b8SKazutaka YOKOTA int shift_state; 5126e8394b8SKazutaka YOKOTA int bell_pitch; 5136e8394b8SKazutaka YOKOTA } bios_values_t; 5146e8394b8SKazutaka YOKOTA 5156e8394b8SKazutaka YOKOTA /* other macros */ 516a8445737SSøren Schmidt #define ISTEXTSC(scp) (!((scp)->status \ 517a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))) 518a8445737SSøren Schmidt #define ISGRAPHSC(scp) (((scp)->status \ 519a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE))) 520a8445737SSøren Schmidt #define ISPIXELSC(scp) (((scp)->status \ 521a8445737SSøren Schmidt & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\ 522a8445737SSøren Schmidt == PIXEL_MODE) 523a8445737SSøren Schmidt #define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE) 524a8445737SSøren Schmidt 525a8445737SSøren Schmidt #define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT) 5266e8394b8SKazutaka YOKOTA #define ISFONTAVAIL(af) ((af) & V_ADP_FONT) 527a8445737SSøren Schmidt #define ISPALAVAIL(af) ((af) & V_ADP_PALETTE) 528a8445737SSøren Schmidt 5296e8394b8SKazutaka YOKOTA #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) 5306e8394b8SKazutaka YOKOTA 531988129b8SScott Long #define SC_VIDEO_LOCKINIT(sc) \ 5321d9c3ad3SJohn Baldwin mtx_init(&(sc)->video_mtx, "syscons video lock", NULL, \ 5331d9c3ad3SJohn Baldwin MTX_SPIN | MTX_RECURSE); 534988129b8SScott Long #define SC_VIDEO_LOCK(sc) \ 535988129b8SScott Long do { \ 536d350ce61SBruce Evans if (!kdb_active) \ 537988129b8SScott Long mtx_lock_spin(&(sc)->video_mtx); \ 538988129b8SScott Long } while(0) 539988129b8SScott Long #define SC_VIDEO_UNLOCK(sc) \ 540988129b8SScott Long do { \ 541d350ce61SBruce Evans if (!kdb_active) \ 542988129b8SScott Long mtx_unlock_spin(&(sc)->video_mtx); \ 543988129b8SScott Long } while(0) 544988129b8SScott Long 545a8445737SSøren Schmidt /* syscons.c */ 546bc093719SEd Schouten extern int (*sc_user_ioctl)(struct tty *tp, u_long cmd, caddr_t data, 547bc093719SEd Schouten struct thread *td); 5486e8394b8SKazutaka YOKOTA 549f359876fSKazutaka YOKOTA int sc_probe_unit(int unit, int flags); 550f359876fSKazutaka YOKOTA int sc_attach_unit(int unit, int flags); 551a8445737SSøren Schmidt 552a8445737SSøren Schmidt int set_mode(scr_stat *scp); 553a8445737SSøren Schmidt 5542b944ee2SKazutaka YOKOTA void sc_set_border(scr_stat *scp, int color); 555b7c96c0dSMarius Strobl void sc_load_font(scr_stat *scp, int page, int size, int width, 556b7c96c0dSMarius Strobl u_char *font, int base, int count); 557b7c96c0dSMarius Strobl void sc_save_font(scr_stat *scp, int page, int size, int width, 558b7c96c0dSMarius Strobl u_char *font, int base, int count); 5592b944ee2SKazutaka YOKOTA void sc_show_font(scr_stat *scp, int page); 560a8445737SSøren Schmidt 5612ad872c5SKazutaka YOKOTA void sc_touch_scrn_saver(void); 5622b944ee2SKazutaka YOKOTA void sc_draw_cursor_image(scr_stat *scp); 5632b944ee2SKazutaka YOKOTA void sc_remove_cursor_image(scr_stat *scp); 5646e8394b8SKazutaka YOKOTA void sc_set_cursor_image(scr_stat *scp); 5654866e276SKazutaka YOKOTA void sc_change_cursor_shape(scr_stat *scp, int flags, 5664866e276SKazutaka YOKOTA int base, int height); 567a8445737SSøren Schmidt int sc_clean_up(scr_stat *scp); 5682b944ee2SKazutaka YOKOTA int sc_switch_scr(sc_softc_t *sc, u_int next_scr); 5696e8394b8SKazutaka YOKOTA void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); 5702b944ee2SKazutaka YOKOTA int sc_init_emulator(scr_stat *scp, char *name); 571b4b1c516SEd Schouten void sc_paste(scr_stat *scp, const u_char *p, int count); 57253e69c0cSEd Schouten void sc_respond(scr_stat *scp, const u_char *p, 57353e69c0cSEd Schouten int count, int wakeup); 5742b944ee2SKazutaka YOKOTA void sc_bell(scr_stat *scp, int pitch, int duration); 5756e8394b8SKazutaka YOKOTA 5766e8394b8SKazutaka YOKOTA /* schistory.c */ 5776e8394b8SKazutaka YOKOTA #ifndef SC_NO_HISTORY 578c4c9400bSKazutaka YOKOTA int sc_alloc_history_buffer(scr_stat *scp, int lines, 579c4c9400bSKazutaka YOKOTA int prev_ysize, int wait); 580c4c9400bSKazutaka YOKOTA void sc_free_history_buffer(scr_stat *scp, int prev_ysize); 5816e8394b8SKazutaka YOKOTA void sc_hist_save(scr_stat *scp); 5826e8394b8SKazutaka YOKOTA #define sc_hist_save_one_line(scp, from) \ 5836e8394b8SKazutaka YOKOTA sc_vtb_append(&(scp)->vtb, (from), (scp)->history, (scp)->xsize) 5846e8394b8SKazutaka YOKOTA int sc_hist_restore(scr_stat *scp); 5856e8394b8SKazutaka YOKOTA void sc_hist_home(scr_stat *scp); 5866e8394b8SKazutaka YOKOTA void sc_hist_end(scr_stat *scp); 5876e8394b8SKazutaka YOKOTA int sc_hist_up_line(scr_stat *scp); 5886e8394b8SKazutaka YOKOTA int sc_hist_down_line(scr_stat *scp); 5896e8394b8SKazutaka YOKOTA int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, 590bc093719SEd Schouten struct thread *td); 5916e8394b8SKazutaka YOKOTA #endif /* SC_NO_HISTORY */ 5926e8394b8SKazutaka YOKOTA 5936e8394b8SKazutaka YOKOTA /* scmouse.c */ 5946e8394b8SKazutaka YOKOTA #ifndef SC_NO_CUTPASTE 5956e8394b8SKazutaka YOKOTA void sc_alloc_cut_buffer(scr_stat *scp, int wait); 5966e8394b8SKazutaka YOKOTA void sc_draw_mouse_image(scr_stat *scp); 5976e8394b8SKazutaka YOKOTA void sc_remove_mouse_image(scr_stat *scp); 5986e8394b8SKazutaka YOKOTA int sc_inside_cutmark(scr_stat *scp, int pos); 5996e8394b8SKazutaka YOKOTA void sc_remove_cutmarking(scr_stat *scp); 6006e8394b8SKazutaka YOKOTA void sc_remove_all_cutmarkings(sc_softc_t *scp); 6016e8394b8SKazutaka YOKOTA void sc_remove_all_mouse(sc_softc_t *scp); 6024629b5e0SAndrey A. Chernov void sc_mouse_paste(scr_stat *scp); 6036e8394b8SKazutaka YOKOTA #else 604c2c86c2bSKazutaka YOKOTA #define sc_draw_mouse_image(scp) 605c2c86c2bSKazutaka YOKOTA #define sc_remove_mouse_image(scp) 6066e8394b8SKazutaka YOKOTA #define sc_inside_cutmark(scp, pos) FALSE 6076e8394b8SKazutaka YOKOTA #define sc_remove_cutmarking(scp) 608c2c86c2bSKazutaka YOKOTA #define sc_remove_all_cutmarkings(scp) 609c2c86c2bSKazutaka YOKOTA #define sc_remove_all_mouse(scp) 6104629b5e0SAndrey A. Chernov #define sc_mouse_paste(scp) 6116e8394b8SKazutaka YOKOTA #endif /* SC_NO_CUTPASTE */ 6126e8394b8SKazutaka YOKOTA #ifndef SC_NO_SYSMOUSE 6136e8394b8SKazutaka YOKOTA void sc_mouse_move(scr_stat *scp, int x, int y); 6146e8394b8SKazutaka YOKOTA int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, 615bc093719SEd Schouten struct thread *td); 6166e8394b8SKazutaka YOKOTA #endif /* SC_NO_SYSMOUSE */ 617a8445737SSøren Schmidt 618a8445737SSøren Schmidt /* scvidctl.c */ 619a8445737SSøren Schmidt int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, 62086330afeSCraig Rodrigues int xsize, int ysize, int fontsize, 62186330afeSCraig Rodrigues int font_width); 622a8445737SSøren Schmidt int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); 62386330afeSCraig Rodrigues int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, 62486330afeSCraig Rodrigues int ysize, int fontsize, int font_width); 6254a9b63a4SJung-uk Kim int sc_support_pixel_mode(void *arg); 626bc093719SEd Schouten int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, 627b40ce416SJulian Elischer struct thread *td); 628a8445737SSøren Schmidt 6292b944ee2SKazutaka YOKOTA int sc_render_add(sc_renderer_t *rndr); 6302b944ee2SKazutaka YOKOTA int sc_render_remove(sc_renderer_t *rndr); 6312b944ee2SKazutaka YOKOTA sc_rndr_sw_t *sc_render_match(scr_stat *scp, char *name, int mode); 6322b944ee2SKazutaka YOKOTA 6336e8394b8SKazutaka YOKOTA /* scvtb.c */ 6346e8394b8SKazutaka YOKOTA void sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, 6356e8394b8SKazutaka YOKOTA void *buffer, int wait); 6366e8394b8SKazutaka YOKOTA void sc_vtb_destroy(sc_vtb_t *vtb); 6376e8394b8SKazutaka YOKOTA size_t sc_vtb_size(int cols, int rows); 6386e8394b8SKazutaka YOKOTA void sc_vtb_clear(sc_vtb_t *vtb, int c, int attr); 6396e8394b8SKazutaka YOKOTA 6406e8394b8SKazutaka YOKOTA int sc_vtb_getc(sc_vtb_t *vtb, int at); 6416e8394b8SKazutaka YOKOTA int sc_vtb_geta(sc_vtb_t *vtb, int at); 6426e8394b8SKazutaka YOKOTA void sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a); 6436e8394b8SKazutaka YOKOTA vm_offset_t sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a); 6446e8394b8SKazutaka YOKOTA vm_offset_t sc_vtb_pointer(sc_vtb_t *vtb, int at); 6456e8394b8SKazutaka YOKOTA int sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset); 6466e8394b8SKazutaka YOKOTA 6476e8394b8SKazutaka YOKOTA #define sc_vtb_tail(vtb) ((vtb)->vtb_tail) 6486e8394b8SKazutaka YOKOTA #define sc_vtb_rows(vtb) ((vtb)->vtb_rows) 649d94eccc2SKazutaka YOKOTA #define sc_vtb_cols(vtb) ((vtb)->vtb_cols) 6506e8394b8SKazutaka YOKOTA 6516e8394b8SKazutaka YOKOTA void sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, 6526e8394b8SKazutaka YOKOTA int count); 6536e8394b8SKazutaka YOKOTA void sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, 6546e8394b8SKazutaka YOKOTA int count); 6556e8394b8SKazutaka YOKOTA void sc_vtb_seek(sc_vtb_t *vtb, int pos); 6566e8394b8SKazutaka YOKOTA void sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr); 6577107ea4aSKazutaka YOKOTA void sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count); 6586e8394b8SKazutaka YOKOTA void sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr); 6596e8394b8SKazutaka YOKOTA void sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr); 6606e8394b8SKazutaka YOKOTA 6612b944ee2SKazutaka YOKOTA /* sysmouse.c */ 6622b944ee2SKazutaka YOKOTA int sysmouse_event(mouse_info_t *info); 6632b944ee2SKazutaka YOKOTA 6642b944ee2SKazutaka YOKOTA /* scterm.c */ 6652b944ee2SKazutaka YOKOTA void sc_move_cursor(scr_stat *scp, int x, int y); 6662b944ee2SKazutaka YOKOTA void sc_clear_screen(scr_stat *scp); 6672b944ee2SKazutaka YOKOTA int sc_term_add(sc_term_sw_t *sw); 6682b944ee2SKazutaka YOKOTA int sc_term_remove(sc_term_sw_t *sw); 6692b944ee2SKazutaka YOKOTA sc_term_sw_t *sc_term_match(char *name); 6702b944ee2SKazutaka YOKOTA sc_term_sw_t *sc_term_match_by_number(int index); 6712b944ee2SKazutaka YOKOTA 6726e8394b8SKazutaka YOKOTA /* machine dependent functions */ 6736e8394b8SKazutaka YOKOTA int sc_max_unit(void); 6746e8394b8SKazutaka YOKOTA sc_softc_t *sc_get_softc(int unit, int flags); 6756e8394b8SKazutaka YOKOTA sc_softc_t *sc_find_softc(struct video_adapter *adp, struct keyboard *kbd); 6766e8394b8SKazutaka YOKOTA int sc_get_cons_priority(int *unit, int *flags); 6776e8394b8SKazutaka YOKOTA void sc_get_bios_values(bios_values_t *values); 6786e8394b8SKazutaka YOKOTA int sc_tone(int herz); 6796e8394b8SKazutaka YOKOTA 6802ad872c5SKazutaka YOKOTA #endif /* !_DEV_SYSCONS_SYSCONS_H_ */ 681