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