1995-02-22 13:48:07 +00:00
|
|
|
|
/*-
|
1998-09-15 18:16:39 +00:00
|
|
|
|
* Copyright (c) 1995-1998 S<EFBFBD>ren Schmidt
|
1995-02-22 13:48:07 +00:00
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1998-09-15 18:16:39 +00:00
|
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
|
* without modification, immediately at the beginning of the file.
|
1995-02-22 13:48:07 +00:00
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
1998-09-15 18:16:39 +00:00
|
|
|
|
* derived from this software without specific prior written permission.
|
1995-02-22 13:48:07 +00:00
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*
|
1999-01-19 11:31:22 +00:00
|
|
|
|
* $Id: syscons.h,v 1.45 1999/01/11 03:18:29 yokota Exp $
|
1995-02-22 13:48:07 +00:00
|
|
|
|
*/
|
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
|
#ifndef _DEV_SYSCONS_SYSCONS_H_
|
|
|
|
|
#define _DEV_SYSCONS_SYSCONS_H_
|
1995-02-25 20:09:44 +00:00
|
|
|
|
|
1995-02-22 13:48:07 +00:00
|
|
|
|
/* vm things */
|
|
|
|
|
#define ISMAPPED(pa, width) \
|
|
|
|
|
(((pa) <= (u_long)0x1000 - (width)) \
|
|
|
|
|
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
|
|
|
|
|
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
|
|
|
|
|
|
|
|
|
|
/* printable chars */
|
1995-04-23 10:15:42 +00:00
|
|
|
|
#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \
|
|
|
|
|
|| (ch) < 0x07)
|
1995-02-22 13:48:07 +00:00
|
|
|
|
|
1995-04-04 20:06:26 +00:00
|
|
|
|
/* macros for "intelligent" screen update */
|
|
|
|
|
#define mark_for_update(scp, x) {\
|
|
|
|
|
if ((x) < scp->start) scp->start = (x);\
|
|
|
|
|
else if ((x) > scp->end) scp->end = (x);\
|
|
|
|
|
}
|
|
|
|
|
#define mark_all(scp) {\
|
|
|
|
|
scp->start = 0;\
|
1998-02-12 22:05:08 +00:00
|
|
|
|
scp->end = scp->xsize * scp->ysize - 1;\
|
1995-04-04 20:06:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1995-02-22 13:48:07 +00:00
|
|
|
|
/* status flags */
|
|
|
|
|
#define UNKNOWN_MODE 0x00010
|
1997-10-01 20:46:29 +00:00
|
|
|
|
#define SWITCH_WAIT_REL 0x00080
|
|
|
|
|
#define SWITCH_WAIT_ACQ 0x00100
|
|
|
|
|
#define BUFFER_SAVED 0x00200
|
|
|
|
|
#define CURSOR_ENABLED 0x00400
|
|
|
|
|
#define MOUSE_ENABLED 0x00800
|
|
|
|
|
#define MOUSE_MOVED 0x01000
|
|
|
|
|
#define MOUSE_CUTTING 0x02000
|
|
|
|
|
#define MOUSE_VISIBLE 0x04000
|
1998-09-15 18:16:39 +00:00
|
|
|
|
#define GRAPHICS_MODE 0x08000
|
|
|
|
|
#define PIXEL_MODE 0x10000
|
|
|
|
|
#define SAVER_RUNNING 0x20000
|
1995-02-22 13:48:07 +00:00
|
|
|
|
|
|
|
|
|
/* configuration flags */
|
|
|
|
|
#define VISUAL_BELL 0x00001
|
|
|
|
|
#define BLINK_CURSOR 0x00002
|
|
|
|
|
#define CHAR_CURSOR 0x00004
|
1999-01-11 03:18:56 +00:00
|
|
|
|
/* these options are now obsolete; use corresponding options for kbd driver */
|
|
|
|
|
#if 0
|
1996-10-23 07:29:44 +00:00
|
|
|
|
#define DETECT_KBD 0x00008
|
1996-11-10 16:44:13 +00:00
|
|
|
|
#define XT_KEYBD 0x00010
|
A fix/work-around for ThinkPad 535.
Add a new configuration flag, KBD_NORESET (0x20) to tell scprobe() not
to reset the keyboard.
IBM ThinkPad 535 has the `Fn' key with which the user can perform
certain functions in conjunction with other keys. For example, `Fn' +
PageUP/PageDOWN adjust speaker volume, `Fn' + Home/End change
brightness of LCD screen. It can also be used to suspend the system.
It appears that these functions are implemented at the keyboard level
or the keyboard controller level and totally independent from BIOS or
OS. But, if the keyboard is reset (as is done in scprobe()), they
become unavailable. (There are other laptops which have similar
functions associated with the `Fn' key. But, they aren't affected by
keyboard reset.)
ThinkPad 535 doesn't have switches or buttons to adjust brightness and
volume, or to put the system into the suspend mode. Therefore, it is
essential to preserve these `Fn' key functions in FreeBSD. The new
flag make scprobe() skip keyboard reset.
If this flag is not set, scprobe() behaves in the same say as before.
(If we only knew a way to detect ThinkPad 535, we could skip keyboard
reset automatically, but...)
1997-06-29 15:11:40 +00:00
|
|
|
|
#define KBD_NORESET 0x00020
|
1999-01-11 03:18:56 +00:00
|
|
|
|
#endif
|
1998-08-03 09:09:35 +00:00
|
|
|
|
#define QUIET_BELL 0x00040
|
1998-09-15 18:16:39 +00:00
|
|
|
|
#define VESA800X600 0x00080
|
1999-01-11 03:18:56 +00:00
|
|
|
|
#define AUTODETECT_KBD 0x00100
|
1995-02-22 13:48:07 +00:00
|
|
|
|
|
1995-11-28 00:17:32 +00:00
|
|
|
|
/* attribute flags */
|
|
|
|
|
#define NORMAL_ATTR 0x00
|
|
|
|
|
#define BLINK_ATTR 0x01
|
|
|
|
|
#define BOLD_ATTR 0x02
|
|
|
|
|
#define UNDERLINE_ATTR 0x04
|
|
|
|
|
#define REVERSE_ATTR 0x08
|
|
|
|
|
#define FOREGROUND_CHANGED 0x10
|
|
|
|
|
#define BACKGROUND_CHANGED 0x20
|
|
|
|
|
|
1995-02-22 13:48:07 +00:00
|
|
|
|
/* misc defines */
|
|
|
|
|
#define FALSE 0
|
|
|
|
|
#define TRUE 1
|
|
|
|
|
#define MAX_ESC_PAR 5
|
|
|
|
|
#define LOAD 1
|
|
|
|
|
#define SAVE 0
|
|
|
|
|
#define COL 80
|
|
|
|
|
#define ROW 25
|
|
|
|
|
#define BELL_DURATION 5
|
|
|
|
|
#define BELL_PITCH 800
|
|
|
|
|
#define CONSOLE_BUFSIZE 1024
|
|
|
|
|
#define PCBURST 128
|
1996-06-26 13:04:53 +00:00
|
|
|
|
#define FONT_NONE 1
|
1997-05-15 05:43:59 +00:00
|
|
|
|
#define FONT_8 2
|
|
|
|
|
#define FONT_14 4
|
|
|
|
|
#define FONT_16 8
|
1995-02-22 13:48:07 +00:00
|
|
|
|
|
|
|
|
|
/* special characters */
|
1995-04-04 20:06:26 +00:00
|
|
|
|
#define cntlc 0x03
|
|
|
|
|
#define cntld 0x04
|
|
|
|
|
#define bs 0x08
|
|
|
|
|
#define lf 0x0a
|
|
|
|
|
#define cr 0x0d
|
|
|
|
|
#define del 0x7f
|
|
|
|
|
|
|
|
|
|
#define DEAD_CHAR 0x07 /* char used for cursor */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
|
|
|
|
|
typedef struct term_stat {
|
|
|
|
|
int esc; /* processing escape sequence */
|
|
|
|
|
int num_param; /* # of parameters to ESC */
|
|
|
|
|
int last_param; /* last parameter # */
|
|
|
|
|
int param[MAX_ESC_PAR]; /* contains ESC parameters */
|
1996-06-25 08:54:57 +00:00
|
|
|
|
int cur_attr; /* current hardware attr word */
|
|
|
|
|
int attr_mask; /* current logical attr mask */
|
1995-11-28 00:17:32 +00:00
|
|
|
|
int cur_color; /* current hardware color */
|
|
|
|
|
int std_color; /* normal hardware color */
|
|
|
|
|
int rev_color; /* reverse hardware color */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
} term_stat;
|
|
|
|
|
|
|
|
|
|
typedef struct scr_stat {
|
1999-01-11 03:18:56 +00:00
|
|
|
|
int ad; /* video adapter index */
|
|
|
|
|
video_adapter_t *adp; /* video adapter structure */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
u_short *scr_buf; /* buffer when off screen */
|
|
|
|
|
int xpos; /* current X position */
|
|
|
|
|
int ypos; /* current Y position */
|
1997-01-23 20:00:45 +00:00
|
|
|
|
int saved_xpos; /* saved X position */
|
|
|
|
|
int saved_ypos; /* saved Y position */
|
1996-09-30 23:00:58 +00:00
|
|
|
|
int xsize; /* X text size */
|
|
|
|
|
int ysize; /* Y text size */
|
|
|
|
|
int xpixel; /* X graphics size */
|
|
|
|
|
int ypixel; /* Y graphics size */
|
1998-09-15 18:16:39 +00:00
|
|
|
|
int xoff; /* X offset in pixel mode */
|
|
|
|
|
int yoff; /* Y offset in pixel mode */
|
1996-06-26 13:04:53 +00:00
|
|
|
|
int font_size; /* fontsize in Y direction */
|
1995-03-29 20:55:03 +00:00
|
|
|
|
int start; /* modified area start */
|
|
|
|
|
int end; /* modified area end */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
term_stat term; /* terminal emulation stuff */
|
|
|
|
|
int status; /* status (bitfield) */
|
1999-01-11 03:18:56 +00:00
|
|
|
|
int kbd_mode; /* keyboard I/O mode */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
u_short *cursor_pos; /* cursor buffer position */
|
1996-09-01 18:16:06 +00:00
|
|
|
|
u_short *cursor_oldpos; /* cursor old buffer position */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
u_short cursor_saveunder; /* saved chars under cursor */
|
|
|
|
|
char cursor_start; /* cursor start line # */
|
|
|
|
|
char cursor_end; /* cursor end line # */
|
|
|
|
|
u_short *mouse_pos; /* mouse buffer position */
|
|
|
|
|
u_short *mouse_oldpos; /* mouse old buffer position */
|
|
|
|
|
short mouse_xpos; /* mouse x coordinate */
|
|
|
|
|
short mouse_ypos; /* mouse y coordinate */
|
1996-06-25 08:54:57 +00:00
|
|
|
|
short mouse_buttons; /* mouse buttons */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
|
1996-06-21 07:19:18 +00:00
|
|
|
|
u_short *mouse_cut_start; /* mouse cut start pos */
|
|
|
|
|
u_short *mouse_cut_end; /* mouse cut end pos */
|
1996-06-25 08:54:57 +00:00
|
|
|
|
struct proc *mouse_proc; /* proc* of controlling proc */
|
|
|
|
|
pid_t mouse_pid; /* pid of controlling proc */
|
|
|
|
|
int mouse_signal; /* signal # to report with */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
u_short bell_duration;
|
|
|
|
|
u_short bell_pitch;
|
|
|
|
|
u_char border; /* border color */
|
1998-08-03 11:30:45 +00:00
|
|
|
|
int mode; /* mode */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
pid_t pid; /* pid of controlling proc */
|
|
|
|
|
struct proc *proc; /* proc* of controlling proc */
|
|
|
|
|
struct vt_mode smode; /* switch mode */
|
|
|
|
|
u_short *history; /* circular history buffer */
|
|
|
|
|
u_short *history_head; /* current head position */
|
|
|
|
|
u_short *history_pos; /* position shown on screen */
|
|
|
|
|
u_short *history_save; /* save area index */
|
|
|
|
|
int history_size; /* size of history buffer */
|
1999-01-19 11:31:22 +00:00
|
|
|
|
#ifdef __i386__
|
1995-02-22 13:48:07 +00:00
|
|
|
|
struct apmhook r_hook; /* reconfiguration support */
|
1999-01-19 11:31:22 +00:00
|
|
|
|
#endif
|
1998-09-15 18:16:39 +00:00
|
|
|
|
int splash_save_mode; /* saved mode for splash screen */
|
|
|
|
|
int splash_save_status; /* saved status for splash screen */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
} scr_stat;
|
|
|
|
|
|
|
|
|
|
typedef struct default_attr {
|
1995-11-28 00:17:32 +00:00
|
|
|
|
int std_color; /* normal hardware color */
|
|
|
|
|
int rev_color; /* reverse hardware color */
|
1995-02-22 13:48:07 +00:00
|
|
|
|
} default_attr;
|
|
|
|
|
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
|
|
#define ISTEXTSC(scp) (!((scp)->status \
|
|
|
|
|
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE)))
|
|
|
|
|
#define ISGRAPHSC(scp) (((scp)->status \
|
|
|
|
|
& (UNKNOWN_MODE | GRAPHICS_MODE)))
|
|
|
|
|
#define ISPIXELSC(scp) (((scp)->status \
|
|
|
|
|
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\
|
|
|
|
|
== PIXEL_MODE)
|
|
|
|
|
#define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE)
|
|
|
|
|
|
|
|
|
|
#define ISFONTAVAIL(af) ((af) & V_ADP_FONT)
|
|
|
|
|
#define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT)
|
|
|
|
|
#define ISPALAVAIL(af) ((af) & V_ADP_PALETTE)
|
|
|
|
|
|
1996-10-18 18:51:37 +00:00
|
|
|
|
/* misc prototypes used by different syscons related LKM's */
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
|
|
/* syscons.c */
|
1999-01-19 11:31:22 +00:00
|
|
|
|
int sc_probe_unit(int unit, int flags);
|
|
|
|
|
int sc_attach_unit(int unit, int flags);
|
|
|
|
|
|
1998-09-26 03:34:10 +00:00
|
|
|
|
extern int (*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data, int flag,
|
1998-09-15 18:16:39 +00:00
|
|
|
|
struct proc *p);
|
|
|
|
|
|
|
|
|
|
int set_mode(scr_stat *scp);
|
|
|
|
|
scr_stat *sc_get_scr_stat(dev_t dev);
|
|
|
|
|
|
|
|
|
|
void copy_font(scr_stat *scp, int operation, int font_size, u_char *font_image);
|
1998-09-23 09:59:00 +00:00
|
|
|
|
void set_border(scr_stat *scp, int color);
|
1999-01-11 03:18:56 +00:00
|
|
|
|
#define save_palette(adp, pal) \
|
|
|
|
|
(*vidsw[(adp)->va_index]->save_palette)((adp), (pal))
|
|
|
|
|
#define load_palette(adp, pal) \
|
|
|
|
|
(*vidsw[(adp)->va_index]->load_palette)((adp), (pal))
|
1995-03-03 08:37:52 +00:00
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
|
void sc_touch_scrn_saver(void);
|
1998-09-15 18:16:39 +00:00
|
|
|
|
void sc_clear_screen(scr_stat *scp);
|
|
|
|
|
void sc_move_mouse(scr_stat *scp, int x, int y);
|
|
|
|
|
int sc_clean_up(scr_stat *scp);
|
|
|
|
|
void sc_alloc_scr_buffer(scr_stat *scp, int wait, int clear);
|
|
|
|
|
void sc_alloc_cut_buffer(scr_stat *scp, int wait);
|
|
|
|
|
void sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait);
|
1998-09-26 03:34:10 +00:00
|
|
|
|
struct tty *scdevtotty(dev_t dev);
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
|
|
/* scvidctl.c */
|
|
|
|
|
int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode,
|
|
|
|
|
int xsize, int ysize, int fontsize);
|
|
|
|
|
int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode);
|
|
|
|
|
int sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
|
|
|
|
|
int xsize, int ysize, int fontsize);
|
|
|
|
|
int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
|
|
|
|
|
struct proc *p);
|
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
|
#endif /* !_DEV_SYSCONS_SYSCONS_H_ */
|