Annotation of sys/arch/sparc/dev/cgtworeg.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: cgtworeg.h,v 1.3 2006/07/20 11:23:49 martin Exp $ */
2: /* $NetBSD: cgtworeg.h,v 1.3 1995/10/04 00:21:27 pk Exp $ */
3:
4: /*
5: * Copyright (c) 1994 Dennis Ferguson
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27: */
28:
29: /* cgtworeg.h - CG2 colour frame buffer definitions
30: *
31: * The mapped memory looks like:
32: *
33: * offset contents
34: * 0x000000 bit plane map - 1st (of 8) plane used by the X server in -mono mode
35: * 0x100000 pixel map - used by the X server in color mode
36: * 0x200000 raster op mode memory map - unused by X server
37: * 0x300000 random control registers (lots of spaces in between)
38: * 0x310000 shadow colour map
39: */
40:
41: /* Frame buffer memory size and depth */
42: #define CG2_FBSIZE (1024 * 1024)
43: #define CG2_N_PLANE 8
44:
45: /* Screen dimensions */
46: #define CG2_WIDTH 1152
47: #define CG2_HEIGHT 900
48:
49: /* Colourmap size */
50: #define CG2_CMSIZE 256
51:
52: #define CG2_BITPLANE_OFF 0
53: #define CG2_BITPLANE_SIZE 0x100000
54: #define CG2_PIXMAP_OFF (CG2_BITPLANE_OFF + CG2_BITPLANE_SIZE)
55: #define CG2_PIXMAP_SIZE 0x100000
56: #define CG2_ROPMEM_OFF (CG2_PIXMAP_OFF + CG2_PIXMAP_SIZE)
57: #define CG2_ROPMEM_SIZE 0x100000
58: #define CG2_CTLREG_OFF (CG2_ROPMEM_OFF + CG2_ROPMEM_SIZE)
59: #define CG2_CTLREG_SIZE 0x010600
60: #define CG2_MAPPED_SIZE (CG2_CTLREG_OFF + CG2_CTLREG_SIZE)
61:
62:
63: /* arrangement of bit plane mode memory */
64: union bitplane {
65: u_short word[CG2_HEIGHT][CG2_WIDTH/(CG2_N_PLANE * sizeof(u_short))];
66: u_short plane[CG2_FBSIZE/(CG2_N_PLANE * sizeof(u_short))];
67: };
68:
69: /* arrangement of pixel mode memory */
70: union byteplane {
71: u_char pixel[CG2_HEIGHT][CG2_WIDTH];
72: u_char frame[CG2_FBSIZE];
73: };
74:
75:
76: /*
77: * Structure describing the first two megabytes of the frame buffer.
78: * Normal memory maps in bit plane and pixel modes
79: */
80: struct cg2memfb {
81: union bitplane memplane[CG2_N_PLANE]; /* bit plane map */
82: union byteplane pixplane; /* pixel map */
83: };
84:
85:
86: /*
87: * Control/status register. The X server only appears to use update_cmap
88: * and video_enab.
89: */
90: struct cg2statusreg {
91: u_int reserved : 2; /* not used */
92: u_int fastread : 1; /* r/o: has some feature I don't understand */
93: u_int id : 1; /* r/o: ext status and ID registers exist */
94: u_int resolution : 4; /* screen resolution, 0 means 1152x900 */
95: u_int retrace : 1; /* r/o: retrace in progress */
96: u_int inpend : 1; /* r/o: interrupt request */
97: u_int ropmode : 3; /* ?? */
98: u_int inten : 1; /* interrupt enable (for end of retrace) */
99: u_int update_cmap : 1; /* copy/use shadow colour map */
100: u_int video_enab : 1; /* enable video */
101: };
102:
103:
104: /*
105: * Extended status register. Unused by X server
106: */
107: struct cg2_extstatus {
108: u_int gpintreq : 1; /* interrupt request */
109: u_int gpintdis : 1; /* interrupt disable */
110: u_int reserved : 13; /* unused */
111: u_int gpbus : 1; /* bus enabled */
112: };
113:
114:
115: /*
116: * Double buffer control register. It appears that (some of?) the
117: * cg2 cards support a pair of memory sets, referred to as `A' and
118: * `B', which can be swapped to allow atomic screen updates. This
119: * controls them.
120: */
121: struct dblbufreg {
122: u_int display_b : 1; /* display memory B (set) or A (reset) */
123: u_int read_b : 1; /* access memory B (set) or A (reset) */
124: u_int nowrite_b : 1; /* when set, writes don't update memory B */
125: u_int nowrite_a : 1; /* when set, writes don't update memory A */
126: u_int read_ecmap : 1; /* copy from(clear)/to(set) shadow colour map */
127: u_int fast_read : 1; /* fast reads, but wrong data */
128: u_int wait : 1; /* when set, remains so to end up v. retrace */
129: u_int update_ecmap : 1; /* copy/use shadow colour map */
130: u_int reserved : 8;
131: };
132:
133:
134: /*
135: * Zoom register, apparently present on Sun-2 colour boards only. See
136: * the Sun documentation, I don't know anyone who still has a Sun-2.
137: */
138: struct cg2_zoom {
139: union {
140: u_short reg;
141: u_char reg_pad[4096];
142: } wordpan;
143: union {
144: struct {
145: u_int unused : 8;
146: u_int lineoff : 4;
147: u_int pixzoom : 4;
148: } reg;
149: u_short word;
150: u_char reg_pad[4096];
151: } zoom;
152: union {
153: struct {
154: u_int unused : 8;
155: u_int lorigin : 4;
156: u_int pixeloff : 4;
157: } reg;
158: u_short word;
159: u_char reg_pad[4096];
160: } pixpan;
161: union {
162: u_short reg;
163: u_char reg_pad[4096];
164: } varzoom;
165: };
166:
167:
168: /*
169: * Miscellany. On the Sun-3 these registers exist in place of the above.
170: */
171: struct cg2_nozoom {
172: union { /* double buffer register (see above) */
173: struct dblbufreg reg;
174: u_short word;
175: u_char reg_pad[4096];
176: } dblbuf;
177: union { /* start of dma window */
178: u_short reg;
179: u_char reg_pad[4096];
180: } dmabase;
181: union { /* dma window size */
182: u_short reg; /* actually 8 bits. reg*16 == size */
183: u_char reg_pad[4096];
184: } dmawidth;
185: union { /* frame count */
186: u_short reg; /* actually 8 bits only. r/o */
187: u_char reg_pad[4096];
188: } framecnt;
189: };
190:
191:
192: /*
193: * Raster op control registers. X doesn't use this, but documented here
194: * for future reference.
195: */
196: struct memropc {
197: u_short mrc_dest;
198: u_short mrc_source1;
199: u_short mrc_source2;
200: u_short mrc_pattern;
201: u_short mrc_mask1;
202: u_short mrc_mask2;
203: u_short mrc_shift;
204: u_short mrc_op;
205: u_short mrc_width;
206: u_short mrc_opcount;
207: u_short mrc_decoderout;
208: u_short mrc_x11;
209: u_short mrc_x12;
210: u_short mrc_x13;
211: u_short mrc_x14;
212: u_short mrc_x15;
213: };
214:
215:
216: /*
217: * Last chunk of the frame buffer (i.e. from offset 0x200000 and above).
218: * Exists separately from struct cg2memfb apparently because Sun software
219: * avoids mapping the latter, though X uses it.
220: */
221: struct cg2fb {
222: union { /* raster op mode frame memory */
223: union bitplane ropplane[CG2_N_PLANE];
224: union byteplane roppixel;
225: } ropio;
226: union { /* raster op control unit (1 per plane) */
227: struct memropc ropregs;
228: struct {
229: u_char pad[2048];
230: struct memropc ropregs;
231: } prime;
232: u_char reg_pad[4096];
233: } ropcontrol[9];
234: union { /* status register */
235: struct cg2statusreg reg;
236: u_short word;
237: u_char reg_pad[4096];
238: } status;
239: union { /* per-plane mask register */
240: u_short reg; /* 8 bit mask register - set means plane r/w */
241: u_char reg_pad[4096];
242: } ppmask;
243: union { /* miscellaneous registers */
244: struct cg2_zoom zoom;
245: struct cg2_nozoom nozoom;
246: } misc;
247: union { /* interrupt vector */
248: u_short reg;
249: u_char reg_pad[32];
250: } intrptvec;
251: union { /* board ID */
252: u_short reg;
253: u_char reg_pad[16];
254: } id;
255: union { /* extended status */
256: struct cg2_extstatus reg;
257: u_short word;
258: u_char reg_pad[16];
259: } extstatus;
260: union { /* auxiliary raster op mode register (?)*/
261: u_short reg;
262: u_char reg_pad[4032];
263: } ropmode;
264: u_short redmap[CG2_CMSIZE]; /* shadow colour maps */
265: u_short greenmap[CG2_CMSIZE];
266: u_short bluemap[CG2_CMSIZE];
267: };
CVSweb