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 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: grf_rb.c 1.1 90/07/09$ 13 * 14 * @(#)grf_rb.c 7.4 (Berkeley) 12/16/90 15 */ 16 17 #include "grf.h" 18 #if NGRF > 0 19 20 /* 21 * Graphics routines for the Renaissance, HP98720 Graphics system. 22 */ 23 #include "sys/param.h" 24 #include "sys/errno.h" 25 26 #include "grfioctl.h" 27 #include "grfvar.h" 28 #include "grf_rbreg.h" 29 30 #include "../include/cpu.h" 31 32 /* 33 * Initialize hardware. 34 * Must point g_display at a grfinfo structure describing the hardware. 35 * Returns 0 if hardware not present, non-zero ow. 36 */ 37 rb_init(gp, addr) 38 struct grf_softc *gp; 39 u_char *addr; 40 { 41 register struct rboxfb *rbp; 42 struct grfinfo *gi = &gp->g_display; 43 int fboff; 44 45 rbp = (struct rboxfb *) addr; 46 gi->gd_regaddr = (caddr_t) UNIOV(addr); 47 gi->gd_regsize = 0x20000; 48 gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb; 49 gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb; 50 fboff = (rbp->fbomsb << 8) | rbp->fbolsb; 51 gi->gd_fbaddr = (caddr_t) (*(addr + fboff) << 16); 52 gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight; 53 gi->gd_dwidth = (rbp->dwmsb << 8) | rbp->dwlsb; 54 gi->gd_dheight = (rbp->dwmsb << 8) | rbp->dwlsb; 55 gi->gd_planes = 0; /* ?? */ 56 gi->gd_colors = 256; 57 return(1); 58 } 59 60 /* 61 * Change the mode of the display. 62 * Right now all we can do is grfon/grfoff. 63 * Return a UNIX error number or 0 for success. 64 */ 65 rb_mode(gp, cmd) 66 register struct grf_softc *gp; 67 { 68 register struct rboxfb *rbp; 69 int error = 0; 70 71 rbp = (struct rboxfb *) IOV(gp->g_display.gd_regaddr); 72 switch (cmd) { 73 /* 74 * The minimal register info here is from the Renaissance X driver. 75 */ 76 case GM_GRFON: 77 case GM_GRFOFF: 78 break; 79 case GM_GRFOVON: 80 rbp->write_enable = 0; 81 rbp->opwen = 0xF; 82 rbp->drive = 0x10; 83 break; 84 case GM_GRFOVOFF: 85 rbp->opwen = 0; 86 rbp->write_enable = 0xffffffff; 87 rbp->drive = 0x01; 88 break; 89 default: 90 error = EINVAL; 91 break; 92 } 93 return(error); 94 } 95 96 #endif 97