Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits)
| 147 | |
| 148 | // Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits) |
| 149 | __ri tDMA_TAG *dmaGetAddr(u32 addr, bool write) |
| 150 | { |
| 151 | // if (addr & 0xf) { DMA_LOG("*PCSX2*: DMA address not 128bit aligned: %8.8x", addr); } |
| 152 | if (DMA_TAG(addr).SPR) return (tDMA_TAG*)&eeMem->Scratch[addr & 0x3ff0]; |
| 153 | |
| 154 | // FIXME: Why??? DMA uses physical addresses |
| 155 | addr &= 0x1ffffff0; |
| 156 | |
| 157 | if (addr < Ps2MemSize::ExposedRam) |
| 158 | { |
| 159 | return (tDMA_TAG*)&eeMem->Main[addr]; |
| 160 | } |
| 161 | else if (addr < 0x10000000) |
| 162 | { |
| 163 | return (tDMA_TAG*)(write ? eeMem->ZeroWrite : eeMem->ZeroRead); |
| 164 | } |
| 165 | else if (addr < 0x10004000) |
| 166 | { |
| 167 | // Secret scratchpad address for DMA = end of maximum main memory? |
| 168 | //Console.Warning("Writing to the scratchpad without the SPR flag set!"); |
| 169 | return (tDMA_TAG*)&eeMem->Scratch[addr & 0x3ff0]; |
| 170 | } |
| 171 | else |
| 172 | { |
| 173 | Console.Error( "*PCSX2*: DMA error: %8.8x", addr); |
| 174 | return NULL; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 179 | // Returns true if the DMA is enabled and executed successfully. Returns false if execution |
no test coverage detected