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_dv.c 1.1 89/02/28$ 13 * 14 * @(#)ite_dv.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_dvreg.h" 26 27 #define REGBASE ((struct dvboxfb *)(ip->regbase)) 28 #define WINDOWMOVER dvbox_windowmove 29 30 dvbox_init(ip) 31 struct ite_softc *ip; 32 { 33 int i; 34 35 dv_reset(REGADDR); 36 DELAY(4000); 37 38 /* 39 * Turn on frame buffer, turn on overlay planes, set replacement 40 * rule, enable top overlay plane writes for ite, disable all frame 41 * buffer planes, set byte per pixel, and display frame buffer 0. 42 * Lastly, turn on the box. 43 */ 44 REGBASE->interrupt = 0x04; 45 REGBASE->drive = 0x10; 46 REGBASE->rep_rule = RR_COPY << 4 | RR_COPY; 47 REGBASE->opwen = 0x01; 48 REGBASE->fbwen = 0x0; 49 REGBASE->fold = 0x01; 50 REGBASE->vdrive = 0x0; 51 REGBASE->dispen = 0x01; 52 53 /* 54 * Video enable top overlay plane. 55 */ 56 REGBASE->opvenp = 0x01; 57 REGBASE->opvens = 0x01; 58 59 /* 60 * Make sure that overlay planes override frame buffer planes. 61 */ 62 REGBASE->ovly0p = 0x0; 63 REGBASE->ovly0s = 0x0; 64 REGBASE->ovly1p = 0x0; 65 REGBASE->ovly1s = 0x0; 66 REGBASE->fv_trig = 0x1; 67 DELAY(400); 68 69 /* 70 * Setup the overlay colormaps. Need to set the 0,1 (black/white) 71 * color for both banks. 72 */ 73 74 for (i = 0; i <= 1; i++) { 75 REGBASE->cmapbank = i; 76 REGBASE->rgb[0].red = 0x00; 77 REGBASE->rgb[0].green = 0x00; 78 REGBASE->rgb[0].blue = 0x00; 79 REGBASE->rgb[1].red = 0xFF; 80 REGBASE->rgb[1].green = 0xFF; 81 REGBASE->rgb[1].blue = 0xFF; 82 } 83 REGBASE->cmapbank = 0; 84 85 db_waitbusy(REGADDR); 86 87 ite_devinfo(ip); 88 ite_fontinit(ip); 89 90 /* 91 * Clear the (visible) framebuffer. 92 */ 93 dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR); 94 db_waitbusy(REGADDR); 95 96 /* 97 * Stash the inverted cursor. 98 */ 99 dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 100 ip->cblanky, ip->cblankx, ip->ftheight, 101 ip->ftwidth, RR_COPYINVERTED); 102 db_waitbusy(REGADDR); 103 } 104 105 dvbox_putc(ip, c, dy, dx, mode) 106 register struct ite_softc *ip; 107 register int dy, dx; 108 int c, mode; 109 { 110 dvbox_windowmove(ip, charY(ip, c), charX(ip, c), 111 dy * ip->ftheight, dx * ip->ftwidth, 112 ip->ftheight, ip->ftwidth, RR_COPY); 113 } 114 115 dvbox_cursor(ip, flag) 116 register struct ite_softc *ip; 117 register int flag; 118 { 119 if (flag == DRAW_CURSOR) 120 draw_cursor(ip) 121 else if (flag == MOVE_CURSOR) { 122 erase_cursor(ip) 123 draw_cursor(ip) 124 } 125 else 126 erase_cursor(ip) 127 } 128 129 dvbox_clear(ip, sy, sx, h, w) 130 struct ite_softc *ip; 131 register int sy, sx, h, w; 132 { 133 dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 134 sy * ip->ftheight, sx * ip->ftwidth, 135 h * ip->ftheight, w * ip->ftwidth, 136 RR_CLEAR); 137 } 138 139 dvbox_scroll(ip, sy, sx, count, dir) 140 register struct ite_softc *ip; 141 register int sy, count; 142 int dir, sx; 143 { 144 register int dy = sy - count; 145 register int height = ip->rows - sy; 146 147 dvbox_cursor(ip, ERASE_CURSOR); 148 149 dvbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 150 dy * ip->ftheight, sx * ip->ftwidth, 151 height * ip->ftheight, 152 ip->cols * ip->ftwidth, RR_COPY); 153 } 154 155 dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func) 156 struct ite_softc *ip; 157 int sy, sx, dy, dx, h, w, func; 158 { 159 register struct dvboxfb *dp = REGBASE; 160 if (h == 0 || w == 0) 161 return; 162 163 db_waitbusy(REGADDR); 164 dp->rep_rule = func << 4 | func; 165 dp->source_y = sy; 166 dp->source_x = sx; 167 dp->dest_y = dy; 168 dp->dest_x = dx; 169 dp->wheight = h; 170 dp->wwidth = w; 171 dp->wmove = 1; 172 } 173 174 dv_reset(dbp) 175 register struct dvboxfb *dbp; 176 { 177 dbp->reset = 0x80; 178 DELAY(400); 179 180 dbp->interrupt = 0x04; 181 dbp->en_scan = 0x01; 182 dbp->fbwen = ~0; 183 dbp->opwen = ~0; 184 dbp->fold = 0x01; 185 dbp->drive = 0x01; 186 dbp->rep_rule = 0x33; 187 dbp->alt_rr = 0x33; 188 dbp->zrr = 0x33; 189 190 dbp->fbvenp = 0xFF; 191 dbp->dispen = 0x01; 192 dbp->fbvens = 0x0; 193 dbp->fv_trig = 0x01; 194 DELAY(400); 195 dbp->vdrive = 0x0; 196 dbp->zconfig = 0x0; 197 198 while (dbp->wbusy & 0x01) 199 DELAY(400); 200 201 /* 202 * Start of missing ROM code. 203 */ 204 dbp->cmapbank = 0; 205 206 dbp->red0 = 0; 207 dbp->red1 = 0; 208 dbp->green0 = 0; 209 dbp->green1 = 0; 210 dbp->blue0 = 0; 211 dbp->blue1 = 0; 212 213 dbp->panxh = 0; 214 dbp->panxl = 0; 215 dbp->panyh = 0; 216 dbp->panyl = 0; 217 dbp->zoom = 0; 218 dbp->cdwidth = 0x50; 219 dbp->chstart = 0x52; 220 dbp->cvwidth = 0x22; 221 dbp->pz_trig = 1; 222 /* 223 * End of missing ROM code. 224 */ 225 } 226 227 #endif 228