KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
pvr_regs.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/pvr/pvr_regs.h
4 Copyright (C) 2002 Megan Potter
5 Copyright (C) 2014 Lawrence Sebald
6 Copyright (C) 2023 Ruslan Rostovtsev
7 Copyright (C) 2024 Falco Girgis
8*/
9
10/** \file dc/pvr/pvr_regs.h
11 \brief PVR Driver Registers
12 \ingroup pvr_registers
13
14 This file provides the low-level driver implementation details for the
15 PowerVR API, including its memory map and register accessors.
16
17 \author Megan Potter
18 \author Roger Cattermole
19 \author Paul Boese
20 \author Brian Paul
21 \author Lawrence Sebald
22 \author Benoit Miller
23 \author Ruslan Rostovtsev
24 \author Falco Girgis
25*/
26
27#ifndef __DC_PVR_PVR_REGS_H
28#define __DC_PVR_PVR_REGS_H
29
30#include <sys/cdefs.h>
31__BEGIN_DECLS
32
33/**** Register macros ***************************************************/
34
35/** \defgroup pvr_registers Registers
36 \brief Direct PVR register and memory access
37 \ingroup pvr
38 @{
39*/
40
41/* We use these macros to do all PVR register access, so that it's
42 simple later on to hook them for debugging or whatnot. */
43
44/** \brief Retrieve a PVR register value
45
46 \param REG The register to fetch. See \ref pvr_regs.
47
48 \return The value of that register (32-bits)
49*/
50#define PVR_GET(REG) (* ( (vuint32*)( 0xa05f8000 + (REG) ) ) )
51
52/** \brief Set a PVR register value
53
54 \param REG The register to set. See \ref pvr_regs.
55 \param VALUE The value to set in the register (32-bits)
56*/
57#define PVR_SET(REG, VALUE) PVR_GET(REG) = (VALUE)
58
59/** @} */
60
61/** \defgroup pvr_regs Offsets
62 \brief PowerVR register offsets
63 \ingroup pvr_registers
64
65 The registers themselves; these are from Maiwe's powervr-reg.txt.
66
67 \note
68 2D specific registers have been excluded for now (like
69 vsync, hsync, v/h size, etc)
70
71 @{
72*/
73
74#define PVR_ID 0x0000 /**< \brief Chip ID */
75#define PVR_REVISION 0x0004 /**< \brief Chip revision */
76#define PVR_RESET 0x0008 /**< \brief Reset pins */
77
78#define PVR_ISP_START 0x0014 /**< \brief Start the ISP/TSP */
79#define PVR_UNK_0018 0x0018 /**< \brief ?? */
80
81#define PVR_ISP_VERTBUF_ADDR 0x0020 /**< \brief Vertex buffer address for scene rendering */
82
83#define PVR_ISP_TILEMAT_ADDR 0x002c /**< \brief Tile matrix address for scene rendering */
84#define PVR_SPANSORT_CFG 0x0030 /**< \brief ?? -- write 0x101 for now */
85
86#define PVR_BORDER_COLOR 0x0040 /**< \brief Border Color in RGB888 */
87#define PVR_FB_CFG_1 0x0044 /**< \brief Framebuffer config 1 */
88#define PVR_FB_CFG_2 0x0048 /**< \brief Framebuffer config 2 */
89#define PVR_RENDER_MODULO 0x004c /**< \brief Render modulo */
90#define PVR_FB_ADDR 0x0050 /**< \brief Framebuffer start address */
91#define PVR_FB_IL_ADDR 0x0054 /**< \brief Framebuffer odd-field start address for interlace */
92
93#define PVR_FB_SIZE 0x005c /**< \brief Framebuffer display size */
94#define PVR_RENDER_ADDR 0x0060 /**< \brief Render output address */
95#define PVR_RENDER_ADDR_2 0x0064 /**< \brief Output for strip-buffering */
96#define PVR_PCLIP_X 0x0068 /**< \brief Horizontal clipping area */
97#define PVR_PCLIP_Y 0x006c /**< \brief Vertical clipping area */
98
99#define PVR_CHEAP_SHADOW 0x0074 /**< \brief Cheap shadow control */
100#define PVR_OBJECT_CLIP 0x0078 /**< \brief Distance for polygon culling */
101#define PVR_UNK_007C 0x007c /**< \brief ?? -- write 0x0027df77 for now */
102#define PVR_UNK_0080 0x0080 /**< \brief ?? -- write 7 for now */
103#define PVR_TEXTURE_CLIP 0x0084 /**< \brief Distance for texture clipping */
104#define PVR_BGPLANE_Z 0x0088 /**< \brief Distance for background plane */
105#define PVR_BGPLANE_CFG 0x008c /**< \brief Background plane config */
106
107#define PVR_UNK_0098 0x0098 /**< \brief ?? -- write 0x00800408 for now */
108
109#define PVR_UNK_00A0 0x00a0 /**< \brief ?? -- write 0x20 for now */
110
111#define PVR_UNK_00A8 0x00a8 /**< \brief ?? -- write 0x15d1c951 for now */
112
113#define PVR_FOG_TABLE_COLOR 0x00b0 /**< \brief Table fog color */
114#define PVR_FOG_VERTEX_COLOR 0x00b4 /**< \brief Vertex fog color */
115#define PVR_FOG_DENSITY 0x00b8 /**< \brief Fog density coefficient */
116#define PVR_COLOR_CLAMP_MAX 0x00bc /**< \brief RGB Color clamp max */
117#define PVR_COLOR_CLAMP_MIN 0x00c0 /**< \brief RGB Color clamp min */
118#define PVR_GUN_POS 0x00c4 /**< \brief Light gun position */
119#define PVR_HPOS_IRQ 0x00c8 /**< \brief Horizontal position IRQ */
120#define PVR_VPOS_IRQ 0x00cc /**< \brief Vertical position IRQ */
121#define PVR_IL_CFG 0x00d0 /**< \brief Interlacing config */
122#define PVR_BORDER_X 0x00d4 /**< \brief Window border X position */
123#define PVR_SCAN_CLK 0x00d8 /**< \brief Clock and scanline values */
124#define PVR_BORDER_Y 0x00dc /**< \brief Window border Y position */
125
126#define PVR_TEXTURE_MODULO 0x00e4 /**< \brief Output texture width modulo */
127#define PVR_VIDEO_CFG 0x00e8 /**< \brief Misc video config */
128#define PVR_BITMAP_X 0x00ec /**< \brief Bitmap window X position */
129#define PVR_BITMAP_Y 0x00f0 /**< \brief Bitmap window Y position */
130#define PVR_SCALER_CFG 0x00f4 /**< \brief Smoothing scaler */
131
132#define PVR_PALETTE_CFG 0x0108 /**< \brief Palette format */
133#define PVR_SYNC_STATUS 0x010c /**< \brief V/H blank status */
134#define PVR_UNK_0110 0x0110 /**< \brief ?? -- write 0x93f39 for now */
135#define PVR_UNK_0114 0x0114 /**< \brief ?? -- write 0x200000 for now */
136#define PVR_UNK_0118 0x0118 /**< \brief ?? -- write 0x8040 for now */
137
138#define PVR_TA_OPB_START 0x0124 /**< \brief Object Pointer Buffer start for TA usage */
139#define PVR_TA_VERTBUF_START 0x0128 /**< \brief Vertex buffer start for TA usage */
140#define PVR_TA_OPB_END 0x012c /**< \brief OPB end for TA usage */
141#define PVR_TA_VERTBUF_END 0x0130 /**< \brief Vertex buffer end for TA usage */
142#define PVR_TA_OPB_POS 0x0134 /**< \brief Top used memory location in OPB for TA usage */
143#define PVR_TA_VERTBUF_POS 0x0138 /**< \brief Top used memory location in vertbuf for TA usage */
144#define PVR_TILEMAT_CFG 0x013c /**< \brief Tile matrix size config */
145#define PVR_OPB_CFG 0x0140 /**< \brief Active lists / list size */
146#define PVR_TA_INIT 0x0144 /**< \brief Initialize vertex reg. params */
147#define PVR_YUV_ADDR 0x0148 /**< \brief YUV conversion destination */
148#define PVR_YUV_CFG 0x014c /**< \brief YUV configuration */
149#define PVR_YUV_STAT 0x0150 /**< \brief The number of YUV macroblocks converted */
150
151#define PVR_UNK_0160 0x0160 /**< \brief ?? */
152#define PVR_TA_OPB_INIT 0x0164 /**< \brief Object pointer buffer position init */
153
154#define PVR_FOG_TABLE_BASE 0x0200 /**< \brief Base of the fog table */
155
156#define PVR_PALETTE_TABLE_BASE 0x1000 /**< \brief Base of the palette table */
157/** @} */
158
159/** \defgroup pvr_addresses Addresses and Constants
160 \brief Miscellaneous Addresses and Constants
161 \ingroup pvr_registers
162
163 Useful PVR memory locations and values.
164
165 @{
166*/
167#define PVR_TA_INPUT 0x10000000 /**< \brief TA command input (64-bit, TA) */
168#define PVR_TA_YUV_CONV 0x10800000 /**< \brief YUV converter (64-bit, TA) */
169#define PVR_TA_TEX_MEM 0x11000000 /**< \brief VRAM 64-bit, TA=>VRAM */
170#define PVR_TA_TEX_MEM_32 0x13000000 /**< \brief VRAM 32-bit, TA->VRAM */
171#define PVR_RAM_BASE_32_P0 0x05000000 /**< \brief VRAM 32-bit, P0 area, PVR->VRAM */
172#define PVR_RAM_BASE_64_P0 0x04000000 /**< \brief VRAM 64-bit, P0 area, PVR->VRAM */
173#define PVR_RAM_BASE 0xa5000000 /**< \brief VRAM 32-bit, P2 area, PVR->VRAM */
174#define PVR_RAM_INT_BASE 0xa4000000 /**< \brief VRAM 64-bit, P2 area, PVR->VRAM */
175
176#define PVR_RAM_SIZE (8*1024*1024) /**< \brief RAM size in bytes */
177
178#define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE) /**< \brief Top of raw PVR RAM */
179#define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE) /**< \brief Top of int PVR RAM */
180/** @} */
181
182/* Register content defines, as needed; these will be filled in over time
183 as the implementation requires them. There's too many to do otherwise. */
184
185/** \defgroup pvr_reset_vals Reset Values
186 \brief Values used to reset parts of the PVR
187 \ingroup pvr_registers
188
189 These values are written to the PVR_RESET register in order to reset the
190 system or to take it out of reset.
191
192 @{
193*/
194#define PVR_RESET_ALL 0xffffffff /**< \brief Reset the whole PVR */
195#define PVR_RESET_NONE 0x00000000 /**< \brief Cancel reset state */
196#define PVR_RESET_TA 0x00000001 /**< \brief Reset only the TA */
197#define PVR_RESET_ISPTSP 0x00000002 /**< \brief Reset only the ISP/TSP */
198/** @} */
199
200/** \defgroup pvr_go Init/Start Values
201 \brief Values to be written to registers to conform or start operations.
202 \ingroup pvr_registers
203 @{
204*/
205#define PVR_ISP_START_GO 0xffffffff /**< \brief Write to the PVR_ISP_START register to start rendering */
206
207#define PVR_TA_INIT_GO 0x80000000 /**< \brief Write to the PVR_TA_INIT register to confirm settings */
208/** @} */
209
210
211__END_DECLS
212
213#endif /* __DC_PVR_PVR_REGS_H */