cg6_regs.h revision 4d26f1c6
1/*
2 * GX and Turbo GX framebuffer - hardware registers.
3 *
4 * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23/* $XFree86$ */
24
25#ifndef CG6_REGS_H
26#define CG6_REGS_H
27
28/* FHC definitions */
29#define CG6_FHC_FBID_SHIFT           24
30#define CG6_FHC_FBID_MASK            255
31#define CG6_FHC_REV_SHIFT            20
32#define CG6_FHC_REV_MASK             15
33#define CG6_FHC_FROP_DISABLE         (1 << 19)
34#define CG6_FHC_ROW_DISABLE          (1 << 18)
35#define CG6_FHC_SRC_DISABLE          (1 << 17)
36#define CG6_FHC_DST_DISABLE          (1 << 16)
37#define CG6_FHC_RESET                (1 << 15)
38#define CG6_FHC_LITTLE_ENDIAN        (1 << 13)
39#define CG6_FHC_RES_MASK             (3 << 11)
40#define CG6_FHC_1024                 (0 << 11)
41#define CG6_FHC_1152                 (1 << 11)
42#define CG6_FHC_1280                 (2 << 11)
43#define CG6_FHC_1600                 (3 << 11)
44#define CG6_FHC_CPU_MASK             (3 << 9)
45#define CG6_FHC_CPU_SPARC            (0 << 9)
46#define CG6_FHC_CPU_68020            (1 << 9)
47#define CG6_FHC_CPU_386              (2 << 9)
48#define CG6_FHC_TEST		     (1 << 8)
49#define CG6_FHC_TEST_X_SHIFT	     4
50#define CG6_FHC_TEST_X_MASK	     15
51#define CG6_FHC_TEST_Y_SHIFT	     0
52#define CG6_FHC_TEST_Y_MASK	     15
53
54/* FBC mode definitions */
55#define CG6_FBC_BLIT_IGNORE		0x00000000
56#define CG6_FBC_BLIT_NOSRC		0x00100000
57#define CG6_FBC_BLIT_SRC		0x00200000
58#define CG6_FBC_BLIT_ILLEGAL		0x00300000
59#define CG6_FBC_BLIT_MASK		0x00300000
60
61#define CG6_FBC_VBLANK			0x00080000
62
63#define CG6_FBC_MODE_IGNORE		0x00000000
64#define CG6_FBC_MODE_COLOR8		0x00020000
65#define CG6_FBC_MODE_COLOR1		0x00040000
66#define CG6_FBC_MODE_HRMONO		0x00060000
67#define CG6_FBC_MODE_MASK		0x00060000
68
69#define CG6_FBC_DRAW_IGNORE		0x00000000
70#define CG6_FBC_DRAW_RENDER		0x00008000
71#define CG6_FBC_DRAW_PICK		0x00010000
72#define CG6_FBC_DRAW_ILLEGAL		0x00018000
73#define CG6_FBC_DRAW_MASK		0x00018000
74
75#define CG6_FBC_BWRITE0_IGNORE		0x00000000
76#define CG6_FBC_BWRITE0_ENABLE		0x00002000
77#define CG6_FBC_BWRITE0_DISABLE		0x00004000
78#define CG6_FBC_BWRITE0_ILLEGAL		0x00006000
79#define CG6_FBC_BWRITE0_MASK		0x00006000
80
81#define CG6_FBC_BWRITE1_IGNORE		0x00000000
82#define CG6_FBC_BWRITE1_ENABLE		0x00000800
83#define CG6_FBC_BWRITE1_DISABLE		0x00001000
84#define CG6_FBC_BWRITE1_ILLEGAL		0x00001800
85#define CG6_FBC_BWRITE1_MASK		0x00001800
86
87#define CG6_FBC_BREAD_IGNORE		0x00000000
88#define CG6_FBC_BREAD_0			0x00000200
89#define CG6_FBC_BREAD_1			0x00000400
90#define CG6_FBC_BREAD_ILLEGAL		0x00000600
91#define CG6_FBC_BREAD_MASK		0x00000600
92
93#define CG6_FBC_BDISP_IGNORE		0x00000000
94#define CG6_FBC_BDISP_0			0x00000080
95#define CG6_FBC_BDISP_1			0x00000100
96#define CG6_FBC_BDISP_ILLEGAL		0x00000180
97#define CG6_FBC_BDISP_MASK		0x00000180
98
99#define CG6_FBC_INDEX_MOD		0x00000040
100#define CG6_FBC_INDEX_MASK		0x00000030
101
102/* THC definitions */
103#define CG6_THC_MISC_REV_SHIFT       16
104#define CG6_THC_MISC_REV_MASK        15
105#define CG6_THC_MISC_RESET           (1 << 12)
106#define CG6_THC_MISC_VIDEO           (1 << 10)
107#define CG6_THC_MISC_SYNC            (1 << 9)
108#define CG6_THC_MISC_VSYNC           (1 << 8)
109#define CG6_THC_MISC_SYNC_ENAB       (1 << 7)
110#define CG6_THC_MISC_CURS_RES        (1 << 6)
111#define CG6_THC_MISC_INT_ENAB        (1 << 5)
112#define CG6_THC_MISC_INT             (1 << 4)
113#define CG6_THC_MISC_INIT            0x9f
114
115/* rasterops */
116#define GX_ROP_CLEAR        0x0
117#define GX_ROP_INVERT       0x1
118#define GX_ROP_NOOP         0x2
119#define GX_ROP_SET          0x3
120
121#define GX_ROP_00_0(rop)    ((rop) << 0)
122#define GX_ROP_00_1(rop)    ((rop) << 2)
123#define GX_ROP_01_0(rop)    ((rop) << 4)
124#define GX_ROP_01_1(rop)    ((rop) << 6)
125#define GX_ROP_10_0(rop)    ((rop) << 8)
126#define GX_ROP_10_1(rop)    ((rop) << 10)
127#define GX_ROP_11_0(rop)    ((rop) << 12)
128#define GX_ROP_11_1(rop)    ((rop) << 14)
129#define GX_PLOT_PLOT        0x00000000
130#define GX_PLOT_UNPLOT      0x00020000
131#define GX_RAST_BOOL        0x00000000
132#define GX_RAST_LINEAR      0x00040000
133#define GX_ATTR_UNSUPP      0x00400000
134#define GX_ATTR_SUPP        0x00800000
135#define GX_POLYG_OVERLAP    0x01000000
136#define GX_POLYG_NONOVERLAP 0x02000000
137#define GX_PATTERN_ZEROS    0x04000000
138#define GX_PATTERN_ONES     0x08000000
139#define GX_PATTERN_MASK     0x0c000000
140#define GX_PIXEL_ZEROS      0x10000000
141#define GX_PIXEL_ONES       0x20000000
142#define GX_PIXEL_MASK       0x30000000
143#define GX_PLANE_ZEROS      0x40000000
144#define GX_PLANE_ONES       0x80000000
145#define GX_PLANE_MASK       0xc0000000
146/* rops for bit blit / copy area
147   with:
148       Plane Mask - use plane mask reg.
149       Pixel Mask - use all ones.
150       Patt  Mask - use all ones.
151*/
152
153#define POLY_O          GX_POLYG_OVERLAP
154#define POLY_N          GX_POLYG_NONOVERLAP
155
156#define ROP_STANDARD    (GX_PLANE_MASK |\
157                        GX_PIXEL_ONES |\
158                        GX_ATTR_SUPP |\
159                        GX_RAST_BOOL |\
160                        GX_PLOT_PLOT)
161
162/* fg = don't care  bg = don't care */
163
164#define ROP_BLIT(O,I)   (ROP_STANDARD | \
165                        GX_PATTERN_ONES |\
166                        GX_ROP_11_1(I) |\
167                        GX_ROP_11_0(O) |\
168                        GX_ROP_10_1(I) |\
169                        GX_ROP_10_0(O) |\
170                        GX_ROP_01_1(I) |\
171                        GX_ROP_01_0(O) |\
172                        GX_ROP_00_1(I) |\
173                        GX_ROP_00_0(O))
174
175/* fg = fgPixel     bg = don't care */
176
177#define ROP_FILL(O,I)   (ROP_STANDARD | \
178                        GX_PATTERN_ONES |\
179                        GX_ROP_11_1(I) |\
180                        GX_ROP_11_0(I) |\
181                        GX_ROP_10_1(I) |\
182                        GX_ROP_10_0(I) | \
183                        GX_ROP_01_1(O) |\
184                        GX_ROP_01_0(O) |\
185                        GX_ROP_00_1(O) |\
186                        GX_ROP_00_0(O))
187
188/* fg = fgPixel     bg = don't care */
189
190#define ROP_STIP(O,I)   (ROP_STANDARD |\
191                        GX_ROP_11_1(I) |\
192                        GX_ROP_11_0(GX_ROP_NOOP) |\
193                        GX_ROP_10_1(I) |\
194                        GX_ROP_10_0(GX_ROP_NOOP) | \
195                        GX_ROP_01_1(O) |\
196                        GX_ROP_01_0(GX_ROP_NOOP) |\
197                        GX_ROP_00_1(O) |\
198                        GX_ROP_00_0(GX_ROP_NOOP))
199
200/* fg = fgPixel     bg = bgPixel */
201
202#define ROP_OSTP(O,I)   (ROP_STANDARD |\
203                        GX_ROP_11_1(I) |\
204                        GX_ROP_11_0(I) |\
205                        GX_ROP_10_1(I) |\
206                        GX_ROP_10_0(O) |\
207                        GX_ROP_01_1(O) |\
208                        GX_ROP_01_0(I) |\
209                        GX_ROP_00_1(O) |\
210                        GX_ROP_00_0(O))
211
212#define GX_ROP_USE_PIXELMASK    0x30000000
213
214#define GX_BLT_INPROGRESS       0x20000000
215
216#define GX_INPROGRESS           0x10000000
217#define GX_FULL                 0x20000000
218
219/* modes */
220#define GX_INDEX(n)         ((n) << 4)
221#define GX_INDEX_ALL        0x00000030
222#define GX_INDEX_MOD        0x00000040
223#define GX_BDISP_0          0x00000080
224#define GX_BDISP_1          0x00000100
225#define GX_BDISP_ALL        0x00000180
226#define GX_BREAD_0          0x00000200
227#define GX_BREAD_1          0x00000400
228#define GX_BREAD_ALL        0x00000600
229#define GX_BWRITE1_ENABLE   0x00000800
230#define GX_BWRITE1_DISABLE  0x00001000
231#define GX_BWRITE1_ALL      0x00001800
232#define GX_BWRITE0_ENABLE   0x00002000
233#define GX_BWRITE0_DISABLE  0x00004000
234#define GX_BWRITE0_ALL      0x00006000
235#define GX_DRAW_RENDER      0x00008000
236#define GX_DRAW_PICK        0x00010000
237#define GX_DRAW_ALL         0x00018000
238#define GX_MODE_COLOR8      0x00020000
239#define GX_MODE_COLOR1      0x00040000
240#define GX_MODE_HRMONO      0x00060000
241#define GX_MODE_ALL         0x00060000
242#define GX_VBLANK           0x00080000
243#define GX_BLIT_NOSRC       0x00100000
244#define GX_BLIT_SRC         0x00200000
245#define GX_BLIT_ALL         0x00300000
246
247typedef struct cg6_tec {
248	volatile unsigned int	tec_matrix;
249	volatile unsigned int	tec_clip;
250	volatile unsigned int	tec_vdc;
251} Cg6Tec, *Cg6TecPtr;
252
253typedef struct cg6_thc {
254        unsigned int		thc_pad0[512];
255	volatile unsigned int	thc_hs;		/* hsync timing */
256	volatile unsigned int	thc_hsdvs;
257	volatile unsigned int	thc_hd;
258	volatile unsigned int	thc_vs;		/* vsync timing */
259	volatile unsigned int	thc_vd;
260	volatile unsigned int	thc_refresh;
261	volatile unsigned int	thc_misc;
262	unsigned int		thc_pad1[56];
263	volatile unsigned int	thc_cursxy;	/* cursor x,y position (16 bits each) */
264	volatile unsigned int	thc_cursmask[32];/* cursor mask bits */
265	volatile unsigned int	thc_cursbits[32];/* what to show where mask enabled */
266} Cg6Thc, *Cg6ThcPtr;
267
268typedef struct cg6_fbc {
269	unsigned int		xxx0[1];
270	volatile unsigned int	mode;
271	volatile unsigned int	clip;
272	unsigned int		xxx1[1];
273	volatile unsigned int	s;
274	volatile unsigned int	draw;
275	volatile unsigned int	blit;
276	volatile unsigned int	font;
277	unsigned int		xxx2[24];
278	volatile unsigned int	x0, y0, z0, color0;
279	volatile unsigned int	x1, y1, z1, color1;
280	volatile unsigned int	x2, y2, z2, color2;
281	volatile unsigned int	x3, y3, z3, color3;
282	volatile unsigned int	offx, offy;
283	unsigned int		xxx3[2];
284	volatile unsigned int	incx, incy;
285	unsigned int		xxx4[2];
286	volatile unsigned int	clipminx, clipminy;
287	unsigned int		xxx5[2];
288	volatile unsigned int	clipmaxx, clipmaxy;
289	unsigned int		xxx6[2];
290	volatile unsigned int	fg;
291	volatile unsigned int	bg;
292	volatile unsigned int	alu;
293	volatile unsigned int	pm;
294	volatile unsigned int	pixelm;
295	unsigned int		xxx7[2];
296	volatile unsigned int	patalign;
297	volatile unsigned int	pattern[8];
298	unsigned int		xxx8[432];
299	volatile unsigned int	apointx, apointy, apointz;
300	unsigned int		xxx9[1];
301	volatile unsigned int	rpointx, rpointy, rpointz;
302	unsigned int		xxx10[5];
303	volatile unsigned int	pointr, pointg, pointb, pointa;
304	volatile unsigned int	alinex, aliney, alinez;
305	unsigned int		xxx11[1];
306	volatile unsigned int	rlinex, rliney, rlinez;
307	unsigned int		xxx12[5];
308	volatile unsigned int	liner, lineg, lineb, linea;
309	volatile unsigned int	atrix, atriy, atriz;
310	unsigned int		xxx13[1];
311	volatile unsigned int	rtrix, rtriy, rtriz;
312	unsigned int		xxx14[5];
313	volatile unsigned int	trir, trig, trib, tria;
314	volatile unsigned int	aquadx, aquady, aquadz;
315	unsigned int		xxx15[1];
316	volatile unsigned int	rquadx, rquady, rquadz;
317	unsigned int		xxx16[5];
318	volatile unsigned int	quadr, quadg, quadb, quada;
319	volatile unsigned int	arectx, arecty, arectz;
320	unsigned int		xxx17[1];
321	volatile unsigned int	rrectx, rrecty, rrectz;
322	unsigned int		xxx18[5];
323	volatile unsigned int	rectr, rectg, rectb, recta;
324} Cg6Fbc, *Cg6FbcPtr;
325
326#endif /* CG6_REGS_H */
327