|
|
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 is only permitted until one year after the first shipment
11: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
12: * binary forms are permitted provided that: (1) source distributions retain
13: * this entire copyright notice and comment, and (2) distributions including
14: * binaries display the following acknowledgement: This product includes
15: * software developed by the University of California, Berkeley and its
16: * contributors'' in the documentation or other materials provided with the
17: * distribution and in all advertising materials mentioning features or use
18: * of this software. Neither the name of the University nor the names of
19: * its contributors may be used to endorse or promote products derived from
20: * this software without specific prior written permission.
21: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
22: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24: *
25: * from: Utah $Hdr: ite_tc.c 1.22 89/04/11$
26: *
27: * @(#)ite_tc.c 7.1 (Berkeley) 5/8/90
28: */
29:
30: #include "ite.h"
31: #if NITE > 0
32:
33: #include "param.h"
34: #include "conf.h"
35: #include "user.h"
36: #include "proc.h"
37: #include "ioctl.h"
38: #include "tty.h"
39: #include "systm.h"
40: #include "uio.h"
41:
42: #include "grf_tcreg.h"
43: #include "itereg.h"
44: #include "itevar.h"
45:
46: #include "machine/cpu.h"
47:
48: #define REGBASE ((struct tcboxfb *)(ip->regbase))
49: #define WINDOWMOVER topcat_windowmove
50:
51: /* XXX */
52: #include "grfioctl.h"
53: #include "grfvar.h"
54:
55: topcat_init(ip)
56: register struct ite_softc *ip;
57: {
58: /* XXX */
59: if (ip->regbase == NULL) {
60: struct grfinfo *gi = &grf_softc[ip - ite_softc].g_display;
61: ip->regbase = IOV(gi->gd_regaddr);
62: ip->fbbase = IOV(gi->gd_fbaddr);
63: }
64:
65: /*
66: * Determine the number of planes by writing to the first frame
67: * buffer display location, then reading it back.
68: */
69: REGBASE->wen = ~0;
70: REGBASE->fben = ~0;
71: REGBASE->prr = RR_COPY;
72: *FBBASE = 0xFF;
73: ip->planemask = *FBBASE;
74:
75: /*
76: * Enable reading/writing of all the planes.
77: */
78: REGBASE->fben = ip->planemask;
79: REGBASE->wen = ip->planemask;
80: REGBASE->ren = ip->planemask;
81: REGBASE->prr = RR_COPY;
82:
83: ite_devinfo(ip);
84:
85: /*
86: * Clear the framebuffer on all planes.
87: */
88: topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
89: tc_waitbusy(REGADDR, ip->planemask);
90:
91: ite_fontinit(ip);
92:
93: /*
94: * Initialize color map for color displays
95: */
96: if (ip->planemask != 1) {
97: tc_waitbusy(REGADDR, ip->planemask);
98: REGBASE->nblank = 0x01;
99:
100: tccm_waitbusy(REGADDR);
101: REGBASE->rdata = 0x0;
102: REGBASE->gdata = 0x0;
103: REGBASE->bdata = 0x0;
104: REGBASE->cindex = 0xFF;
105: REGBASE->strobe = 0xFF;
106:
107: DELAY(100);
108: tccm_waitbusy(REGADDR);
109: REGBASE->rdata = 0x0;
110: REGBASE->gdata = 0x0;
111: REGBASE->bdata = 0x0;
112: REGBASE->cindex = 0x0;
113:
114: DELAY(100);
115: tccm_waitbusy(REGADDR);
116: REGBASE->rdata = 0xFF;
117: REGBASE->gdata = 0xFF;
118: REGBASE->bdata = 0xFF;
119: REGBASE->cindex = 0xFE;
120: REGBASE->strobe = 0xFF;
121:
122: DELAY(100);
123: tccm_waitbusy(REGADDR);
124: REGBASE->rdata = 0x0;
125: REGBASE->gdata = 0x0;
126: REGBASE->bdata = 0x0;
127: REGBASE->cindex = 0x0;
128: }
129:
130: /*
131: * Stash the inverted cursor.
132: */
133: topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
134: ip->cblanky, ip->cblankx, ip->ftheight,
135: ip->ftwidth, RR_COPYINVERTED);
136: }
137:
138: topcat_deinit(ip)
139: register struct ite_softc *ip;
140: {
141: topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
142: tc_waitbusy(REGADDR, ip->planemask);
143:
144: REGBASE->nblank = ~0;
145: ip->flags &= ~ITE_INITED;
146: }
147:
148: topcat_putc(ip, c, dy, dx, mode)
149: register struct ite_softc *ip;
150: int c, dy, dx, mode;
151: {
152: int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
153:
154: topcat_windowmove(ip, charY(ip, c), charX(ip, c),
155: dy * ip->ftheight, dx * ip->ftwidth,
156: ip->ftheight, ip->ftwidth, wmrr);
157: }
158:
159: topcat_cursor(ip, flag)
160: register struct ite_softc *ip;
161: register int flag;
162: {
163: if (flag == DRAW_CURSOR)
164: draw_cursor(ip)
165: else if (flag == MOVE_CURSOR) {
166: erase_cursor(ip)
167: draw_cursor(ip)
168: }
169: else
170: erase_cursor(ip)
171: }
172:
173: topcat_clear(ip, sy, sx, h, w)
174: register struct ite_softc *ip;
175: register int sy, sx, h, w;
176: {
177: topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
178: sy * ip->ftheight, sx * ip->ftwidth,
179: h * ip->ftheight, w * ip->ftwidth,
180: RR_CLEAR);
181: }
182:
183: topcat_scroll(ip, sy, sx, count, dir)
184: register struct ite_softc *ip;
185: register int sy, count;
186: int dir, sx;
187: {
188: register int dy;
189: register int dx = sx;
190: register int height = 1;
191: register int width = ip->cols;
192:
193: topcat_cursor(ip, ERASE_CURSOR);
194:
195: if (dir == SCROLL_UP) {
196: dy = sy - count;
197: height = ip->rows - sy;
198: }
199: else if (dir == SCROLL_DOWN) {
200: dy = sy + count;
201: height = ip->rows - dy - 1;
202: }
203: else if (dir == SCROLL_RIGHT) {
204: dy = sy;
205: dx = sx + count;
206: width = ip->cols - dx;
207: }
208: else {
209: dy = sy;
210: dx = sx - count;
211: width = ip->cols - sx;
212: }
213:
214: topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
215: dy * ip->ftheight, dx * ip->ftwidth,
216: height * ip->ftheight,
217: width * ip->ftwidth, RR_COPY);
218: }
219:
220: topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
221: struct ite_softc *ip;
222: int sy, sx, dy, dx, h, w, func;
223: {
224: register struct tcboxfb *rp = REGBASE;
225:
226: if (h == 0 || w == 0)
227: return;
228: tc_waitbusy(REGADDR, ip->planemask);
229: rp->wmrr = func;
230: rp->source_y = sy;
231: rp->source_x = sx;
232: rp->dest_y = dy;
233: rp->dest_x = dx;
234: rp->wheight = h;
235: rp->wwidth = w;
236: rp->wmove = ip->planemask;
237: }
238: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.