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