|
|
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_dv.c 1.5 89/04/11$ ! 26: * ! 27: * @(#)ite_dv.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_dvreg.h" ! 45: ! 46: #include "machine/cpu.h" ! 47: ! 48: /* XXX */ ! 49: #include "grfioctl.h" ! 50: #include "grfvar.h" ! 51: ! 52: #define REGBASE ((struct dvboxfb *)(ip->regbase)) ! 53: #define WINDOWMOVER dvbox_windowmove ! 54: ! 55: dvbox_init(ip) ! 56: struct ite_softc *ip; ! 57: { ! 58: 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: dv_reset(REGADDR); ! 68: ! 69: /* ! 70: * Turn on frame buffer, turn on overlay planes, set replacement ! 71: * rule, enable top overlay plane writes for ite, disable all frame ! 72: * buffer planes, set byte per pixel, and display frame buffer 0. ! 73: * Lastly, turn on the box. ! 74: */ ! 75: REGBASE->interrupt = 0x04; ! 76: REGBASE->drive = 0x10; ! 77: REGBASE->rep_rule = RR_COPY << 4 | RR_COPY; ! 78: REGBASE->opwen = 0x01; ! 79: REGBASE->fbwen = 0x0; ! 80: REGBASE->fold = 0x01; ! 81: REGBASE->vdrive = 0x0; ! 82: REGBASE->dispen = 0x01; ! 83: ! 84: /* ! 85: * Video enable top overlay plane. ! 86: */ ! 87: REGBASE->opvenp = 0x01; ! 88: REGBASE->opvens = 0x01; ! 89: ! 90: /* ! 91: * Make sure that overlay planes override frame buffer planes. ! 92: */ ! 93: REGBASE->ovly0p = 0x0; ! 94: REGBASE->ovly0s = 0x0; ! 95: REGBASE->ovly1p = 0x0; ! 96: REGBASE->ovly1s = 0x0; ! 97: REGBASE->fv_trig = 0x1; ! 98: DELAY(100); ! 99: ! 100: /* ! 101: * Setup the overlay colormaps. Need to set the 0,1 (black/white) ! 102: * color for both banks. ! 103: */ ! 104: ! 105: for (i = 0; i <= 1; i++) { ! 106: REGBASE->cmapbank = i; ! 107: REGBASE->rgb[0].red = 0x00; ! 108: REGBASE->rgb[0].green = 0x00; ! 109: REGBASE->rgb[0].blue = 0x00; ! 110: REGBASE->rgb[1].red = 0xFF; ! 111: REGBASE->rgb[1].green = 0xFF; ! 112: REGBASE->rgb[1].blue = 0xFF; ! 113: } ! 114: REGBASE->cmapbank = 0; ! 115: ! 116: db_waitbusy(REGADDR); ! 117: ! 118: ite_devinfo(ip); ! 119: ite_fontinit(ip); ! 120: ! 121: /* ! 122: * Clear the (visible) framebuffer. ! 123: */ ! 124: dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR); ! 125: db_waitbusy(REGADDR); ! 126: ! 127: /* ! 128: * Stash the inverted cursor. ! 129: */ ! 130: dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '), ! 131: ip->cblanky, ip->cblankx, ip->ftheight, ! 132: ip->ftwidth, RR_COPYINVERTED); ! 133: } ! 134: ! 135: dvbox_deinit(ip) ! 136: struct ite_softc *ip; ! 137: { ! 138: dvbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); ! 139: db_waitbusy(REGADDR); ! 140: ! 141: ip->flags &= ~ITE_INITED; ! 142: } ! 143: ! 144: dvbox_putc(ip, c, dy, dx, mode) ! 145: register struct ite_softc *ip; ! 146: register int dy, dx; ! 147: int c, mode; ! 148: { ! 149: register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY); ! 150: ! 151: dvbox_windowmove(ip, charY(ip, c), charX(ip, c), ! 152: dy * ip->ftheight, dx * ip->ftwidth, ! 153: ip->ftheight, ip->ftwidth, wrr); ! 154: } ! 155: ! 156: dvbox_cursor(ip, flag) ! 157: register struct ite_softc *ip; ! 158: register int flag; ! 159: { ! 160: if (flag == DRAW_CURSOR) ! 161: draw_cursor(ip) ! 162: else if (flag == MOVE_CURSOR) { ! 163: erase_cursor(ip) ! 164: draw_cursor(ip) ! 165: } ! 166: else ! 167: erase_cursor(ip) ! 168: } ! 169: ! 170: dvbox_clear(ip, sy, sx, h, w) ! 171: struct ite_softc *ip; ! 172: register int sy, sx, h, w; ! 173: { ! 174: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, ! 175: sy * ip->ftheight, sx * ip->ftwidth, ! 176: h * ip->ftheight, w * ip->ftwidth, ! 177: RR_CLEAR); ! 178: } ! 179: ! 180: dvbox_scroll(ip, sy, sx, count, dir) ! 181: register struct ite_softc *ip; ! 182: register int sy, count; ! 183: int dir, sx; ! 184: { ! 185: register int dy; ! 186: register int dx = sx; ! 187: register int height = 1; ! 188: register int width = ip->cols; ! 189: ! 190: dvbox_cursor(ip, ERASE_CURSOR); ! 191: ! 192: if (dir == SCROLL_UP) { ! 193: dy = sy - count; ! 194: height = ip->rows - sy; ! 195: } ! 196: else if (dir == SCROLL_DOWN) { ! 197: dy = sy + count; ! 198: height = ip->rows - dy - 1; ! 199: } ! 200: else if (dir == SCROLL_RIGHT) { ! 201: dy = sy; ! 202: dx = sx + count; ! 203: width = ip->cols - dx; ! 204: } ! 205: else { ! 206: dy = sy; ! 207: dx = sx - count; ! 208: width = ip->cols - sx; ! 209: } ! 210: ! 211: dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, ! 212: dy * ip->ftheight, dx * ip->ftwidth, ! 213: height * ip->ftheight, ! 214: width * ip->ftwidth, RR_COPY); ! 215: } ! 216: ! 217: dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func) ! 218: struct ite_softc *ip; ! 219: int sy, sx, dy, dx, h, w, func; ! 220: { ! 221: register struct dvboxfb *dp = REGBASE; ! 222: if (h == 0 || w == 0) ! 223: return; ! 224: ! 225: db_waitbusy(REGADDR); ! 226: dp->rep_rule = func << 4 | func; ! 227: dp->source_y = sy; ! 228: dp->source_x = sx; ! 229: dp->dest_y = dy; ! 230: dp->dest_x = dx; ! 231: dp->wheight = h; ! 232: dp->wwidth = w; ! 233: dp->wmove = 1; ! 234: } ! 235: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.