]>
git.saurik.com Git - apple/xnu.git/blob - pexpert/pexpert/i386/kdsoft.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
25 #ifndef _PEXPERT_I386_KDSOFT_H_
26 #define _PEXPERT_I386_KDSOFT_H_
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
58 * Description: Software structures for keyboard/display driver, shared with
59 * drivers for specific graphics cards.
63 * Copyright Ing. C. Olivetti & C. S.p.A. 1988, 1989.
64 * All rights reserved.
66 * Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc.,
67 * Cupertino, California.
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.
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.
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.
96 * Most of the driver uses the following abstraction for the display:
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.
104 * The kd_dxxx routines handle the conversion from this abstraction to
105 * what the hardware requires.
107 * (*kd_dput)(pos, ch, chattr)
110 * Displays a character at "pos", where "ch" = the character to
111 * be displayed and "chattr" is its attribute byte.
113 * (*kd_dmvup)(from, to, 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
122 * (*kd_dmvdown)(from, to, 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
130 * (*kd_dclear)(to, count, chattr)
134 * Erases "count" character positions, starting with "to".
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).
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
149 //ERICHACK#include <device/io_req.h>
152 * Globals used for both character-based controllers and bitmap-based
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 */
165 * Globals used only for bitmap-based controllers.
166 * XXX - probably needs reworking for color.
170 * The following font layout is assumed:
172 * The top scan line of all the characters comes first. Then the
173 * second scan line, then the third, etc.
175 * ------ ... ---------|-----N--------|-------------- ... -----------
176 * ------ ... ---------|-----N--------|-------------- ... -----------
180 * ------ ... ---------|-----N--------|-------------- ... -----------
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.)
191 extern u_char
*font_start
; /* starting addr of font */
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 */
201 extern u_char char_black
; /* 8 black (off) bits */
202 extern u_char char_white
; /* 8 white (on) bits */
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
211 extern short xstart
, ystart
;
215 * Accelerators for bitmap displays.
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 */
230 extern void bmpmvdown(
234 extern void bmpclear(
238 extern void bmpsetcursor(
241 extern void (*kd_dput
)( /* put attributed char */
245 extern void (*kd_dmvup
)( /* block move up */
249 extern void (*kd_dmvdown
)( /* block move down */
253 extern void (*kd_dclear
)( /* block clear */
257 extern void (*kd_dsetcursor
)(
258 /* set cursor position on displayed page */
260 extern void (*kd_dreset
)(void); /* prepare for reboot */
263 #include <pexpert/i386/kd_entries.h>
269 #endif /* _PEXPERT_I386_KDSOFT_H_ */