plug it to the SD/MMC FIFO.

now half the shit is done.
This commit is contained in:
Arisotura 2019-06-18 23:10:55 +02:00
parent b1ed835ae9
commit f0131cfac9
2 changed files with 51 additions and 2 deletions

View File

@ -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;

View File

@ -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)