|
|
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_rb.c 1.10 89/04/11$ ! 26: * ! 27: * @(#)grf_rb.c 7.2 (Berkeley) 5/25/90 ! 28: */ ! 29: ! 30: #include "grf.h" ! 31: #if NGRF > 0 ! 32: ! 33: /* ! 34: * Graphics routines for the Renaissance, HP98720 Graphics system. ! 35: */ ! 36: #include "param.h" ! 37: #include "errno.h" ! 38: ! 39: #include "grfioctl.h" ! 40: #include "grfvar.h" ! 41: #include "grf_rbreg.h" ! 42: ! 43: #include "machine/cpu.h" ! 44: ! 45: /* ! 46: * Initialize hardware. ! 47: * Must point g_display at a grfinfo structure describing the hardware. ! 48: * Returns 0 if hardware not present, non-zero ow. ! 49: */ ! 50: rb_init(gp, addr) ! 51: struct grf_softc *gp; ! 52: u_char *addr; ! 53: { ! 54: register struct rboxfb *rbp; ! 55: struct grfinfo *gi = &gp->g_display; ! 56: int fboff; ! 57: ! 58: rbp = (struct rboxfb *) addr; ! 59: gi->gd_regaddr = (caddr_t) UNIOV(addr); ! 60: gi->gd_regsize = 0x20000; ! 61: gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb; ! 62: gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb; ! 63: fboff = (rbp->fbomsb << 8) | rbp->fbolsb; ! 64: gi->gd_fbaddr = (caddr_t) (*(addr + fboff) << 16); ! 65: gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight; ! 66: gi->gd_dwidth = (rbp->dwmsb << 8) | rbp->dwlsb; ! 67: gi->gd_dheight = (rbp->dwmsb << 8) | rbp->dwlsb; ! 68: gi->gd_planes = 0; /* ?? */ ! 69: gi->gd_colors = 256; ! 70: return(1); ! 71: } ! 72: ! 73: /* ! 74: * Change the mode of the display. ! 75: * Right now all we can do is grfon/grfoff. ! 76: * Return a UNIX error number or 0 for success. ! 77: */ ! 78: rb_mode(gp, cmd) ! 79: register struct grf_softc *gp; ! 80: { ! 81: register struct rboxfb *rbp; ! 82: int error = 0; ! 83: ! 84: rbp = (struct rboxfb *) IOV(gp->g_display.gd_regaddr); ! 85: switch (cmd) { ! 86: /* ! 87: * The minimal register info here is from the Renaissance X driver. ! 88: */ ! 89: case GM_GRFON: ! 90: case GM_GRFOFF: ! 91: break; ! 92: case GM_GRFOVON: ! 93: rbp->write_enable = 0; ! 94: rbp->opwen = 0xF; ! 95: rbp->drive = 0x10; ! 96: break; ! 97: case GM_GRFOVOFF: ! 98: rbp->opwen = 0; ! 99: rbp->write_enable = 0xffffffff; ! 100: rbp->drive = 0x01; ! 101: break; ! 102: default: ! 103: error = EINVAL; ! 104: break; ! 105: } ! 106: return(error); ! 107: } ! 108: ! 109: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.