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

Function GIFdma

pcsx2/Gif.cpp:387–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void GIFdma()
388{
389 while (gifch.qwc > 0 || !gif.gspath3done)
390 {
391 tDMA_TAG* ptag;
392 gif.gscycles = gif.prevcycles;
393
394 if (gifRegs.ctrl.PSE)
395 { // Temporarily stop
396 DevCon.WriteLn("Gif dma paused by PSE bit.");
397 GifDMAInt(16);
398 CPU_SET_DMASTALL(DMAC_GIF, true);
399 return;
400 }
401
402 if ((dmacRegs.ctrl.STD == STD_GIF) && (gif.prevcycles != 0))
403 {
404 //Console.WriteLn("GS Stall Control Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3, gifch.madr, psHu32(DMAC_STADR));
405 if ((gifch.madr + (gifch.qwc * 16)) > dmacRegs.stadr.ADDR)
406 {
407 GifDMAInt(4);
408 CPU_SET_DMASTALL(DMAC_GIF, true);
409 gif.gscycles = 0;
410 return;
411 }
412 gif.prevcycles = 0;
413 gifch.qwc = 0;
414 }
415
416 if ((gifch.chcr.MOD == CHAIN_MODE) && (!gif.gspath3done) && gifch.qwc == 0) // Chain Mode
417 {
418 ptag = ReadTag();
419 if (ptag == NULL)
420 return;
421 //DevCon.Warning("GIF Reading Tag MSK = %x", vif1Regs.mskpath3);
422 GIF_LOG("gifdmaChain %8.8x_%8.8x size=%d, id=%d, addr=%lx tadr=%lx", ptag[1]._u32, ptag[0]._u32, gifch.qwc, ptag->ID, gifch.madr, gifch.tadr);
423 gifRegs.stat.FQC = std::min((u32)0x10, gifch.qwc);
424 CalculateFIFOCSR();
425
426 if (dmacRegs.ctrl.STD == STD_GIF)
427 {
428 // there are still bugs, need to also check if gifch.madr +16*qwc >= stadr, if not, stall
429 if ((ptag->ID == TAG_REFS) && ((gifch.madr + (gifch.qwc * 16)) > dmacRegs.stadr.ADDR))
430 {
431 // stalled.
432 // We really need to test this. Pay attention to prevcycles, as it used to trigger GIFchains in the code above. (rama)
433 //DevCon.Warning("GS Stall Control start Source = %x, Drain = %x\n MADR = %x, STADR = %x", (psHu32(0xe000) >> 4) & 0x3, (psHu32(0xe000) >> 6) & 0x3,gifch.madr, psHu32(DMAC_STADR));
434 gif.prevcycles = gif.gscycles;
435 gifch.tadr -= 16;
436 gifch.qwc = 0;
437 hwDmacIrq(DMAC_STALL_SIS);
438 GifDMAInt(128);
439 gif.gscycles = 0;
440 CPU_SET_DMASTALL(DMAC_GIF, true);
441 return;
442 }
443 }
444

Callers 1

gifInterruptFunction · 0.85

Calls 11

GifDMAIntFunction · 0.85
CPU_SET_DMASTALLFunction · 0.85
ReadTagFunction · 0.85
CalculateFIFOCSRFunction · 0.85
hwDmacIrqFunction · 0.85
checkTieBitFunction · 0.85
GIFchainFunction · 0.85
Path3MaskedMethod · 0.80
CanDoPath3Method · 0.80
minFunction · 0.50
WriteLnMethod · 0.45

Tested by

no test coverage detected