Annotation of Net2/arch/hp300/dev/ite_gb.c, revision 1.1

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_gb.c 1.18 91/01/21$
        !            39:  *
        !            40:  *     @(#)ite_gb.c    7.5 (Berkeley) 5/7/91
        !            41:  */
        !            42: 
        !            43: #include "ite.h"
        !            44: #if NITE > 0
        !            45: 
        !            46: #include "param.h"
        !            47: #include "conf.h"
        !            48: #include "proc.h"
        !            49: #include "ioctl.h"
        !            50: #include "tty.h"
        !            51: #include "systm.h"
        !            52: 
        !            53: #include "itevar.h"
        !            54: #include "itereg.h"
        !            55: #include "grf_gbreg.h"
        !            56: 
        !            57: #include "machine/cpu.h"
        !            58: 
        !            59: /* XXX */
        !            60: #include "grfioctl.h"
        !            61: #include "grfvar.h"
        !            62: 
        !            63: #define REGBASE        ((struct gboxfb *)(ip->regbase))
        !            64: #define WINDOWMOVER    gatorbox_windowmove
        !            65: 
        !            66: gatorbox_init(ip)
        !            67:        register struct ite_softc *ip;
        !            68: {
        !            69:        /* XXX */
        !            70:        if (ip->regbase == 0) {
        !            71:                struct grf_softc *gp = &grf_softc[ip - ite_softc];
        !            72:                ip->regbase = gp->g_regkva;
        !            73:                ip->fbbase = gp->g_fbkva;
        !            74:        }
        !            75: 
        !            76:        REGBASE->write_protect = 0x0;
        !            77:        REGBASE->interrupt = 0x4;
        !            78:        REGBASE->rep_rule = RR_COPY;
        !            79:        REGBASE->blink1 = 0xff;
        !            80:        REGBASE->blink2 = 0xff;
        !            81:        gb_microcode(REGADDR);
        !            82:        REGBASE->sec_interrupt = 0x01;
        !            83: 
        !            84:        /*
        !            85:         * Set up the color map entries. We use three entries in the
        !            86:         * color map. The first, is for black, the second is for
        !            87:         * white, and the very last entry is for the inverted cursor.
        !            88:         */
        !            89:        REGBASE->creg_select = 0x00;
        !            90:        REGBASE->cmap_red    = 0x00;
        !            91:        REGBASE->cmap_grn    = 0x00;
        !            92:        REGBASE->cmap_blu    = 0x00;
        !            93:        REGBASE->cmap_write  = 0x00;
        !            94:        gbcm_waitbusy(REGADDR);
        !            95:        
        !            96:        REGBASE->creg_select = 0x01;
        !            97:        REGBASE->cmap_red    = 0xFF;
        !            98:        REGBASE->cmap_grn    = 0xFF;
        !            99:        REGBASE->cmap_blu    = 0xFF;
        !           100:        REGBASE->cmap_write  = 0x01;
        !           101:        gbcm_waitbusy(REGADDR);
        !           102: 
        !           103:        REGBASE->creg_select = 0xFF;
        !           104:        REGBASE->cmap_red    = 0xFF;
        !           105:        REGBASE->cmap_grn    = 0xFF;
        !           106:        REGBASE->cmap_blu    = 0xFF;
        !           107:        REGBASE->cmap_write  = 0x01;
        !           108:        gbcm_waitbusy(REGADDR);
        !           109: 
        !           110:        ite_devinfo(ip);
        !           111:        ite_fontinit(ip);
        !           112: 
        !           113:        /*
        !           114:         * Clear the display. This used to be before the font unpacking
        !           115:         * but it crashes. Figure it out later.
        !           116:         */
        !           117:        gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
        !           118:        tile_mover_waitbusy(REGADDR);
        !           119: 
        !           120:        /*
        !           121:         * Stash the inverted cursor.
        !           122:         */
        !           123:        gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
        !           124:                            ip->cblanky, ip->cblankx, ip->ftheight,
        !           125:                            ip->ftwidth, RR_COPYINVERTED);
        !           126: }
        !           127: 
        !           128: gatorbox_deinit(ip)
        !           129:        struct ite_softc *ip;
        !           130: {
        !           131:        gatorbox_windowmove(ip, 0, 0, 0, 0,
        !           132:                            ip->dheight, ip->dwidth, RR_CLEAR);
        !           133:        tile_mover_waitbusy(REGADDR);
        !           134: 
        !           135:        ip->flags &= ~ITE_INITED;
        !           136: }
        !           137: 
        !           138: gatorbox_putc(ip, c, dy, dx, mode)
        !           139:        register struct ite_softc *ip;
        !           140:         register int dy, dx;
        !           141:        int c, mode;
        !           142: {
        !           143:         register int wrr = ((mode == ATTR_INV) ? RR_COPYINVERTED : RR_COPY);
        !           144: 
        !           145:        gatorbox_windowmove(ip, charY(ip, c), charX(ip, c),
        !           146:                            dy * ip->ftheight, dx * ip->ftwidth,
        !           147:                            ip->ftheight, ip->ftwidth, wrr);
        !           148: }
        !           149: 
        !           150: gatorbox_cursor(ip, flag)
        !           151:        register struct ite_softc *ip;
        !           152:         register int flag;
        !           153: {
        !           154:        if (flag == DRAW_CURSOR)
        !           155:                draw_cursor(ip)
        !           156:        else if (flag == MOVE_CURSOR) {
        !           157:                erase_cursor(ip)
        !           158:                draw_cursor(ip)
        !           159:        }
        !           160:        else
        !           161:                erase_cursor(ip)
        !           162: }
        !           163: 
        !           164: gatorbox_clear(ip, sy, sx, h, w)
        !           165:        struct ite_softc *ip;
        !           166:        register int sy, sx, h, w;
        !           167: {
        !           168:        gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
        !           169:                            sy * ip->ftheight, sx * ip->ftwidth, 
        !           170:                            h  * ip->ftheight, w  * ip->ftwidth,
        !           171:                            RR_CLEAR);
        !           172: }
        !           173: #define        gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \
        !           174:        gatorbox_windowmove((ip), \
        !           175:                            (sy) * ip->ftheight, \
        !           176:                            (sx) * ip->ftwidth, \
        !           177:                            (dy) * ip->ftheight, \
        !           178:                            (dx) * ip->ftwidth, \
        !           179:                            (h)  * ip->ftheight, \
        !           180:                            (w)  * ip->ftwidth, \
        !           181:                            RR_COPY)
        !           182: 
        !           183: gatorbox_scroll(ip, sy, sx, count, dir)
        !           184:         register struct ite_softc *ip;
        !           185:         register int sy;
        !           186:         int dir, sx, count;
        !           187: {
        !           188:        register int height, dy, i;
        !           189:        
        !           190:        tile_mover_waitbusy(REGADDR);
        !           191:        REGBASE->write_protect = 0x0;
        !           192:        
        !           193:        gatorbox_cursor(ip, ERASE_CURSOR);
        !           194: 
        !           195:        if (dir == SCROLL_UP) {
        !           196:                dy = sy - count;
        !           197:                height = ip->rows - sy;
        !           198:                for (i = 0; i < height; i++)
        !           199:                        gatorbox_blockmove(ip, sy + i, sx, dy + i, 0,
        !           200:                                           1, ip->cols);
        !           201:        }
        !           202:        else if (dir == SCROLL_DOWN) {
        !           203:                dy = sy + count;
        !           204:                height = ip->rows - dy;
        !           205:                for (i = (height - 1); i >= 0; i--)
        !           206:                        gatorbox_blockmove(ip, sy + i, sx, dy + i, 0,
        !           207:                                           1, ip->cols);
        !           208:        }
        !           209:        else if (dir == SCROLL_RIGHT) {
        !           210:                gatorbox_blockmove(ip, sy, sx, sy, sx + count,
        !           211:                                   1, ip->cols - (sx + count));
        !           212:        }
        !           213:        else {
        !           214:                gatorbox_blockmove(ip, sy, sx, sy, sx - count,
        !           215:                                   1, ip->cols - sx);
        !           216:        }               
        !           217: }
        !           218: 
        !           219: gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
        !           220:      register struct ite_softc *ip;
        !           221:      int sy, sx, dy, dx, mask;
        !           222:      register int h, w;
        !           223: {
        !           224:        register int src, dest;
        !           225: 
        !           226:        src  = (sy * 1024) + sx;        /* upper left corner in pixels */
        !           227:        dest = (dy * 1024) + dx;
        !           228: 
        !           229:        tile_mover_waitbusy(REGADDR);
        !           230:        REGBASE->width = -(w / 4);
        !           231:        REGBASE->height = -(h / 4);
        !           232:        if (src < dest)
        !           233:                REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
        !           234:        else {
        !           235:                REGBASE->rep_rule = MOVE_UP_LEFT|mask;
        !           236:                /*
        !           237:                 * Adjust to top of lower right tile of the block.
        !           238:                 */
        !           239:                src = src + ((h - 4) * 1024) + (w - 4);
        !           240:                dest= dest + ((h - 4) * 1024) + (w - 4);
        !           241:        }
        !           242:        FBBASE[dest] = FBBASE[src];
        !           243: }
        !           244: #endif

unix.superglobalmegacorp.com

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