fix moar bugs, get furtherer (add support for SDHC addressing)

This commit is contained in:
Arisotura 2019-06-19 15:54:07 +02:00
parent 6e5879f8bb
commit 2a60fad0a5
2 changed files with 12 additions and 3 deletions

View File

@ -532,6 +532,11 @@ void DSi_MMCStorage::SendCMD(u8 cmd, u32 param)
case 18: // read multiple blocks case 18: // read multiple blocks
printf("READ_MULTIPLE_BLOCKS addr=%08X size=%08X\n", param, BlockSize); printf("READ_MULTIPLE_BLOCKS addr=%08X size=%08X\n", param, BlockSize);
RWAddress = param; RWAddress = param;
if (OCR & (1<<30))
{
RWAddress <<= 9;
BlockSize = 512;
}
RWCommand = 18; RWCommand = 18;
Host->SendResponse(CSR, true); Host->SendResponse(CSR, true);
ReadBlock(RWAddress); ReadBlock(RWAddress);
@ -563,6 +568,10 @@ void DSi_MMCStorage::SendACMD(u8 cmd, u32 param)
return; return;
case 41: // set operating conditions case 41: // set operating conditions
// CHECKME:
// DSi boot2 sets this to 0x40100000 (hardcoded)
// then has two codepaths depending on whether bit30 did get set
// is it settable at all on the MMC?
OCR &= 0xBF000000; OCR &= 0xBF000000;
OCR |= (param & 0x40FFFFFF); OCR |= (param & 0x40FFFFFF);
Host->SendResponse(OCR, true); Host->SendResponse(OCR, true);
@ -588,7 +597,7 @@ void DSi_MMCStorage::ContinueTransfer()
RWAddress += BlockSize; RWAddress += BlockSize;
} }
void DSi_MMCStorage::ReadBlock(u32 addr) void DSi_MMCStorage::ReadBlock(u64 addr)
{ {
if (!File) return; if (!File) return;

View File

@ -120,12 +120,12 @@ private:
u8 SSR[64]; u8 SSR[64];
u32 BlockSize; u32 BlockSize;
u32 RWAddress; u64 RWAddress;
u32 RWCommand; u32 RWCommand;
void SetState(u32 state) { CSR &= ~(0xF << 9); CSR |= (state << 9); } void SetState(u32 state) { CSR &= ~(0xF << 9); CSR |= (state << 9); }
void ReadBlock(u32 addr); void ReadBlock(u64 addr);
}; };
#endif // DSI_SD_H #endif // DSI_SD_H