|
|
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_dv.c 1.7 91/01/21$
39: *
1.1.1.2 ! root 40: * from: @(#)ite_dv.c 7.5 (Berkeley) 5/7/91
! 41: * ite_dv.c,v 1.2 1993/05/22 07:56:26 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_dvreg.h"
57:
58: #include "machine/cpu.h"
59:
60: /* XXX */
61: #include "grfioctl.h"
62: #include "grfvar.h"
63:
64: #define REGBASE ((struct dvboxfb *)(ip->regbase))
65: #define WINDOWMOVER dvbox_windowmove
66:
67: dvbox_init(ip)
68: struct ite_softc *ip;
69: {
70: 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: dv_reset(REGADDR);
80:
81: /*
82: * Turn on frame buffer, turn on overlay planes, set replacement
83: * rule, enable top overlay plane writes for ite, disable all frame
84: * buffer planes, set byte per pixel, and display frame buffer 0.
85: * Lastly, turn on the box.
86: */
87: REGBASE->interrupt = 0x04;
88: REGBASE->drive = 0x10;
89: REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
90: REGBASE->opwen = 0x01;
91: REGBASE->fbwen = 0x0;
92: REGBASE->fold = 0x01;
93: REGBASE->vdrive = 0x0;
94: REGBASE->dispen = 0x01;
95:
96: /*
97: * Video enable top overlay plane.
98: */
99: REGBASE->opvenp = 0x01;
100: REGBASE->opvens = 0x01;
101:
102: /*
103: * Make sure that overlay planes override frame buffer planes.
104: */
105: REGBASE->ovly0p = 0x0;
106: REGBASE->ovly0s = 0x0;
107: REGBASE->ovly1p = 0x0;
108: REGBASE->ovly1s = 0x0;
109: REGBASE->fv_trig = 0x1;
110: DELAY(100);
111:
112: /*
113: * Setup the overlay colormaps. Need to set the 0,1 (black/white)
114: * color for both banks.
115: */
116:
117: for (i = 0; i <= 1; i++) {
118: REGBASE->cmapbank = i;
119: REGBASE->rgb[0].red = 0x00;
120: REGBASE->rgb[0].green = 0x00;
121: REGBASE->rgb[0].blue = 0x00;
122: REGBASE->rgb[1].red = 0xFF;
123: REGBASE->rgb[1].green = 0xFF;
124: REGBASE->rgb[1].blue = 0xFF;
125: }
126: REGBASE->cmapbank = 0;
127:
128: db_waitbusy(REGADDR);
129:
130: ite_devinfo(ip);
131: ite_fontinit(ip);
132:
133: /*
134: * Clear the (visible) framebuffer.
135: */
136: dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
137: db_waitbusy(REGADDR);
138:
139: /*
140: * Stash the inverted cursor.
141: */
142: dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
143: ip->cblanky, ip->cblankx, ip->ftheight,
144: ip->ftwidth, RR_COPYINVERTED);
145: }
146:
147: dvbox_deinit(ip)
148: struct ite_softc *ip;
149: {
150: dvbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
151: db_waitbusy(REGADDR);
152:
153: ip->flags &= ~ITE_INITED;
154: }
155:
156: dvbox_putc(ip, c, dy, dx, mode)
157: register struct ite_softc *ip;
158: register int dy, dx;
159: int c, mode;
160: {
161: register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
162:
163: dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
164: dy * ip->ftheight, dx * ip->ftwidth,
165: ip->ftheight, ip->ftwidth, wrr);
166: }
167:
168: dvbox_cursor(ip, flag)
169: register struct ite_softc *ip;
170: register int flag;
171: {
172: if (flag == DRAW_CURSOR)
173: draw_cursor(ip)
174: else if (flag == MOVE_CURSOR) {
175: erase_cursor(ip)
176: draw_cursor(ip)
177: }
178: else
179: erase_cursor(ip)
180: }
181:
182: dvbox_clear(ip, sy, sx, h, w)
183: struct ite_softc *ip;
184: register int sy, sx, h, w;
185: {
186: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
187: sy * ip->ftheight, sx * ip->ftwidth,
188: h * ip->ftheight, w * ip->ftwidth,
189: RR_CLEAR);
190: }
191:
192: dvbox_scroll(ip, sy, sx, count, dir)
193: register struct ite_softc *ip;
194: register int sy, count;
195: int dir, sx;
196: {
197: register int dy;
198: register int dx = sx;
199: register int height = 1;
200: register int width = ip->cols;
201:
202: dvbox_cursor(ip, ERASE_CURSOR);
203:
204: if (dir == SCROLL_UP) {
205: dy = sy - count;
206: height = ip->rows - sy;
207: }
208: else if (dir == SCROLL_DOWN) {
209: dy = sy + count;
210: height = ip->rows - dy - 1;
211: }
212: else if (dir == SCROLL_RIGHT) {
213: dy = sy;
214: dx = sx + count;
215: width = ip->cols - dx;
216: }
217: else {
218: dy = sy;
219: dx = sx - count;
220: width = ip->cols - sx;
221: }
222:
223: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
224: dy * ip->ftheight, dx * ip->ftwidth,
225: height * ip->ftheight,
226: width * ip->ftwidth, RR_COPY);
227: }
228:
229: dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
230: struct ite_softc *ip;
231: int sy, sx, dy, dx, h, w, func;
232: {
233: register struct dvboxfb *dp = REGBASE;
234: if (h == 0 || w == 0)
235: return;
236:
237: db_waitbusy(REGADDR);
238: dp->rep_rule = func << 4 | func;
239: dp->source_y = sy;
240: dp->source_x = sx;
241: dp->dest_y = dy;
242: dp->dest_x = dx;
243: dp->wheight = h;
244: dp->wwidth = w;
245: dp->wmove = 1;
246: }
247: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.