xref: /csrg-svn/sys/sparc/sbus/btvar.h (revision 65800)
164775Storek /*
2*65800Sbostic  * Copyright (c) 1993
3*65800Sbostic  *	The Regents of the University of California.  All rights reserved.
464775Storek  *
564775Storek  * This software was developed by the Computer Systems Engineering group
664775Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
764775Storek  * contributed to Berkeley.
864775Storek  *
964775Storek  * All advertising materials mentioning features or use of this software
1064775Storek  * must display the following acknowledgement:
1164775Storek  *	This product includes software developed by the University of
1264775Storek  *	California, Lawrence Berkeley Laboratory.
1364775Storek  *
1464775Storek  * %sccs.include.redist.c%
1564775Storek  *
16*65800Sbostic  *	@(#)btvar.h	8.2 (Berkeley) 01/21/94
1764775Storek  *
1864775Storek  * from: $Header: btvar.h,v 1.1 93/10/12 15:29:01 torek Exp $
1964775Storek  */
2064775Storek 
2164775Storek /*
2264775Storek  * Brooktree color frame buffer state variables (see btreg.h).
2364775Storek  *
2464775Storek  * Unfortunately, remarkably little code can be shared between the
2564775Storek  * cg3 and cg6 drivers here, as the cg3 registers do longword-ops
2664775Storek  * `as expected', but the cg6 ones use only the upper byte.
2764775Storek  *
2864775Storek  * Still, the software color map manipulation is not completely trivial.
2964775Storek  */
3064775Storek union bt_cmap {
3164775Storek 	u_char  cm_map[256][3];		/* 256 R/G/B entries */
3264775Storek 	u_int   cm_chip[256 * 3 / 4];	/* the way the chip gets loaded */
3364775Storek };
3464775Storek 
3564775Storek /*
3664775Storek  * Routines in bt_subr.c.
3764775Storek  */
3864775Storek int	bt_getcmap __P((struct fbcmap *, union bt_cmap *, int));
3964775Storek int	bt_putcmap __P((struct fbcmap *, union bt_cmap *, int));
4064775Storek 
4164775Storek /*
4264775Storek  * Compute (x / 4) * 3 and (x / 4) * 4.  These are used in turning
4364775Storek  * RGB indices (which are in multiples of three) into `chip RGB' values
4464775Storek  * (which are in multiples of four).
4564775Storek  */
4664775Storek #define	BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2))	/* (x / 4) * 3 */
4764775Storek #define	BT_D4M4(x) ((x) & ~3)				/* (x / 4) * 4 */
48