aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-06-19 15:54:07 +0200
committerArisotura <thetotalworm@gmail.com>2019-06-19 15:54:07 +0200
commit2a60fad0a51833a02e5e1c6dd7f59b4117676831 (patch)
treed69c356ef45c2c79ecb3d0f3b1aeb01303588a7b /src
parent6e5879f8bbf6bf85791b03f36675aa7991ae4771 (diff)
fix moar bugs, get furtherer (add support for SDHC addressing)
Diffstat (limited to 'src')
-rw-r--r--src/DSi_SD.cpp11
-rw-r--r--src/DSi_SD.h4
2 files changed, 12 insertions, 3 deletions
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp
index 4a7fd2e..fed26b1 100644
--- a/src/DSi_SD.cpp
+++ b/src/DSi_SD.cpp
@@ -532,6 +532,11 @@ void DSi_MMCStorage::SendCMD(u8 cmd, u32 param)
case 18: // read multiple blocks
printf("READ_MULTIPLE_BLOCKS addr=%08X size=%08X\n", param, BlockSize);
RWAddress = param;
+ if (OCR & (1<<30))
+ {
+ RWAddress <<= 9;
+ BlockSize = 512;
+ }
RWCommand = 18;
Host->SendResponse(CSR, true);
ReadBlock(RWAddress);
@@ -563,6 +568,10 @@ void DSi_MMCStorage::SendACMD(u8 cmd, u32 param)
return;
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 |= (param & 0x40FFFFFF);
Host->SendResponse(OCR, true);
@@ -588,7 +597,7 @@ void DSi_MMCStorage::ContinueTransfer()
RWAddress += BlockSize;
}
-void DSi_MMCStorage::ReadBlock(u32 addr)
+void DSi_MMCStorage::ReadBlock(u64 addr)
{
if (!File) return;
diff --git a/src/DSi_SD.h b/src/DSi_SD.h
index 57da7df..3c76872 100644
--- a/src/DSi_SD.h
+++ b/src/DSi_SD.h
@@ -120,12 +120,12 @@ private:
u8 SSR[64];
u32 BlockSize;
- u32 RWAddress;
+ u64 RWAddress;
u32 RWCommand;
void SetState(u32 state) { CSR &= ~(0xF << 9); CSR |= (state << 9); }
- void ReadBlock(u32 addr);
+ void ReadBlock(u64 addr);
};
#endif // DSI_SD_H