No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hp300 / stand / common / ite_gb.c
bloba61eed96721bbd0e275cd6254367bb0b898effbc
1 /* $NetBSD: ite_gb.c,v 1.5 2005/12/11 12:17:19 christos Exp $ */
3 /*
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer
9 * Science Department.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
35 * from: Utah $Hdr: ite_gb.c 1.9 92/01/20$
37 * @(#)ite_gb.c 8.1 (Berkeley) 6/10/93
40 * Copyright (c) 1988 University of Utah.
42 * This code is derived from software contributed to Berkeley by
43 * the Systems Programming Group of the University of Utah Computer
44 * Science Department.
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 3. All advertising materials mentioning features or use of this software
55 * must display the following acknowledgement:
56 * This product includes software developed by the University of
57 * California, Berkeley and its contributors.
58 * 4. Neither the name of the University nor the names of its contributors
59 * may be used to endorse or promote products derived from this software
60 * without specific prior written permission.
62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE.
74 * from: Utah $Hdr: ite_gb.c 1.9 92/01/20$
76 * @(#)ite_gb.c 8.1 (Berkeley) 6/10/93
79 #ifdef ITECONSOLE
81 #include <sys/param.h>
83 #include <hp300/dev/itereg.h>
84 #include <hp300/dev/grf_gbreg.h>
86 #include <hp300/stand/common/samachdep.h>
87 #include <hp300/stand/common/itevar.h>
89 #define WINDOWMOVER gbox_windowmove
91 void gbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
93 void
94 gbox_init(struct ite_data *ip)
96 struct gboxfb *regbase = (void *)ip->regbase;
98 regbase->write_protect = 0x0;
99 regbase->interrupt = 0x4;
100 regbase->rep_rule = RR_COPY;
101 regbase->blink1 = 0xff;
102 regbase->blink2 = 0xff;
103 regbase->sec_interrupt = 0x01;
106 * Set up the color map entries. We use three entries in the
107 * color map. The first, is for black, the second is for
108 * white, and the very last entry is for the inverted cursor.
110 regbase->creg_select = 0x00;
111 regbase->cmap_red = 0x00;
112 regbase->cmap_grn = 0x00;
113 regbase->cmap_blu = 0x00;
114 regbase->cmap_write = 0x00;
115 gbcm_waitbusy(regbase);
117 regbase->creg_select = 0x01;
118 regbase->cmap_red = 0xFF;
119 regbase->cmap_grn = 0xFF;
120 regbase->cmap_blu = 0xFF;
121 regbase->cmap_write = 0x01;
122 gbcm_waitbusy(regbase);
124 regbase->creg_select = 0xFF;
125 regbase->cmap_red = 0xFF;
126 regbase->cmap_grn = 0xFF;
127 regbase->cmap_blu = 0xFF;
128 regbase->cmap_write = 0x01;
129 gbcm_waitbusy(regbase);
131 ite_fontinfo(ip);
132 ite_fontinit(ip);
135 * Clear the display. This used to be before the font unpacking
136 * but it crashes. Figure it out later.
138 gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
139 tile_mover_waitbusy(regbase);
142 * Stash the inverted cursor.
144 gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
145 ip->cblanky, ip->cblankx, ip->ftheight,
146 ip->ftwidth, RR_COPYINVERTED);
149 void
150 gbox_putc(struct ite_data *ip, int c, int dy, int dx, int mode)
153 gbox_windowmove(ip, charY(ip, c), charX(ip, c),
154 dy * ip->ftheight, dx * ip->ftwidth,
155 ip->ftheight, ip->ftwidth, RR_COPY);
158 void
159 gbox_cursor(struct ite_data *ip, int flag)
162 if (flag == DRAW_CURSOR)
163 draw_cursor(ip)
164 else if (flag == MOVE_CURSOR) {
165 erase_cursor(ip)
166 draw_cursor(ip)
167 } else
168 erase_cursor(ip)
171 void
172 gbox_clear(struct ite_data *ip, int sy, int sx, int h, int w)
175 gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
176 sy * ip->ftheight, sx * ip->ftwidth,
177 h * ip->ftheight, w * ip->ftwidth,
178 RR_CLEAR);
181 #define gbox_blockmove(ip, sy, sx, dy, dx, h, w) \
182 gbox_windowmove((ip), \
183 (sy) * ip->ftheight, \
184 (sx) * ip->ftwidth, \
185 (dy) * ip->ftheight, \
186 (dx) * ip->ftwidth, \
187 (h) * ip->ftheight, \
188 (w) * ip->ftwidth, \
189 RR_COPY)
191 void
192 gbox_scroll(struct ite_data *ip, int sy, int sx, int count, int dir)
194 struct gboxfb *regbase = (void *)ip->regbase;
195 int height, dy, i;
197 tile_mover_waitbusy(regbase);
198 regbase->write_protect = 0x0;
200 gbox_cursor(ip, ERASE_CURSOR);
202 dy = sy - count;
203 height = ip->rows - sy;
204 for (i = 0; i < height; i++)
205 gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
208 void
209 gbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
210 int w, int mask)
212 struct gboxfb *regbase = (void *)ip->regbase;
213 int src, dest;
215 src = (sy * 1024) + sx; /* upper left corner in pixels */
216 dest = (dy * 1024) + dx;
218 tile_mover_waitbusy(regbase);
219 regbase->width = -(w / 4);
220 regbase->height = -(h / 4);
221 if (src < dest)
222 regbase->rep_rule = MOVE_DOWN_RIGHT|mask;
223 else {
224 regbase->rep_rule = MOVE_UP_LEFT|mask;
226 * Adjust to top of lower right tile of the block.
228 src = src + ((h - 4) * 1024) + (w - 4);
229 dest= dest + ((h - 4) * 1024) + (w - 4);
231 FBBASE[dest] = FBBASE[src];
233 #endif