1 /* $NetBSD: ite_rb.c,v 1.1 1997/02/04 03:52:35 thorpej Exp $ */ 2 3 /* 4 * Copyright (c) 1988 University of Utah. 5 * Copyright (c) 1990, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * the Systems Programming Group of the University of Utah Computer 10 * Science Department. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the University of 23 * California, Berkeley and its contributors. 24 * 4. Neither the name of the University nor the names of its contributors 25 * may be used to endorse or promote products derived from this software 26 * without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * SUCH DAMAGE. 39 * 40 * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$ 41 * 42 * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93 43 */ 44 45 #ifdef ITECONSOLE 46 47 #include <sys/param.h> 48 49 #include <hp300/dev/itereg.h> 50 #include <hp300/dev/grf_rbreg.h> 51 52 #include <hp300/stand/common/samachdep.h> 53 #include <hp300/stand/common/itevar.h> 54 55 #define REGBASE ((struct rboxfb *)(ip->regbase)) 56 #define WINDOWMOVER rbox_windowmove 57 58 void rbox_windowmove __P((struct ite_data *, int, int, int, int, 59 int, int, int)); 60 61 void 62 rbox_init(ip) 63 struct ite_data *ip; 64 { 65 int i; 66 67 rb_waitbusy(ip->regbase); 68 DELAY(3000); 69 70 REGBASE->interrupt = 0x04; 71 REGBASE->display_enable = 0x01; 72 REGBASE->video_enable = 0x01; 73 REGBASE->drive = 0x01; 74 REGBASE->vdrive = 0x0; 75 76 ite_fontinfo(ip); 77 78 REGBASE->opwen = 0xFF; 79 80 /* 81 * Clear the framebuffer. 82 */ 83 rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); 84 rb_waitbusy(ip->regbase); 85 86 for(i = 0; i < 16; i++) { 87 *(ip->regbase + 0x63c3 + i*4) = 0x0; 88 *(ip->regbase + 0x6403 + i*4) = 0x0; 89 *(ip->regbase + 0x6803 + i*4) = 0x0; 90 *(ip->regbase + 0x6c03 + i*4) = 0x0; 91 *(ip->regbase + 0x73c3 + i*4) = 0x0; 92 *(ip->regbase + 0x7403 + i*4) = 0x0; 93 *(ip->regbase + 0x7803 + i*4) = 0x0; 94 *(ip->regbase + 0x7c03 + i*4) = 0x0; 95 } 96 97 REGBASE->rep_rule = 0x33; 98 99 /* 100 * I cannot figure out how to make the blink planes stop. So, we 101 * must set both colormaps so that when the planes blink, and 102 * the secondary colormap is active, we still get text. 103 */ 104 CM1RED[0x00].value = 0x00; 105 CM1GRN[0x00].value = 0x00; 106 CM1BLU[0x00].value = 0x00; 107 CM1RED[0x01].value = 0xFF; 108 CM1GRN[0x01].value = 0xFF; 109 CM1BLU[0x01].value = 0xFF; 110 111 CM2RED[0x00].value = 0x00; 112 CM2GRN[0x00].value = 0x00; 113 CM2BLU[0x00].value = 0x00; 114 CM2RED[0x01].value = 0xFF; 115 CM2GRN[0x01].value = 0xFF; 116 CM2BLU[0x01].value = 0xFF; 117 118 REGBASE->blink = 0x00; 119 REGBASE->write_enable = 0x01; 120 REGBASE->opwen = 0x00; 121 122 ite_fontinit(ip); 123 124 /* 125 * Stash the inverted cursor. 126 */ 127 rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 128 ip->cblanky, ip->cblankx, ip->ftheight, 129 ip->ftwidth, RR_COPYINVERTED); 130 } 131 132 void 133 rbox_putc(ip, c, dy, dx, mode) 134 register struct ite_data *ip; 135 register int dy, dx; 136 int c, mode; 137 { 138 rbox_windowmove(ip, charY(ip, c), charX(ip, c), 139 dy * ip->ftheight, dx * ip->ftwidth, 140 ip->ftheight, ip->ftwidth, RR_COPY); 141 } 142 143 void 144 rbox_cursor(ip, flag) 145 register struct ite_data *ip; 146 register int flag; 147 { 148 if (flag == DRAW_CURSOR) 149 draw_cursor(ip) 150 else if (flag == MOVE_CURSOR) { 151 erase_cursor(ip) 152 draw_cursor(ip) 153 } 154 else 155 erase_cursor(ip) 156 } 157 158 void 159 rbox_clear(ip, sy, sx, h, w) 160 struct ite_data *ip; 161 register int sy, sx, h, w; 162 { 163 rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 164 sy * ip->ftheight, sx * ip->ftwidth, 165 h * ip->ftheight, w * ip->ftwidth, 166 RR_CLEAR); 167 } 168 169 void 170 rbox_scroll(ip, sy, sx, count, dir) 171 register struct ite_data *ip; 172 register int sy, count; 173 int dir, sx; 174 { 175 register int dy = sy - count; 176 register int height = ip->rows - sy; 177 178 rbox_cursor(ip, ERASE_CURSOR); 179 180 rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 181 dy * ip->ftheight, sx * ip->ftwidth, 182 height * ip->ftheight, 183 ip->cols * ip->ftwidth, RR_COPY); 184 } 185 186 void 187 rbox_windowmove(ip, sy, sx, dy, dx, h, w, func) 188 struct ite_data *ip; 189 int sy, sx, dy, dx, h, w, func; 190 { 191 register struct rboxfb *rp = REGBASE; 192 if (h == 0 || w == 0) 193 return; 194 195 rb_waitbusy(ip->regbase); 196 rp->rep_rule = func << 4 | func; 197 rp->source_y = sy; 198 rp->source_x = sx; 199 rp->dest_y = dy; 200 rp->dest_x = dx; 201 rp->wheight = h; 202 rp->wwidth = w; 203 rp->wmove = 1; 204 } 205 #endif 206