syscons.h revision 55849
1193326Sed/*-
2193326Sed * Copyright (c) 1995-1998 S�ren Schmidt
3193326Sed * All rights reserved.
4193326Sed *
5193326Sed * Redistribution and use in source and binary forms, with or without
6193326Sed * modification, are permitted provided that the following conditions
7193326Sed * are met:
8193326Sed * 1. Redistributions of source code must retain the above copyright
9193326Sed *    notice, this list of conditions and the following disclaimer,
10193326Sed *    without modification, immediately at the beginning of the file.
11193326Sed * 2. Redistributions in binary form must reproduce the above copyright
12193326Sed *    notice, this list of conditions and the following disclaimer in the
13193326Sed *    documentation and/or other materials provided with the distribution.
14193326Sed * 3. The name of the author may not be used to endorse or promote products
15193326Sed *    derived from this software without specific prior written permission.
16193326Sed *
17193326Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18193326Sed * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19198092Srdivacky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20193326Sed * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21193326Sed * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22193326Sed * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23193326Sed * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24193326Sed * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25193326Sed * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26193326Sed * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27193326Sed *
28193326Sed * $FreeBSD: head/sys/dev/syscons/syscons.h 55849 2000-01-12 12:30:33Z yokota $
29193326Sed */
30193326Sed
31193326Sed#ifndef _DEV_SYSCONS_SYSCONS_H_
32193326Sed#define	_DEV_SYSCONS_SYSCONS_H_
33193326Sed
34193326Sed/* machine-dependent part of the header */
35193326Sed
36193326Sed#ifdef PC98
37208600Srdivacky#include <pc98/pc98/sc_machdep.h>
38193326Sed#elif defined(__i386__)
39193326Sed/* nothing for the moment */
40193326Sed#elif defined(__alpha__)
41193326Sed/* nothing for the moment */
42193326Sed#endif
43193326Sed
44193326Sed/* default values for configuration options */
45193326Sed
46193326Sed#ifndef MAXCONS
47198092Srdivacky#define MAXCONS		16
48193326Sed#endif
49193326Sed
50193326Sed#ifdef SC_NO_SYSMOUSE
51193326Sed#undef SC_NO_CUTPASTE
52193326Sed#define SC_NO_CUTPASTE	1
53193326Sed#endif
54193326Sed
55193326Sed#ifdef SC_NO_MODE_CHANGE
56193326Sed#undef SC_PIXEL_MODE
57208600Srdivacky#endif
58208600Srdivacky
59193326Sed#ifndef SC_MOUSE_CHAR
60193326Sed#define SC_MOUSE_CHAR	(0xd0)
61194179Sed#endif
62208600Srdivacky
63208600Srdivacky#ifndef SC_DEBUG_LEVEL
64194179Sed#define SC_DEBUG_LEVEL	0
65194179Sed#endif
66193326Sed
67193326Sed#define DPRINTF(l, p)	if (SC_DEBUG_LEVEL >= (l)) printf p
68193326Sed
69193326Sed#define SC_DRIVER_NAME	"sc"
70193326Sed#define SC_VTY(dev)	minor(dev)
71193326Sed#define SC_DEV(sc, vty)	((sc)->dev[(vty) - (sc)->first_vty])
72193326Sed#define SC_STAT(dev)	((scr_stat *)(dev)->si_drv1)
73193326Sed
74193326Sed/* printable chars */
75193326Sed#ifndef PRINTABLE
76193326Sed#define PRINTABLE(ch)	((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \
77193326Sed			 || (ch) < 0x07)
78193326Sed#endif
79193326Sed
80193326Sed/* macros for "intelligent" screen update */
81193326Sed#define mark_for_update(scp, x)	{\
82193326Sed			  	    if ((x) < scp->start) scp->start = (x);\
83193326Sed				    else if ((x) > scp->end) scp->end = (x);\
84208600Srdivacky				}
85208600Srdivacky#define mark_all(scp)		{\
86193326Sed				    scp->start = 0;\
87193326Sed				    scp->end = scp->xsize * scp->ysize - 1;\
88193326Sed				}
89198092Srdivacky
90193326Sed/* vty status flags (scp->status) */
91193326Sed#define UNKNOWN_MODE	0x00010
92193326Sed#define SWITCH_WAIT_REL	0x00080
93193326Sed#define SWITCH_WAIT_ACQ	0x00100
94193326Sed#define BUFFER_SAVED	0x00200
95193326Sed#define CURSOR_ENABLED 	0x00400
96193326Sed#define MOUSE_MOVED	0x01000
97193326Sed#define MOUSE_CUTTING	0x02000
98193326Sed#define MOUSE_VISIBLE	0x04000
99193326Sed#define GRAPHICS_MODE	0x08000
100193326Sed#define PIXEL_MODE	0x10000
101193326Sed#define SAVER_RUNNING	0x20000
102198092Srdivacky#define VR_CURSOR_BLINK	0x40000
103198092Srdivacky#define VR_CURSOR_ON	0x80000
104198092Srdivacky
105198092Srdivacky/* attribute flags */
106193326Sed#define NORMAL_ATTR             0x00
107193326Sed#define BLINK_ATTR              0x01
108193326Sed#define BOLD_ATTR               0x02
109193326Sed#define UNDERLINE_ATTR          0x04
110198092Srdivacky#define REVERSE_ATTR            0x08
111193326Sed#define FOREGROUND_CHANGED      0x10
112208600Srdivacky#define BACKGROUND_CHANGED      0x20
113193326Sed
114193326Sed/* misc defines */
115193326Sed#define FALSE		0
116193326Sed#define TRUE		1
117193326Sed#define MAX_ESC_PAR 	5
118193326Sed#define	LOAD		1
119193326Sed#define SAVE		0
120193326Sed#define	COL		80
121193326Sed#define	ROW		25
122193326Sed#define CONSOLE_BUFSIZE 1024
123193326Sed#define PCBURST		128
124193326Sed#define FONT_NONE	1
125193326Sed#define FONT_8		2
126193326Sed#define FONT_14		4
127193326Sed#define FONT_16		8
128193326Sed
129193326Sed#ifndef BELL_DURATION
130193326Sed#define BELL_DURATION	5
131198092Srdivacky#define BELL_PITCH	800
132193326Sed#endif
133198092Srdivacky
134198092Srdivacky/* special characters */
135198092Srdivacky#define cntlc		0x03
136198092Srdivacky#define cntld		0x04
137193326Sed#define bs		0x08
138208600Srdivacky#define lf		0x0a
139208600Srdivacky#define cr		0x0d
140193326Sed#define del		0x7f
141193326Sed
142193326Sed#define DEAD_CHAR 	0x07			/* char used for cursor */
143193326Sed
144198092Srdivacky/* virtual terminal buffer */
145193326Sedtypedef struct sc_vtb {
146193326Sed	int		vtb_flags;
147193326Sed#define VTB_VALID	(1 << 0)
148208600Srdivacky	int		vtb_type;
149208600Srdivacky#define VTB_INVALID	0
150208600Srdivacky#define VTB_MEMORY	1
151193326Sed#define VTB_FRAMEBUFFER	2
152193326Sed#define VTB_RINGBUFFER	3
153208600Srdivacky	int		vtb_cols;
154208600Srdivacky	int		vtb_rows;
155208600Srdivacky	int		vtb_size;
156193326Sed	vm_offset_t	vtb_buffer;
157193326Sed	int		vtb_tail;	/* valid for VTB_RINGBUFFER only */
158193326Sed} sc_vtb_t;
159193326Sed
160193326Sed/* terminal status */
161193326Sedtypedef struct term_stat {
162198092Srdivacky	int 		esc;			/* processing escape sequence */
163193326Sed	int 		num_param;		/* # of parameters to ESC */
164193326Sed	int	 	last_param;		/* last parameter # */
165193326Sed	int 		param[MAX_ESC_PAR];	/* contains ESC parameters */
166193326Sed	int             cur_attr;               /* current hardware attr word */
167193326Sed	int             attr_mask;              /* current logical attr mask */
168193326Sed	int             cur_color;              /* current hardware color */
169193326Sed	int             std_color;              /* normal hardware color */
170198092Srdivacky	int             rev_color;              /* reverse hardware color */
171198092Srdivacky} term_stat;
172208600Srdivacky
173208600Srdivacky/* softc */
174193326Sed
175193326Sedstruct keyboard;
176193326Sedstruct video_adapter;
177198092Srdivackystruct scr_stat;
178193326Sedstruct tty;
179193326Sed
180198092Srdivackytypedef struct sc_softc {
181193326Sed	int		unit;			/* unit # */
182193326Sed	int		config;			/* configuration flags */
183193326Sed#define SC_VESA800X600	(1 << 7)
184193326Sed#define SC_AUTODETECT_KBD (1 << 8)
185208600Srdivacky#define SC_KERNEL_CONSOLE (1 << 9)
186208600Srdivacky
187193326Sed	int		flags;			/* status flags */
188193326Sed#define SC_VISUAL_BELL	(1 << 0)
189193326Sed#define SC_QUIET_BELL	(1 << 1)
190193326Sed#define SC_BLINK_CURSOR	(1 << 2)
191198092Srdivacky#define SC_CHAR_CURSOR	(1 << 3)
192193326Sed#define SC_MOUSE_ENABLED (1 << 4)
193193326Sed#define	SC_SCRN_IDLE	(1 << 5)
194193326Sed#define	SC_SCRN_BLANKED	(1 << 6)
195193326Sed#define	SC_SAVER_FAILED	(1 << 7)
196193326Sed
197193326Sed#define	SC_INIT_DONE	(1 << 16)
198193326Sed#define	SC_SPLASH_SCRN	(1 << 17)
199193326Sed
200193326Sed	int		keyboard;		/* -1 if unavailable */
201193326Sed	struct keyboard	*kbd;
202208600Srdivacky
203208600Srdivacky	int		adapter;
204208600Srdivacky	struct video_adapter *adp;
205193326Sed	int		initial_mode;		/* initial video mode */
206193326Sed
207193326Sed	int		first_vty;
208198092Srdivacky	int		vtys;
209193326Sed	dev_t		*dev;
210193326Sed	struct scr_stat	*cur_scp;
211198092Srdivacky	struct scr_stat	*new_scp;
212193326Sed	struct scr_stat	*old_scp;
213208600Srdivacky	int     	delayed_next_scr;
214208600Srdivacky
215193326Sed	char        	font_loading_in_progress;
216193326Sed	char        	switch_in_progress;
217193326Sed	char        	videoio_in_progress;
218193326Sed	char        	write_in_progress;
219193326Sed	char        	blink_in_progress;
220193326Sed
221198092Srdivacky	long		scrn_time_stamp;
222193326Sed
223193326Sed	char		cursor_base;
224193326Sed	char		cursor_height;
225193326Sed
226193326Sed	u_char      	scr_map[256];
227193326Sed	u_char      	scr_rmap[256];
228193326Sed
229193326Sed#ifdef _SC_MD_SOFTC_DECLARED_
230193326Sed	sc_md_softc_t	md;			/* machine dependent vars */
231193326Sed#endif
232193326Sed
233198092Srdivacky#ifndef SC_NO_PALETTE_LOADING
234193326Sed	u_char        	palette[256*3];
235193326Sed#endif
236198092Srdivacky
237193326Sed#ifndef SC_NO_FONT_LOADING
238193326Sed	int     	fonts_loaded;
239198092Srdivacky	u_char		*font_8;
240193326Sed	u_char		*font_14;
241193326Sed	u_char		*font_16;
242193326Sed#endif
243193326Sed
244193326Sed	u_char		mouse_char;
245193326Sed
246193326Sed} sc_softc_t;
247193326Sed
248193326Sed/* virtual screen */
249193326Sedtypedef struct scr_stat {
250193326Sed	int		index;			/* index of this vty */
251193326Sed	struct sc_softc *sc;			/* pointer to softc */
252193326Sed	struct sc_rndr_sw *rndr;		/* renderer */
253193326Sed	sc_vtb_t	scr;
254193326Sed	sc_vtb_t	vtb;
255193326Sed	int 		xpos;			/* current X position */
256193326Sed	int 		ypos;			/* current Y position */
257193326Sed	int             saved_xpos;             /* saved X position */
258193326Sed	int             saved_ypos;             /* saved Y position */
259198092Srdivacky	int 		xsize;			/* X text size */
260193326Sed	int 		ysize;			/* Y text size */
261193326Sed	int 		xpixel;			/* X graphics size */
262198092Srdivacky	int 		ypixel;			/* Y graphics size */
263193326Sed	int		xoff;			/* X offset in pixel mode */
264193326Sed	int		yoff;			/* Y offset in pixel mode */
265198092Srdivacky	u_char		*font;			/* current font */
266193326Sed	int		font_size;		/* fontsize in Y direction */
267193326Sed	int		start;			/* modified area start */
268193326Sed	int		end;			/* modified area end */
269193326Sed	term_stat 	term;			/* terminal emulation stuff */
270193326Sed	int	 	status;			/* status (bitfield) */
271193326Sed	int		kbd_mode;		/* keyboard I/O mode */
272193326Sed	int		cursor_pos;		/* cursor buffer position */
273193326Sed	int		cursor_oldpos;		/* cursor old buffer position */
274193326Sed	u_short		cursor_saveunder_char;	/* saved char under cursor */
275193326Sed	u_short		cursor_saveunder_attr;	/* saved attr under cursor */
276193326Sed	char		cursor_base;		/* cursor base line # */
277193326Sed	char		cursor_height;		/* cursor height */
278193326Sed	int		mouse_pos;		/* mouse buffer position */
279193326Sed	int		mouse_oldpos;		/* mouse old buffer position */
280193326Sed	short		mouse_xpos;		/* mouse x coordinate */
281193326Sed	short		mouse_ypos;		/* mouse y coordinate */
282193326Sed	short		mouse_buttons;		/* mouse buttons */
283193326Sed	int		mouse_cut_start;	/* mouse cut start pos */
284193326Sed	int		mouse_cut_end;		/* mouse cut end pos */
285193326Sed	struct proc 	*mouse_proc;		/* proc* of controlling proc */
286193326Sed	pid_t 		mouse_pid;		/* pid of controlling proc */
287198092Srdivacky	int		mouse_signal;		/* signal # to report with */
288193326Sed	u_short		bell_duration;
289193326Sed	u_short		bell_pitch;
290193326Sed	u_char		border;			/* border color */
291193326Sed	int	 	mode;			/* mode */
292193326Sed	pid_t 		pid;			/* pid of controlling proc */
293193326Sed	struct proc 	*proc;			/* proc* of controlling proc */
294193326Sed	struct vt_mode 	smode;			/* switch mode */
295193326Sed	sc_vtb_t	*history;		/* circular history buffer */
296193326Sed	int		history_pos;		/* position shown on screen */
297198092Srdivacky	int		history_size;		/* size of history buffer */
298193326Sed	int		splash_save_mode;	/* saved mode for splash screen */
299193326Sed	int		splash_save_status;	/* saved status for splash screen */
300193326Sed#ifdef _SCR_MD_STAT_DECLARED_
301193326Sed	scr_md_stat_t	md;			/* machine dependent vars */
302193326Sed#endif
303193326Sed} scr_stat;
304198092Srdivacky
305193326Sedtypedef struct default_attr {
306193326Sed	int             std_color;              /* normal hardware color */
307193326Sed	int             rev_color;              /* reverse hardware color */
308193326Sed} default_attr;
309193326Sed
310193326Sed#ifndef SC_NORM_ATTR
311193326Sed#define SC_NORM_ATTR		(FG_LIGHTGREY | BG_BLACK)
312193326Sed#endif
313198092Srdivacky#ifndef SC_NORM_REV_ATTR
314193326Sed#define SC_NORM_REV_ATTR	(FG_BLACK | BG_LIGHTGREY)
315198092Srdivacky#endif
316193326Sed#ifndef SC_KERNEL_CONS_ATTR
317193326Sed#define SC_KERNEL_CONS_ATTR	(FG_WHITE | BG_BLACK)
318193326Sed#endif
319193326Sed#ifndef SC_KERNEL_CONS_REV_ATTR
320193326Sed#define SC_KERNEL_CONS_REV_ATTR	(FG_BLACK | BG_LIGHTGREY)
321193326Sed#endif
322193326Sed
323193326Sed/* renderer function table */
324193326Sedtypedef void	vr_clear_t(scr_stat *scp, int c, int attr);
325193326Sedtypedef void	vr_draw_border_t(scr_stat *scp, int color);
326193326Sedtypedef void	vr_draw_t(scr_stat *scp, int from, int count, int flip);
327193326Sedtypedef void	vr_set_cursor_t(scr_stat *scp, int base, int height, int blink);
328193326Sedtypedef void	vr_draw_cursor_t(scr_stat *scp, int at, int blink,
329193326Sed				 int on, int flip);
330193326Sedtypedef void	vr_blink_cursor_t(scr_stat *scp, int at, int flip);
331193326Sedtypedef void	vr_set_mouse_t(scr_stat *scp);
332193326Sedtypedef void	vr_draw_mouse_t(scr_stat *scp, int x, int y, int on);
333193326Sed
334198092Srdivackytypedef struct sc_rndr_sw {
335193326Sed	vr_clear_t		*clear;
336193326Sed	vr_draw_border_t	*draw_border;
337193326Sed	vr_draw_t		*draw;
338193326Sed	vr_set_cursor_t		*set_cursor;
339193326Sed	vr_draw_cursor_t	*draw_cursor;
340193326Sed	vr_blink_cursor_t	*blink_cursor;
341193326Sed	vr_set_mouse_t		*set_mouse;
342193326Sed	vr_draw_mouse_t		*draw_mouse;
343193326Sed} sc_rndr_sw_t;
344193326Sed
345193326Sedtypedef struct sc_renderer {
346193326Sed	char		*name;
347193326Sed	int		mode;
348193326Sed	sc_rndr_sw_t	*rndrsw;
349193326Sed} sc_renderer_t;
350193326Sed
351193326Sed#define RENDERER(name, mode, sw)				\
352193326Sed	static struct sc_renderer name##_##mode##_renderer = {	\
353198092Srdivacky		#name, mode, &sw				\
354193326Sed	};							\
355193326Sed	DATA_SET(scrndr_set, name##_##mode##_renderer)
356193326Sed
357198092Srdivackyextern struct linker_set scrndr_set;
358193326Sed
359193326Sedtypedef struct {
360193326Sed	int		cursor_start;
361193326Sed	int		cursor_end;
362193326Sed	int		shift_state;
363193326Sed	int		bell_pitch;
364193326Sed} bios_values_t;
365193326Sed
366193326Sed/* other macros */
367193326Sed#define ISTEXTSC(scp)	(!((scp)->status 				\
368193326Sed			  & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE)))
369193326Sed#define ISGRAPHSC(scp)	(((scp)->status 				\
370193326Sed			  & (UNKNOWN_MODE | GRAPHICS_MODE)))
371193326Sed#define ISPIXELSC(scp)	(((scp)->status 				\
372193326Sed			  & (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\
373193326Sed			  == PIXEL_MODE)
374193326Sed#define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE)
375193326Sed
376193326Sed#ifndef ISMOUSEAVAIL
377193326Sed#ifdef SC_ALT_MOUSE_IMAGE
378198092Srdivacky#define ISMOUSEAVAIL(af) (1)
379193326Sed#else
380193326Sed#define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT)
381193326Sed#endif /* SC_ALT_MOUSE_IMAGE */
382193326Sed#define ISFONTAVAIL(af)	((af) & V_ADP_FONT)
383193326Sed#define ISPALAVAIL(af)	((af) & V_ADP_PALETTE)
384193326Sed#endif /* ISMOUSEAVAIL */
385193326Sed
386193326Sed#define ISSIGVALID(sig)	((sig) > 0 && (sig) < NSIG)
387193326Sed
388193326Sed#define kbd_read_char(kbd, wait)					\
389193326Sed		(*kbdsw[(kbd)->kb_index]->read_char)((kbd), (wait))
390202879Srdivacky#define kbd_check_char(kbd)						\
391199990Srdivacky		(*kbdsw[(kbd)->kb_index]->check_char)((kbd))
392193326Sed#define kbd_enable(kbd)							\
393198092Srdivacky		(*kbdsw[(kbd)->kb_index]->enable)((kbd))
394198092Srdivacky#define kbd_disable(kbd)						\
395198092Srdivacky		(*kbdsw[(kbd)->kb_index]->disable)((kbd))
396198092Srdivacky#define kbd_lock(kbd, lockf)						\
397198092Srdivacky		(*kbdsw[(kbd)->kb_index]->lock)((kbd), (lockf))
398199990Srdivacky#define kbd_ioctl(kbd, cmd, arg)					\
399198092Srdivacky	    (((kbd) == NULL) ?						\
400199990Srdivacky		ENODEV : (*kbdsw[(kbd)->kb_index]->ioctl)((kbd), (cmd), (arg)))
401199990Srdivacky#define kbd_clear_state(kbd)						\
402199990Srdivacky		(*kbdsw[(kbd)->kb_index]->clear_state)((kbd))
403199990Srdivacky#define kbd_get_fkeystr(kbd, fkey, len)					\
404199990Srdivacky		(*kbdsw[(kbd)->kb_index]->get_fkeystr)((kbd), (fkey), (len))
405198092Srdivacky#define kbd_poll(kbd, on)						\
406198092Srdivacky		(*kbdsw[(kbd)->kb_index]->poll)((kbd), (on))
407199990Srdivacky
408198092Srdivacky/* syscons.c */
409199990Srdivackyextern int 	(*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data,
410199990Srdivacky				 int flag, struct proc *p);
411198092Srdivacky
412199990Srdivackyint		sc_probe_unit(int unit, int flags);
413198092Srdivackyint		sc_attach_unit(int unit, int flags);
414199990Srdivackyint		sc_resume_unit(int unit);
415199990Srdivacky
416198092Srdivackyint		set_mode(scr_stat *scp);
417199990Srdivacky
418198092Srdivackyvoid		copy_font(scr_stat *scp, int operation, int font_size,
419198092Srdivacky			  u_char *font_image);
420198092Srdivackyvoid		set_border(scr_stat *scp, int color);
421198092Srdivacky
422193326Sedvoid		sc_touch_scrn_saver(void);
423193326Sedvoid		sc_clear_screen(scr_stat *scp);
424193326Sedvoid		sc_set_cursor_image(scr_stat *scp);
425193326Sedint		sc_clean_up(scr_stat *scp);
426193326Sedvoid		sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard);
427193326Sed#ifndef SC_NO_SYSMOUSE
428193326Sedstruct tty	*sc_get_mouse_tty(void);
429193326Sed#endif /* SC_NO_SYSMOUSE */
430193326Sed#ifndef SC_NO_CUTPASTE
431193326Sedvoid		sc_paste(scr_stat *scp, u_char *p, int count);
432193326Sed#endif /* SC_NO_CUTPASTE */
433193326Sed
434193326Sed/* schistory.c */
435193326Sed#ifndef SC_NO_HISTORY
436193326Sedint		sc_alloc_history_buffer(scr_stat *scp, int lines,
437198092Srdivacky					int prev_ysize, int wait);
438193326Sedvoid		sc_free_history_buffer(scr_stat *scp, int prev_ysize);
439193326Sedvoid		sc_hist_save(scr_stat *scp);
440193326Sed#define		sc_hist_save_one_line(scp, from)	\
441193326Sed		sc_vtb_append(&(scp)->vtb, (from), (scp)->history, (scp)->xsize)
442193326Sedint		sc_hist_restore(scr_stat *scp);
443193326Sedvoid		sc_hist_home(scr_stat *scp);
444193326Sedvoid		sc_hist_end(scr_stat *scp);
445193326Sedint		sc_hist_up_line(scr_stat *scp);
446193326Sedint		sc_hist_down_line(scr_stat *scp);
447193326Sedint		sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data,
448193326Sed			      int flag, struct proc *p);
449193326Sed#endif /* SC_NO_HISTORY */
450193326Sed
451193326Sed/* scmouse.c */
452198092Srdivacky#ifndef SC_NO_CUTPASTE
453193326Sedvoid		sc_alloc_cut_buffer(scr_stat *scp, int wait);
454193326Sedvoid		sc_draw_mouse_image(scr_stat *scp);
455193326Sedvoid		sc_remove_mouse_image(scr_stat *scp);
456193326Sedint		sc_inside_cutmark(scr_stat *scp, int pos);
457198092Srdivackyvoid		sc_remove_cutmarking(scr_stat *scp);
458193326Sedvoid		sc_remove_all_cutmarkings(sc_softc_t *scp);
459193326Sedvoid		sc_remove_all_mouse(sc_softc_t *scp);
460193326Sed#else
461193326Sed#define		sc_inside_cutmark(scp, pos)	FALSE
462193326Sed#define		sc_remove_cutmarking(scp)
463193326Sed#endif /* SC_NO_CUTPASTE */
464193326Sed#ifndef SC_NO_SYSMOUSE
465193326Sedvoid		sc_mouse_set_level(int level);
466193326Sedvoid		sc_mouse_move(scr_stat *scp, int x, int y);
467193326Sedint		sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data,
468193326Sed			       int flag, struct proc *p);
469193326Sed#endif /* SC_NO_SYSMOUSE */
470193326Sed
471193326Sed/* scvidctl.c */
472198092Srdivackyint		sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode,
473202379Srdivacky				 int xsize, int ysize, int fontsize);
474193326Sedint		sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode);
475193326Sedint		sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
476193326Sed				  int xsize, int ysize, int fontsize);
477193326Sedsc_rndr_sw_t	*sc_render_match(scr_stat *scp, video_adapter_t *adp, int mode);
478193326Sedint		sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
479193326Sed			     struct proc *p);
480193326Sed
481193326Sed/* scvtb.c */
482193326Sedvoid		sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows,
483193326Sed			    void *buffer, int wait);
484193326Sedvoid		sc_vtb_destroy(sc_vtb_t *vtb);
485193326Sedsize_t		sc_vtb_size(int cols, int rows);
486198092Srdivackyvoid		sc_vtb_clear(sc_vtb_t *vtb, int c, int attr);
487202379Srdivacky
488202379Srdivackyint		sc_vtb_getc(sc_vtb_t *vtb, int at);
489202379Srdivackyint		sc_vtb_geta(sc_vtb_t *vtb, int at);
490202379Srdivackyvoid		sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a);
491202379Srdivackyvm_offset_t	sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a);
492202379Srdivackyvm_offset_t	sc_vtb_pointer(sc_vtb_t *vtb, int at);
493193326Sedint		sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset);
494193326Sed
495193326Sed#define		sc_vtb_tail(vtb)	((vtb)->vtb_tail)
496193326Sed#define		sc_vtb_rows(vtb)	((vtb)->vtb_rows)
497193326Sed#define		sc_vtb_cols(vtb)	((vtb)->vtb_cols)
498193326Sed
499193326Sedvoid		sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to,
500193326Sed			    int count);
501198092Srdivackyvoid		sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2,
502193326Sed			      int count);
503193326Sedvoid		sc_vtb_seek(sc_vtb_t *vtb, int pos);
504193326Sedvoid		sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr);
505193326Sedvoid		sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count);
506193326Sedvoid		sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr);
507193326Sedvoid		sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr);
508193326Sed
509193326Sed/* machine dependent functions */
510193326Sedint		sc_max_unit(void);
511193326Sedsc_softc_t	*sc_get_softc(int unit, int flags);
512193326Sedsc_softc_t	*sc_find_softc(struct video_adapter *adp, struct keyboard *kbd);
513193326Sedint		sc_get_cons_priority(int *unit, int *flags);
514193326Sedvoid		sc_get_bios_values(bios_values_t *values);
515193326Sedint		sc_tone(int herz);
516193326Sed
517193326Sed#endif /* !_DEV_SYSCONS_SYSCONS_H_ */
518193326Sed