|
|
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_dv.c 1.6 89/04/11$
26: *
27: * @(#)grf_dv.c 7.1 (Berkeley) 5/8/90
28: */
29:
30: #include "grf.h"
31: #if NGRF > 0
32:
33: /*
34: * Graphics routines for the DaVinci, HP98730/98731 Graphics system.
35: */
36: #include "param.h"
37: #include "errno.h"
38:
39: #include "grfioctl.h"
40: #include "grfvar.h"
41: #include "grf_dvreg.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: dv_init(gp, addr)
51: struct grf_softc *gp;
52: u_char *addr;
53: {
54: register struct dvboxfb *dbp;
55: struct grfinfo *gi = &gp->g_display;
56: int fboff;
57:
58: dbp = (struct dvboxfb *) addr;
59: gi->gd_regaddr = (caddr_t) UNIOV(addr);
60: gi->gd_regsize = 0x20000;
61: gi->gd_fbwidth = (dbp->fbwmsb << 8) | dbp->fbwlsb;
62: gi->gd_fbheight = (dbp->fbhmsb << 8) | dbp->fbhlsb;
63: fboff = (dbp->fbomsb << 8) | dbp->fbolsb;
64: gi->gd_fbaddr = (caddr_t) (*(addr + fboff) << 16);
65: gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight;
66: gi->gd_dwidth = (dbp->dwmsb << 8) | dbp->dwlsb;
67: gi->gd_dheight = (dbp->dwmsb << 8) | dbp->dwlsb;
68: gi->gd_planes = 0; /* ?? */
69: gi->gd_colors = 256;
70:
71: dv_reset(dbp);
72: return(1);
73: }
74:
75: /*
76: * Magic code herein.
77: */
78: dv_reset(dbp)
79: register struct dvboxfb *dbp;
80: {
81: dbp->reset = 0x80;
82: DELAY(100);
83:
84: dbp->interrupt = 0x04;
85: dbp->en_scan = 0x01;
86: dbp->fbwen = ~0;
87: dbp->opwen = ~0;
88: dbp->fold = 0x01;
89: dbp->drive = 0x01;
90: dbp->rep_rule = 0x33;
91: dbp->alt_rr = 0x33;
92: dbp->zrr = 0x33;
93:
94: dbp->fbvenp = 0xFF;
95: dbp->dispen = 0x01;
96: dbp->fbvens = 0x0;
97: dbp->fv_trig = 0x01;
98: DELAY(100);
99: dbp->vdrive = 0x0;
100: dbp->zconfig = 0x0;
101:
102: while (dbp->wbusy & 0x01)
103: DELAY(100);
104:
105: dbp->cmapbank = 0;
106:
107: dbp->red0 = 0;
108: dbp->red1 = 0;
109: dbp->green0 = 0;
110: dbp->green1 = 0;
111: dbp->blue0 = 0;
112: dbp->blue1 = 0;
113:
114: dbp->panxh = 0;
115: dbp->panxl = 0;
116: dbp->panyh = 0;
117: dbp->panyl = 0;
118: dbp->zoom = 0;
119: dbp->cdwidth = 0x50;
120: dbp->chstart = 0x52;
121: dbp->cvwidth = 0x22;
122: dbp->pz_trig = 1;
123: }
124:
125: /*
126: * Change the mode of the display.
127: * Right now all we can do is grfon/grfoff.
128: * Return a UNIX error number or 0 for success.
129: */
130: dv_mode(gp, cmd)
131: register struct grf_softc *gp;
132: {
133: register struct dvboxfb *dbp;
134: int error = 0;
135:
136: dbp = (struct dvboxfb *) IOV(gp->g_display.gd_regaddr);
137: switch (cmd) {
138: case GM_GRFON:
139: dbp->dispen = 0x01;
140: break;
141: case GM_GRFOFF:
142: break;
143: case GM_GRFOVON:
144: dbp->opwen = 0xF;
145: dbp->drive = 0x10;
146: break;
147: case GM_GRFOVOFF:
148: dbp->opwen = 0;
149: dbp->drive = 0x01;
150: break;
151: default:
152: error = EINVAL;
153: break;
154: }
155: return(error);
156: }
157:
158: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.