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