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

unix.superglobalmegacorp.com

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