1 |
/* GXemul: $Id: dreamcast_pvr.h,v 1.6 2006/10/31 08:27:26 debug Exp $ */ |
2 |
/* $NetBSD: pvr.c,v 1.22 2006/04/12 19:38:22 jmmv Exp $ */ |
3 |
|
4 |
#ifndef DREAMCAST_PVR_H |
5 |
#define DREAMCAST_PVR_H |
6 |
|
7 |
/* |
8 |
* Note: This was pvr.c in NetBSD. It has been extended with reasonably |
9 |
* similar symbolnames from http://www.ludd.luth.se/~jlo/dc/powervr-reg.txt. |
10 |
* |
11 |
* There are still many things missing. |
12 |
*/ |
13 |
|
14 |
/*- |
15 |
* Copyright (c) 2001 Marcus Comstedt. |
16 |
* Copyright (c) 2001 Jason R. Thorpe. |
17 |
* All rights reserved. |
18 |
* |
19 |
* Redistribution and use in source and binary forms, with or without |
20 |
* modification, are permitted provided that the following conditions |
21 |
* are met: |
22 |
* 1. Redistributions of source code must retain the above copyright |
23 |
* notice, this list of conditions and the following disclaimer. |
24 |
* 2. Redistributions in binary form must reproduce the above copyright |
25 |
* notice, this list of conditions and the following disclaimer in the |
26 |
* documentation and/or other materials provided with the distribution. |
27 |
* 3. All advertising materials mentioning features or use of this software |
28 |
* must display the following acknowledgement: |
29 |
* This product includes software developed by Marcus Comstedt. |
30 |
* 4. Neither the name of The NetBSD Foundation nor the names of its |
31 |
* contributors may be used to endorse or promote products derived |
32 |
* from this software without specific prior written permission. |
33 |
* |
34 |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
35 |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
36 |
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
37 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
38 |
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
39 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
40 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
41 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
42 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
43 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
44 |
* POSSIBILITY OF SUCH DAMAGE. |
45 |
*/ |
46 |
|
47 |
/* |
48 |
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved. |
49 |
* |
50 |
* Redistribution and use in source and binary forms, with or without |
51 |
* modification, are permitted provided that the following conditions |
52 |
* are met: |
53 |
* 1. Redistributions of source code must retain the above copyright |
54 |
* notice, this list of conditions and the following disclaimer. |
55 |
* 2. Redistributions in binary form must reproduce the above copyright |
56 |
* notice, this list of conditions and the following disclaimer in the |
57 |
* documentation and/or other materials provided with the distribution. |
58 |
* 3. All advertising materials mentioning features or use of this software |
59 |
* must display the following acknowledgement: |
60 |
* This product includes software developed by Tohru Nishimura |
61 |
* for the NetBSD Project. |
62 |
* 4. The name of the author may not be used to endorse or promote products |
63 |
* derived from this software without specific prior written permission |
64 |
* |
65 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
66 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
67 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
68 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
69 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
70 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
71 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
72 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
73 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
74 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
75 |
*/ |
76 |
|
77 |
#define PVRREG_FBSTART 0x05000000 |
78 |
#define PVRREG_REGSTART 0x005f8000 |
79 |
|
80 |
#define PVRREG_REGSIZE 0x00002000 |
81 |
|
82 |
|
83 |
#define PVRREG_ID 0x00 |
84 |
|
85 |
#define PVRREG_REVISION 0x04 |
86 |
#define PVR_REVISION_MINOR_MASK 0xf |
87 |
#define PVR_REVISION_MAJOR_MASK 0xf0 |
88 |
#define PVR_REVISION_MAJOR_SHIFT 4 |
89 |
|
90 |
#define PVRREG_RESET 0x08 |
91 |
#define PVR_RESET_TA 0x00000001 |
92 |
#define PVR_RESET_PVR 0x00000002 |
93 |
#define PVR_RESET_BUS 0x00000004 |
94 |
|
95 |
#define PVRREG_STARTRENDER 0x14 |
96 |
|
97 |
#define PVRREG_OB_ADDR 0x20 |
98 |
/* Object Buffer start address. Bits 0..19 should always be zero. */ |
99 |
#define PVR_OB_ADDR_MASK 0x00f00000 |
100 |
|
101 |
#define PVRREG_TILEBUF_ADDR 0x2c |
102 |
#define PVR_TILEBUF_ADDR_MASK 0x00fffff8 |
103 |
|
104 |
#define PVRREG_SPANSORT 0x30 |
105 |
#define PVR_SPANSORT_SPAN0 0x00000001 |
106 |
#define PVR_SPANSORT_SPAN1 0x00000100 |
107 |
#define PVR_SPANSORT_TSP_CACHE_ENABLE 0x00010000 |
108 |
|
109 |
#define PVRREG_BRDCOLR 0x40 |
110 |
#define BRDCOLR_BLUE(x) ((x) << 0) |
111 |
#define BRDCOLR_GREEN(x) ((x) << 8) |
112 |
#define BRDCOLR_RED(x) ((x) << 16) |
113 |
|
114 |
#define PVRREG_DIWMODE 0x44 |
115 |
#define DIWMODE_DE (1U << 0) /* display enable */ |
116 |
#define DIWMODE_SD (1U << 1) /* scan double enable */ |
117 |
#define DIWMODE_COL(x) ((x) << 2) |
118 |
#define DIWMODE_COL_RGB555 DIWMODE_COL(0) /* RGB555, 16-bit */ |
119 |
#define DIWMODE_COL_RGB565 DIWMODE_COL(1) /* RGB565, 16-bit */ |
120 |
#define DIWMODE_COL_RGB888 DIWMODE_COL(2) /* RGB888, 24-bit */ |
121 |
#define DIWMODE_COL_ARGB888 DIWMODE_COL(3) /* RGB888, 32-bit */ |
122 |
#define DIWMODE_C (1U << 23) /* 2x clock enable (VGA) */ |
123 |
#define DIWMODE_DE_MASK 0x00000001 |
124 |
#define DIWMODE_SD_MASK 0x00000002 /* Line double */ |
125 |
#define DIWMODE_COL_MASK 0x0000000c /* Pixel mode */ |
126 |
#define DIWMODE_COL_SHIFT 2 |
127 |
#define DIWMODE_EX_MASK 0x00000070 /* Extend bits */ |
128 |
#define DIWMODE_EX_SHIFT 4 |
129 |
#define DIWMODE_TH_MASK 0x0000ff00 /* ARGB8888 threshold */ |
130 |
#define DIWMODE_TH_SHIFT 8 |
131 |
#define DIWMODE_SL_MASK 0x003f0000 /* Strip Length */ |
132 |
#define DIWMODE_SL_SHIFT 16 |
133 |
#define DIWMODE_SE_MASK 0x00400000 /* Strip Buffer enabled */ |
134 |
#define DIWMODE_C_MASK 0x00800000 /* Clock double */ |
135 |
|
136 |
#define PVRREG_FB_RENDER_CFG 0x48 |
137 |
/* TODO */ |
138 |
|
139 |
#define PVRREG_FB_RENDER_MODULO 0x4c |
140 |
#define FB_RENDER_MODULO_MASK 0x000001ff |
141 |
/* TODO */ |
142 |
|
143 |
#define PVRREG_DIWADDRL 0x50 |
144 |
|
145 |
#define PVRREG_DIWADDRS 0x54 |
146 |
|
147 |
#define PVRREG_DIWSIZE 0x5c |
148 |
#define DIWSIZE_DPL(x) ((x) << 0) /* pixel data per line */ |
149 |
#define DIWSIZE_LPF(x) ((x) << 10) /* lines per field */ |
150 |
#define DIWSIZE_MODULO(x) ((x) << 20) /* words to skip + 1 */ |
151 |
#define DIWSIZE_MASK 0x3ff /* All fields are 10 bits. */ |
152 |
#define DIWSIZE_DPL_SHIFT 0 |
153 |
#define DIWSIZE_LPF_SHIFT 10 |
154 |
#define DIWSIZE_MODULO_SHIFT 20 |
155 |
|
156 |
#define PVRREG_FB_RENDER_ADDR1 0x60 /* Odd interlace lines */ |
157 |
|
158 |
#define PVRREG_FB_RENDER_ADDR2 0x64 /* Even interlace lines */ |
159 |
|
160 |
#define PVRREG_VRAM_CFG1 0xa0 |
161 |
#define VRAM_CFG1_GOOD_REFRESH_VALUE 0x20 |
162 |
|
163 |
#define PVRREG_VRAM_CFG2 0xa4 |
164 |
#define VRAM_CFG2_UNKNOWN_MAGIC 0x0000001f |
165 |
|
166 |
#define PVRREG_VRAM_CFG3 0xa8 |
167 |
#define VRAM_CFG3_UNKNOWN_MAGIC 0x15d1c951 |
168 |
|
169 |
#define PVRREG_FOG_TABLE_COL 0xb0 |
170 |
|
171 |
#define PVRREG_FOG_VERTEX_COL 0xb4 |
172 |
|
173 |
#define PVRREG_RASEVTPOS 0xcc |
174 |
#define RASEVTPOS_POS2_MASK 0x000003ff |
175 |
#define RASEVTPOS_POS1_MASK 0x03ff0000 |
176 |
#define RASEVTPOS_POS1_SHIFT 16 |
177 |
#define RASEVTPOS_BOTTOM(x) ((x) << 0) |
178 |
#define RASEVTPOS_TOP(x) ((x) << 16) |
179 |
|
180 |
#define PVRREG_SYNCCONF 0xd0 |
181 |
#define SYNCCONF_VP (1U << 0) /* V-sync polarity */ |
182 |
#define SYNCCONF_HP (1U << 1) /* H-sync polarity */ |
183 |
#define SYNCCONF_I (1U << 4) /* interlace */ |
184 |
#define SYNCCONF_BC(x) (1U << 6) /* broadcast standard */ |
185 |
#define SYNCCONF_VO (1U << 8) /* video output enable */ |
186 |
#define SYNCCONF_VO_MASK 0x00000100 |
187 |
#define SYNCCONF_BC_MASK 0x000000c0 |
188 |
#define SYNCCONF_BC_SHIFT 6 |
189 |
#define SYNCCONF_BC_VGA 0 |
190 |
#define SYNCCONF_BC_NTSC 1 |
191 |
#define SYNCCONF_BC_PAL 2 |
192 |
#define SYNCCONF_I_MASK 0x00000010 |
193 |
#define SYNCCONF_HP_MASK 0x00000004 /* Positive H-sync */ |
194 |
#define SYNCCONF_VP_MASK 0x00000002 /* Positive V-sync */ |
195 |
|
196 |
#define PVRREG_BRDHORZ 0xd4 |
197 |
#define BRDHORZ_STOP_MASK 0x0000ffff |
198 |
#define BRDHORZ_START_MASK 0xffff0000 |
199 |
#define BRDHORZ_START_SHIFT 16 |
200 |
#define BRDHORZ_STOP(x) ((x) << 0) |
201 |
#define BRDHORZ_START(x) ((x) << 16) |
202 |
|
203 |
#define PVRREG_SYNCSIZE 0xd8 |
204 |
#define SYNCSIZE_H_MASK 0x0000ffff |
205 |
#define SYNCSIZE_V_MASK 0xffff0000 |
206 |
#define SYNCSIZE_V_SHIFT 16 |
207 |
#define SYNCSIZE_H(x) ((x) << 0) |
208 |
#define SYNCSIZE_V(x) ((x) << 16) |
209 |
|
210 |
#define PVRREG_BRDVERT 0xdc |
211 |
#define BRDVERT_STOP_MASK 0x0000ffff |
212 |
#define BRDVERT_START_MASK 0xffff0000 |
213 |
#define BRDVERT_START_SHIFT 16 |
214 |
#define BRDVERT_STOP(x) ((x) << 0) |
215 |
#define BRDVERT_START(x) ((x) << 16) |
216 |
|
217 |
#define PVRREG_DIWCONF 0xe8 |
218 |
#define DIWCONF_BLANK (1U << 3) /* blank screen */ |
219 |
#define DIWCONF_LR (1U << 8) /* low-res (320 horizontal) */ |
220 |
#define DIWCONF_MAGIC_MASK 0x003f0000 |
221 |
#define DIWCONF_MAGIC (22 << 16) |
222 |
|
223 |
#define PVRREG_DIWHSTRT 0xec |
224 |
#define DIWVSTRT_HPOS_MASK 0x000003ff |
225 |
|
226 |
#define PVRREG_DIWVSTRT 0xf0 |
227 |
#define DIWVSTRT_V1_MASK 0x000003ff |
228 |
#define DIWVSTRT_V2_MASK 0x03ff0000 |
229 |
#define DIWVSTRT_V2_SHIFT 16 |
230 |
#define DIWVSTRT_V1(x) ((x) << 0) |
231 |
#define DIWVSTRT_V2(x) ((x) << 16) |
232 |
|
233 |
#define PVRREG_PALETTE_CFG 0x108 |
234 |
#define PVR_PALETTE_CFG_MODE_MASK 0x3 |
235 |
#define PVR_PALETTE_CFG_MODE_ARGB1555 0x0 |
236 |
#define PVR_PALETTE_CFG_MODE_RGB565 0x1 |
237 |
#define PVR_PALETTE_CFG_MODE_ARGB4444 0x2 |
238 |
#define PVR_PALETTE_CFG_MODE_ARGB8888 0x3 |
239 |
|
240 |
#define PVRREG_SYNC_STAT 0x10c |
241 |
#define PVR_SYNC_STAT_VPOS_MASK 0x000003ff |
242 |
#define PVR_SYNC_STAT_INTERLACE_FIELD_EVEN 0x00000400 |
243 |
#define PVR_SYNC_STAT_HBLANK 0x00001000 |
244 |
#define PVR_SYNC_STAT_VBLANK 0x00002000 |
245 |
|
246 |
#define PVRREG_TA_OPB_START 0x124 |
247 |
#define TA_OPB_START_MASK 0x00ffff80 |
248 |
|
249 |
#define PVRREG_TA_OB_START 0x128 |
250 |
#define TA_OB_START_MASK 0x00fffff8 |
251 |
|
252 |
#define PVRREG_TA_OPB_END 0x12c |
253 |
#define TA_OPB_END_MASK 0x00ffff80 |
254 |
|
255 |
#define PVRREG_TA_OB_END 0x130 |
256 |
#define TA_OB_END_MASK 0x00fffff8 |
257 |
|
258 |
#define PVRREG_TA_OPB_POS 0x134 |
259 |
#define TA_OPB_POS_MASK 0x00ffff80 |
260 |
|
261 |
#define PVRREG_TA_OB_POS 0x138 |
262 |
#define TA_OB_POS_MASK 0x00fffff8 |
263 |
|
264 |
#define PVRREG_TILEBUF_SIZE 0x13c |
265 |
#define TILEBUF_SIZE_HEIGHT_MASK 0xffff0000 |
266 |
#define TILEBUF_SIZE_HEIGHT_SHIFT 16 |
267 |
#define TILEBUF_SIZE_WIDTH_MASK 0x0000ffff |
268 |
|
269 |
#define PVRREG_TA_OPB_CFG 0x140 |
270 |
#define TA_OPB_CFG_OPAQUEPOLY_MASK 0x00000003 |
271 |
#define TA_OPB_CFG_OPAQUEMOD_MASK 0x00000030 |
272 |
#define TA_OPB_CFG_OPAQUEMOD_SHIFT 4 |
273 |
#define TA_OPB_CFG_TRANSPOLY_MASK 0x00000300 |
274 |
#define TA_OPB_CFG_TRANSPOLY_SHIFT 8 |
275 |
#define TA_OPB_CFG_TRANSMOD_MASK 0x00003000 |
276 |
#define TA_OPB_CFG_TRANSMOD_SHIFT 12 |
277 |
#define TA_OPB_CFG_PUNCHTHROUGH_MASK 0x00030000 |
278 |
#define TA_OPB_CFG_PUNCHTHROUGH_SHIFT 16 |
279 |
#define TA_OPB_CFG_OPBDIR 0x00100000 |
280 |
|
281 |
#define PVRREG_TA_INIT 0x144 |
282 |
#define PVR_TA_INIT 0x80000000 |
283 |
|
284 |
#define PVRREG_YUV_ADDR 0x148 |
285 |
#define PVR_YUV_ADDR_MASK 0x00ffffe0 |
286 |
|
287 |
#define PVRREG_YUV_CFG1 0x14c |
288 |
/* TODO */ |
289 |
|
290 |
#define PVRREG_YUV_STAT 0x150 |
291 |
/* Nr of currently converted 16x16 macro blocks. */ |
292 |
#define PVR_YUV_STAT_BLOCKS_MASK 0x1fff |
293 |
|
294 |
#define PVRREG_TA_OPL_REINIT 0x160 |
295 |
#define PVR_TA_OPL_REINIT 0x80000000 |
296 |
|
297 |
#define PVRREG_TA_OPL_INIT 0x164 |
298 |
/* Start of Object Pointer List allocation in VRAM. */ |
299 |
#define PVR_TA_OPL_INIT_MASK 0x00ffff80 |
300 |
|
301 |
#define PVRREG_FOG_TABLE 0x0200 |
302 |
#define PVR_FOG_TABLE_SIZE 0x0200 |
303 |
|
304 |
#define PVRREG_PALETTE 0x1000 |
305 |
#define PVR_PALETTE_SIZE 0x1000 |
306 |
|
307 |
#endif /* DREAMCAST_PVR_H */ |
308 |
|