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