|
|
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.1 89/02/28$
39: *
1.1.1.2 ! root 40: * from: @(#)ite_dv.c 7.2 (Berkeley) 12/16/90
! 41: * ite_dv.c,v 1.2 1993/05/22 07:59:03 cgd Exp
1.1 root 42: */
43:
44: #include "samachdep.h"
45:
46: #ifdef ITECONSOLE
47:
48: #include "sys/param.h"
49: #include "../dev/itevar.h"
50: #include "../dev/itereg.h"
51: #include "../dev/grfvar.h"
52: #include "../dev/grf_dvreg.h"
53:
54: #define REGBASE ((struct dvboxfb *)(ip->regbase))
55: #define WINDOWMOVER dvbox_windowmove
56:
57: dvbox_init(ip)
58: struct ite_softc *ip;
59: {
60: int i;
61:
62: dv_reset(REGADDR);
63: DELAY(4000);
64:
65: /*
66: * Turn on frame buffer, turn on overlay planes, set replacement
67: * rule, enable top overlay plane writes for ite, disable all frame
68: * buffer planes, set byte per pixel, and display frame buffer 0.
69: * Lastly, turn on the box.
70: */
71: REGBASE->interrupt = 0x04;
72: REGBASE->drive = 0x10;
73: REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
74: REGBASE->opwen = 0x01;
75: REGBASE->fbwen = 0x0;
76: REGBASE->fold = 0x01;
77: REGBASE->vdrive = 0x0;
78: REGBASE->dispen = 0x01;
79:
80: /*
81: * Video enable top overlay plane.
82: */
83: REGBASE->opvenp = 0x01;
84: REGBASE->opvens = 0x01;
85:
86: /*
87: * Make sure that overlay planes override frame buffer planes.
88: */
89: REGBASE->ovly0p = 0x0;
90: REGBASE->ovly0s = 0x0;
91: REGBASE->ovly1p = 0x0;
92: REGBASE->ovly1s = 0x0;
93: REGBASE->fv_trig = 0x1;
94: DELAY(400);
95:
96: /*
97: * Setup the overlay colormaps. Need to set the 0,1 (black/white)
98: * color for both banks.
99: */
100:
101: for (i = 0; i <= 1; i++) {
102: REGBASE->cmapbank = i;
103: REGBASE->rgb[0].red = 0x00;
104: REGBASE->rgb[0].green = 0x00;
105: REGBASE->rgb[0].blue = 0x00;
106: REGBASE->rgb[1].red = 0xFF;
107: REGBASE->rgb[1].green = 0xFF;
108: REGBASE->rgb[1].blue = 0xFF;
109: }
110: REGBASE->cmapbank = 0;
111:
112: db_waitbusy(REGADDR);
113:
114: ite_devinfo(ip);
115: ite_fontinit(ip);
116:
117: /*
118: * Clear the (visible) framebuffer.
119: */
120: dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
121: db_waitbusy(REGADDR);
122:
123: /*
124: * Stash the inverted cursor.
125: */
126: dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
127: ip->cblanky, ip->cblankx, ip->ftheight,
128: ip->ftwidth, RR_COPYINVERTED);
129: db_waitbusy(REGADDR);
130: }
131:
132: dvbox_putc(ip, c, dy, dx, mode)
133: register struct ite_softc *ip;
134: register int dy, dx;
135: int c, mode;
136: {
137: dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
138: dy * ip->ftheight, dx * ip->ftwidth,
139: ip->ftheight, ip->ftwidth, RR_COPY);
140: }
141:
142: dvbox_cursor(ip, flag)
143: register struct ite_softc *ip;
144: register int flag;
145: {
146: if (flag == DRAW_CURSOR)
147: draw_cursor(ip)
148: else if (flag == MOVE_CURSOR) {
149: erase_cursor(ip)
150: draw_cursor(ip)
151: }
152: else
153: erase_cursor(ip)
154: }
155:
156: dvbox_clear(ip, sy, sx, h, w)
157: struct ite_softc *ip;
158: register int sy, sx, h, w;
159: {
160: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
161: sy * ip->ftheight, sx * ip->ftwidth,
162: h * ip->ftheight, w * ip->ftwidth,
163: RR_CLEAR);
164: }
165:
166: dvbox_scroll(ip, sy, sx, count, dir)
167: register struct ite_softc *ip;
168: register int sy, count;
169: int dir, sx;
170: {
171: register int dy = sy - count;
172: register int height = ip->rows - sy;
173:
174: dvbox_cursor(ip, ERASE_CURSOR);
175:
176: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
177: dy * ip->ftheight, sx * ip->ftwidth,
178: height * ip->ftheight,
179: ip->cols * ip->ftwidth, RR_COPY);
180: }
181:
182: dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
183: struct ite_softc *ip;
184: int sy, sx, dy, dx, h, w, func;
185: {
186: register struct dvboxfb *dp = REGBASE;
187: if (h == 0 || w == 0)
188: return;
189:
190: db_waitbusy(REGADDR);
191: dp->rep_rule = func << 4 | func;
192: dp->source_y = sy;
193: dp->source_x = sx;
194: dp->dest_y = dy;
195: dp->dest_x = dx;
196: dp->wheight = h;
197: dp->wwidth = w;
198: dp->wmove = 1;
199: }
200:
201: dv_reset(dbp)
202: register struct dvboxfb *dbp;
203: {
204: dbp->reset = 0x80;
205: DELAY(400);
206:
207: dbp->interrupt = 0x04;
208: dbp->en_scan = 0x01;
209: dbp->fbwen = ~0;
210: dbp->opwen = ~0;
211: dbp->fold = 0x01;
212: dbp->drive = 0x01;
213: dbp->rep_rule = 0x33;
214: dbp->alt_rr = 0x33;
215: dbp->zrr = 0x33;
216:
217: dbp->fbvenp = 0xFF;
218: dbp->dispen = 0x01;
219: dbp->fbvens = 0x0;
220: dbp->fv_trig = 0x01;
221: DELAY(400);
222: dbp->vdrive = 0x0;
223: dbp->zconfig = 0x0;
224:
225: while (dbp->wbusy & 0x01)
226: DELAY(400);
227:
228: /*
229: * Start of missing ROM code.
230: */
231: dbp->cmapbank = 0;
232:
233: dbp->red0 = 0;
234: dbp->red1 = 0;
235: dbp->green0 = 0;
236: dbp->green1 = 0;
237: dbp->blue0 = 0;
238: dbp->blue1 = 0;
239:
240: dbp->panxh = 0;
241: dbp->panxl = 0;
242: dbp->panyh = 0;
243: dbp->panyl = 0;
244: dbp->zoom = 0;
245: dbp->cdwidth = 0x50;
246: dbp->chstart = 0x52;
247: dbp->cvwidth = 0x22;
248: dbp->pz_trig = 1;
249: /*
250: * End of missing ROM code.
251: */
252: }
253:
254: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.