aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-06-19 14:44:00 +0200
committerArisotura <thetotalworm@gmail.com>2019-06-19 14:44:00 +0200
commit78b28f6a5cd40c77f63acc0fbd95135c45187e2a (patch)
tree8abef5eb31d7f81c9720f87924ca8e6d3078126c
parent81dde71ebac19cf9a68dd7a2a41561cbcbfacc68 (diff)
fix bug with SD reads going a bit too far
-rw-r--r--src/DSi_SD.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp
index bb3c4a4..9775ca8 100644
--- a/src/DSi_SD.cpp
+++ b/src/DSi_SD.cpp
@@ -160,12 +160,12 @@ void DSi_SDHost::FinishSend(u32 param)
host->ClearIRQ(25);
host->SetIRQ(24);
- if (param & 0x2) host->SetIRQ(2);
+ //if (param & 0x2) host->SetIRQ(2);
}
void DSi_SDHost::SendData(u8* data, u32 len)
{
- printf("%s: data RX, len=%d, blkcnt=%d blklen=%d, irq=%08X\n", SD_DESC, len, BlockCount16, BlockLen16, IRQMask);
+ printf("%s: data RX, len=%d, blkcnt=%d (%d) blklen=%d, irq=%08X\n", SD_DESC, len, BlockCount16, BlockCountInternal, BlockLen16, IRQMask);
if (len != BlockLen16) printf("!! BAD BLOCKLEN\n");
bool last = (BlockCountInternal == 0);
@@ -236,7 +236,7 @@ u16 DSi_SDHost::Read(u32 addr)
{
ClearIRQ(24);
- if (BlockCountInternal == 0)
+ if (BlockCountInternal <= 1)
{
printf("%s: data RX complete", SD_DESC);
@@ -251,7 +251,7 @@ u16 DSi_SDHost::Read(u32 addr)
// CHECKME: presumably IRQ2 should not trigger here, but rather
// when the data transfer is done
//SetIRQ(0);
- //SetIRQ(2);
+ SetIRQ(2);
}
else
{
@@ -300,7 +300,7 @@ u32 DSi_SDHost::ReadFIFO32()
{
ClearIRQ(24);
- if (BlockCountInternal == 0)
+ if (BlockCountInternal <= 1)
{
printf("%s: data32 RX complete", SD_DESC);
@@ -315,7 +315,7 @@ u32 DSi_SDHost::ReadFIFO32()
// CHECKME: presumably IRQ2 should not trigger here, but rather
// when the data transfer is done
//SetIRQ(0);
- //SetIRQ(2);
+ SetIRQ(2);
}
else
{