mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
better place and method for the spinup wait code, still I'd welcome comments on this
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3815 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f937912b5c
commit
adef8fb17e
1 changed files with 14 additions and 11 deletions
|
|
@ -424,19 +424,9 @@ extern void ata_flush(void)
|
||||||
|
|
||||||
static int check_registers(void)
|
static int check_registers(void)
|
||||||
{
|
{
|
||||||
/* When starting from Flash, the disk is not yet ready when we get here. */
|
if ( ATA_STATUS & STATUS_BSY )
|
||||||
/* Crude first fix is to block and poll here for a while,
|
|
||||||
can we do better? */
|
|
||||||
int time = 0;
|
|
||||||
while ((ATA_STATUS & STATUS_BSY))
|
|
||||||
{
|
|
||||||
if (time >= HZ*10) /* timeout, disk is not coming up */
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sleep(HZ/10);
|
|
||||||
time += HZ/10;
|
|
||||||
};
|
|
||||||
|
|
||||||
ATA_NSECTOR = 0xa5;
|
ATA_NSECTOR = 0xa5;
|
||||||
ATA_SECTOR = 0x5a;
|
ATA_SECTOR = 0x5a;
|
||||||
ATA_LCYL = 0xaa;
|
ATA_LCYL = 0xaa;
|
||||||
|
|
@ -819,6 +809,19 @@ int ata_init(void)
|
||||||
ata_enable(true);
|
ata_enable(true);
|
||||||
|
|
||||||
if ( !initialized ) {
|
if ( !initialized ) {
|
||||||
|
/* When starting from Flash, the disk is not yet ready when we get here. */
|
||||||
|
/* Crude first fix is to block and poll here for a while,
|
||||||
|
can we do better? */
|
||||||
|
int time = 0;
|
||||||
|
while ((ATA_STATUS & STATUS_BSY))
|
||||||
|
{
|
||||||
|
if (time >= HZ*10) /* timeout, disk is not coming up */
|
||||||
|
return -6;
|
||||||
|
|
||||||
|
sleep(HZ/10);
|
||||||
|
time += HZ/10;
|
||||||
|
};
|
||||||
|
|
||||||
if (master_slave_detect())
|
if (master_slave_detect())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue