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