Annotation of 43BSDReno/sys/hpdev/grf_tc.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 is only permitted until one year after the first shipment
                     11:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
                     12:  * binary forms are permitted provided that: (1) source distributions retain
                     13:  * this entire copyright notice and comment, and (2) distributions including
                     14:  * binaries display the following acknowledgement:  This product includes
                     15:  * software developed by the University of California, Berkeley and its
                     16:  * contributors'' in the documentation or other materials provided with the
                     17:  * distribution and in all advertising materials mentioning features or use
                     18:  * of this software.  Neither the name of the University nor the names of
                     19:  * its contributors may be used to endorse or promote products derived from
                     20:  * this software without specific prior written permission.
                     21:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     22:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     23:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     24:  *
                     25:  * from: Utah $Hdr: grf_tc.c 1.13 89/08/25$
                     26:  *
                     27:  *     @(#)grf_tc.c    7.1 (Berkeley) 5/8/90
                     28:  */
                     29: 
                     30: #include "grf.h"
                     31: #if NGRF > 0
                     32: 
                     33: /*
                     34:  * Graphics routines for TOPCAT frame buffer
                     35:  */
                     36: #include "param.h"
                     37: #include "errno.h"
                     38: 
                     39: #include "grfioctl.h"
                     40: #include "grfvar.h"
                     41: #include "grf_tcreg.h"
                     42: 
                     43: #include "machine/cpu.h"
                     44: 
                     45: /*
                     46:  * Initialize hardware.
                     47:  * Must fill in the grfinfo structure in g_softc.
                     48:  * Returns 0 if hardware not present, non-zero ow.
                     49:  */
                     50: tc_init(gp, addr)
                     51:        struct grf_softc *gp;
                     52:        u_char *addr;
                     53: {
                     54:        register struct tcboxfb *tp = (struct tcboxfb *) addr;
                     55:        struct grfinfo *gi = &gp->g_display;
                     56:        volatile u_char *fbp;
                     57:        u_char save;
                     58:        int fboff;
                     59: 
                     60: #if defined(HP360) || defined(HP370)
                     61:        extern char grfregs[];
                     62:        if (addr == (u_char *)grfregs)
                     63:                gi->gd_regaddr = (caddr_t) DIOIIBASE;
                     64:        else
                     65: #endif
                     66:        gi->gd_regaddr = (caddr_t) UNIOV(addr);
                     67:        gi->gd_regsize = 0x10000;
                     68:        gi->gd_fbwidth = (tp->fbwmsb << 8) | tp->fbwlsb;
                     69:        gi->gd_fbheight = (tp->fbhmsb << 8) | tp->fbhlsb;
                     70:        fboff = (tp->fbomsb << 8) | tp->fbolsb;
                     71:        gi->gd_fbaddr = (caddr_t) (*(addr + fboff) << 16);
                     72: #if defined(HP360) || defined(HP370)
                     73:        /*
                     74:         * For DIO II space addresses offset is relative to the DIO II space.
                     75:         * XXX: this should apply to all frame buffer types.
                     76:         */
                     77:        if (gi->gd_regaddr >= (caddr_t)DIOIIBASE)
                     78:                gi->gd_fbaddr += (int) gi->gd_regaddr;
                     79: #endif
                     80:        gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
                     81:        gi->gd_dwidth = (tp->dwmsb << 8) | tp->dwlsb;
                     82:        gi->gd_dheight = (tp->dhmsb << 8) | tp->dhlsb;
                     83:        gi->gd_planes = tp->num_planes;
                     84:        gi->gd_colors = 1 << gi->gd_planes;
                     85:        if (gi->gd_colors == 1) {
                     86:                fbp = (u_char *) IOV(gi->gd_fbaddr);
                     87:                tp->wen = ~0;
                     88:                tp->prr = 0x3;
                     89:                tp->fben = ~0;
                     90:                save = *fbp;
                     91:                *fbp = 0xFF;
                     92:                gi->gd_colors = *fbp + 1;
                     93:                *fbp = save;
                     94:        }
                     95:        return(1);
                     96: }
                     97: 
                     98: /*
                     99:  * Change the mode of the display.
                    100:  * Right now all we can do is grfon/grfoff.
                    101:  * Return a UNIX error number or 0 for success.
                    102:  * Function may not be needed anymore.
                    103:  */
                    104: /*ARGSUSED*/
                    105: tc_mode(gp, cmd)
                    106:        struct grf_softc *gp;
                    107: {
                    108:        int error = 0;
                    109: 
                    110:        switch (cmd) {
                    111:        case GM_GRFON:
                    112:        case GM_GRFOFF:
                    113:                break;
                    114:        default:
                    115:                error = EINVAL;
                    116:                break;
                    117:        }
                    118:        return(error);
                    119: }
                    120: #endif

unix.superglobalmegacorp.com

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