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

Function _cpuTestInterrupts

pcsx2/R5900.cpp:260–316  ·  view source on GitHub ↗

[TODO] move this function to Dmac.cpp, and remove most of the DMAC-related headers from being included into R5900.cpp.

Source from the content-addressed store, hash-verified

258// [TODO] move this function to Dmac.cpp, and remove most of the DMAC-related headers from
259// being included into R5900.cpp.
260static __fi bool _cpuTestInterrupts()
261{
262
263 if (!dmacRegs.ctrl.DMAE || (psHu8(DMAC_ENABLER+2) & 1))
264 {
265 //Console.Write("DMAC Disabled or suspended");
266 return false;
267 }
268
269 eeRunInterruptScan = INT_RUNNING;
270
271 while (eeRunInterruptScan == INT_RUNNING)
272 {
273 /* These are 'pcsx2 interrupts', they handle asynchronous stuff
274 that depends on the cycle timings */
275 TESTINT(VU_MTVU_BUSY, MTVUInterrupt);
276 TESTINT(DMAC_VIF1, vif1Interrupt);
277 TESTINT(DMAC_GIF, gifInterrupt);
278 TESTINT(DMAC_SIF0, EEsif0Interrupt);
279 TESTINT(DMAC_SIF1, EEsif1Interrupt);
280 // Profile-guided Optimization (sorta)
281 // The following ints are rarely called. Encasing them in a conditional
282 // as follows helps speed up most games.
283
284 if (cpuRegs.interrupt & ((1 << DMAC_VIF0) | (1 << DMAC_FROM_IPU) | (1 << DMAC_TO_IPU)
285 | (1 << DMAC_FROM_SPR) | (1 << DMAC_TO_SPR) | (1 << DMAC_MFIFO_VIF) | (1 << DMAC_MFIFO_GIF)
286 | (1 << VIF_VU0_FINISH) | (1 << VIF_VU1_FINISH) | (1 << IPU_PROCESS)))
287 {
288 TESTINT(DMAC_VIF0, vif0Interrupt);
289
290 TESTINT(DMAC_FROM_IPU, ipu0Interrupt);
291 TESTINT(DMAC_TO_IPU, ipu1Interrupt);
292 TESTINT(IPU_PROCESS, ipuCMDProcess);
293
294 TESTINT(DMAC_FROM_SPR, SPRFROMinterrupt);
295 TESTINT(DMAC_TO_SPR, SPRTOinterrupt);
296
297 TESTINT(DMAC_MFIFO_VIF, vifMFIFOInterrupt);
298 TESTINT(DMAC_MFIFO_GIF, gifMFIFOInterrupt);
299
300 TESTINT(VIF_VU0_FINISH, vif0VUFinish);
301 TESTINT(VIF_VU1_FINISH, vif1VUFinish);
302 }
303
304 if (eeRunInterruptScan == INT_REQ_LOOP)
305 eeRunInterruptScan = INT_RUNNING;
306 else
307 break;
308 }
309
310 eeRunInterruptScan = INT_NOT_RUNNING;
311
312 if ((cpuRegs.interrupt & 0x1FFFF) & ~cpuRegs.dmastall)
313 return true;
314 else
315 return false;
316}
317

Callers 1

_cpuEventTest_SharedFunction · 0.85

Calls 1

TESTINTFunction · 0.85

Tested by

no test coverage detected