|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)fbutil.c 1.1 86/02/03 Copyr 1985 Sun Micro"; ! 3: #endif ! 4: ! 5: /* ! 6: * Copyright (c) 1985 by Sun Microsystems, Inc. ! 7: */ ! 8: ! 9: /* ! 10: * Frame buffer driver utilities. ! 11: */ ! 12: ! 13: #include "../h/param.h" ! 14: #include "../h/systm.h" ! 15: #include "../h/dir.h" ! 16: #include "../h/user.h" ! 17: #include "../h/proc.h" ! 18: #include "../h/buf.h" ! 19: #include "../h/conf.h" ! 20: #include "../h/file.h" ! 21: #include "../machine/pte.h" ! 22: #include "../machine/mmu.h" ! 23: #include "../sundev/mbvar.h" ! 24: ! 25: fbopen(dev, flag, numdevs, mb_devs) ! 26: dev_t dev; ! 27: int flag, numdevs; ! 28: struct mb_device **mb_devs; ! 29: { ! 30: register int unit = minor(dev); ! 31: struct mb_device *mb_dev = *(mb_devs+unit); ! 32: ! 33: if (unit >= numdevs || mb_dev == 0 || mb_dev->md_alive == 0) ! 34: u.u_error = ENXIO; ! 35: } ! 36: ! 37: /* ! 38: * Call intclear to turn off interrupts on all alive devices. ! 39: * If intclear returns non-zero value then know that found an interrupting ! 40: * device. ! 41: */ ! 42: int ! 43: fbintr(numdevs, mb_devs, intclear) ! 44: int numdevs; ! 45: struct mb_device **mb_devs; ! 46: int (*intclear)(); ! 47: { ! 48: register int i; ! 49: register struct mb_device *md; ! 50: ! 51: for (i = 0; i < numdevs; i++) { ! 52: if ((md = *(mb_devs+i)) == NULL) ! 53: continue; ! 54: if (!md->md_alive) ! 55: continue; ! 56: if ((*intclear)(md->md_addr)) ! 57: return (1); ! 58: } ! 59: return (0); ! 60: } ! 61: ! 62: /*ARGSUSED*/ ! 63: int ! 64: fbmmap(dev, off, prot, numdevs, mb_devs, size) ! 65: dev_t dev; ! 66: off_t off; ! 67: int prot; ! 68: int numdevs; ! 69: struct mb_device **mb_devs; ! 70: int size; ! 71: { ! 72: struct mb_device *mb_dev = *(mb_devs+minor(dev)); ! 73: register int page; ! 74: ! 75: if (off >= size) ! 76: return (-1); ! 77: page = getkpgmap(mb_dev->md_addr + off) & PG_PFNUM; ! 78: return (page); ! 79: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.