|
|
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_rb.c 1.15 89/04/11$
26: *
27: * @(#)ite_rb.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 "itevar.h"
43: #include "itereg.h"
44: #include "grf_rbreg.h"
45:
46: #include "machine/cpu.h"
47:
48: /* XXX */
49: #include "grfioctl.h"
50: #include "grfvar.h"
51:
52: #define REGBASE ((struct rboxfb *)(ip->regbase))
53: #define WINDOWMOVER rbox_windowmove
54:
55: rbox_init(ip)
56: struct ite_softc *ip;
57: {
58: register int i;
59:
60: /* XXX */
61: if (ip->regbase == 0) {
62: struct grfinfo *gi = &grf_softc[ip - ite_softc].g_display;
63: ip->regbase = IOV(gi->gd_regaddr);
64: ip->fbbase = IOV(gi->gd_fbaddr);
65: }
66:
67: rb_waitbusy(REGADDR);
68:
69: REGBASE->reset = 0x39;
70: DELAY(1000);
71:
72: REGBASE->interrupt = 0x04;
73: REGBASE->display_enable = 0x01;
74: REGBASE->video_enable = 0x01;
75: REGBASE->drive = 0x01;
76: REGBASE->vdrive = 0x0;
77:
78: ite_devinfo(ip);
79:
80: REGBASE->opwen = 0xFF;
81:
82: /*
83: * Clear the framebuffer.
84: */
85: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
86: rb_waitbusy(REGADDR);
87:
88: for(i = 0; i < 16; i++) {
89: *(REGADDR + 0x63c3 + i*4) = 0x0;
90: *(REGADDR + 0x6403 + i*4) = 0x0;
91: *(REGADDR + 0x6803 + i*4) = 0x0;
92: *(REGADDR + 0x6c03 + i*4) = 0x0;
93: *(REGADDR + 0x73c3 + i*4) = 0x0;
94: *(REGADDR + 0x7403 + i*4) = 0x0;
95: *(REGADDR + 0x7803 + i*4) = 0x0;
96: *(REGADDR + 0x7c03 + i*4) = 0x0;
97: }
98:
99: REGBASE->rep_rule = 0x33;
100:
101: /*
102: * I cannot figure out how to make the blink planes stop. So, we
103: * must set both colormaps so that when the planes blink, and
104: * the secondary colormap is active, we still get text.
105: */
106: CM1RED[0x00].value = 0x00;
107: CM1GRN[0x00].value = 0x00;
108: CM1BLU[0x00].value = 0x00;
109: CM1RED[0x01].value = 0xFF;
110: CM1GRN[0x01].value = 0xFF;
111: CM1BLU[0x01].value = 0xFF;
112:
113: CM2RED[0x00].value = 0x00;
114: CM2GRN[0x00].value = 0x00;
115: CM2BLU[0x00].value = 0x00;
116: CM2RED[0x01].value = 0xFF;
117: CM2GRN[0x01].value = 0xFF;
118: CM2BLU[0x01].value = 0xFF;
119:
120: REGBASE->blink = 0x00;
121: REGBASE->write_enable = 0x01;
122: REGBASE->opwen = 0x00;
123:
124: ite_fontinit(ip);
125:
126: /*
127: * Stash the inverted cursor.
128: */
129: rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
130: ip->cblanky, ip->cblankx, ip->ftheight,
131: ip->ftwidth, RR_COPYINVERTED);
132: }
133:
134: rbox_deinit(ip)
135: struct ite_softc *ip;
136: {
137: rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
138: rb_waitbusy(REGADDR);
139:
140: ip->flags &= ~ITE_INITED;
141: }
142:
143: rbox_putc(ip, c, dy, dx, mode)
144: register struct ite_softc *ip;
145: register int dy, dx;
146: int c, mode;
147: {
148: register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
149:
150: rbox_windowmove(ip, charY(ip, c), charX(ip, c),
151: dy * ip->ftheight, dx * ip->ftwidth,
152: ip->ftheight, ip->ftwidth, wrr);
153: }
154:
155: rbox_cursor(ip, flag)
156: register struct ite_softc *ip;
157: register int flag;
158: {
159: if (flag == DRAW_CURSOR)
160: draw_cursor(ip)
161: else if (flag == MOVE_CURSOR) {
162: erase_cursor(ip)
163: draw_cursor(ip)
164: }
165: else
166: erase_cursor(ip)
167: }
168:
169: rbox_clear(ip, sy, sx, h, w)
170: struct ite_softc *ip;
171: register int sy, sx, h, w;
172: {
173: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
174: sy * ip->ftheight, sx * ip->ftwidth,
175: h * ip->ftheight, w * ip->ftwidth,
176: RR_CLEAR);
177: }
178:
179: rbox_scroll(ip, sy, sx, count, dir)
180: register struct ite_softc *ip;
181: register int sy, count;
182: int dir, sx;
183: {
184: register int dy;
185: register int dx = sx;
186: register int height = 1;
187: register int width = ip->cols;
188:
189: rbox_cursor(ip, ERASE_CURSOR);
190:
191: if (dir == SCROLL_UP) {
192: dy = sy - count;
193: height = ip->rows - sy;
194: }
195: else if (dir == SCROLL_DOWN) {
196: dy = sy + count;
197: height = ip->rows - dy - 1;
198: }
199: else if (dir == SCROLL_RIGHT) {
200: dy = sy;
201: dx = sx + count;
202: width = ip->cols - dx;
203: }
204: else {
205: dy = sy;
206: dx = sx - count;
207: width = ip->cols - sx;
208: }
209:
210: rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
211: dy * ip->ftheight, dx * ip->ftwidth,
212: height * ip->ftheight,
213: width * ip->ftwidth, RR_COPY);
214: }
215:
216: rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
217: struct ite_softc *ip;
218: int sy, sx, dy, dx, h, w, func;
219: {
220: register struct rboxfb *rp = REGBASE;
221: if (h == 0 || w == 0)
222: return;
223:
224: rb_waitbusy(REGADDR);
225: rp->rep_rule = func << 4 | func;
226: rp->source_y = sy;
227: rp->source_x = sx;
228: rp->dest_y = dy;
229: rp->dest_x = dx;
230: rp->wheight = h;
231: rp->wwidth = w;
232: rp->wmove = 1;
233: }
234: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.