Annotation of Net2/arch/hp300/dev/ite_tc.c, revision 1.1.1.2

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 and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  * 3. All advertising materials mentioning features or use of this software
                     19:  *    must display the following acknowledgement:
                     20:  *     This product includes software developed by the University of
                     21:  *     California, Berkeley and its contributors.
                     22:  * 4. Neither the name of the University nor the names of its contributors
                     23:  *    may be used to endorse or promote products derived from this software
                     24:  *    without specific prior written permission.
                     25:  *
                     26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     36:  * SUCH DAMAGE.
                     37:  *
                     38:  * from: Utah $Hdr: ite_tc.c 1.25 91/03/25$
                     39:  *
1.1.1.2 ! root       40:  *     from: @(#)ite_tc.c      7.4 (Berkeley) 5/7/91
        !            41:  *     ite_tc.c,v 1.2 1993/05/22 07:56:32 cgd Exp
1.1       root       42:  */
                     43: 
                     44: #include "ite.h"
                     45: #if NITE > 0
                     46: 
                     47: #include "param.h"
                     48: #include "conf.h"
                     49: #include "proc.h"
                     50: #include "ioctl.h"
                     51: #include "tty.h"
                     52: #include "systm.h"
                     53: 
                     54: #include "grf_tcreg.h"
                     55: #include "itereg.h"
                     56: #include "itevar.h"
                     57: 
                     58: #include "machine/cpu.h"
                     59: 
                     60: #define REGBASE                ((struct tcboxfb *)(ip->regbase))
                     61: #define WINDOWMOVER    topcat_windowmove
                     62: 
                     63: /* XXX */
                     64: #include "grfioctl.h"
                     65: #include "grfvar.h"
                     66: 
                     67: topcat_init(ip)
                     68:        register struct ite_softc *ip;
                     69: {
                     70:        /* XXX */
                     71:        if (ip->regbase == NULL) {
                     72:                struct grf_softc *gp = &grf_softc[ip - ite_softc];
                     73:                ip->regbase = gp->g_regkva;
                     74:                ip->fbbase = gp->g_fbkva;
                     75:        }
                     76: 
                     77:        /*
                     78:         * Catseye looks a lot like a topcat, but not completely.
                     79:         * So, we set some bits to make it work.
                     80:         */
                     81:        if (REGBASE->fbid != GID_TOPCAT) {
                     82:                while ((REGBASE->catseye_status & 1))
                     83:                        ;
                     84:                REGBASE->catseye_status = 0x0;
                     85:                REGBASE->vb_select      = 0x0;
                     86:                REGBASE->tcntrl         = 0x0;
                     87:                REGBASE->acntrl         = 0x0;
                     88:                REGBASE->pncntrl        = 0x0;
                     89:                REGBASE->rug_cmdstat    = 0x90;
                     90:        }
                     91: 
                     92:        /*
                     93:         * Determine the number of planes by writing to the first frame
                     94:         * buffer display location, then reading it back. 
                     95:         */
                     96:        REGBASE->wen = ~0;
                     97:        REGBASE->fben = ~0;
                     98:        REGBASE->prr = RR_COPY;
                     99:        *FBBASE = 0xFF;
                    100:        ip->planemask = *FBBASE;
                    101: 
                    102:        /*
                    103:         * Enable reading/writing of all the planes.
                    104:         */
                    105:        REGBASE->fben = ip->planemask;
                    106:        REGBASE->wen  = ip->planemask;
                    107:        REGBASE->ren  = ip->planemask;
                    108:        REGBASE->prr  = RR_COPY;
                    109: 
                    110:        ite_devinfo(ip);
                    111: 
                    112:        /*
                    113:         * Clear the framebuffer on all planes.
                    114:         */
                    115:        topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
                    116:        tc_waitbusy(REGADDR, ip->planemask);
                    117: 
                    118:        ite_fontinit(ip);
                    119: 
                    120:        /*
                    121:         * Initialize color map for color displays
                    122:         */
                    123:        if (ip->planemask != 1) {
                    124:                tc_waitbusy(REGADDR, ip->planemask);
                    125:                REGBASE->nblank = 0x01;
                    126: 
                    127:                tccm_waitbusy(REGADDR);
                    128:                REGBASE->rdata  = 0x0;
                    129:                REGBASE->gdata  = 0x0;
                    130:                REGBASE->bdata  = 0x0;
                    131:                REGBASE->cindex = 0xFF;
                    132:                REGBASE->strobe = 0xFF;
                    133: 
                    134:                DELAY(100);
                    135:                tccm_waitbusy(REGADDR);
                    136:                REGBASE->rdata  = 0x0;
                    137:                REGBASE->gdata  = 0x0;
                    138:                REGBASE->bdata  = 0x0;
                    139:                REGBASE->cindex = 0x0;
                    140: 
                    141:                DELAY(100);
                    142:                tccm_waitbusy(REGADDR);
                    143:                REGBASE->rdata  = 0xFF;
                    144:                REGBASE->gdata  = 0xFF;
                    145:                REGBASE->bdata  = 0xFF;
                    146:                REGBASE->cindex = 0xFE;
                    147:                REGBASE->strobe = 0xFF;
                    148: 
                    149:                DELAY(100);
                    150:                tccm_waitbusy(REGADDR);
                    151:                REGBASE->rdata  = 0x0;
                    152:                REGBASE->gdata  = 0x0;
                    153:                REGBASE->bdata  = 0x0;
                    154:                REGBASE->cindex = 0x0;
                    155:        }
                    156: 
                    157:        /*
                    158:         * Stash the inverted cursor.
                    159:         */
                    160:        topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
                    161:                          ip->cblanky, ip->cblankx, ip->ftheight,
                    162:                          ip->ftwidth, RR_COPYINVERTED);
                    163: }
                    164: 
                    165: topcat_deinit(ip)
                    166:        register struct ite_softc *ip;
                    167: {
                    168:        topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
                    169:        tc_waitbusy(REGADDR, ip->planemask);
                    170: 
                    171:        REGBASE->nblank = ~0;
                    172:        ip->flags &= ~ITE_INITED;
                    173: }
                    174: 
                    175: topcat_putc(ip, c, dy, dx, mode)
                    176:        register struct ite_softc *ip;
                    177:        int c, dy, dx, mode;
                    178: {
                    179:         int wmrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
                    180:        
                    181:        topcat_windowmove(ip, charY(ip, c), charX(ip, c),
                    182:                          dy * ip->ftheight, dx * ip->ftwidth,
                    183:                          ip->ftheight, ip->ftwidth, wmrr);
                    184: }
                    185: 
                    186: topcat_cursor(ip, flag)
                    187:        register struct ite_softc *ip;
                    188:        register int flag;
                    189: {
                    190:        if (flag == DRAW_CURSOR)
                    191:                draw_cursor(ip)
                    192:        else if (flag == MOVE_CURSOR) {
                    193:                erase_cursor(ip)
                    194:                draw_cursor(ip)
                    195:        }
                    196:        else
                    197:                erase_cursor(ip)
                    198: }
                    199: 
                    200: topcat_clear(ip, sy, sx, h, w)
                    201:        register struct ite_softc *ip;
                    202:        register int sy, sx, h, w;
                    203: {
                    204:        topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
                    205:                          sy * ip->ftheight, sx * ip->ftwidth, 
                    206:                          h  * ip->ftheight, w  * ip->ftwidth,
                    207:                          RR_CLEAR);
                    208: }
                    209: 
                    210: topcat_scroll(ip, sy, sx, count, dir)
                    211:         register struct ite_softc *ip;
                    212:         register int sy, count;
                    213:         int dir, sx;
                    214: {
                    215:        register int dy;
                    216:        register int dx = sx;
                    217:        register int height = 1;
                    218:        register int width = ip->cols;
                    219: 
                    220:        topcat_cursor(ip, ERASE_CURSOR);
                    221: 
                    222:        if (dir == SCROLL_UP) {
                    223:                dy = sy - count;
                    224:                height = ip->rows - sy;
                    225:        }
                    226:        else if (dir == SCROLL_DOWN) {
                    227:                dy = sy + count;
                    228:                height = ip->rows - dy - 1;
                    229:        }
                    230:        else if (dir == SCROLL_RIGHT) {
                    231:                dy = sy;
                    232:                dx = sx + count;
                    233:                width = ip->cols - dx;
                    234:        }
                    235:        else {
                    236:                dy = sy;
                    237:                dx = sx - count;
                    238:                width = ip->cols - sx;
                    239:        }               
                    240: 
                    241:        topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
                    242:                          dy * ip->ftheight, dx * ip->ftwidth,
                    243:                          height * ip->ftheight,
                    244:                          width  * ip->ftwidth, RR_COPY);
                    245: }
                    246: 
                    247: topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
                    248:        struct ite_softc *ip;
                    249:        int sy, sx, dy, dx, h, w, func;
                    250: {
                    251:        register struct tcboxfb *rp = REGBASE;
                    252:        
                    253:        if (h == 0 || w == 0)
                    254:                return;
                    255:        tc_waitbusy(REGADDR, ip->planemask);
                    256:        rp->wmrr     = func;
                    257:        rp->source_y = sy;
                    258:        rp->source_x = sx;
                    259:        rp->dest_y   = dy;
                    260:        rp->dest_x   = dx;
                    261:        rp->wheight  = h;
                    262:        rp->wwidth   = w;
                    263:        rp->wmove    = ip->planemask;
                    264: }
                    265: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.