|
|
1.1 root 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: *
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.
25: *
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.
37: *
38: * from: Utah $Hdr: ite_tc.c 1.25 91/03/25$
39: *
40: * @(#)ite_tc.c 7.4 (Berkeley) 5/7/91
41: */
42:
43: #include "ite.h"
44: #if NITE > 0
45:
46: #include "param.h"
47: #include "conf.h"
48: #include "proc.h"
49: #include "ioctl.h"
50: #include "tty.h"
51: #include "systm.h"
52:
53: #include "grf_tcreg.h"
54: #include "itereg.h"
55: #include "itevar.h"
56:
57: #include "machine/cpu.h"
58:
59: #define REGBASE ((struct tcboxfb *)(ip->regbase))
60: #define WINDOWMOVER topcat_windowmove
61:
62: /* XXX */
63: #include "grfioctl.h"
64: #include "grfvar.h"
65:
66: topcat_init(ip)
67: register struct ite_softc *ip;
68: {
69: /* XXX */
70: if (ip->regbase == NULL) {
71: struct grf_softc *gp = &grf_softc[ip - ite_softc];
72: ip->regbase = gp->g_regkva;
73: ip->fbbase = gp->g_fbkva;
74: }
75:
76: /*
77: * Catseye looks a lot like a topcat, but not completely.
78: * So, we set some bits to make it work.
79: */
80: if (REGBASE->fbid != GID_TOPCAT) {
81: while ((REGBASE->catseye_status & 1))
82: ;
83: REGBASE->catseye_status = 0x0;
84: REGBASE->vb_select = 0x0;
85: REGBASE->tcntrl = 0x0;
86: REGBASE->acntrl = 0x0;
87: REGBASE->pncntrl = 0x0;
88: REGBASE->rug_cmdstat = 0x90;
89: }
90:
91: /*
92: * Determine the number of planes by writing to the first frame
93: * buffer display location, then reading it back.
94: */
95: REGBASE->wen = ~0;
96: REGBASE->fben = ~0;
97: REGBASE->prr = RR_COPY;
98: *FBBASE = 0xFF;
99: ip->planemask = *FBBASE;
100:
101: /*
102: * Enable reading/writing of all the planes.
103: */
104: REGBASE->fben = ip->planemask;
105: REGBASE->wen = ip->planemask;
106: REGBASE->ren = ip->planemask;
107: REGBASE->prr = RR_COPY;
108:
109: ite_devinfo(ip);
110:
111: /*
112: * Clear the framebuffer on all planes.
113: */
114: topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
115: tc_waitbusy(REGADDR, ip->planemask);
116:
117: ite_fontinit(ip);
118:
119: /*
120: * Initialize color map for color displays
121: */
122: if (ip->planemask != 1) {
123: tc_waitbusy(REGADDR, ip->planemask);
124: REGBASE->nblank = 0x01;
125:
126: tccm_waitbusy(REGADDR);
127: REGBASE->rdata = 0x0;
128: REGBASE->gdata = 0x0;
129: REGBASE->bdata = 0x0;
130: REGBASE->cindex = 0xFF;
131: REGBASE->strobe = 0xFF;
132:
133: DELAY(100);
134: tccm_waitbusy(REGADDR);
135: REGBASE->rdata = 0x0;
136: REGBASE->gdata = 0x0;
137: REGBASE->bdata = 0x0;
138: REGBASE->cindex = 0x0;
139:
140: DELAY(100);
141: tccm_waitbusy(REGADDR);
142: REGBASE->rdata = 0xFF;
143: REGBASE->gdata = 0xFF;
144: REGBASE->bdata = 0xFF;
145: REGBASE->cindex = 0xFE;
146: REGBASE->strobe = 0xFF;
147:
148: DELAY(100);
149: tccm_waitbusy(REGADDR);
150: REGBASE->rdata = 0x0;
151: REGBASE->gdata = 0x0;
152: REGBASE->bdata = 0x0;
153: REGBASE->cindex = 0x0;
154: }
155:
156: /*
157: * Stash the inverted cursor.
158: */
159: topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
160: ip->cblanky, ip->cblankx, ip->ftheight,
161: ip->ftwidth, RR_COPYINVERTED);
162: }
163:
164: topcat_deinit(ip)
165: register struct ite_softc *ip;
166: {
167: topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
168: tc_waitbusy(REGADDR, ip->planemask);
169:
170: REGBASE->nblank = ~0;
171: ip->flags &= ~ITE_INITED;
172: }
173:
174: topcat_putc(ip, c, dy, dx, mode)
175: register struct ite_softc *ip;
176: int c, dy, dx, mode;
177: {
178: int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
179:
180: topcat_windowmove(ip, charY(ip, c), charX(ip, c),
181: dy * ip->ftheight, dx * ip->ftwidth,
182: ip->ftheight, ip->ftwidth, wmrr);
183: }
184:
185: topcat_cursor(ip, flag)
186: register struct ite_softc *ip;
187: register int flag;
188: {
189: if (flag == DRAW_CURSOR)
190: draw_cursor(ip)
191: else if (flag == MOVE_CURSOR) {
192: erase_cursor(ip)
193: draw_cursor(ip)
194: }
195: else
196: erase_cursor(ip)
197: }
198:
199: topcat_clear(ip, sy, sx, h, w)
200: register struct ite_softc *ip;
201: register int sy, sx, h, w;
202: {
203: topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
204: sy * ip->ftheight, sx * ip->ftwidth,
205: h * ip->ftheight, w * ip->ftwidth,
206: RR_CLEAR);
207: }
208:
209: topcat_scroll(ip, sy, sx, count, dir)
210: register struct ite_softc *ip;
211: register int sy, count;
212: int dir, sx;
213: {
214: register int dy;
215: register int dx = sx;
216: register int height = 1;
217: register int width = ip->cols;
218:
219: topcat_cursor(ip, ERASE_CURSOR);
220:
221: if (dir == SCROLL_UP) {
222: dy = sy - count;
223: height = ip->rows - sy;
224: }
225: else if (dir == SCROLL_DOWN) {
226: dy = sy + count;
227: height = ip->rows - dy - 1;
228: }
229: else if (dir == SCROLL_RIGHT) {
230: dy = sy;
231: dx = sx + count;
232: width = ip->cols - dx;
233: }
234: else {
235: dy = sy;
236: dx = sx - count;
237: width = ip->cols - sx;
238: }
239:
240: topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
241: dy * ip->ftheight, dx * ip->ftwidth,
242: height * ip->ftheight,
243: width * ip->ftwidth, RR_COPY);
244: }
245:
246: topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
247: struct ite_softc *ip;
248: int sy, sx, dy, dx, h, w, func;
249: {
250: register struct tcboxfb *rp = REGBASE;
251:
252: if (h == 0 || w == 0)
253: return;
254: tc_waitbusy(REGADDR, ip->planemask);
255: rp->wmrr = func;
256: rp->source_y = sy;
257: rp->source_x = sx;
258: rp->dest_y = dy;
259: rp->dest_x = dx;
260: rp->wheight = h;
261: rp->wwidth = w;
262: rp->wmove = ip->planemask;
263: }
264: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.