IPU: Split IPU DMA stuff out into its own file, and add missing region info (got left out AGAIN >_<) and a potentially important bit of IPU information to the savestate.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3726 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine
2010-09-05 00:36:03 +00:00
parent 46b89abb72
commit 935159ed8e
14 changed files with 901 additions and 877 deletions
+2
View File
@@ -371,6 +371,7 @@ set(pcsx2GuiHeaders
set(pcsx2IPUSources
IPU/IPU.cpp
IPU/IPU_Fifo.cpp
IPU/IPUdma.cpp
IPU/mpeg2lib/Idct.cpp
IPU/mpeg2lib/Mpeg.cpp
IPU/yuv2rgb.cpp)
@@ -379,6 +380,7 @@ set(pcsx2IPUSources
set(pcsx2IPUHeaders
IPU/IPU.h
IPU/IPU_Fifo.h
IPU/IPUdma.h
IPU/yuv2rgb.h)
# Linux sources
+1 -3
View File
@@ -459,9 +459,7 @@ void SaveStateBase::gsFreeze()
{
FreezeMem(PS2MEM_GS, 0x2000);
Freeze(SIGNAL_IMR_Pending);
if( GetVersion() > 0 )
Freeze(gsRegionMode);
Freeze(gsRegionMode);
gifPathFreeze();
}
+4 -5
View File
@@ -18,6 +18,7 @@
#include "Hardware.h"
#include "newVif.h"
#include "IPU/IPUdma.h"
using namespace R5900;
@@ -45,11 +46,6 @@ void hwInit()
hwInitialized = true;
}
/*void hwShutdown()
{
ipuShutdown();
}*/
void hwReset()
{
hwInit();
@@ -72,6 +68,9 @@ void hwReset()
ipuReset();
vif0Reset();
vif1Reset();
// needed for legacy DMAC
ipuDmaReset();
}
__fi void intcInterrupt()
+294 -780
View File
File diff suppressed because it is too large Load Diff
-81
View File
@@ -17,10 +17,6 @@
#include "IPU_Fifo.h"
#ifdef _MSC_VER
//#pragma pack(1)
#endif
#define ipumsk( src ) ( (src) & 0xff )
#define ipucase( src ) case ipumsk(src)
@@ -29,26 +25,6 @@
#define IPU_FORCEINLINE __fi
struct IPUStatus {
bool InProgress;
u8 DMAMode;
bool DMAFinished;
bool IRQTriggered;
u8 TagFollow;
u32 TagAddr;
bool stalled;
u8 ChainMode;
u32 NextMem;
};
#define DMA_MODE_NORMAL 0
#define DMA_MODE_CHAIN 1
#define IPU1_TAG_FOLLOW 0
#define IPU1_TAG_QWC 1
#define IPU1_TAG_ADDR 2
#define IPU1_TAG_NONE 3
//
// Bitfield Structures
//
@@ -102,10 +78,6 @@ struct tIPU_BP {
}
};
#ifdef _WIN32
//#pragma pack()
#endif
union tIPU_CMD_IDEC
{
struct
@@ -178,47 +150,6 @@ union tIPU_CMD_CSC
void log_from_RGB32() const;
};
union tIPU_DMA
{
struct
{
bool GIFSTALL : 1;
bool TIE0 :1;
bool TIE1 : 1;
bool ACTV1 : 1;
bool DOTIE1 : 1;
bool FIREINT0 : 1;
bool FIREINT1 : 1;
bool VIFSTALL : 1;
bool SIFSTALL : 1;
};
u32 _u32;
tIPU_DMA( u32 val ){ _u32 = val; }
bool test(u32 flags) const { return !!(_u32 & flags); }
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const
{
wxString temp(L"g_nDMATransfer[");
if (GIFSTALL) temp += L" GIFSTALL ";
if (TIE0) temp += L" TIE0 ";
if (TIE1) temp += L" TIE1 ";
if (ACTV1) temp += L" ACTV1 ";
if (DOTIE1) temp += L" DOTIE1 ";
if (FIREINT0) temp += L" FIREINT0 ";
if (FIREINT1) temp += L" FIREINT1 ";
if (VIFSTALL) temp += L" VIFSTALL ";
if (SIFSTALL) temp += L" SIFSTALL ";
temp += L"]";
return temp;
}
};
enum SCE_IPU
{
SCE_IPU_BCLR = 0x0
@@ -273,14 +204,9 @@ struct tIPU_cmd
extern tIPU_cmd ipu_cmd;
extern int coded_block_pattern;
extern IPUStatus IPU1Status;
extern tIPU_DMA g_nDMATransfer;
extern int ipuInit();
extern void ipuReset();
extern void ipuShutdown();
extern int ipuFreeze(gzFile f, int Mode);
extern bool ipuCanFreeze();
extern u32 ipuRead32(u32 mem);
extern u64 ipuRead64(u32 mem);
@@ -290,13 +216,6 @@ extern bool ipuWrite64(u32 mem,u64 value);
extern void IPUCMD_WRITE(u32 val);
extern void ipuSoftReset();
extern void IPUProcessInterrupt();
extern void ipu0Interrupt();
extern void ipu1Interrupt();
extern void dmaIPU0();
extern void dmaIPU1();
extern int IPU0dma();
extern int IPU1dma();
extern u16 __fastcall FillInternalBuffer(u32 * pointer, u32 advance, u32 size);
extern u8 __fastcall getBits128(u8 *address, u32 advance);
+3 -7
View File
@@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "Common.h"
#include "IPU.h"
#include "IPU/IPUdma.h"
#include "mpeg2lib/Mpeg.h"
@@ -204,13 +205,8 @@ void __fastcall WriteFIFO_IPUin(const mem128_t* value)
IPU_LOG( "WriteFIFO/IPUin <- %ls", value->ToString().c_str() );
//committing every 16 bytes
while( ipu_fifo.in.write((u32*)value, 1) == 0 )
if( ipu_fifo.in.write((u32*)value, 1) == 0 )
{
// Legacy code from an older thread-based IPU. Current IPU is fixed to always
// return non-zero from the above write function; but we'll leave this in place
// for now in case we change our minds (again) and re-add threading. --air
Console.WriteLn("IPU sleeping");
Threading::Timeslice();
IPUProcessInterrupt();
}
}
File diff suppressed because it is too large Load Diff
+71
View File
@@ -0,0 +1,71 @@
struct IPUStatus {
bool InProgress;
u8 DMAMode;
bool DMAFinished;
bool IRQTriggered;
u8 TagFollow;
u32 TagAddr;
bool stalled;
u8 ChainMode;
u32 NextMem;
};
#define DMA_MODE_NORMAL 0
#define DMA_MODE_CHAIN 1
#define IPU1_TAG_FOLLOW 0
#define IPU1_TAG_QWC 1
#define IPU1_TAG_ADDR 2
#define IPU1_TAG_NONE 3
union tIPU_DMA
{
struct
{
bool GIFSTALL : 1;
bool TIE0 :1;
bool TIE1 : 1;
bool ACTV1 : 1;
bool DOTIE1 : 1;
bool FIREINT0 : 1;
bool FIREINT1 : 1;
bool VIFSTALL : 1;
bool SIFSTALL : 1;
};
u32 _u32;
tIPU_DMA( u32 val ){ _u32 = val; }
tIPU_DMA() { }
bool test(u32 flags) const { return !!(_u32 & flags); }
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const
{
wxString temp(L"g_nDMATransfer[");
if (GIFSTALL) temp += L" GIFSTALL ";
if (TIE0) temp += L" TIE0 ";
if (TIE1) temp += L" TIE1 ";
if (ACTV1) temp += L" ACTV1 ";
if (DOTIE1) temp += L" DOTIE1 ";
if (FIREINT0) temp += L" FIREINT0 ";
if (FIREINT1) temp += L" FIREINT1 ";
if (VIFSTALL) temp += L" VIFSTALL ";
if (SIFSTALL) temp += L" SIFSTALL ";
temp += L"]";
return temp;
}
};
extern void ipu0Interrupt();
extern void ipu1Interrupt();
extern void dmaIPU0();
extern void dmaIPU1();
extern int IPU0dma();
extern int IPU1dma();
extern void ipuDmaReset();
+2
View File
@@ -294,6 +294,8 @@
<Unit filename="../IPU/IPU.h" />
<Unit filename="../IPU/IPU_Fifo.cpp" />
<Unit filename="../IPU/IPU_Fifo.h" />
<Unit filename="../IPU/IPUdma.cpp" />
<Unit filename="../IPU/IPUdma.h" />
<Unit filename="../IPU/mpeg2lib/Idct.cpp" />
<Unit filename="../IPU/mpeg2lib/Mpeg.cpp" />
<Unit filename="../IPU/mpeg2lib/Mpeg.h" />
+3
View File
@@ -26,6 +26,7 @@
#include "R5900Exceptions.h"
#include "Hardware.h"
#include "IPU/IPUdma.h"
#include "Elfheader.h"
#include "CDVD/CDVD.h"
@@ -287,6 +288,8 @@ static __fi void TESTINT( u8 n, void (*callback)() )
cpuSetNextBranch( cpuRegs.sCycle[n], cpuRegs.eCycle[n] );
}
// [TODO] move this function to LegacyDmac.cpp, and remove most of the DMAC-related headers from
// being included into R5900.cpp.
static __fi void _cpuTestInterrupts()
{
if (!dmacRegs.ctrl.DMAE || (psHu8(DMAC_ENABLER+2) & 1))
+1
View File
@@ -194,6 +194,7 @@ void SaveStateBase::FreezeRegisters()
vif1Freeze();
sifFreeze();
ipuFreeze();
ipuDmaFreeze();
gifFreeze();
sprFreeze();
+2 -1
View File
@@ -24,7 +24,7 @@
// the lower 16 bit value. IF the change is breaking of all compatibility with old
// states, increment the upper 16 bit value, and clear the lower 16 bits to 0.
static const u32 g_SaveVersion = 0x8b480000;
static const u32 g_SaveVersion = 0x8b490000;
// this function is meant to be used in the place of GSfreeze, and provides a safe layer
// between the GS saving function and the MTGS's needs. :)
@@ -214,6 +214,7 @@ protected:
#endif
void sifFreeze();
void ipuFreeze();
void ipuDmaFreeze();
void gifFreeze();
void sprFreeze();
+1
View File
@@ -18,6 +18,7 @@
#include "Common.h"
#include "Hardware.h"
#include "IPU/IPUdma.h"
#include "ps2/HwInternal.h"
bool DMACh::transfer(const char *s, tDMA_TAG* ptag)
@@ -1330,6 +1330,14 @@
RelativePath="..\..\Ipu\IPU_Fifo.h"
>
</File>
<File
RelativePath="..\..\IPU\IPUdma.cpp"
>
</File>
<File
RelativePath="..\..\IPU\IPUdma.h"
>
</File>
<File
RelativePath="..\..\Ipu\yuv2rgb.cpp"
>