The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/syscons/syscons.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 8c8747ad79716971160daaf4c4bb48ce


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.