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