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