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