forked from len0rd/rockbox
wait_for_rdy() now actually waits for RDY
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2057 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
53ee298d4a
commit
5d154f9723
1 changed files with 17 additions and 1 deletions
|
|
@ -122,9 +122,25 @@ static int wait_for_bsy(void)
|
||||||
static int wait_for_rdy(void) __attribute__ ((section (".icode")));
|
static int wait_for_rdy(void) __attribute__ ((section (".icode")));
|
||||||
static int wait_for_rdy(void)
|
static int wait_for_rdy(void)
|
||||||
{
|
{
|
||||||
|
int timeout;
|
||||||
|
|
||||||
if (!wait_for_bsy())
|
if (!wait_for_bsy())
|
||||||
return 0;
|
return 0;
|
||||||
return ATA_ALT_STATUS & STATUS_RDY;
|
|
||||||
|
timeout = current_tick + HZ*4;
|
||||||
|
|
||||||
|
while (TIME_BEFORE(current_tick, timeout) &&
|
||||||
|
!(ATA_ALT_STATUS & STATUS_RDY))
|
||||||
|
yield();
|
||||||
|
|
||||||
|
if (TIME_BEFORE(current_tick, timeout))
|
||||||
|
{
|
||||||
|
return STATUS_RDY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0; /* timeout */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wait_for_start_of_transfer(void) __attribute__ ((section (".icode")));
|
static int wait_for_start_of_transfer(void) __attribute__ ((section (".icode")));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue