aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DSi.cpp4
-rw-r--r--src/DSi_SD.cpp49
2 files changed, 51 insertions, 2 deletions
diff --git a/src/DSi.cpp b/src/DSi.cpp
index e6e3c5a..fc590e1 100644
--- a/src/DSi.cpp
+++ b/src/DSi.cpp
@@ -1101,10 +1101,12 @@ u32 ARM7IORead32(u32 addr)
if (addr >= 0x04004800 && addr < 0x04004A00)
{
+ if (addr == 0x0400490C) return SDMMC->ReadFIFO32();
return SDMMC->Read(addr) | (SDMMC->Read(addr+2) << 16);
}
if (addr >= 0x04004A00 && addr < 0x04004C00)
{
+ if (addr == 0x04004B0C) return SDIO->ReadFIFO32();
return SDIO->Read(addr) | (SDIO->Read(addr+2) << 16);
}
@@ -1184,12 +1186,14 @@ void ARM7IOWrite32(u32 addr, u32 val)
if (addr >= 0x04004800 && addr < 0x04004A00)
{
+ if (addr == 0x0400490C) { SDMMC->WriteFIFO32(val); return; }
SDMMC->Write(addr, val & 0xFFFF);
SDMMC->Write(addr+2, val >> 16);
return;
}
if (addr >= 0x04004A00 && addr < 0x04004C00)
{
+ if (addr == 0x04004B0C) { SDIO->WriteFIFO32(val); return; }
SDIO->Write(addr, val & 0xFFFF);
SDIO->Write(addr+2, val >> 16);
return;
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp
index 2e16140..42b515c 100644
--- a/src/DSi_SD.cpp
+++ b/src/DSi_SD.cpp
@@ -281,8 +281,53 @@ u16 DSi_SDHost::Read(u32 addr)
u32 DSi_SDHost::ReadFIFO32()
{
- //
- return 0;
+ if (DataMode != 1) return 0;
+
+ // TODO: decrement BlockLen????
+
+ u32 f = CurFIFO;
+ if (DataFIFO[f]->IsEmpty())
+ {
+ // TODO
+ return 0;
+ }
+
+ DSi_SDDevice* dev = Ports[PortSelect & 0x1];
+ u32 ret = DataFIFO[f]->Read();
+ ret |= (DataFIFO[f]->Read() << 16);
+
+ if (DataFIFO[f]->IsEmpty())
+ {
+ ClearIRQ(24);
+
+ if (BlockCountInternal == 0)
+ {
+ printf("%s: data32 RX complete", SD_DESC);
+
+ if (StopAction & (1<<8))
+ {
+ printf(", sending CMD12");
+ if (dev) dev->SendCMD(12, 0);
+ }
+
+ printf("\n");
+
+ // CHECKME: presumably IRQ2 should not trigger here, but rather
+ // when the data transfer is done
+ //SetIRQ(0);
+ //SetIRQ(2);
+ }
+ else
+ {
+ BlockCountInternal--;
+
+ if (dev) dev->ContinueTransfer();
+ }
+
+ SetIRQ(25);
+ }
+
+ return ret;
}
void DSi_SDHost::Write(u32 addr, u16 val)