Add dma_addr to convert pointers to DMA addresses

This commit is contained in:
marcan 2009-03-06 05:25:28 +01:00 committed by bushing
parent 5b14f07ea2
commit e463cdea43
2 changed files with 21 additions and 0 deletions

View File

@ -229,6 +229,25 @@ void mem_setswap(int enable)
}
u32 dma_addr(void *p)
{
u32 addr = (u32)p;
switch(addr>>20) {
case 0xfff:
case 0x0d4:
case 0x0dc:
if(read32(HW_MEMMIRR) & 0x20) {
addr ^= 0x10000;
}
addr &= 0x0001FFFF;
addr |= 0x0d400000;
break;
}
//gecko_printf("DMA to %p: address %08x\n", p, addr);
return addr;
}
#define SECTION 0x012
#define NONBUFFERABLE 0x000

View File

@ -27,6 +27,8 @@ void mem_setswap(int enable);
void mem_initialize(void);
void mem_shutdown(void);
u32 dma_addr(void *);
static inline u32 get_cr(void)
{
u32 data;