|
|
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: /*
1.1.1.2 ! root 61: * Globals used for both character-based controllers and bitmap-based
! 62: * controllers.
! 63: */
! 64: typedef short csrpos_t; /* cursor position, ONE_SPACE bytes per char */
! 65:
! 66: extern u_char *vid_start; /* VM start of video RAM or frame buffer */
! 67: extern csrpos_t kd_curpos; /* should be set only by kd_setpos */
! 68: extern short kd_lines; /* num lines in tty display */
! 69: extern short kd_cols;
! 70: extern char kd_attr; /* current character attribute */
! 71:
! 72:
! 73: /*
! 74: * Globals used only for bitmap-based controllers.
! 75: * XXX - probably needs reworking for color.
! 76: */
! 77:
! 78: /*
1.1 root 79: * This driver handles two types of graphics cards. The first type
80: * (e.g., EGA, CGA), treats the screen as a page of characters and
81: * has a hardware cursor. The second type (e.g., the Blit) treats the
82: * screen as a bitmap. A hardware cursor may be present, but it is
83: * ignored in favor of a software cursor.
84: *
85: *
86: * Most of the driver uses the following abstraction for the display:
87: *
88: * The cursor position is simply an index into a (logical) linear char
89: * array that wraps around at the end of each line. Each character
90: * takes up ONE_SPACE bytes. Values in [0..ONE_PAGE) are positions in
91: * the displayed page. Values < 0 and >= ONE_PAGE are off the page
92: * and require some scrolling to put the cursor back on the page.
93: *
94: * The kd_dxxx routines handle the conversion from this abstraction to
95: * what the hardware requires.
96: *
97: * (*kd_dput)(pos, ch, chattr)
98: * csrpos_t pos;
99: * char ch, chattr;
100: * Displays a character at "pos", where "ch" = the character to
101: * be displayed and "chattr" is its attribute byte.
102: *
103: * (*kd_dmvup)(from, to, count)
104: * csrpos_t from, to;
105: * int count;
106: * Does a (relatively) fast block transfer of characters upward.
107: * "count" is the number of character positions (not bytes) to move.
108: * "from" is the character position to start moving from (at the start
109: * of the block to be moved). "to" is the character position to start
110: * moving to.
111: *
112: * (*kd_dmvdown)(from, to, count)
113: * csrpos_t from, to;
114: * int count;
115: * "count" is the number of character positions (not bytes) to move.
116: * "from" is the character position to start moving from (at the end
117: * of the block to be moved). "to" is the character position to
118: * start moving to.
119: *
120: * (*kd_dclear)(to, count, chattr)
121: * csrpos_t, to;
122: * int count;
123: * char chattr;
124: * Erases "count" character positions, starting with "to".
125: *
126: * (*kd_dsetcursor)(pos)
127: * Sets kd_curpos and moves the displayed cursor to track it. "pos"
128: * should be in the range [0..ONE_PAGE).
129: *
130: * (*kd_dreset)()
131: * In some cases, the boot program expects the display to be in a
132: * particular state, and doing a soft reset (i.e.,
133: * software-controlled reboot) doesn't put it into that state. For
134: * these cases, the machine-specific driver should provide a "reset"
135: * procedure, which will be called just before the kd code causes the
136: * system to reboot.
137: */
138:
1.1.1.2 ! root 139: extern void bmpput(csrpos_t, char, char);
! 140: extern void bmpmvup(csrpos_t, csrpos_t, int);
! 141: extern void bmpmvdown(csrpos_t, csrpos_t, int);
! 142: extern void bmpclear(csrpos_t, int, char);
! 143: extern void bmpsetcursor(csrpos_t);
1.1 root 144:
145: extern void (*kd_dput)(); /* put attributed char */
146: extern void (*kd_dmvup)(); /* block move up */
147: extern void (*kd_dmvdown)(); /* block move down */
148: extern void (*kd_dclear)(); /* block clear */
149: extern void (*kd_dsetcursor)();
150: /* set cursor position on displayed page */
151: extern void (*kd_dreset)(); /* prepare for reboot */
152:
153:
154: /*
155: * The following font layout is assumed:
156: *
157: * The top scan line of all the characters comes first. Then the
158: * second scan line, then the third, etc.
159: *
160: * ------ ... ---------|-----N--------|-------------- ... -----------
161: * ------ ... ---------|-----N--------|-------------- ... -----------
162: * .
163: * .
164: * .
165: * ------ ... ---------|-----N--------|-------------- ... -----------
166: *
167: * In the picture, each line is a scan line from the font. Each scan
168: * line is stored in memory immediately after the previous one. The
169: * bits between the vertical lines are the bits for a single character
170: * (e.g., the letter "N").
171: * There are "char_height" scan lines. Each character is "char_width"
172: * bits wide. We make the simplifying assumption that characters are
173: * on byte boundaries. (We also assume that a byte is 8 bits.)
174: */
175:
176: extern u_char *font_start; /* starting addr of font */
177:
178: extern short fb_width; /* bits in frame buffer scan line */
179: extern short fb_height; /* scan lines in frame buffer*/
180: extern short char_width; /* bit width of 1 char */
181: extern short char_height; /* bit height of 1 char */
182: extern short chars_in_font;
183: extern short cursor_height; /* bit height of cursor */
184: /* char_height + cursor_height = line_height */
185:
186: extern u_char char_black; /* 8 black (off) bits */
187: extern u_char char_white; /* 8 white (on) bits */
188:
189:
190: /*
191: * The tty emulation does not usually require the entire frame buffer.
192: * (xstart, ystart) is the bit address for the upper left corner of the
193: * tty "screen".
194: */
195:
196: extern short xstart, ystart;
197:
198:
199: /*
200: * Accelerators for bitmap displays.
201: */
202:
203: extern short char_byte_width; /* char_width/8 */
204: extern short fb_byte_width; /* fb_width/8 */
205: 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.