|
|
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: *
1.1.1.2 ! root 40: * from: @(#)ite_rb.c 7.5 (Berkeley) 5/7/91
! 41: * ite_rb.c,v 1.2 1993/05/22 07:56:30 cgd Exp
1.1 root 42: */
43:
44: #include "ite.h"
45: #if NITE > 0
46:
47: #include "param.h"
48: #include "conf.h"
49: #include "proc.h"
50: #include "ioctl.h"
51: #include "tty.h"
52: #include "systm.h"
53:
54: #include "itevar.h"
55: #include "itereg.h"
56: #include "grf_rbreg.h"
57:
58: #include "machine/cpu.h"
59:
60: /* XXX */
61: #include "grfioctl.h"
62: #include "grfvar.h"
63:
64: #define REGBASE ((struct rboxfb *)(ip->regbase))
65: #define WINDOWMOVER rbox_windowmove
66:
67: rbox_init(ip)
68: struct ite_softc *ip;
69: {
70: register int i;
71:
72: /* XXX */
73: if (ip->regbase == 0) {
74: struct grf_softc *gp = &grf_softc[ip - ite_softc];
75: ip->regbase = gp->g_regkva;
76: ip->fbbase = gp->g_fbkva;
77: }
78:
79: rb_waitbusy(REGADDR);
80:
81: REGBASE->reset = 0x39;
82: DELAY(1000);
83:
84: REGBASE->interrupt = 0x04;
85: REGBASE->display_enable = 0x01;
86: REGBASE->video_enable = 0x01;
87: REGBASE->drive = 0x01;
88: REGBASE->vdrive = 0x0;
89:
90: ite_devinfo(ip);
91:
92: REGBASE->opwen = 0xFF;
93:
94: /*
95: * Clear the framebuffer.
96: */
97: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
98: rb_waitbusy(REGADDR);
99:
100: for(i = 0; i < 16; i++) {
101: *(REGADDR + 0x63c3 + i*4) = 0x0;
102: *(REGADDR + 0x6403 + i*4) = 0x0;
103: *(REGADDR + 0x6803 + i*4) = 0x0;
104: *(REGADDR + 0x6c03 + i*4) = 0x0;
105: *(REGADDR + 0x73c3 + i*4) = 0x0;
106: *(REGADDR + 0x7403 + i*4) = 0x0;
107: *(REGADDR + 0x7803 + i*4) = 0x0;
108: *(REGADDR + 0x7c03 + i*4) = 0x0;
109: }
110:
111: REGBASE->rep_rule = 0x33;
112:
113: /*
114: * I cannot figure out how to make the blink planes stop. So, we
115: * must set both colormaps so that when the planes blink, and
116: * the secondary colormap is active, we still get text.
117: */
118: CM1RED[0x00].value = 0x00;
119: CM1GRN[0x00].value = 0x00;
120: CM1BLU[0x00].value = 0x00;
121: CM1RED[0x01].value = 0xFF;
122: CM1GRN[0x01].value = 0xFF;
123: CM1BLU[0x01].value = 0xFF;
124:
125: CM2RED[0x00].value = 0x00;
126: CM2GRN[0x00].value = 0x00;
127: CM2BLU[0x00].value = 0x00;
128: CM2RED[0x01].value = 0xFF;
129: CM2GRN[0x01].value = 0xFF;
130: CM2BLU[0x01].value = 0xFF;
131:
132: REGBASE->blink = 0x00;
133: REGBASE->write_enable = 0x01;
134: REGBASE->opwen = 0x00;
135:
136: ite_fontinit(ip);
137:
138: /*
139: * Stash the inverted cursor.
140: */
141: rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
142: ip->cblanky, ip->cblankx, ip->ftheight,
143: ip->ftwidth, RR_COPYINVERTED);
144: }
145:
146: rbox_deinit(ip)
147: struct ite_softc *ip;
148: {
149: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
150: rb_waitbusy(REGADDR);
151:
152: ip->flags &= ~ITE_INITED;
153: }
154:
155: rbox_putc(ip, c, dy, dx, mode)
156: register struct ite_softc *ip;
157: register int dy, dx;
158: int c, mode;
159: {
160: register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
161:
162: rbox_windowmove(ip, charY(ip, c), charX(ip, c),
163: dy * ip->ftheight, dx * ip->ftwidth,
164: ip->ftheight, ip->ftwidth, wrr);
165: }
166:
167: rbox_cursor(ip, flag)
168: register struct ite_softc *ip;
169: register int flag;
170: {
171: if (flag == DRAW_CURSOR)
172: draw_cursor(ip)
173: else if (flag == MOVE_CURSOR) {
174: erase_cursor(ip)
175: draw_cursor(ip)
176: }
177: else
178: erase_cursor(ip)
179: }
180:
181: rbox_clear(ip, sy, sx, h, w)
182: struct ite_softc *ip;
183: register int sy, sx, h, w;
184: {
185: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
186: sy * ip->ftheight, sx * ip->ftwidth,
187: h * ip->ftheight, w * ip->ftwidth,
188: RR_CLEAR);
189: }
190:
191: rbox_scroll(ip, sy, sx, count, dir)
192: register struct ite_softc *ip;
193: register int sy, count;
194: int dir, sx;
195: {
196: register int dy;
197: register int dx = sx;
198: register int height = 1;
199: register int width = ip->cols;
200:
201: rbox_cursor(ip, ERASE_CURSOR);
202:
203: if (dir == SCROLL_UP) {
204: dy = sy - count;
205: height = ip->rows - sy;
206: }
207: else if (dir == SCROLL_DOWN) {
208: dy = sy + count;
209: height = ip->rows - dy - 1;
210: }
211: else if (dir == SCROLL_RIGHT) {
212: dy = sy;
213: dx = sx + count;
214: width = ip->cols - dx;
215: }
216: else {
217: dy = sy;
218: dx = sx - count;
219: width = ip->cols - sx;
220: }
221:
222: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
223: dy * ip->ftheight, dx * ip->ftwidth,
224: height * ip->ftheight,
225: width * ip->ftwidth, RR_COPY);
226: }
227:
228: rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
229: struct ite_softc *ip;
230: int sy, sx, dy, dx, h, w, func;
231: {
232: register struct rboxfb *rp = REGBASE;
233: if (h == 0 || w == 0)
234: return;
235:
236: rb_waitbusy(REGADDR);
237: rp->rep_rule = func << 4 | func;
238: rp->source_y = sy;
239: rp->source_x = sx;
240: rp->dest_y = dy;
241: rp->dest_x = dx;
242: rp->wheight = h;
243: rp->wwidth = w;
244: rp->wmove = 1;
245: }
246: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.