forked from len0rd/rockbox
sd-as3525v2 Remove post transfer wait for state call and move pre transfer wait for state call inside the transfer loop.
We don't need the post transfer call this way. We check on TRAN state before each partial transfer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25282 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6357c5a085
commit
48b8080330
1 changed files with 14 additions and 20 deletions
|
|
@ -744,19 +744,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
last_disk_activity = current_tick;
|
last_disk_activity = current_tick;
|
||||||
ret = sd_wait_for_state(drive, SD_TRAN);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
static const char *st[9] = {
|
|
||||||
"IDLE", "RDY", "IDENT", "STBY", "TRAN", "DATA", "RCV", "PRG", "DIS"
|
|
||||||
};
|
|
||||||
if(ret <= -10)
|
|
||||||
panicf("wait for state failed (%s) %d", st[(-ret / 10) % 9], drive);
|
|
||||||
else
|
|
||||||
panicf("wait for state failed");
|
|
||||||
goto sd_transfer_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
dma_retain();
|
dma_retain();
|
||||||
|
|
||||||
const int cmd = write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK;
|
const int cmd = write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK;
|
||||||
|
|
@ -781,6 +768,20 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||||
while(MCI_CTRL & (FIFO_RESET|DMA_RESET))
|
while(MCI_CTRL & (FIFO_RESET|DMA_RESET))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
ret = sd_wait_for_state(drive, SD_TRAN);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
static const char *st[9] = {
|
||||||
|
"IDLE", "RDY", "IDENT", "STBY", "TRAN", "DATA", "RCV",
|
||||||
|
"PRG", "DIS"};
|
||||||
|
if(ret <= -10)
|
||||||
|
panicf("wait for TRAN state failed (%s) %d",
|
||||||
|
st[(-ret / 10) % 9], drive);
|
||||||
|
else
|
||||||
|
panicf("wait for state failed");
|
||||||
|
goto sd_transfer_error;
|
||||||
|
}
|
||||||
|
|
||||||
MCI_CTRL |= DMA_ENABLE;
|
MCI_CTRL |= DMA_ENABLE;
|
||||||
MCI_MASK = MCI_INT_CD|MCI_INT_DTO|MCI_INT_DCRC|MCI_INT_DRTO| \
|
MCI_MASK = MCI_INT_CD|MCI_INT_DTO|MCI_INT_DCRC|MCI_INT_DRTO| \
|
||||||
MCI_INT_HTO|MCI_INT_FRUN|MCI_INT_HLE|MCI_INT_SBE|MCI_INT_EBE;
|
MCI_INT_HTO|MCI_INT_FRUN|MCI_INT_HLE|MCI_INT_SBE|MCI_INT_EBE;
|
||||||
|
|
@ -816,13 +817,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||||
goto sd_transfer_error;
|
goto sd_transfer_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_wait_for_state(drive, SD_TRAN);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
panicf(" wait for state TRAN failed (%d)", ret);
|
|
||||||
goto sd_transfer_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!retry)
|
if(!retry)
|
||||||
{
|
{
|
||||||
if(!write)
|
if(!write)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue