Annotation of Net2/arch/hp300/dev/grf_rb.c, revision 1.1.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: grf_rb.c 1.13 91/04/02$
                     39:  *
                     40:  *     @(#)grf_rb.c    7.5 (Berkeley) 5/7/91
                     41:  */
                     42: 
                     43: #include "grf.h"
                     44: #if NGRF > 0
                     45: 
                     46: /*
                     47:  * Graphics routines for the Renaissance, HP98720 Graphics system.
                     48:  */
                     49: #include "sys/param.h"
                     50: #include "sys/errno.h"
                     51: 
                     52: #include "grfioctl.h"
                     53: #include "grfvar.h"
                     54: #include "grf_rbreg.h"
                     55: 
                     56: #include "../include/cpu.h"
                     57: 
                     58: /*
                     59:  * Initialize hardware.
                     60:  * Must point g_display at a grfinfo structure describing the hardware.
                     61:  * Returns 0 if hardware not present, non-zero ow.
                     62:  */
                     63: rb_init(gp, addr)
                     64:        struct grf_softc *gp;
                     65:        caddr_t addr;
                     66: {
                     67:        register struct rboxfb *rbp;
                     68:        struct grfinfo *gi = &gp->g_display;
                     69:        int fboff;
                     70:        extern caddr_t sctopa(), iomap();
                     71: 
                     72:        rbp = (struct rboxfb *) addr;
                     73:        if (ISIIOVA(addr))
                     74:                gi->gd_regaddr = (caddr_t) IIOP(addr);
                     75:        else
                     76:                gi->gd_regaddr = sctopa(vatosc(addr));
                     77:        gi->gd_regsize = 0x20000;
                     78:        gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb;
                     79:        gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb;
                     80:        gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
                     81:        fboff = (rbp->fbomsb << 8) | rbp->fbolsb;
                     82:        gi->gd_fbaddr = (caddr_t) (*((u_char *)addr + fboff) << 16);
                     83:        if (gi->gd_regaddr >= (caddr_t)DIOIIBASE) {
                     84:                /*
                     85:                 * For DIO II space the fbaddr just computed is the offset
                     86:                 * from the select code base (regaddr) of the framebuffer.
                     87:                 * Hence it is also implicitly the size of the register set.
                     88:                 */
                     89:                gi->gd_regsize = (int) gi->gd_fbaddr;
                     90:                gi->gd_fbaddr += (int) gi->gd_regaddr;
                     91:                gp->g_regkva = addr;
                     92:                gp->g_fbkva = addr + gi->gd_regsize;
                     93:        } else {
                     94:                /*
                     95:                 * For DIO space we need to map the seperate framebuffer.
                     96:                 */
                     97:                gp->g_regkva = addr;
                     98:                gp->g_fbkva = iomap(gi->gd_fbaddr, gi->gd_fbsize);
                     99:        }
                    100:        gi->gd_dwidth = (rbp->dwmsb << 8) | rbp->dwlsb;
                    101:        gi->gd_dheight = (rbp->dwmsb << 8) | rbp->dwlsb;
                    102:        gi->gd_planes = 0;      /* ?? */
                    103:        gi->gd_colors = 256;
                    104:        return(1);
                    105: }
                    106: 
                    107: /*
                    108:  * Change the mode of the display.
                    109:  * Right now all we can do is grfon/grfoff.
                    110:  * Return a UNIX error number or 0 for success.
                    111:  */
                    112: rb_mode(gp, cmd)
                    113:        register struct grf_softc *gp;
                    114: {
                    115:        register struct rboxfb *rbp;
                    116:        int error = 0;
                    117: 
                    118:        rbp = (struct rboxfb *) gp->g_regkva;
                    119:        switch (cmd) {
                    120:        /*
                    121:         * The minimal register info here is from the Renaissance X driver.
                    122:         */
                    123:        case GM_GRFON:
                    124:        case GM_GRFOFF:
                    125:                break;
                    126:        case GM_GRFOVON:
                    127:                rbp->write_enable = 0;
                    128:                rbp->opwen = 0xF;
                    129:                rbp->drive = 0x10;
                    130:                break;
                    131:        case GM_GRFOVOFF:
                    132:                rbp->opwen = 0;
                    133:                rbp->write_enable = 0xffffffff;
                    134:                rbp->drive = 0x01;
                    135:                break;
                    136:        default:
                    137:                error = EINVAL;
                    138:                break;
                    139:        }
                    140:        return(error);
                    141: }
                    142: 
                    143: #endif

unix.superglobalmegacorp.com

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