1
0
Fork 0
forked from len0rd/rockbox

Unconditionally drive HD power control pin for player (doesn't hurt even for very old players). Slight optimization for recorders.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5487 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-12-16 22:29:01 +00:00
parent 78acda25b3
commit 127c363e87

View file

@ -119,30 +119,22 @@ void ide_power_enable(bool on)
if(on) if(on)
{ {
#ifdef ATA_POWER_PLAYERSTYLE #ifdef ATA_POWER_PLAYERSTYLE
if (is_new_player()) or_b(0x10, &PBDRL);
{
or_b(0x10, &PBDRL);
touched = true;
}
#else #else
or_b(0x20, &PADRL); or_b(0x20, &PADRL);
touched = true;
#endif #endif
touched = true;
} }
#endif #endif
#ifdef HAVE_ATA_POWER_OFF #ifdef HAVE_ATA_POWER_OFF
if(!on) if(!on)
{ {
#ifdef ATA_POWER_PLAYERSTYLE #ifdef ATA_POWER_PLAYERSTYLE
if (is_new_player()) and_b(~0x10, &PBDRL);
{
and_b(~0x10, &PBDRL);
touched = true;
}
#else #else
and_b(~0x20, &PADRL); and_b(~0x20, &PADRL);
touched = true;
#endif #endif
touched = true;
} }
#endif #endif
@ -166,20 +158,18 @@ bool ide_powered(void)
{ {
#if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF)
#ifdef ATA_POWER_PLAYERSTYLE #ifdef ATA_POWER_PLAYERSTYLE
if (is_new_player()) /* This is not correct for very old players, since these are unable to
{ * control hd power. However, driving the pin doesn't hurt, because it
if ((PBCR2 & 0x0300) || !(PBIOR & 0x0010)) /* not configured for output */ * is not connected anywhere */
return false; /* would be floating low, disk off */ if ((PBCR2 & 0x0300) || !(PBIORL & 0x10)) /* not configured for output */
else return false; /* would be floating low, disk off */
return (PBDR & 0x0010) != 0;
}
else else
return true; /* old player: always on */ return (PBDRL & 0x10) != 0;
#else #else
if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ if ((PACR2 & 0x0400) || !(PAIORL & 0x20)) /* not configured for output */
return true; /* would be floating high, disk on */ return true; /* would be floating high, disk on */
else else
return (PADR & 0x0020) != 0; return (PADRL & 0x20) != 0;
#endif /* ATA_POWER_PLAYERSTYLE */ #endif /* ATA_POWER_PLAYERSTYLE */
#else #else
return true; /* pretend always powered if not controlable */ return true; /* pretend always powered if not controlable */