/[pcsx2_0.9.7]/trunk/pcsx2/IPU/IPUdma.cpp
ViewVC logotype

Diff of /trunk/pcsx2/IPU/IPUdma.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/pcsx2/IPU/IPUdma.cpp	2010/12/23 11:48:33	279
+++ trunk/pcsx2/IPU/IPUdma.cpp	2010/12/23 12:02:12	280
@@ -42,21 +42,6 @@
 	Freeze(IPU1Status);
 }
 
-static __fi bool ipuDmacPartialChain(tDMA_TAG tag)
-{
-	switch (tag.ID)
-	{
-		case TAG_REFE:  // refe
-			ipu1dma.tadr += 16;
-			return true;
-
-		case TAG_END: // end
-			ipu1dma.tadr = ipu1dma.madr;
-			return true;
-	}
-	return false;
-}
-
 static __fi void ipuDmacSrcChain()
 {
 	switch (IPU1Status.ChainMode)
@@ -82,7 +67,7 @@
 			break;
 
 		case TAG_END: // end
-			ipu1dma.tadr = ipu1dma.madr;
+			//ipu1dma.tadr = ipu1dma.madr;
 			IPU1Status.DMAFinished = true;
 			break;
 	}
@@ -136,15 +121,12 @@
 		ipu1dma.qwc -= qwc;
 		totalqwc += qwc;
 	}
+
+	//Update TADR etc
+	if(IPU1Status.DMAMode == DMA_MODE_CHAIN) ipuDmacSrcChain();
+
 	if( ipu1dma.qwc == 0)
-	{
-		//Update TADR etc
-		if(IPU1Status.DMAMode == DMA_MODE_CHAIN) ipuDmacSrcChain();
-		//If the transfer has finished or we have room in the FIFO, schedule to the interrupt code.
-		
-		//No data left
 		IPU1Status.InProgress = false;
-	} //If we still have data the commands should pull this across when need be.
 
 	return totalqwc;
 }
@@ -238,7 +220,8 @@
 							break;
 
 						case TAG_CNT: // cnt
-							ipu1dma.madr = ipu1dma.tadr + 16;
+							ipu1dma.tadr += 16;
+							ipu1dma.madr = ipu1dma.tadr;
 							IPU_LOG("Tag should end on %x", ipu1dma.madr + ipu1dma.qwc * 16);
 							//ipu1dma.tadr = ipu1dma.madr + (ipu1dma.qwc * 16);
 							// Set the taddr to the next tag
@@ -262,7 +245,7 @@
 						case TAG_END: // end
 							// do not change tadr
 							ipu1dma.madr = ipu1dma.tadr + 16;
-							ipu1dma.tadr += 16;
+							//ipu1dma.tadr += 16;
 							IPU_LOG("Tag should end on %x", ipu1dma.madr + ipu1dma.qwc * 16);
 
 							break;
@@ -310,15 +293,23 @@
 	return totalqwc;
 }
 
-int IPU0dma()
+void IPU0dma()
 {
-	if(!ipuRegs.ctrl.OFC) return 0;
+	if(!ipuRegs.ctrl.OFC) 
+	{
+		IPU_INT_FROM( 64 );
+		IPUProcessInterrupt();
+		return;
+	}
 
 	int readsize;
 	tDMA_TAG* pMem;
 
 	if ((!(ipu0dma.chcr.STR) || (cpuRegs.interrupt & (1 << DMAC_FROM_IPU))) || (ipu0dma.qwc == 0))
-		return 0;
+	{
+		DevCon.Warning("How??");
+		return;
+	}
 
 	pxAssert(!(ipu0dma.chcr.TTE));
 
@@ -362,10 +353,11 @@
 		//This was IPU_INT_FROM(readsize*BIAS );
 		//This broke vids in Digital Devil Saga
 		//Note that interrupting based on totalsize is just guessing..
-		IPU_INT_FROM( readsize * BIAS );
 	}
+	IPU_INT_FROM( readsize * BIAS );
+	if(ipuRegs.ctrl.IFC > 0) IPUProcessInterrupt();
 
-	return readsize;
+	//return readsize;
 }
 
 __fi void dmaIPU0() // fromIPU
@@ -381,7 +373,10 @@
 		hwDmacIrq(DMAC_FROM_IPU);
 	}
 
-	IPUProcessInterrupt();
+	IPU_INT_FROM( 64 );
+
+
+	
 }
 
 __fi void dmaIPU1() // toIPU
@@ -450,6 +445,11 @@
 {
 	IPU_LOG("ipu0Interrupt: %x", cpuRegs.cycle);
 
+	if(ipu0dma.qwc > 0)
+	{
+		IPU0dma();
+		return;
+	}
 	if (g_nDMATransfer.FIREINT0)
 	{
 		g_nDMATransfer.FIREINT0 = false;

 

  ViewVC Help
Powered by ViewVC 1.1.22