xref: /csrg-svn/sys/sparc/sbus/btvar.h (revision 64775)
1*64775Storek /*
2*64775Storek  * Copyright (c) 1993 The Regents of the University of California.
3*64775Storek  * All rights reserved.
4*64775Storek  *
5*64775Storek  * This software was developed by the Computer Systems Engineering group
6*64775Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7*64775Storek  * contributed to Berkeley.
8*64775Storek  *
9*64775Storek  * All advertising materials mentioning features or use of this software
10*64775Storek  * must display the following acknowledgement:
11*64775Storek  *	This product includes software developed by the University of
12*64775Storek  *	California, Lawrence Berkeley Laboratory.
13*64775Storek  *
14*64775Storek  * %sccs.include.redist.c%
15*64775Storek  *
16*64775Storek  *	@(#)btvar.h	8.1 (Berkeley) 10/30/93
17*64775Storek  *
18*64775Storek  * from: $Header: btvar.h,v 1.1 93/10/12 15:29:01 torek Exp $
19*64775Storek  */
20*64775Storek 
21*64775Storek /*
22*64775Storek  * Brooktree color frame buffer state variables (see btreg.h).
23*64775Storek  *
24*64775Storek  * Unfortunately, remarkably little code can be shared between the
25*64775Storek  * cg3 and cg6 drivers here, as the cg3 registers do longword-ops
26*64775Storek  * `as expected', but the cg6 ones use only the upper byte.
27*64775Storek  *
28*64775Storek  * Still, the software color map manipulation is not completely trivial.
29*64775Storek  */
30*64775Storek union bt_cmap {
31*64775Storek 	u_char  cm_map[256][3];		/* 256 R/G/B entries */
32*64775Storek 	u_int   cm_chip[256 * 3 / 4];	/* the way the chip gets loaded */
33*64775Storek };
34*64775Storek 
35*64775Storek /*
36*64775Storek  * Routines in bt_subr.c.
37*64775Storek  */
38*64775Storek int	bt_getcmap __P((struct fbcmap *, union bt_cmap *, int));
39*64775Storek int	bt_putcmap __P((struct fbcmap *, union bt_cmap *, int));
40*64775Storek 
41*64775Storek /*
42*64775Storek  * Compute (x / 4) * 3 and (x / 4) * 4.  These are used in turning
43*64775Storek  * RGB indices (which are in multiples of three) into `chip RGB' values
44*64775Storek  * (which are in multiples of four).
45*64775Storek  */
46*64775Storek #define	BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2))	/* (x / 4) * 3 */
47*64775Storek #define	BT_D4M4(x) ((x) & ~3)				/* (x / 4) * 4 */
48