forked from len0rd/rockbox
as3525*: sd_wait_for_state() is only used for waiting to SD_TRAN state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26251 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8d1ec38a1d
commit
13f159df57
2 changed files with 12 additions and 12 deletions
|
@ -100,7 +100,7 @@ static const int pl180_base[NUM_DRIVES] = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sd_wait_for_state(const int drive, unsigned int state);
|
static int sd_wait_for_tran_state(const int drive);
|
||||||
static int sd_select_bank(signed char bank);
|
static int sd_select_bank(signed char bank);
|
||||||
static int sd_init_card(const int drive);
|
static int sd_init_card(const int drive);
|
||||||
static void init_pl180_controller(const int drive);
|
static void init_pl180_controller(const int drive);
|
||||||
|
@ -321,7 +321,7 @@ static int sd_init_card(const int drive)
|
||||||
return -5;
|
return -5;
|
||||||
mci_delay();
|
mci_delay();
|
||||||
|
|
||||||
if(sd_wait_for_state(drive, SD_TRAN))
|
if(sd_wait_for_tran_state(drive))
|
||||||
return -6;
|
return -6;
|
||||||
/* CMD6 */
|
/* CMD6 */
|
||||||
if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL))
|
if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL))
|
||||||
|
@ -570,7 +570,7 @@ bool sd_present(IF_MD_NONVOID(int drive))
|
||||||
}
|
}
|
||||||
#endif /* HAVE_HOTSWAP */
|
#endif /* HAVE_HOTSWAP */
|
||||||
|
|
||||||
static int sd_wait_for_state(const int drive, unsigned int state)
|
static int sd_wait_for_tran_state(const int drive)
|
||||||
{
|
{
|
||||||
unsigned long response = 0;
|
unsigned long response = 0;
|
||||||
unsigned int timeout = current_tick + HZ;
|
unsigned int timeout = current_tick + HZ;
|
||||||
|
@ -581,7 +581,7 @@ static int sd_wait_for_state(const int drive, unsigned int state)
|
||||||
MCI_RESP|MCI_ARG, &response))
|
MCI_RESP|MCI_ARG, &response))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (((response >> 9) & 0xf) == state)
|
if (((response >> 9) & 0xf) == SD_TRAN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(TIME_AFTER(current_tick, timeout))
|
if(TIME_AFTER(current_tick, timeout))
|
||||||
|
@ -605,7 +605,7 @@ static int sd_select_bank(signed char bank)
|
||||||
panicf("SD bank %d error : 0x%x", bank,
|
panicf("SD bank %d error : 0x%x", bank,
|
||||||
transfer_error[INTERNAL_AS3525]);
|
transfer_error[INTERNAL_AS3525]);
|
||||||
|
|
||||||
ret = sd_wait_for_state(INTERNAL_AS3525, SD_TRAN);
|
ret = sd_wait_for_tran_state(INTERNAL_AS3525);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret - 2;
|
return ret - 2;
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||||
if(write)
|
if(write)
|
||||||
memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE);
|
memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE);
|
||||||
|
|
||||||
ret = sd_wait_for_state(drive, SD_TRAN);
|
ret = sd_wait_for_tran_state(drive);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ret -= 2*20;
|
ret -= 2*20;
|
||||||
|
|
|
@ -328,7 +328,7 @@ static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attr
|
||||||
static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);
|
static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]);
|
||||||
|
|
||||||
static void init_controller(void);
|
static void init_controller(void);
|
||||||
static int sd_wait_for_state(const int drive, unsigned int state);
|
static int sd_wait_for_tran_state(const int drive);
|
||||||
|
|
||||||
static tCardInfo card_info[NUM_DRIVES];
|
static tCardInfo card_info[NUM_DRIVES];
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ static int sd_init_card(const int drive)
|
||||||
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
|
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
|
||||||
return -7;
|
return -7;
|
||||||
|
|
||||||
if(sd_wait_for_state(drive, SD_TRAN))
|
if(sd_wait_for_tran_state(drive))
|
||||||
return -8;
|
return -8;
|
||||||
|
|
||||||
/* CMD6 */
|
/* CMD6 */
|
||||||
|
@ -544,7 +544,7 @@ static int sd_init_card(const int drive)
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
/* Switch to to 4 bit widebus mode */
|
/* Switch to to 4 bit widebus mode */
|
||||||
if(sd_wait_for_state(drive, SD_TRAN) < 0)
|
if(sd_wait_for_tran_state(drive) < 0)
|
||||||
return -13;
|
return -13;
|
||||||
/* CMD55 */ /* Response is requested due to timing issue */
|
/* CMD55 */ /* Response is requested due to timing issue */
|
||||||
if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, &response))
|
if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, &response))
|
||||||
|
@ -756,7 +756,7 @@ int sd_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sd_wait_for_state(const int drive, unsigned int state)
|
static int sd_wait_for_tran_state(const int drive)
|
||||||
{
|
{
|
||||||
unsigned long response;
|
unsigned long response;
|
||||||
unsigned int timeout = 100; /* ticks */
|
unsigned int timeout = 100; /* ticks */
|
||||||
|
@ -768,7 +768,7 @@ static int sd_wait_for_state(const int drive, unsigned int state)
|
||||||
|
|
||||||
while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response)));
|
while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response)));
|
||||||
|
|
||||||
if (((response >> 9) & 0xf) == state)
|
if (((response >> 9) & 0xf) == SD_TRAN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(TIME_AFTER(current_tick, t + timeout))
|
if(TIME_AFTER(current_tick, t + timeout))
|
||||||
|
@ -846,7 +846,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||||
|
|
||||||
MCI_BYTCNT = transfer * SD_BLOCK_SIZE;
|
MCI_BYTCNT = transfer * SD_BLOCK_SIZE;
|
||||||
|
|
||||||
ret = sd_wait_for_state(drive, SD_TRAN);
|
ret = sd_wait_for_tran_state(drive);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
static const char *st[9] = {
|
static const char *st[9] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue