mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-11 06:05:21 -05:00
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:
parent
973d7a9440
commit
d1a3a3e148
1 changed files with 17 additions and 7 deletions
|
|
@ -424,8 +424,18 @@ extern void ata_flush(void)
|
||||||
|
|
||||||
static int check_registers(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. */
|
||||||
return -1;
|
/* 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_NSECTOR = 0xa5;
|
||||||
ATA_SECTOR = 0x5a;
|
ATA_SECTOR = 0x5a;
|
||||||
|
|
@ -797,14 +807,14 @@ unsigned short* ata_get_identify(void)
|
||||||
|
|
||||||
int ata_init(void)
|
int ata_init(void)
|
||||||
{
|
{
|
||||||
mutex_init(&ata_mtx);
|
mutex_init(&ata_mtx);
|
||||||
|
|
||||||
led(false);
|
led(false);
|
||||||
|
|
||||||
/* Port A setup */
|
/* Port A setup */
|
||||||
PAIOR |= 0x0200; /* output for ATA reset */
|
PAIOR |= 0x0200; /* output for ATA reset */
|
||||||
PADR |= 0x0200; /* release ATA reset */
|
PADR |= 0x0200; /* release ATA reset */
|
||||||
PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
|
PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
|
||||||
|
|
||||||
ata_enable(true);
|
ata_enable(true);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue