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