1 /* $NetBSD: ite_tc.c,v 1.12 2025/05/27 18:02:58 tsutsui 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. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: Utah $Hdr: ite_tc.c 1.11 92/01/20$ 37 * 38 * @(#)ite_tc.c 8.1 (Berkeley) 6/10/93 39 */ 40 41 #ifdef ITECONSOLE 42 43 #include <sys/param.h> 44 45 #include <hp300/dev/diofbreg.h> 46 #include <hp300/stand/common/itereg.h> 47 #include <hp300/stand/common/grf_tcreg.h> 48 49 #include <hp300/stand/common/samachdep.h> 50 #include <hp300/stand/common/itevar.h> 51 52 static void topcat_windowmove(struct ite_data *, int, int, int, int, 53 int, int, int); 54 55 void 56 topcat_init(struct ite_data *ip) 57 { 58 struct tcboxfb *regbase = (void *)ip->regbase; 59 60 ip->bmv = topcat_windowmove; 61 62 /* 63 * Catseye looks a lot like a topcat, but not completely. 64 * So, we set some bits to make it work. 65 */ 66 if (regbase->fbid != GID_TOPCAT) { 67 while ((regbase->catseye_status & 1)) 68 ; 69 regbase->catseye_status = 0x0; 70 regbase->vb_select = 0x0; 71 regbase->tcntrl = 0x0; 72 regbase->acntrl = 0x0; 73 regbase->pncntrl = 0x0; 74 regbase->rug_cmdstat = 0x90; 75 } 76 77 /* 78 * Determine the number of planes by writing to the first frame 79 * buffer display location, then reading it back. 80 */ 81 regbase->wen = ~0; 82 regbase->fben = ~0; 83 regbase->prr = RR_COPY; 84 *FBBASE = 0xFF; 85 ip->planemask = *FBBASE; 86 87 /* 88 * Enable reading/writing of all the planes. 89 */ 90 regbase->fben = ip->planemask; 91 regbase->wen = ip->planemask; 92 regbase->ren = ip->planemask; 93 regbase->prr = RR_COPY; 94 95 ite_fontinfo(ip); 96 97 /* 98 * Clear the framebuffer on all planes. 99 */ 100 topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); 101 tc_waitbusy(regbase, ip->planemask); 102 103 ite_fontinit8bpp(ip); 104 105 /* 106 * Stash the inverted cursor. 107 */ 108 topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 109 ip->cblanky, ip->cblankx, ip->ftheight, 110 ip->ftwidth, RR_COPYINVERTED); 111 } 112 113 static void 114 topcat_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, 115 int w, int func) 116 { 117 struct tcboxfb *rp = (void *)ip->regbase; 118 119 if (h == 0 || w == 0) 120 return; 121 tc_waitbusy(rp, ip->planemask); 122 rp->wmrr = func; 123 rp->source_y = sy; 124 rp->source_x = sx; 125 rp->dest_y = dy; 126 rp->dest_x = dx; 127 rp->wheight = h; 128 rp->wwidth = w; 129 rp->wmove = ip->planemask; 130 } 131 #endif 132