Pica/GPU: Change hardware registers to use physical addresses rather than virtual ones.
This cleans up the mess that address reading/writing had become and makes the code a *lot* more sensible. This adds a physical<->virtual address converter to mem_map.h. For further accuracy, we will want to properly extend this to support a wider range of address regions. For now, this makes simply homebrew applications work in a good manner though.
This commit is contained in:
parent
bd798390d5
commit
7b6a7d7dfb
8 changed files with 81 additions and 217 deletions
|
@ -249,72 +249,6 @@ static_assert(sizeof(Regs) == 0x1000 * sizeof(u32), "Invalid total size of regis
|
|||
|
||||
extern Regs g_regs;
|
||||
|
||||
enum {
|
||||
TOP_ASPECT_X = 0x5,
|
||||
TOP_ASPECT_Y = 0x3,
|
||||
|
||||
TOP_HEIGHT = 240,
|
||||
TOP_WIDTH = 400,
|
||||
BOTTOM_WIDTH = 320,
|
||||
|
||||
// Physical addresses in FCRAM (chosen arbitrarily)
|
||||
PADDR_TOP_LEFT_FRAME1 = 0x201D4C00,
|
||||
PADDR_TOP_LEFT_FRAME2 = 0x202D4C00,
|
||||
PADDR_TOP_RIGHT_FRAME1 = 0x203D4C00,
|
||||
PADDR_TOP_RIGHT_FRAME2 = 0x204D4C00,
|
||||
PADDR_SUB_FRAME1 = 0x205D4C00,
|
||||
PADDR_SUB_FRAME2 = 0x206D4C00,
|
||||
// Physical addresses in FCRAM used by ARM9 applications
|
||||
/* PADDR_TOP_LEFT_FRAME1 = 0x20184E60,
|
||||
PADDR_TOP_LEFT_FRAME2 = 0x201CB370,
|
||||
PADDR_TOP_RIGHT_FRAME1 = 0x20282160,
|
||||
PADDR_TOP_RIGHT_FRAME2 = 0x202C8670,
|
||||
PADDR_SUB_FRAME1 = 0x202118E0,
|
||||
PADDR_SUB_FRAME2 = 0x20249CF0,*/
|
||||
|
||||
// Physical addresses in VRAM
|
||||
// TODO: These should just be deduced from the ones above
|
||||
PADDR_VRAM_TOP_LEFT_FRAME1 = 0x181D4C00,
|
||||
PADDR_VRAM_TOP_LEFT_FRAME2 = 0x182D4C00,
|
||||
PADDR_VRAM_TOP_RIGHT_FRAME1 = 0x183D4C00,
|
||||
PADDR_VRAM_TOP_RIGHT_FRAME2 = 0x184D4C00,
|
||||
PADDR_VRAM_SUB_FRAME1 = 0x185D4C00,
|
||||
PADDR_VRAM_SUB_FRAME2 = 0x186D4C00,
|
||||
// Physical addresses in VRAM used by ARM9 applications
|
||||
/* PADDR_VRAM_TOP_LEFT_FRAME2 = 0x181CB370,
|
||||
PADDR_VRAM_TOP_RIGHT_FRAME1 = 0x18282160,
|
||||
PADDR_VRAM_TOP_RIGHT_FRAME2 = 0x182C8670,
|
||||
PADDR_VRAM_SUB_FRAME1 = 0x182118E0,
|
||||
PADDR_VRAM_SUB_FRAME2 = 0x18249CF0,*/
|
||||
};
|
||||
|
||||
/// Framebuffer location
|
||||
enum FramebufferLocation {
|
||||
FRAMEBUFFER_LOCATION_UNKNOWN, ///< Framebuffer location is unknown
|
||||
FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap
|
||||
FRAMEBUFFER_LOCATION_VRAM, ///< Framebuffer is in VRAM
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
|
||||
* @param
|
||||
*/
|
||||
void SetFramebufferLocation(const FramebufferLocation mode);
|
||||
|
||||
/**
|
||||
* Gets a read-only pointer to a framebuffer in memory
|
||||
* @param address Physical address of framebuffer
|
||||
* @return Returns const pointer to raw framebuffer
|
||||
*/
|
||||
const u8* GetFramebufferPointer(const u32 address);
|
||||
|
||||
u32 GetFramebufferAddr(const u32 address);
|
||||
|
||||
/**
|
||||
* Gets the location of the framebuffers
|
||||
*/
|
||||
FramebufferLocation GetFramebufferLocation(u32 address);
|
||||
|
||||
template <typename T>
|
||||
void Read(T &var, const u32 addr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue