Annotation of sys/arch/hp300/stand/common/ite_dv.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: ite_dv.c,v 1.6 2006/08/17 06:31:10 miod Exp $ */
2: /* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */
3:
4: /*
5: * Copyright (c) 1988 University of Utah.
6: * Copyright (c) 1990, 1993
7: * The Regents of the University of California. All rights reserved.
8: *
9: * This code is derived from software contributed to Berkeley by
10: * the Systems Programming Group of the University of Utah Computer
11: * Science Department.
12: *
13: * Redistribution and use in source and binary forms, with or without
14: * modification, are permitted provided that the following conditions
15: * are met:
16: * 1. Redistributions of source code must retain the above copyright
17: * notice, this list of conditions and the following disclaimer.
18: * 2. Redistributions in binary form must reproduce the above copyright
19: * notice, this list of conditions and the following disclaimer in the
20: * documentation and/or other materials provided with the distribution.
21: * 3. Neither the name of the University nor the names of its contributors
22: * may be used to endorse or promote products derived from this software
23: * without specific prior written permission.
24: *
25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: * SUCH DAMAGE.
36: *
37: * from: Utah $Hdr: ite_dv.c 1.2 92/01/20$
38: *
39: * @(#)ite_dv.c 8.1 (Berkeley) 6/10/93
40: */
41:
42: #ifdef ITECONSOLE
43:
44: #include <sys/param.h>
45:
46: #include "samachdep.h"
47: #include "itevar.h"
48: #include "grf_dvreg.h"
49:
50: #define REGBASE ((struct dvboxfb *)(ip->regbase))
51:
52: void dvbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
53: void dv_reset(struct dvboxfb *);
54:
55: void
56: dvbox_init(struct ite_data *ip)
57: {
58: int i;
59:
60: ip->bmv = dvbox_windowmove;
61: dv_reset((struct dvboxfb *)ip->regbase);
62: DELAY(4000);
63:
64: /*
65: * Turn on frame buffer, turn on overlay planes, set replacement
66: * rule, enable top overlay plane writes for ite, disable all frame
67: * buffer planes, set byte per pixel, and display frame buffer 0.
68: * Lastly, turn on the box.
69: */
70: REGBASE->interrupt = 0x04;
71: REGBASE->drive = 0x10;
72: REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
73: REGBASE->opwen = 0x01;
74: REGBASE->fbwen = 0x0;
75: REGBASE->fold = 0x01;
76: REGBASE->vdrive = 0x0;
77: REGBASE->dispen = 0x01;
78:
79: /*
80: * Video enable top overlay plane.
81: */
82: REGBASE->opvenp = 0x01;
83: REGBASE->opvens = 0x01;
84:
85: /*
86: * Make sure that overlay planes override frame buffer planes.
87: */
88: REGBASE->ovly0p = 0x0;
89: REGBASE->ovly0s = 0x0;
90: REGBASE->ovly1p = 0x0;
91: REGBASE->ovly1s = 0x0;
92: REGBASE->fv_trig = 0x1;
93: DELAY(400);
94:
95: /*
96: * Setup the overlay colormaps. Need to set the 0,1 (black/white)
97: * color for both banks.
98: */
99:
100: for (i = 0; i <= 1; i++) {
101: REGBASE->cmapbank = i;
102: REGBASE->rgb[0].red = 0x00;
103: REGBASE->rgb[0].green = 0x00;
104: REGBASE->rgb[0].blue = 0x00;
105: REGBASE->rgb[1].red = 0xFF;
106: REGBASE->rgb[1].green = 0xFF;
107: REGBASE->rgb[1].blue = 0xFF;
108: }
109: REGBASE->cmapbank = 0;
110:
111: db_waitbusy(ip->regbase);
112:
113: ite_fontinfo(ip);
114: ite_fontinit8bpp(ip);
115:
116: /*
117: * Clear the (visible) framebuffer.
118: */
119: dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
120: db_waitbusy(ip->regbase);
121:
122: /*
123: * Stash the inverted cursor.
124: */
125: dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
126: ip->cblanky, ip->cblankx, ip->ftheight,
127: ip->ftwidth, RR_COPYINVERTED);
128: db_waitbusy(ip->regbase);
129: }
130:
131: void
132: dvbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
133: int w, int func)
134: {
135: struct dvboxfb *dp = REGBASE;
136: if (h == 0 || w == 0)
137: return;
138:
139: db_waitbusy(ip->regbase);
140: dp->rep_rule = func << 4 | func;
141: dp->source_y = sy;
142: dp->source_x = sx;
143: dp->dest_y = dy;
144: dp->dest_x = dx;
145: dp->wheight = h;
146: dp->wwidth = w;
147: dp->wmove = 1;
148: }
149:
150: void
151: dv_reset(struct dvboxfb *dbp)
152: {
153: dbp->reset = 0x80;
154: DELAY(400);
155:
156: dbp->interrupt = 0x04;
157: dbp->en_scan = 0x01;
158: dbp->fbwen = ~0;
159: dbp->opwen = ~0;
160: dbp->fold = 0x01;
161: dbp->drive = 0x01;
162: dbp->rep_rule = 0x33;
163: dbp->alt_rr = 0x33;
164: dbp->zrr = 0x33;
165:
166: dbp->fbvenp = 0xFF;
167: dbp->dispen = 0x01;
168: dbp->fbvens = 0x0;
169: dbp->fv_trig = 0x01;
170: DELAY(400);
171: dbp->vdrive = 0x0;
172: dbp->zconfig = 0x0;
173:
174: while (dbp->wbusy & 0x01)
175: DELAY(400);
176:
177: /*
178: * Start of missing ROM code.
179: */
180: dbp->cmapbank = 0;
181:
182: dbp->red0 = 0;
183: dbp->red1 = 0;
184: dbp->green0 = 0;
185: dbp->green1 = 0;
186: dbp->blue0 = 0;
187: dbp->blue1 = 0;
188:
189: dbp->panxh = 0;
190: dbp->panxl = 0;
191: dbp->panyh = 0;
192: dbp->panyl = 0;
193: dbp->zoom = 0;
194: dbp->cdwidth = 0x50;
195: dbp->chstart = 0x52;
196: dbp->cvwidth = 0x22;
197: dbp->pz_trig = 1;
198: /*
199: * End of missing ROM code.
200: */
201: }
202: #endif
CVSweb