When starting from flash, we have to wait for the disk to get ready. (Quite a new situation ;-)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3803 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2003-07-03 00:02:15 +00:00
parent 973d7a9440
commit d1a3a3e148

View file

@ -424,9 +424,19 @@ extern void ata_flush(void)
static int check_registers(void)
{
if ( ATA_STATUS & STATUS_BSY )
/* 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 -1;
sleep(HZ/10);
time += HZ/10;
};
ATA_NSECTOR = 0xa5;
ATA_SECTOR = 0x5a;
ATA_LCYL = 0xaa;