add NDMA start mode 0x0A (AES input FIFO)

This commit is contained in:
Arisotura 2019-06-19 19:19:51 +02:00
parent f4c7f5c96b
commit dcae9788e5
3 changed files with 27 additions and 4 deletions

View File

@ -191,6 +191,8 @@ void WriteCnt(u32 val)
{
// transfer start (checkme)
RemBlocks = BlkCnt >> 16;
DSi::CheckNDMAs(1, 0x2A);
}
printf("AES CNT: %08X / mode=%d inDMA=%d outDMA=%d blocks=%d\n",
@ -204,7 +206,8 @@ void WriteBlkCnt(u32 val)
u32 ReadOutputFIFO()
{
return OutputFIFO->Read();
u32 ret = OutputFIFO->Read();
return ret;
}
void WriteInputFIFO(u32 val)
@ -234,17 +237,30 @@ void WriteInputFIFO(u32 val)
if (OutputFIFO->Level() >= OutputDMASize)
{
// trigger DMA
// trigger output DMA
DSi::CheckNDMAs(1, 0x2B);
}
// TODO: DMA the other way around
if (RemBlocks == 0)
{
Cnt &= ~(1<<31);
if (Cnt & (1<<30)) NDS::SetIRQ2(NDS::IRQ2_DSi_AES);
DSi::StopNDMAs(1, 0x2A);
DSi::StopNDMAs(1, 0x2B);
}
else
{
CheckInputDMA();
}
}
void CheckInputDMA()
{
if (InputFIFO->Level() < InputDMASize)
{
// trigger input DMA
DSi::CheckNDMAs(1, 0x2A);
}
}

View File

@ -36,6 +36,7 @@ void WriteBlkCnt(u32 val);
u32 ReadOutputFIFO();
void WriteInputFIFO(u32 val);
void CheckInputDMA();
void WriteIV(u32 offset, u32 val, u32 mask);
void WriteMAC(u32 offset, u32 val, u32 mask);

View File

@ -21,6 +21,7 @@
#include "DSi.h"
#include "DSi_NDMA.h"
#include "GPU.h"
#include "DSi_AES.h"
@ -100,7 +101,7 @@ void DSi_NDMA::WriteCnt(u32 val)
Start();
if (StartMode != 0x10 && StartMode != 0x30 &&
StartMode != 0x2B)
StartMode != 0x2A && StartMode != 0x2B)
printf("UNIMPLEMENTED ARM%d NDMA%d START MODE %02X, %08X->%08X\n", CPU?7:9, Num, StartMode, SrcAddr, DstAddr);
}
}
@ -290,6 +291,7 @@ void DSi_NDMA::Run7()
CurDstAddr += DstAddrInc<<2;
IterCount--;
RemCount--;
TotalRemCount--;
if (NDS::ARM7Timestamp >= NDS::ARM7Target) break;
}
@ -303,6 +305,8 @@ void DSi_NDMA::Run7()
{
Running = 0;
NDS::ResumeCPU(1, 1<<(Num+4));
DSi_AES::CheckInputDMA();
}
return;
@ -325,4 +329,6 @@ void DSi_NDMA::Run7()
Running = 0;
InProgress = false;
NDS::ResumeCPU(1, 1<<(Num+4));
DSi_AES::CheckInputDMA();
}