Commit | Line | Data |
---|---|---|
a8fd2d0d KM |
1 | /* |
2 | * Copyright (c) 1988 University of Utah. | |
ad787160 C |
3 | * Copyright (c) 1990, 1993 |
4 | * The Regents of the University of California. All rights reserved. | |
a8fd2d0d KM |
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 | * | |
ad787160 C |
10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | |
18 | * 3. All advertising materials mentioning features or use of this software | |
19 | * must display the following acknowledgement: | |
20 | * This product includes software developed by the University of | |
21 | * California, Berkeley and its contributors. | |
22 | * 4. Neither the name of the University nor the names of its contributors | |
23 | * may be used to endorse or promote products derived from this software | |
24 | * without specific prior written permission. | |
a8fd2d0d | 25 | * |
ad787160 C |
26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
36 | * SUCH DAMAGE. | |
a8fd2d0d | 37 | * |
33583b53 | 38 | * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$ |
a8fd2d0d | 39 | * |
ad787160 | 40 | * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93 |
a8fd2d0d KM |
41 | */ |
42 | ||
38a01dbe | 43 | #include <hp300/stand/samachdep.h> |
a8fd2d0d KM |
44 | |
45 | #ifdef ITECONSOLE | |
46 | ||
38a01dbe KB |
47 | #include <sys/param.h> |
48 | #include <hp/dev/itevar.h> | |
49 | #include <hp/dev/itereg.h> | |
33583b53 | 50 | |
38a01dbe | 51 | #include <hp300/dev/grf_rbreg.h> |
a8fd2d0d KM |
52 | |
53 | #define REGBASE ((struct rboxfb *)(ip->regbase)) | |
54 | #define WINDOWMOVER rbox_windowmove | |
55 | ||
56 | rbox_init(ip) | |
57 | struct ite_softc *ip; | |
58 | { | |
59 | int i; | |
60 | ||
33583b53 | 61 | rb_waitbusy(ip->regbase); |
a8fd2d0d KM |
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 | ||
33583b53 | 70 | ite_fontinfo(ip); |
a8fd2d0d KM |
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); | |
33583b53 | 78 | rb_waitbusy(ip->regbase); |
a8fd2d0d KM |
79 | |
80 | for(i = 0; i < 16; i++) { | |
33583b53 MH |
81 | *(ip->regbase + 0x63c3 + i*4) = 0x0; |
82 | *(ip->regbase + 0x6403 + i*4) = 0x0; | |
83 | *(ip->regbase + 0x6803 + i*4) = 0x0; | |
84 | *(ip->regbase + 0x6c03 + i*4) = 0x0; | |
85 | *(ip->regbase + 0x73c3 + i*4) = 0x0; | |
86 | *(ip->regbase + 0x7403 + i*4) = 0x0; | |
87 | *(ip->regbase + 0x7803 + i*4) = 0x0; | |
88 | *(ip->regbase + 0x7c03 + i*4) = 0x0; | |
a8fd2d0d KM |
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 | rbox_putc(ip, c, dy, dx, mode) | |
127 | register struct ite_softc *ip; | |
128 | register int dy, dx; | |
129 | int c, mode; | |
130 | { | |
131 | rbox_windowmove(ip, charY(ip, c), charX(ip, c), | |
132 | dy * ip->ftheight, dx * ip->ftwidth, | |
133 | ip->ftheight, ip->ftwidth, RR_COPY); | |
134 | } | |
135 | ||
136 | rbox_cursor(ip, flag) | |
137 | register struct ite_softc *ip; | |
138 | register int flag; | |
139 | { | |
140 | if (flag == DRAW_CURSOR) | |
141 | draw_cursor(ip) | |
142 | else if (flag == MOVE_CURSOR) { | |
143 | erase_cursor(ip) | |
144 | draw_cursor(ip) | |
145 | } | |
146 | else | |
147 | erase_cursor(ip) | |
148 | } | |
149 | ||
150 | rbox_clear(ip, sy, sx, h, w) | |
151 | struct ite_softc *ip; | |
152 | register int sy, sx, h, w; | |
153 | { | |
154 | rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, | |
155 | sy * ip->ftheight, sx * ip->ftwidth, | |
156 | h * ip->ftheight, w * ip->ftwidth, | |
157 | RR_CLEAR); | |
158 | } | |
159 | ||
160 | rbox_scroll(ip, sy, sx, count, dir) | |
161 | register struct ite_softc *ip; | |
162 | register int sy, count; | |
163 | int dir, sx; | |
164 | { | |
165 | register int dy = sy - count; | |
166 | register int height = ip->rows - sy; | |
167 | ||
168 | rbox_cursor(ip, ERASE_CURSOR); | |
169 | ||
170 | rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, | |
171 | dy * ip->ftheight, sx * ip->ftwidth, | |
172 | height * ip->ftheight, | |
173 | ip->cols * ip->ftwidth, RR_COPY); | |
174 | } | |
175 | ||
176 | rbox_windowmove(ip, sy, sx, dy, dx, h, w, func) | |
177 | struct ite_softc *ip; | |
178 | int sy, sx, dy, dx, h, w, func; | |
179 | { | |
180 | register struct rboxfb *rp = REGBASE; | |
181 | if (h == 0 || w == 0) | |
182 | return; | |
183 | ||
33583b53 | 184 | rb_waitbusy(ip->regbase); |
a8fd2d0d KM |
185 | rp->rep_rule = func << 4 | func; |
186 | rp->source_y = sy; | |
187 | rp->source_x = sx; | |
188 | rp->dest_y = dy; | |
189 | rp->dest_x = dx; | |
190 | rp->wheight = h; | |
191 | rp->wwidth = w; | |
192 | rp->wmove = 1; | |
193 | } | |
194 | #endif |