xref: /netbsd/sys/arch/sparc/dev/cgfourteenvar.h (revision c4a72b64)
1 /*	$NetBSD: cgfourteenvar.h,v 1.4 2002/08/23 02:53:11 thorpej Exp $ */
2 
3 /*
4  * Copyright (c) 1996
5  *	The President and Fellows of Harvard College. All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Harvard University and
18  *	its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 
36 /*
37  * Layout of cg14 hardware colormap
38  */
39 union cg14cmap {
40 	u_char  	cm_map[256][4];	/* 256 R/G/B/A entries (B is high)*/
41 	u_int32_t   	cm_chip[256];	/* the way the chip gets loaded */
42 };
43 
44 /*
45  * cg14 hardware cursor colormap
46  */
47 union cg14cursor_cmap {		/* colormap, like bt_cmap, but tiny */
48 	u_char		cm_map[2][4];	/* 2 R/G/B/A entries */
49 	u_int32_t	cm_chip[2];	/* 2 chip equivalents */
50 };
51 
52 /*
53  * cg14 hardware cursor status
54  */
55 struct cg14_cursor {		/* cg14 hardware cursor status */
56 	short	cc_enable;		/* cursor is enabled */
57 	struct	fbcurpos cc_pos;	/* position */
58 	struct	fbcurpos cc_hot;	/* hot-spot */
59 	struct	fbcurpos cc_size;	/* size of mask & image fields */
60 	u_int	cc_eplane[32];		/* enable plane */
61 	u_int	cc_cplane[32];		/* color plane */
62 	union	cg14cursor_cmap cc_color; /* cursor colormap */
63 };
64 
65 /*
66  * per-cg14 variables/state
67  */
68 struct cgfourteen_softc {
69 	struct device	sc_dev;		/* base device */
70 	struct fbdevice	sc_fb;		/* frame buffer device */
71 	bus_space_tag_t	sc_bustag;
72 	struct openprom_addr sc_physadr[2]; /* phys addrs of h/w */
73 #define CG14_CTL_IDX	0
74 #define CG14_PXL_IDX	1
75 
76 	union	cg14cmap sc_cmap;	/* current colormap */
77 	struct	cg14_cursor sc_cursor;	/* Hardware cursor state */
78 	union 	cg14cmap sc_saveclut; 	/* a place to stash PROM state */
79 	u_int8_t	sc_savexlut[256];
80 	u_int8_t	sc_savectl;
81 	u_int8_t	sc_savehwc;
82 
83 	struct	cg14ctl  *sc_ctl; 	/* various registers */
84 	struct	cg14curs *sc_hwc;
85 	struct 	cg14dac	 *sc_dac;
86 	struct	cg14xlut *sc_xlut;
87 	struct 	cg14clut *sc_clut1;
88 	struct	cg14clut *sc_clut2;
89 	struct	cg14clut *sc_clut3;
90 	u_int	*sc_clutincr;
91 };
92