|
|
1.1 root 1: /*
2: * Copyright (c) 1988 University of Utah.
3: * Copyright (c) 1990 The Regents of the University of California.
4: * All rights reserved.
5: *
6: * This code is derived from software contributed to Berkeley by
7: * the Systems Programming Group of the University of Utah Computer
8: * Science Department.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed by the University of
21: * California, Berkeley and its contributors.
22: * 4. Neither the name of the University nor the names of its contributors
23: * may be used to endorse or promote products derived from this software
24: * without specific prior written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: * SUCH DAMAGE.
37: *
38: * from: Utah $Hdr: ite_rb.c 1.16 91/01/21$
39: *
40: * @(#)ite_rb.c 7.5 (Berkeley) 5/7/91
41: */
42:
43: #include "ite.h"
44: #if NITE > 0
45:
46: #include "param.h"
47: #include "conf.h"
48: #include "proc.h"
49: #include "ioctl.h"
50: #include "tty.h"
51: #include "systm.h"
52:
53: #include "itevar.h"
54: #include "itereg.h"
55: #include "grf_rbreg.h"
56:
57: #include "machine/cpu.h"
58:
59: /* XXX */
60: #include "grfioctl.h"
61: #include "grfvar.h"
62:
63: #define REGBASE ((struct rboxfb *)(ip->regbase))
64: #define WINDOWMOVER rbox_windowmove
65:
66: rbox_init(ip)
67: struct ite_softc *ip;
68: {
69: register int i;
70:
71: /* XXX */
72: if (ip->regbase == 0) {
73: struct grf_softc *gp = &grf_softc[ip - ite_softc];
74: ip->regbase = gp->g_regkva;
75: ip->fbbase = gp->g_fbkva;
76: }
77:
78: rb_waitbusy(REGADDR);
79:
80: REGBASE->reset = 0x39;
81: DELAY(1000);
82:
83: REGBASE->interrupt = 0x04;
84: REGBASE->display_enable = 0x01;
85: REGBASE->video_enable = 0x01;
86: REGBASE->drive = 0x01;
87: REGBASE->vdrive = 0x0;
88:
89: ite_devinfo(ip);
90:
91: REGBASE->opwen = 0xFF;
92:
93: /*
94: * Clear the framebuffer.
95: */
96: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
97: rb_waitbusy(REGADDR);
98:
99: for(i = 0; i < 16; i++) {
100: *(REGADDR + 0x63c3 + i*4) = 0x0;
101: *(REGADDR + 0x6403 + i*4) = 0x0;
102: *(REGADDR + 0x6803 + i*4) = 0x0;
103: *(REGADDR + 0x6c03 + i*4) = 0x0;
104: *(REGADDR + 0x73c3 + i*4) = 0x0;
105: *(REGADDR + 0x7403 + i*4) = 0x0;
106: *(REGADDR + 0x7803 + i*4) = 0x0;
107: *(REGADDR + 0x7c03 + i*4) = 0x0;
108: }
109:
110: REGBASE->rep_rule = 0x33;
111:
112: /*
113: * I cannot figure out how to make the blink planes stop. So, we
114: * must set both colormaps so that when the planes blink, and
115: * the secondary colormap is active, we still get text.
116: */
117: CM1RED[0x00].value = 0x00;
118: CM1GRN[0x00].value = 0x00;
119: CM1BLU[0x00].value = 0x00;
120: CM1RED[0x01].value = 0xFF;
121: CM1GRN[0x01].value = 0xFF;
122: CM1BLU[0x01].value = 0xFF;
123:
124: CM2RED[0x00].value = 0x00;
125: CM2GRN[0x00].value = 0x00;
126: CM2BLU[0x00].value = 0x00;
127: CM2RED[0x01].value = 0xFF;
128: CM2GRN[0x01].value = 0xFF;
129: CM2BLU[0x01].value = 0xFF;
130:
131: REGBASE->blink = 0x00;
132: REGBASE->write_enable = 0x01;
133: REGBASE->opwen = 0x00;
134:
135: ite_fontinit(ip);
136:
137: /*
138: * Stash the inverted cursor.
139: */
140: rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
141: ip->cblanky, ip->cblankx, ip->ftheight,
142: ip->ftwidth, RR_COPYINVERTED);
143: }
144:
145: rbox_deinit(ip)
146: struct ite_softc *ip;
147: {
148: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
149: rb_waitbusy(REGADDR);
150:
151: ip->flags &= ~ITE_INITED;
152: }
153:
154: rbox_putc(ip, c, dy, dx, mode)
155: register struct ite_softc *ip;
156: register int dy, dx;
157: int c, mode;
158: {
159: register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
160:
161: rbox_windowmove(ip, charY(ip, c), charX(ip, c),
162: dy * ip->ftheight, dx * ip->ftwidth,
163: ip->ftheight, ip->ftwidth, wrr);
164: }
165:
166: rbox_cursor(ip, flag)
167: register struct ite_softc *ip;
168: register int flag;
169: {
170: if (flag == DRAW_CURSOR)
171: draw_cursor(ip)
172: else if (flag == MOVE_CURSOR) {
173: erase_cursor(ip)
174: draw_cursor(ip)
175: }
176: else
177: erase_cursor(ip)
178: }
179:
180: rbox_clear(ip, sy, sx, h, w)
181: struct ite_softc *ip;
182: register int sy, sx, h, w;
183: {
184: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
185: sy * ip->ftheight, sx * ip->ftwidth,
186: h * ip->ftheight, w * ip->ftwidth,
187: RR_CLEAR);
188: }
189:
190: rbox_scroll(ip, sy, sx, count, dir)
191: register struct ite_softc *ip;
192: register int sy, count;
193: int dir, sx;
194: {
195: register int dy;
196: register int dx = sx;
197: register int height = 1;
198: register int width = ip->cols;
199:
200: rbox_cursor(ip, ERASE_CURSOR);
201:
202: if (dir == SCROLL_UP) {
203: dy = sy - count;
204: height = ip->rows - sy;
205: }
206: else if (dir == SCROLL_DOWN) {
207: dy = sy + count;
208: height = ip->rows - dy - 1;
209: }
210: else if (dir == SCROLL_RIGHT) {
211: dy = sy;
212: dx = sx + count;
213: width = ip->cols - dx;
214: }
215: else {
216: dy = sy;
217: dx = sx - count;
218: width = ip->cols - sx;
219: }
220:
221: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
222: dy * ip->ftheight, dx * ip->ftwidth,
223: height * ip->ftheight,
224: width * ip->ftwidth, RR_COPY);
225: }
226:
227: rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
228: struct ite_softc *ip;
229: int sy, sx, dy, dx, h, w, func;
230: {
231: register struct rboxfb *rp = REGBASE;
232: if (h == 0 || w == 0)
233: return;
234:
235: rb_waitbusy(REGADDR);
236: rp->rep_rule = func << 4 | func;
237: rp->source_y = sy;
238: rp->source_x = sx;
239: rp->dest_y = dy;
240: rp->dest_x = dx;
241: rp->wheight = h;
242: rp->wwidth = w;
243: rp->wmove = 1;
244: }
245: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.