MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SPRdmaGetAddr

Function SPRdmaGetAddr

pcsx2/Dmac.cpp:81–146  ·  view source on GitHub ↗

Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits)

Source from the content-addressed store, hash-verified

79
80// Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits)
81__fi tDMA_TAG* SPRdmaGetAddr(u32 addr, bool write)
82{
83 // if (addr & 0xf) { DMA_LOG("*PCSX2*: DMA address not 128bit aligned: %8.8x", addr); }
84
85 //For some reason Getaway references SPR Memory from itself using SPR0, oh well, let it i guess...
86 if((addr & 0x70000000) == 0x70000000)
87 {
88 return (tDMA_TAG*)&eeMem->Scratch[addr & 0x3ff0];
89 }
90
91 // FIXME: Why??? DMA uses physical addresses
92 addr &= 0x1ffffff0;
93
94 if (addr < Ps2MemSize::ExposedRam)
95 {
96 return (tDMA_TAG*)&eeMem->Main[addr];
97 }
98 else if (addr < 0x10000000)
99 {
100 return (tDMA_TAG*)(write ? eeMem->ZeroWrite : eeMem->ZeroRead);
101 }
102 else if ((addr >= 0x11000000) && (addr < 0x11010000))
103 {
104 if (addr >= 0x11008000 && THREAD_VU1)
105 {
106 DevCon.Warning("MTVU: SPR Accessing VU1 Memory");
107 vu1Thread.WaitVU();
108 }
109
110 //Access for VU Memory
111
112 if((addr >= 0x1100c000) && (addr < 0x11010000))
113 {
114 //DevCon.Warning("VU1 Mem %x", addr);
115 return (tDMA_TAG*)(VU1.Mem + (addr & 0x3ff0));
116 }
117
118 if((addr >= 0x11004000) && (addr < 0x11008000))
119 {
120 //DevCon.Warning("VU0 Mem %x", addr);
121 return (tDMA_TAG*)(VU0.Mem + (addr & 0xff0));
122 }
123
124 //Possibly not needed but the manual doesn't say SPR cannot access it.
125 if((addr >= 0x11000000) && (addr < 0x11004000))
126 {
127 //DevCon.Warning("VU0 Micro %x", addr);
128 return (tDMA_TAG*)(VU0.Micro + (addr & 0xff0));
129 }
130
131 if((addr >= 0x11008000) && (addr < 0x1100c000))
132 {
133 //DevCon.Warning("VU1 Micro %x", addr);
134 return (tDMA_TAG*)(VU1.Micro + (addr & 0x3ff0));
135 }
136
137
138 // Unreachable

Callers 5

_SPR0chainFunction · 0.85
_SPR0interleaveFunction · 0.85
_SPR1chainFunction · 0.85
_SPR1interleaveFunction · 0.85
_dmaSPR1Function · 0.85

Calls 3

WaitVUMethod · 0.80
WarningMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected