Sansa AMS storage driver: restart bank selection if data transfer failed, and precise a comment about retry variable

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21248 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2009-06-11 17:28:24 +00:00
parent 7572141d42
commit 460a1c4497

View file

@ -571,6 +571,10 @@ static int sd_select_bank(signed char bank)
unsigned char card_data[512];
int ret;
do {
/* The ISR will set this to true if an error occurred */
retry = false;
ret = sd_wait_for_state(INTERNAL_AS3525, SD_TRAN);
if (ret < 0)
return ret - 2;
@ -615,6 +619,7 @@ static int sd_select_bank(signed char bank)
ret = sd_wait_for_state(INTERNAL_AS3525, SD_TRAN);
if (ret < 0)
return ret - 4;
} while(retry);
card_info[INTERNAL_AS3525].current_bank = (bank == -1) ? 0 : bank;
@ -670,7 +675,7 @@ static int sd_transfer_sectors(IF_MV2(int drive,) unsigned long start,
write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK;
unsigned long bank_start = start;
/* Interrupt handler might set this to true during transfer */
/* The ISR will set this to true if an error occurred */
retry = false;
/* Only switch banks for internal storage */