ite_rb.c revision 1.9 1 /* $NetBSD: ite_rb.c,v 1.9 2011/02/08 20:20:14 rmind 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 #define WINDOWMOVER rbox_windowmove
52
53 void rbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
54
55 void
56 rbox_init(struct ite_data *ip)
57 {
58 struct rboxfb *regbase = (void *)ip->regbase;
59 int i;
60
61 rb_waitbusy(regbase);
62 DELAY(3000);
63
64 regbase->interrupt = 0x04;
65 regbase->display_enable = 0x01;
66 regbase->video_enable = 0x01;
67 regbase->drive = 0x01;
68 regbase->vdrive = 0x0;
69
70 ite_fontinfo(ip);
71
72 regbase->opwen = 0xFF;
73
74 /*
75 * Clear the framebuffer.
76 */
77 rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
78 rb_waitbusy(regbase);
79
80 for(i = 0; i < 16; i++) {
81 *((char *)ip->regbase + 0x63c3 + i * 4) = 0x0;
82 *((char *)ip->regbase + 0x6403 + i * 4) = 0x0;
83 *((char *)ip->regbase + 0x6803 + i * 4) = 0x0;
84 *((char *)ip->regbase + 0x6c03 + i * 4) = 0x0;
85 *((char *)ip->regbase + 0x73c3 + i * 4) = 0x0;
86 *((char *)ip->regbase + 0x7403 + i * 4) = 0x0;
87 *((char *)ip->regbase + 0x7803 + i * 4) = 0x0;
88 *((char *)ip->regbase + 0x7c03 + i * 4) = 0x0;
89 }
90
91 regbase->rep_rule = 0x33;
92
93 /*
94 * I cannot figure out how to make the blink planes stop. So, we
95 * must set both colormaps so that when the planes blink, and
96 * the secondary colormap is active, we still get text.
97 */
98 CM1RED[0x00].value = 0x00;
99 CM1GRN[0x00].value = 0x00;
100 CM1BLU[0x00].value = 0x00;
101 CM1RED[0x01].value = 0xFF;
102 CM1GRN[0x01].value = 0xFF;
103 CM1BLU[0x01].value = 0xFF;
104
105 CM2RED[0x00].value = 0x00;
106 CM2GRN[0x00].value = 0x00;
107 CM2BLU[0x00].value = 0x00;
108 CM2RED[0x01].value = 0xFF;
109 CM2GRN[0x01].value = 0xFF;
110 CM2BLU[0x01].value = 0xFF;
111
112 regbase->blink = 0x00;
113 regbase->write_enable = 0x01;
114 regbase->opwen = 0x00;
115
116 ite_fontinit(ip);
117
118 /*
119 * Stash the inverted cursor.
120 */
121 rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
122 ip->cblanky, ip->cblankx, ip->ftheight,
123 ip->ftwidth, RR_COPYINVERTED);
124 }
125
126 void
127 rbox_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
128 {
129
130 rbox_windowmove(ip, charY(ip, c), charX(ip, c),
131 dy * ip->ftheight, dx * ip->ftwidth,
132 ip->ftheight, ip->ftwidth, RR_COPY);
133 }
134
135 void
136 rbox_cursor(struct ite_data *ip, int flag)
137 {
138
139 if (flag == DRAW_CURSOR)
140 draw_cursor(ip)
141 else if (flag == MOVE_CURSOR) {
142 erase_cursor(ip)
143 draw_cursor(ip)
144 } else
145 erase_cursor(ip)
146 }
147
148 void
149 rbox_clear(struct ite_data *ip, int sy, int sx, int h, int w)
150 {
151
152 rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
153 sy * ip->ftheight, sx * ip->ftwidth,
154 h * ip->ftheight, w * ip->ftwidth,
155 RR_CLEAR);
156 }
157
158 void
159 rbox_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
160 {
161 int dy = sy - count;
162 int height = ip->rows - sy;
163
164 rbox_cursor(ip, ERASE_CURSOR);
165
166 rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
167 dy * ip->ftheight, sx * ip->ftwidth,
168 height * ip->ftheight,
169 ip->cols * ip->ftwidth, RR_COPY);
170 }
171
172 void
173 rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx,
174 int h, int w, int func)
175 {
176 struct rboxfb *rp = (void *)ip->regbase;
177
178 if (h == 0 || w == 0)
179 return;
180
181 rb_waitbusy(rp);
182 rp->rep_rule = func << 4 | func;
183 rp->source_y = sy;
184 rp->source_x = sx;
185 rp->dest_y = dy;
186 rp->dest_x = dx;
187 rp->wheight = h;
188 rp->wwidth = w;
189 rp->wmove = 1;
190 }
191 #endif
192