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