Debian Codegraph @

i386/i386at/kdsoft.h

raw
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or [email protected]
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /* **********************************************************************
27 File: kdsoft.h
28 Description: Software structures for keyboard/display driver, shared with
29 drivers for specific graphics cards.
30
31 $ Header: $
32
33 Copyright Ing. C. Olivetti & C. S.p.A. 1988, 1989.
34 All rights reserved.
35 ********************************************************************** */
36
37 /*
38 Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc.,
39 Cupertino, California.
40
41 All Rights Reserved
42
43 Permission to use, copy, modify, and distribute this software and
44 its documentation for any purpose and without fee is hereby
45 granted, provided that the above copyright notice appears in all
46 copies and that both the copyright notice and this permission notice
47 appear in supporting documentation, and that the name of Olivetti
48 not be used in advertising or publicity pertaining to distribution
49 of the software without specific, written prior permission.
50
51 OLIVETTI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
52 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
53 IN NO EVENT SHALL OLIVETTI BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
54 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
55 LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
56 NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION
57 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
58 */
59
60 #ifndef _KDSOFT_H_
61 #define _KDSOFT_H_
62
63 /*
64 * Globals used for both character-based controllers and bitmap-based
65 * controllers.
66 */
67 typedef short csrpos_t; /* cursor position, ONE_SPACE bytes per char */
68
69 extern u_char *vid_start; /* VM start of video RAM or frame buffer */
70 extern csrpos_t kd_curpos; /* should be set only by kd_setpos */
71 extern short kd_lines; /* num lines in tty display */
72 extern short kd_cols;
73 extern char kd_attr; /* current character attribute */
74
75
76 /*
77 * Globals used only for bitmap-based controllers.
78 * XXX - probably needs reworking for color.
79 */
80
81 /*
82 * This driver handles two types of graphics cards. The first type
83 * (e.g., EGA, CGA), treats the screen as a page of characters and
84 * has a hardware cursor. The second type (e.g., the Blit) treats the
85 * screen as a bitmap. A hardware cursor may be present, but it is
86 * ignored in favor of a software cursor.
87 *
88 *
89 * Most of the driver uses the following abstraction for the display:
90 *
91 * The cursor position is simply an index into a (logical) linear char
92 * array that wraps around at the end of each line. Each character
93 * takes up ONE_SPACE bytes. Values in [0..ONE_PAGE) are positions in
94 * the displayed page. Values < 0 and >= ONE_PAGE are off the page
95 * and require some scrolling to put the cursor back on the page.
96 *
97 * The kd_dxxx routines handle the conversion from this abstraction to
98 * what the hardware requires.
99 *
100 * (*kd_dput)(pos, ch, chattr)
101 * csrpos_t pos;
102 * char ch, chattr;
103 * Displays a character at "pos", where "ch" = the character to
104 * be displayed and "chattr" is its attribute byte.
105 *
106 * (*kd_dmvup)(from, to, count)
107 * csrpos_t from, to;
108 * int count;
109 * Does a (relatively) fast block transfer of characters upward.
110 * "count" is the number of character positions (not bytes) to move.
111 * "from" is the character position to start moving from (at the start
112 * of the block to be moved). "to" is the character position to start
113 * moving to.
114 *
115 * (*kd_dmvdown)(from, to, count)
116 * csrpos_t from, to;
117 * int count;
118 * "count" is the number of character positions (not bytes) to move.
119 * "from" is the character position to start moving from (at the end
120 * of the block to be moved). "to" is the character position to
121 * start moving to.
122 *
123 * (*kd_dclear)(to, count, chattr)
124 * csrpos_t, to;
125 * int count;
126 * char chattr;
127 * Erases "count" character positions, starting with "to".
128 *
129 * (*kd_dsetcursor)(pos)
130 * Sets kd_curpos and moves the displayed cursor to track it. "pos"
131 * should be in the range [0..ONE_PAGE).
132 *
133 * (*kd_dreset)()
134 * In some cases, the boot program expects the display to be in a
135 * particular state, and doing a soft reset (i.e.,
136 * software-controlled reboot) doesn't put it into that state. For
137 * these cases, the machine-specific driver should provide a "reset"
138 * procedure, which will be called just before the kd code causes the
139 * system to reboot.
140 */
141
142 extern void bmpput(csrpos_t, char, char);
143 extern void bmpmvup(csrpos_t, csrpos_t, int);
144 extern void bmpmvdown(csrpos_t, csrpos_t, int);
145 extern void bmpclear(csrpos_t, int, char);
146 extern void bmpsetcursor(csrpos_t);
147
148 extern void (*kd_dput)(csrpos_t, char, char); /* put attributed char */
149 extern void (*kd_dmvup)(csrpos_t, csrpos_t, int); /* block move up */
150 extern void (*kd_dmvdown)(csrpos_t, csrpos_t, int); /* block move down */
151 extern void (*kd_dclear)(csrpos_t, int, char); /* block clear */
152 extern void (*kd_dsetcursor)(csrpos_t); /* set cursor position on displayed page */
153 extern void (*kd_dreset)(void); /* prepare for reboot */
154
155
156 /*
157 * The following font layout is assumed:
158 *
159 * The top scan line of all the characters comes first. Then the
160 * second scan line, then the third, etc.
161 *
162 * ------ ... ---------|-----N--------|-------------- ... -----------
163 * ------ ... ---------|-----N--------|-------------- ... -----------
164 * .
165 * .
166 * .
167 * ------ ... ---------|-----N--------|-------------- ... -----------
168 *
169 * In the picture, each line is a scan line from the font. Each scan
170 * line is stored in memory immediately after the previous one. The
171 * bits between the vertical lines are the bits for a single character
172 * (e.g., the letter "N").
173 * There are "char_height" scan lines. Each character is "char_width"
174 * bits wide. We make the simplifying assumption that characters are
175 * on byte boundaries. (We also assume that a byte is 8 bits.)
176 */
177
178 extern u_char *font_start; /* starting addr of font */
179
180 extern short fb_width; /* bits in frame buffer scan line */
181 extern short fb_height; /* scan lines in frame buffer*/
182 extern short char_width; /* bit width of 1 char */
183 extern short char_height; /* bit height of 1 char */
184 extern short chars_in_font;
185 extern short cursor_height; /* bit height of cursor */
186 /* char_height + cursor_height = line_height */
187
188 extern u_char char_black; /* 8 black (off) bits */
189 extern u_char char_white; /* 8 white (on) bits */
190
191
192 /*
193 * The tty emulation does not usually require the entire frame buffer.
194 * (xstart, ystart) is the bit address for the upper left corner of the
195 * tty "screen".
196 */
197
198 extern short xstart, ystart;
199
200
201 /*
202 * Accelerators for bitmap displays.
203 */
204
205 extern short char_byte_width; /* char_width/8 */
206 extern short fb_byte_width; /* fb_width/8 */
207 extern short font_byte_width; /* num bytes in 1 scan line of font */
208
209 #endif /* _KDSOFT_H_ */