__fi void dmaIPU1() // toIPU { IPU_LOG("IPU1DMAStart QWC %x, MADR %x, CHCR %x, TADR %x", ipu1ch.qwc, ipu1ch.madr, ipu1ch.chcr._u32, ipu1ch.tadr); if (ipu1ch.pad != 0) { // Note: pad is the padding right above qwc, so we're testing whether qwc // has overflowed into pad. DevCon.Warning(L"IPU1dma's upper 16 bits set to %x\n", ipu1ch.pad); ipu1ch.qwc = ipu1ch.pad = 0; // If we are going to clear down IPU1, we should end it too. // Going to test this scenario on the PS2 mind - Refraction ipu1ch.chcr.STR = false; hwDmacIrq(DMAC_TO_IPU); } if (ipu1ch.chcr.MOD == NORMAL_MODE && ipu1ch.qwc == 0) //avoids freeze when IPU1 Normal error is triggered { /*ipu1ch.chcr.STR = false; // Hack to force stop IPU ipuRegs.cmd.BUSY = 0; ipuRegs.ctrl.BUSY = 0; ipuRegs.topbusy = 0; // hwDmacIrq(DMAC_TO_IPU);*/ IPU_LOG("IPU1 Normal error fix"); ipu1ch.qwc = 1; } if (ipu1ch.chcr.MOD == CHAIN_MODE) //Chain Mode { IPU_LOG("Setting up IPU1 Chain mode"); if(ipu1ch.qwc == 0) { IPU1Status.InProgress = false; IPU1Status.DMAFinished = false; } else { //Attempting to continue a previous chain IPU_LOG("Resuming DMA TAG %x", (ipu1ch.chcr.TAG >> 12)); //We MUST check the CHCR for the tag it last knew, it can be manipulated! IPU1Status.ChainMode = (ipu1ch.chcr.TAG >> 12) & 0x7; IPU1Status.InProgress = true; if ((ipu1ch.chcr.tag().ID == TAG_REFE) || (ipu1ch.chcr.tag().ID == TAG_END) || (ipu1ch.chcr.tag().IRQ && ipu1ch.chcr.TIE)) { IPU1Status.DMAFinished = true; } else { IPU1Status.DMAFinished = false; } } IPU1Status.DMAMode = DMA_MODE_CHAIN; IPU1dma(); }
__fi void dmaIPU1() // toIPU { IPU_LOG("IPU1DMAStart QWC %x, MADR %x, CHCR %x, TADR %x", ipu1dma.qwc, ipu1dma.madr, ipu1dma.chcr._u32, ipu1dma.tadr); if (ipu1dma.pad != 0) { // Note: pad is the padding right above qwc, so we're testing whether qwc // has overflowed into pad. DevCon.Warning(L"IPU1dma's upper 16 bits set to %x\n", ipu1dma.pad); ipu1dma.qwc = ipu1dma.pad = 0; // If we are going to clear down IPU1, we should end it too. // Going to test this scenario on the PS2 mind - Refraction ipu1dma.chcr.STR = false; hwDmacIrq(DMAC_TO_IPU); } if (ipu1dma.chcr.MOD == CHAIN_MODE) //Chain Mode { IPU_LOG("Setting up IPU1 Chain mode"); if(ipu1dma.qwc == 0) { IPU1Status.InProgress = false; IPU1Status.DMAFinished = false; } else { //Attempting to continue a previous chain IPU_LOG("Resuming DMA TAG %x", (ipu1dma.chcr.TAG >> 12)); //We MUST check the CHCR for the tag it last knew, it can be manipulated! IPU1Status.ChainMode = (ipu1dma.chcr.TAG >> 12) & 0x7; IPU1Status.InProgress = true; IPU1Status.DMAFinished = ((ipu1dma.chcr.TAG >> 15) && ipu1dma.chcr.TIE) ? true : false; } IPU1Status.DMAMode = DMA_MODE_CHAIN; IPU1dma(); }