FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/syscons.h
1 /*-
2 * Copyright (c) 1995-1997 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 * in this position and unchanged.
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: src/sys/i386/isa/syscons.h,v 1.23.2.11 1999/09/05 08:13:38 peter Exp $
29 */
30
31 #ifndef _I386_ISA_SYSCONS_H_
32 #define _I386_ISA_SYSCONS_H_
33
34 /* vm things */
35 #define ISMAPPED(pa, width) \
36 (((pa) <= (u_long)0x1000 - (width)) \
37 || ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
38 #define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
39
40 /* printable chars */
41 #define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \
42 || (ch) < 0x07)
43
44 /* macros for "intelligent" screen update */
45 #define mark_for_update(scp, x) {\
46 if ((x) < scp->start) scp->start = (x);\
47 else if ((x) > scp->end) scp->end = (x);\
48 }
49 #define mark_all(scp) {\
50 scp->start = 0;\
51 scp->end = scp->xsize * scp->ysize;\
52 }
53
54 /* status flags */
55 #define LOCK_KEY_MASK 0x0000F
56 #define LED_MASK 0x00007
57 #define UNKNOWN_MODE 0x00010
58 #define KBD_RAW_MODE 0x00020
59 #define KBD_CODE_MODE 0x00040
60 #define SWITCH_WAIT_REL 0x00080
61 #define SWITCH_WAIT_ACQ 0x00100
62 #define BUFFER_SAVED 0x00200
63 #define CURSOR_ENABLED 0x00400
64 #define MOUSE_ENABLED 0x00800
65 #define MOUSE_MOVED 0x01000
66 #define MOUSE_CUTTING 0x02000
67 #define MOUSE_VISIBLE 0x04000
68
69 /* configuration flags */
70 #define VISUAL_BELL 0x00001
71 #define BLINK_CURSOR 0x00002
72 #define CHAR_CURSOR 0x00004
73 #define DETECT_KBD 0x00008
74 #define XT_KEYBD 0x00010
75 #define KBD_NORESET 0x00020
76 #define QUIET_BELL 0x00040
77
78 /* attribute flags */
79 #define NORMAL_ATTR 0x00
80 #define BLINK_ATTR 0x01
81 #define BOLD_ATTR 0x02
82 #define UNDERLINE_ATTR 0x04
83 #define REVERSE_ATTR 0x08
84 #define FOREGROUND_CHANGED 0x10
85 #define BACKGROUND_CHANGED 0x20
86
87 /* video hardware memory addresses */
88 #define VIDEOMEM 0x000A0000
89
90 /* misc defines */
91 #define FALSE 0
92 #define TRUE 1
93 #define MAX_ESC_PAR 5
94 #define LOAD 1
95 #define SAVE 0
96 #define COL 80
97 #define ROW 25
98 #define BELL_DURATION 5
99 #define BELL_PITCH 800
100 #define TIMER_FREQ 1193182 /* should be in isa.h */
101 #define CONSOLE_BUFSIZE 1024
102 #define PCBURST 128
103 #define FONT_NONE 1
104 #define FONT_8 2
105 #define FONT_14 4
106 #define FONT_16 8
107
108 /* defines related to hardware addresses */
109 #define MONO_BASE 0x3B4 /* crt controller base mono */
110 #define COLOR_BASE 0x3D4 /* crt controller base color */
111 #define MISC 0x3C2 /* misc output register */
112 #define ATC IO_VGA+0x00 /* attribute controller */
113 #define TSIDX IO_VGA+0x04 /* timing sequencer idx */
114 #define TSREG IO_VGA+0x05 /* timing sequencer data */
115 #define PIXMASK IO_VGA+0x06 /* pixel write mask */
116 #define PALRADR IO_VGA+0x07 /* palette read address */
117 #define PALWADR IO_VGA+0x08 /* palette write address */
118 #define PALDATA IO_VGA+0x09 /* palette data register */
119 #define GDCIDX IO_VGA+0x0E /* graph data controller idx */
120 #define GDCREG IO_VGA+0x0F /* graph data controller data */
121
122 /* special characters */
123 #define cntlc 0x03
124 #define cntld 0x04
125 #define bs 0x08
126 #define lf 0x0a
127 #define cr 0x0d
128 #define del 0x7f
129
130 #define DEAD_CHAR 0x07 /* char used for cursor */
131
132 typedef struct term_stat {
133 int esc; /* processing escape sequence */
134 int num_param; /* # of parameters to ESC */
135 int last_param; /* last parameter # */
136 int param[MAX_ESC_PAR]; /* contains ESC parameters */
137 int cur_attr; /* current hardware attr word */
138 int attr_mask; /* current logical attr mask */
139 int cur_color; /* current hardware color */
140 int std_color; /* normal hardware color */
141 int rev_color; /* reverse hardware color */
142 } term_stat;
143
144 typedef struct scr_stat {
145 u_short *scr_buf; /* buffer when off screen */
146 int xpos; /* current X position */
147 int ypos; /* current Y position */
148 int saved_xpos; /* saved X position */
149 int saved_ypos; /* saved Y position */
150 int xsize; /* X text size */
151 int ysize; /* Y text size */
152 int xpixel; /* X graphics size */
153 int ypixel; /* Y graphics size */
154 int font_size; /* fontsize in Y direction */
155 int start; /* modified area start */
156 int end; /* modified area end */
157 term_stat term; /* terminal emulation stuff */
158 int status; /* status (bitfield) */
159 u_short *cursor_pos; /* cursor buffer position */
160 u_short *cursor_oldpos; /* cursor old buffer position */
161 u_short cursor_saveunder; /* saved chars under cursor */
162 char cursor_start; /* cursor start line # */
163 char cursor_end; /* cursor end line # */
164 u_short *mouse_pos; /* mouse buffer position */
165 u_short *mouse_oldpos; /* mouse old buffer position */
166 short mouse_xpos; /* mouse x coordinate */
167 short mouse_ypos; /* mouse y coordinate */
168 short mouse_buttons; /* mouse buttons */
169 u_char mouse_cursor[128]; /* mouse cursor bitmap store */
170 u_short *mouse_cut_start; /* mouse cut start pos */
171 u_short *mouse_cut_end; /* mouse cut end pos */
172 struct proc *mouse_proc; /* proc* of controlling proc */
173 pid_t mouse_pid; /* pid of controlling proc */
174 int mouse_signal; /* signal # to report with */
175 u_short bell_duration;
176 u_short bell_pitch;
177 u_char border; /* border color */
178 u_char initial_mode; /* initial mode */
179 u_char mode; /* mode */
180 pid_t pid; /* pid of controlling proc */
181 struct proc *proc; /* proc* of controlling proc */
182 struct vt_mode smode; /* switch mode */
183 u_short *history; /* circular history buffer */
184 u_short *history_head; /* current head position */
185 u_short *history_pos; /* position shown on screen */
186 u_short *history_save; /* save area index */
187 int history_size; /* size of history buffer */
188 struct apmhook r_hook; /* reconfiguration support */
189 } scr_stat;
190
191 typedef struct default_attr {
192 int std_color; /* normal hardware color */
193 int rev_color; /* reverse hardware color */
194 } default_attr;
195
196 /* misc prototypes used by different syscons related LKM's */
197 void set_border(u_char color);
198 void set_mode(scr_stat *scp);
199 void copy_font(int operation, int font_type, char* font_image);
200 void load_palette(char *palette);
201 int add_scrn_saver(void (*this)(int));
202 int remove_scrn_saver(void (*this)(int));
203
204 #endif /* !_I386_ISA_SYSCONS_H_ */
Cache object: 0d131668d63e8f2b156cc551df280afd
|