diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-07-02 23:46:39 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-07-02 23:46:39 +0200 |
commit | 851e255b4099904b4784fa7e1c672f03e5ca531b (patch) | |
tree | 8b7d2ef7d3c80bb80e3c833b42abed5f6923d955 /src/DSi_SD.cpp | |
parent | 8c6429095824ce42a354e1def86a45a19a3b1d90 (diff) |
* AES-CCM decrypt
* fix a bunch of bugs
Diffstat (limited to 'src/DSi_SD.cpp')
-rw-r--r-- | src/DSi_SD.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp index 7367eea..93431b5 100644 --- a/src/DSi_SD.cpp +++ b/src/DSi_SD.cpp @@ -185,6 +185,17 @@ void DSi_SDHost::SendData(u8* data, u32 len) NDS::ScheduleEvent(NDS::Event_DSi_SDTransfer, false, 512, FinishSend, param); } +void DSi_SDHost::FinishReceive(u32 param) +{ + DSi_SDHost* host = (param & 0x1) ? DSi::SDIO : DSi::SDMMC; + DSi_SDDevice* dev = host->Ports[host->PortSelect & 0x1]; + + host->ClearIRQ(24); + host->SetIRQ(25); + + if (dev) dev->ContinueTransfer(); +} + void DSi_SDHost::ReceiveData(u8* data, u32 len) { printf("%s: data TX, len=%d, blkcnt=%d (%d) blklen=%d, irq=%08X\n", SD_DESC, len, BlockCount16, BlockCountInternal, BlockLen16, IRQMask); @@ -481,10 +492,12 @@ void DSi_SDHost::WriteFIFO32(u32 val) // we completed one block, send it to the SD card - ClearIRQ(24); - SetIRQ(25); + //ClearIRQ(24); + //SetIRQ(25); - if (dev) dev->ContinueTransfer(); + //if (dev) dev->ContinueTransfer(); + // TODO measure the actual delay!! + NDS::ScheduleEvent(NDS::Event_DSi_SDTransfer, false, 2048, FinishReceive, Num); } @@ -622,10 +635,10 @@ void DSi_MMCStorage::SendCMD(u8 cmd, u32 param) Host->SendResponse(CSR, true); WriteBlock(RWAddress); RWAddress += BlockSize; - SetState(0x06); + SetState(0x04); return; - case 55: // ?? + case 55: // appcmd prefix CSR |= (1<<5); Host->SendResponse(CSR, true); return; |