BSD 4_3_Reno release
[unix-history] / usr / src / sys / hpstand / ite_dv.c
CommitLineData
a8fd2d0d
KM
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 *
1c15e888
C
10 * Redistribution is only permitted until one year after the first shipment
11 * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
12 * binary forms are permitted provided that: (1) source distributions retain
13 * this entire copyright notice and comment, and (2) distributions including
14 * binaries display the following acknowledgement: This product includes
15 * software developed by the University of California, Berkeley and its
16 * contributors'' in the documentation or other materials provided with the
17 * distribution and in all advertising materials mentioning features or use
18 * of this software. Neither the name of the University nor the names of
19 * its contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
a8fd2d0d
KM
24 *
25 * from: Utah $Hdr: ite_dv.c 1.1 89/02/28$
26 *
1c15e888 27 * @(#)ite_dv.c 7.1 (Berkeley) 5/8/90
a8fd2d0d
KM
28 */
29
30#include "samachdep.h"
31
32#ifdef ITECONSOLE
33
1c15e888
C
34#include "param.h"
35#include "../hpdev/itevar.h"
36#include "../hpdev/itereg.h"
37#include "../hpdev/grfvar.h"
38#include "../hpdev/grf_dvreg.h"
a8fd2d0d
KM
39
40#define REGBASE ((struct dvboxfb *)(ip->regbase))
41#define WINDOWMOVER dvbox_windowmove
42
43dvbox_init(ip)
44 struct ite_softc *ip;
45{
46 int i;
47
48 dv_reset(REGADDR);
49 DELAY(4000);
50
51 /*
52 * Turn on frame buffer, turn on overlay planes, set replacement
53 * rule, enable top overlay plane writes for ite, disable all frame
54 * buffer planes, set byte per pixel, and display frame buffer 0.
55 * Lastly, turn on the box.
56 */
57 REGBASE->interrupt = 0x04;
58 REGBASE->drive = 0x10;
59 REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
60 REGBASE->opwen = 0x01;
61 REGBASE->fbwen = 0x0;
62 REGBASE->fold = 0x01;
63 REGBASE->vdrive = 0x0;
64 REGBASE->dispen = 0x01;
65
66 /*
67 * Video enable top overlay plane.
68 */
69 REGBASE->opvenp = 0x01;
70 REGBASE->opvens = 0x01;
71
72 /*
73 * Make sure that overlay planes override frame buffer planes.
74 */
75 REGBASE->ovly0p = 0x0;
76 REGBASE->ovly0s = 0x0;
77 REGBASE->ovly1p = 0x0;
78 REGBASE->ovly1s = 0x0;
79 REGBASE->fv_trig = 0x1;
80 DELAY(400);
81
82 /*
83 * Setup the overlay colormaps. Need to set the 0,1 (black/white)
84 * color for both banks.
85 */
86
87 for (i = 0; i <= 1; i++) {
88 REGBASE->cmapbank = i;
89 REGBASE->rgb[0].red = 0x00;
90 REGBASE->rgb[0].green = 0x00;
91 REGBASE->rgb[0].blue = 0x00;
92 REGBASE->rgb[1].red = 0xFF;
93 REGBASE->rgb[1].green = 0xFF;
94 REGBASE->rgb[1].blue = 0xFF;
95 }
96 REGBASE->cmapbank = 0;
97
98 db_waitbusy(REGADDR);
99
100 ite_devinfo(ip);
101 ite_fontinit(ip);
102
103 /*
104 * Clear the (visible) framebuffer.
105 */
106 dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
107 db_waitbusy(REGADDR);
108
109 /*
110 * Stash the inverted cursor.
111 */
112 dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
113 ip->cblanky, ip->cblankx, ip->ftheight,
114 ip->ftwidth, RR_COPYINVERTED);
115 db_waitbusy(REGADDR);
116}
117
118dvbox_putc(ip, c, dy, dx, mode)
119 register struct ite_softc *ip;
120 register int dy, dx;
121 int c, mode;
122{
123 dvbox_windowmove(ip, charY(ip, c), charX(ip, c),
124 dy * ip->ftheight, dx * ip->ftwidth,
125 ip->ftheight, ip->ftwidth, RR_COPY);
126}
127
128dvbox_cursor(ip, flag)
129 register struct ite_softc *ip;
130 register int flag;
131{
132 if (flag == DRAW_CURSOR)
133 draw_cursor(ip)
134 else if (flag == MOVE_CURSOR) {
135 erase_cursor(ip)
136 draw_cursor(ip)
137 }
138 else
139 erase_cursor(ip)
140}
141
142dvbox_clear(ip, sy, sx, h, w)
143 struct ite_softc *ip;
144 register int sy, sx, h, w;
145{
146 dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
147 sy * ip->ftheight, sx * ip->ftwidth,
148 h * ip->ftheight, w * ip->ftwidth,
149 RR_CLEAR);
150}
151
152dvbox_scroll(ip, sy, sx, count, dir)
153 register struct ite_softc *ip;
154 register int sy, count;
155 int dir, sx;
156{
157 register int dy = sy - count;
158 register int height = ip->rows - sy;
159
160 dvbox_cursor(ip, ERASE_CURSOR);
161
162 dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
163 dy * ip->ftheight, sx * ip->ftwidth,
164 height * ip->ftheight,
165 ip->cols * ip->ftwidth, RR_COPY);
166}
167
168dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
169 struct ite_softc *ip;
170 int sy, sx, dy, dx, h, w, func;
171{
172 register struct dvboxfb *dp = REGBASE;
173 if (h == 0 || w == 0)
174 return;
175
176 db_waitbusy(REGADDR);
177 dp->rep_rule = func << 4 | func;
178 dp->source_y = sy;
179 dp->source_x = sx;
180 dp->dest_y = dy;
181 dp->dest_x = dx;
182 dp->wheight = h;
183 dp->wwidth = w;
184 dp->wmove = 1;
185}
186
187dv_reset(dbp)
188 register struct dvboxfb *dbp;
189{
190 dbp->reset = 0x80;
191 DELAY(400);
192
193 dbp->interrupt = 0x04;
194 dbp->en_scan = 0x01;
195 dbp->fbwen = ~0;
196 dbp->opwen = ~0;
197 dbp->fold = 0x01;
198 dbp->drive = 0x01;
199 dbp->rep_rule = 0x33;
200 dbp->alt_rr = 0x33;
201 dbp->zrr = 0x33;
202
203 dbp->fbvenp = 0xFF;
204 dbp->dispen = 0x01;
205 dbp->fbvens = 0x0;
206 dbp->fv_trig = 0x01;
207 DELAY(400);
208 dbp->vdrive = 0x0;
209 dbp->zconfig = 0x0;
210
211 while (dbp->wbusy & 0x01)
212 DELAY(400);
213
214 /*
215 * Start of missing ROM code.
216 */
217 dbp->cmapbank = 0;
218
219 dbp->red0 = 0;
220 dbp->red1 = 0;
221 dbp->green0 = 0;
222 dbp->green1 = 0;
223 dbp->blue0 = 0;
224 dbp->blue1 = 0;
225
226 dbp->panxh = 0;
227 dbp->panxl = 0;
228 dbp->panyh = 0;
229 dbp->panyl = 0;
230 dbp->zoom = 0;
231 dbp->cdwidth = 0x50;
232 dbp->chstart = 0x52;
233 dbp->cvwidth = 0x22;
234 dbp->pz_trig = 1;
235 /*
236 * End of missing ROM code.
237 */
238}
239
240#endif