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