ite_rb.c revision 1.12 1 /* $NetBSD: ite_rb.c,v 1.12 2025/05/27 18:02:58 tsutsui Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1990, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
37 *
38 * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93
39 */
40
41 #ifdef ITECONSOLE
42
43 #include <sys/param.h>
44
45 #include <hp300/stand/common/itereg.h>
46 #include <hp300/stand/common/grf_rbreg.h>
47
48 #include <hp300/stand/common/samachdep.h>
49 #include <hp300/stand/common/itevar.h>
50
51 static void rbox_windowmove(struct ite_data *, int, int, int, int,
52 int, int, int);
53
54 void
55 rbox_init(struct ite_data *ip)
56 {
57 struct rboxfb *regbase = (void *)ip->regbase;
58 int i;
59
60 ip->bmv = rbox_windowmove;
61
62 rb_waitbusy(regbase);
63 DELAY(3000);
64
65 regbase->interrupt = 0x04;
66 regbase->display_enable = 0x01;
67 regbase->video_enable = 0x01;
68 regbase->drive = 0x01;
69 regbase->vdrive = 0x0;
70
71 ite_fontinfo(ip);
72
73 regbase->opwen = 0xFF;
74
75 /*
76 * Clear the framebuffer.
77 */
78 rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
79 rb_waitbusy(regbase);
80
81 for(i = 0; i < 16; i++) {
82 *((char *)ip->regbase + 0x63c3 + i * 4) = 0x0;
83 *((char *)ip->regbase + 0x6403 + i * 4) = 0x0;
84 *((char *)ip->regbase + 0x6803 + i * 4) = 0x0;
85 *((char *)ip->regbase + 0x6c03 + i * 4) = 0x0;
86 *((char *)ip->regbase + 0x73c3 + i * 4) = 0x0;
87 *((char *)ip->regbase + 0x7403 + i * 4) = 0x0;
88 *((char *)ip->regbase + 0x7803 + i * 4) = 0x0;
89 *((char *)ip->regbase + 0x7c03 + i * 4) = 0x0;
90 }
91
92 regbase->rep_rule = 0x33;
93
94 /*
95 * I cannot figure out how to make the blink planes stop. So, we
96 * must set both colormaps so that when the planes blink, and
97 * the secondary colormap is active, we still get text.
98 */
99 CM1RED[0x00].value = 0x00;
100 CM1GRN[0x00].value = 0x00;
101 CM1BLU[0x00].value = 0x00;
102 CM1RED[0x01].value = 0xFF;
103 CM1GRN[0x01].value = 0xFF;
104 CM1BLU[0x01].value = 0xFF;
105
106 CM2RED[0x00].value = 0x00;
107 CM2GRN[0x00].value = 0x00;
108 CM2BLU[0x00].value = 0x00;
109 CM2RED[0x01].value = 0xFF;
110 CM2GRN[0x01].value = 0xFF;
111 CM2BLU[0x01].value = 0xFF;
112
113 regbase->blink = 0x00;
114 regbase->write_enable = 0x01;
115 regbase->opwen = 0x00;
116
117 ite_fontinit8bpp(ip);
118
119 /*
120 * Stash the inverted cursor.
121 */
122 rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
123 ip->cblanky, ip->cblankx, ip->ftheight,
124 ip->ftwidth, RR_COPYINVERTED);
125 }
126
127 static void
128 rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
129 int w, int func)
130 {
131 struct rboxfb *rp = (void *)ip->regbase;
132
133 if (h == 0 || w == 0)
134 return;
135
136 rb_waitbusy(rp);
137 rp->rep_rule = func << 4 | func;
138 rp->source_y = sy;
139 rp->source_x = sx;
140 rp->dest_y = dy;
141 rp->dest_x = dx;
142 rp->wheight = h;
143 rp->wwidth = w;
144 rp->wmove = 1;
145 }
146 #endif
147