1 /* $NetBSD: cgtworeg.h,v 1.4 2003/05/03 18:11:00 wiz Exp $ */
4 * Copyright (c) 1994 Dennis Ferguson
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 /* cgtworeg.h - CG2 colour frame buffer definitions
30 * The mapped memory looks like:
33 * 0x000000 bit plane map - 1st (of 8) plane used by the X server in -mono mode
34 * 0x100000 pixel map - used by the X server in color mode
35 * 0x200000 raster op mode memory map - unused by X server
36 * 0x300000 random control registers (lots of spaces in between)
37 * 0x310000 shadow colour map
40 /* Frame buffer memory size and depth */
41 #define CG2_FBSIZE (1024 * 1024)
44 /* Screen dimensions */
45 #define CG2_WIDTH 1152
46 #define CG2_HEIGHT 900
49 #define CG2_CMSIZE 256
51 #define CG2_BITPLANE_OFF 0
52 #define CG2_BITPLANE_SIZE 0x100000
53 #define CG2_PIXMAP_OFF (CG2_BITPLANE_OFF + CG2_BITPLANE_SIZE)
54 #define CG2_PIXMAP_SIZE 0x100000
55 #define CG2_ROPMEM_OFF (CG2_PIXMAP_OFF + CG2_PIXMAP_SIZE)
56 #define CG2_ROPMEM_SIZE 0x100000
57 #define CG2_CTLREG_OFF (CG2_ROPMEM_OFF + CG2_ROPMEM_SIZE)
58 #define CG2_CTLREG_SIZE 0x010600
59 #define CG2_MAPPED_SIZE (CG2_CTLREG_OFF + CG2_CTLREG_SIZE)
62 /* arrangement of bit plane mode memory */
64 u_short word
[CG2_HEIGHT
][CG2_WIDTH
/(CG2_N_PLANE
* sizeof(u_short
))];
65 u_short plane
[CG2_FBSIZE
/(CG2_N_PLANE
* sizeof(u_short
))];
68 /* arrangement of pixel mode memory */
70 u_char pixel
[CG2_HEIGHT
][CG2_WIDTH
];
71 u_char frame
[CG2_FBSIZE
];
76 * Structure describing the first two megabytes of the frame buffer.
77 * Normal memory maps in bit plane and pixel modes
80 union bitplane memplane
[CG2_N_PLANE
]; /* bit plane map */
81 union byteplane pixplane
; /* pixel map */
86 * Control/status register. The X server only appears to use update_cmap
90 u_int reserved
: 2; /* not used */
91 u_int fastread
: 1; /* r/o: has some feature I don't understand */
92 u_int id
: 1; /* r/o: ext status and ID registers exist */
93 u_int resolution
: 4; /* screen resolution, 0 means 1152x900 */
94 u_int retrace
: 1; /* r/o: retrace in progress */
95 u_int inpend
: 1; /* r/o: interrupt request */
96 u_int ropmode
: 3; /* ?? */
97 u_int inten
: 1; /* interrupt enable (for end of retrace) */
98 u_int update_cmap
: 1; /* copy/use shadow colour map */
99 u_int video_enab
: 1; /* enable video */
104 * Extended status register. Unused by X server
106 struct cg2_extstatus
{
107 u_int gpintreq
: 1; /* interrupt request */
108 u_int gpintdis
: 1; /* interrupt disable */
109 u_int reserved
: 13; /* unused */
110 u_int gpbus
: 1; /* bus enabled */
115 * Double buffer control register. It appears that (some of?) the
116 * cg2 cards support a pair of memory sets, referred to as `A' and
117 * `B', which can be swapped to allow atomic screen updates. This
121 u_int display_b
: 1; /* display memory B (set) or A (reset) */
122 u_int read_b
: 1; /* accesss memory B (set) or A (reset) */
123 u_int nowrite_b
: 1; /* when set, writes don't update memory B */
124 u_int nowrite_a
: 1; /* when set, writes don't update memory A */
125 u_int read_ecmap
: 1; /* copy from(clear)/to(set) shadow colour map */
126 u_int fast_read
: 1; /* fast reads, but wrong data */
127 u_int wait
: 1; /* when set, remains so to end up v. retrace */
128 u_int update_ecmap
: 1; /* copy/use shadow colour map */
134 * Zoom register, apparently present on Sun-2 colour boards only. See
135 * the Sun documentation, I don't know anyone who still has a Sun-2.
140 u_char reg_pad
[4096];
149 u_char reg_pad
[4096];
158 u_char reg_pad
[4096];
162 u_char reg_pad
[4096];
168 * Miscellany. On the Sun-3 these registers exist in place of the above.
171 union { /* double buffer register (see above) */
172 struct dblbufreg reg
;
174 u_char reg_pad
[4096];
176 union { /* start of DMA window */
178 u_char reg_pad
[4096];
180 union { /* DMA window size */
181 u_short reg
; /* actually 8 bits. reg*16 == size */
182 u_char reg_pad
[4096];
184 union { /* frame count */
185 u_short reg
; /* actually 8 bits only. r/o */
186 u_char reg_pad
[4096];
192 * Raster op control registers. X doesn't use this, but documented here
193 * for future reference.
206 u_short mrc_decoderout
;
216 * Last chunk of the frame buffer (i.e. from offset 0x200000 and above).
217 * Exists separately from struct cg2memfb apparently because Sun software
218 * avoids mapping the latter, though X uses it.
221 union { /* raster op mode frame memory */
222 union bitplane ropplane
[CG2_N_PLANE
];
223 union byteplane roppixel
;
225 union { /* raster op control unit (1 per plane) */
226 struct memropc ropregs
;
229 struct memropc ropregs
;
231 u_char reg_pad
[4096];
233 union { /* status register */
234 struct cg2statusreg reg
;
236 u_char reg_pad
[4096];
238 union { /* per-plane mask register */
239 u_short reg
; /* 8 bit mask register - set means plane r/w */
240 u_char reg_pad
[4096];
242 union { /* miscellaneous registers */
243 struct cg2_zoom zoom
;
244 struct cg2_nozoom nozoom
;
246 union { /* interrupt vector */
250 union { /* board ID */
254 union { /* extended status */
255 struct cg2_extstatus reg
;
259 union { /* auxiliary raster op mode register (?)*/
261 u_char reg_pad
[4032];
263 u_short redmap
[CG2_CMSIZE
]; /* shadow colour maps */
264 u_short greenmap
[CG2_CMSIZE
];
265 u_short bluemap
[CG2_CMSIZE
];