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 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: ite_tc.c 1.9 89/02/20$ 13 * 14 * @(#)ite_tc.c 7.1 (Berkeley) 05/08/90 15 */ 16 17 #include "samachdep.h" 18 19 #ifdef ITECONSOLE 20 21 #include "param.h" 22 #include "../hpdev/itevar.h" 23 #include "../hpdev/itereg.h" 24 #include "../hpdev/grfvar.h" 25 #include "../hpdev/grf_tcreg.h" 26 27 #define REGBASE ((struct tcboxfb *)(ip->regbase)) 28 #define WINDOWMOVER topcat_windowmove 29 30 topcat_init(ip) 31 register struct ite_softc *ip; 32 { 33 34 /* 35 * Determine the number of planes by writing to the first frame 36 * buffer display location, then reading it back. 37 */ 38 REGBASE->wen = ~0; 39 REGBASE->fben = ~0; 40 REGBASE->prr = RR_COPY; 41 *FBBASE = 0xFF; 42 ip->planemask = *FBBASE; 43 44 /* 45 * Enable reading/writing of all the planes. 46 */ 47 REGBASE->fben = ip->planemask; 48 REGBASE->wen = ip->planemask; 49 REGBASE->ren = ip->planemask; 50 REGBASE->prr = RR_COPY; 51 52 ite_devinfo(ip); 53 54 /* 55 * Clear the framebuffer on all planes. 56 */ 57 topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); 58 tc_waitbusy(REGADDR, ip->planemask); 59 60 ite_fontinit(ip); 61 62 /* 63 * Stash the inverted cursor. 64 */ 65 topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 66 ip->cblanky, ip->cblankx, ip->ftheight, 67 ip->ftwidth, RR_COPYINVERTED); 68 } 69 70 topcat_putc(ip, c, dy, dx, mode) 71 register struct ite_softc *ip; 72 register int dy, dx; 73 int c, mode; 74 { 75 topcat_windowmove(ip, charY(ip, c), charX(ip, c), 76 dy * ip->ftheight, dx * ip->ftwidth, 77 ip->ftheight, ip->ftwidth, RR_COPY); 78 } 79 80 topcat_cursor(ip, flag) 81 register struct ite_softc *ip; 82 register int flag; 83 { 84 if (flag == DRAW_CURSOR) 85 draw_cursor(ip) 86 else if (flag == MOVE_CURSOR) { 87 erase_cursor(ip) 88 draw_cursor(ip) 89 } 90 else 91 erase_cursor(ip) 92 } 93 94 topcat_clear(ip, sy, sx, h, w) 95 struct ite_softc *ip; 96 register int sy, sx, h, w; 97 { 98 topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 99 sy * ip->ftheight, sx * ip->ftwidth, 100 h * ip->ftheight, w * ip->ftwidth, 101 RR_CLEAR); 102 } 103 104 topcat_scroll(ip, sy, sx, count, dir) 105 register struct ite_softc *ip; 106 register int sy, count; 107 int dir, sx; 108 { 109 register int dy = sy - count; 110 register int height = ip->rows - sy; 111 112 topcat_cursor(ip, ERASE_CURSOR); 113 114 topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 115 dy * ip->ftheight, sx * ip->ftwidth, 116 height * ip->ftheight, 117 ip->cols * ip->ftwidth, RR_COPY); 118 } 119 120 topcat_windowmove(ip, sy, sx, dy, dx, h, w, func) 121 struct ite_softc *ip; 122 int sy, sx, dy, dx, h, w, func; 123 { 124 register struct tcboxfb *rp = REGBASE; 125 126 if (h == 0 || w == 0) 127 return; 128 tc_waitbusy(REGADDR, ip->planemask); 129 rp->wmrr = func; 130 rp->source_y = sy; 131 rp->source_x = sx; 132 rp->dest_y = dy; 133 rp->dest_x = dx; 134 rp->wheight = h; 135 rp->wwidth = w; 136 rp->wmove = ip->planemask; 137 } 138 #endif 139