Whoops missed a file. Another small refactoring too.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2577 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2010-02-08 16:35:18 +00:00
parent 822e2a8166
commit 6730abd967
4 changed files with 45 additions and 39 deletions

View File

@ -224,14 +224,20 @@ void psxDma10(u32 madr, u32 bcr, u32 chcr)
// Local Declarations
// in IopSio2.cpp
extern s32 CALLBACK sio2DmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
extern s32 CALLBACK sio2DmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
extern s32 CALLBACK sio2DmaStart(s32 channel, u32 madr, u32 bcr, u32 chcr);
extern s32 CALLBACK sio2DmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
extern s32 CALLBACK sio2DmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
extern void CALLBACK sio2DmaInterrupt(s32 channel);
// implemented below
s32 CALLBACK errDmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
s32 CALLBACK errDmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
// pointer types
typedef s32 (CALLBACK * DmaHandler)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
typedef void (CALLBACK * DmaIHandler)(s32 channel);
typedef s32 (CALLBACK * DmaSHandler)(s32 channel, u32 madr, u32 bcr, u32 chcr);
// constants
struct DmaHandlerInfo
{
@ -243,6 +249,7 @@ struct DmaHandlerInfo
DmaHandler Read;
DmaHandler Write;
DmaIHandler Interrupt;
DmaSHandler Start;
__forceinline u32& REG_MADR(void) const { return psxHu32(DmacRegisterBase + 0x0); }
__forceinline u32& REG_BCR(void) const { return psxHu32(DmacRegisterBase + 0x4); }
@ -308,8 +315,8 @@ const DmaHandlerInfo IopDmaHandlers[DMA_CHANNEL_MAX] =
{"Sif1", _D__}, //10: SIF1
#endif
#ifdef ENABLE_NEW_IOPDMA_SIO
{"Sio2 (writes)", _E_W, CHANNEL_BASE2(4), errDmaRead, sio2DmaWrite, sio2DmaInterrupt}, //11: Sio2
{"Sio2 (reads)", _ER_, CHANNEL_BASE2(5), sio2DmaRead, errDmaWrite, sio2DmaInterrupt}, //12: Sio2
{"Sio2 (writes)", _E_W, CHANNEL_BASE2(4), errDmaRead, sio2DmaWrite, sio2DmaInterrupt, sio2DmaStart}, //11: Sio2
{"Sio2 (reads)", _ER_, CHANNEL_BASE2(5), sio2DmaRead, errDmaWrite, sio2DmaInterrupt, sio2DmaStart}, //12: Sio2
#else
{"Sio2 (writes)", _D__}, //11: Sio2
{"Sio2 (reads)", _D__}, //12: Sio2
@ -377,11 +384,18 @@ void IopDmaStart(int channel)
}
}
// hack!
extern void sio2DmaSetBs(int bs);
if(channel==11 || channel==12)
sio2DmaSetBs(bcr_size);
if(IopDmaHandlers[channel].Start)
{
int ret = IopDmaHandlers[channel].Start(channel,
IopDmaHandlers[channel].REG_MADR(),
IopDmaHandlers[channel].REG_BCR(),
IopDmaHandlers[channel].REG_CHCR());
if(ret < 0)
{
IopDmaHandlers[channel].REG_CHCR() &= ~DMA_CTRL_ACTIVE;
return;
}
}
//Console.WriteLn(Color_StrongOrange,"Starting NewDMA ch=%d, size=%d(0x%08x), dir=%d", channel, size, bcr, chcr&DMA_CTRL_DIRECTION);

View File

@ -22,9 +22,6 @@
#ifdef ENABLE_NEW_IOPDMA
typedef s32(CALLBACK * DmaHandler)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
typedef void (CALLBACK * DmaIHandler)(s32 channel);
// unused for now
class DmaBcrReg
{

View File

@ -212,6 +212,13 @@ void SaveStateBase::sio2Freeze()
/////////////////////////////////////////////////
#ifdef ENABLE_NEW_IOPDMA
static int dmaBlockSize = 0x24;
s32 CALLBACK sio2DmaStart(s32 channel, u32 madr, u32 bcr, u32 chcr)
{
dmaBlockSize = bcr & 0xFFFF;
return 0; // continue
}
s32 CALLBACK sio2DmaRead(s32 channel, u32* tdata, u32 bytesLeft, u32* bytesProcessed)
{
#ifdef ENABLE_NEW_IOPDMA_SIO
@ -244,12 +251,6 @@ s32 CALLBACK sio2DmaRead(s32 channel, u32* tdata, u32 bytesLeft, u32* bytesProce
return 0;
}
int sioBs = 0x24;
void sio2DmaSetBs(int bs)
{
sioBs = bs;
}
s32 CALLBACK sio2DmaWrite(s32 channel, u32* tdata, u32 bytesLeft, u32* bytesProcessed)
{
#ifdef ENABLE_NEW_IOPDMA_SIO
@ -265,18 +266,8 @@ s32 CALLBACK sio2DmaWrite(s32 channel, u32* tdata, u32 bytesLeft, u32* bytesProc
int written = 0;
// FIXME: temp code, might need to implement properly
int bs = sioBs;
int bc = bytesLeft / (bs*4);
int ts = bc * bs * 4;
// HACK!
if(ts != bytesLeft)
{
bs = bytesLeft;
bc = 1;
}
int bs = dmaBlockSize * 4;
int bc = bytesLeft / bs;
//assert(ts == bytesLeft);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1253"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="pcsx2"
ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
RootNamespace="pcsx2"
@ -784,6 +784,10 @@
RelativePath="..\..\Sif.cpp"
>
</File>
<File
RelativePath="..\..\Sif.h"
>
</File>
<File
RelativePath="..\..\Sif0.cpp"
>
@ -792,10 +796,6 @@
RelativePath="..\..\Sif1.cpp"
>
</File>
<File
RelativePath="..\..\Sif.h"
>
</File>
<File
RelativePath="..\..\Sifcmd.h"
>
@ -1102,6 +1102,10 @@
RelativePath="..\..\IopDma.h"
>
</File>
<File
RelativePath="..\..\IopIrq.cpp"
>
</File>
<File
RelativePath="..\..\IopMem.cpp"
>
@ -1278,6 +1282,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Ipu\IPU.h"
>
</File>
<File
RelativePath="..\..\Ipu\IPU_Fifo.cpp"
>
@ -1306,10 +1314,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Ipu\IPU.h"
>
</File>
<File
RelativePath="..\..\Ipu\IPU_Fifo.h"
>