xref: /original-bsd/sys/sparc/sbus/btreg.h (revision 333da485)
1 /*
2  * Copyright (c) 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * All advertising materials mentioning features or use of this software
10  * must display the following acknowledgement:
11  *	This product includes software developed by the University of
12  *	California, Lawrence Berkeley Laboratory.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)btreg.h	8.2 (Berkeley) 01/21/94
17  *
18  * from: $Header: btreg.h,v 1.1 93/10/12 15:28:52 torek Exp $
19  */
20 
21 /*
22  * Several Sun color frame buffers use some kind of Brooktree video
23  * DAC (e.g., the Bt458, -- in any case, Brooktree make the only
24  * decent color frame buffer chips).
25  *
26  * Color map control on these is a bit funky in a SPARCstation.
27  * To update the color map one would normally do byte writes, but
28  * the hardware takes longword writes.  Since there are three
29  * registers for each color map entry (R, then G, then B), we have
30  * to set color 1 with a write to address 0 (setting 0's R/G/B and
31  * color 1's R) followed by a second write to address 1 (setting
32  * color 1's G/B and color 2's R/G).  Software must therefore keep
33  * a copy of the current map.
34  *
35  * The colormap address register increments automatically, so the
36  * above write is done as:
37  *
38  *	bt->bt_addr = 0;
39  *	bt->bt_cmap = R0G0B0R1;
40  *	bt->bt_cmap = G1B1R2G2;
41  *	...
42  *
43  * Yow!
44  *
45  * Bonus complication: on the cg6, only the top 8 bits of each 32 bit
46  * register matter, even though the cg3 takes all the bits from all
47  * bytes written to it.
48  */
49 struct bt_regs {
50 	u_int	bt_addr;		/* map address register */
51 	u_int	bt_cmap;		/* colormap data register */
52 	u_int	bt_ctrl;		/* control register */
53 	u_int	bt_omap;		/* overlay (cursor) map register */
54 };
55