summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-11-20 14:17:43 +0000
committerJens Arnold <amiconn@rockbox.org>2004-11-20 14:17:43 +0000
commit7ebb5d915e3a39003aa2b88d78c450afe0ef8281 (patch)
tree713461d9c316168bb7c1d5e08482fdfe8c3e6515 /firmware
parentbdba1d00c07011e97ebee4d36e0f0b49fd8a17d1 (diff)
downloadrockbox-7ebb5d915e3a39003aa2b88d78c450afe0ef8281.tar.gz
rockbox-7ebb5d915e3a39003aa2b88d78c450afe0ef8281.tar.bz2
rockbox-7ebb5d915e3a39003aa2b88d78c450afe0ef8281.zip
Moved player ATA power handling to the correct functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5449 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c9
-rw-r--r--firmware/drivers/power.c33
-rw-r--r--firmware/export/config-player.h7
3 files changed, 40 insertions, 9 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 40d3da2f98..60b6a87488 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -1131,15 +1131,6 @@ int ata_init(void)
or_b(0x02, &PAIORH); /* output for ATA reset */
or_b(0x02, &PADRH); /* release ATA reset */
PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
-
-#ifdef HAVE_LCD_CHARCELLS
- if (read_rom_version() > 451) /* new player: power on the HD */
- {
- PBCR2 &= ~0x0300; /* Set PB4 (IDE power) to GPIO */
- or_b(0x10, &PBDRL); /* ... high */
- or_b(0x10, &PBIORL); /* ... and output */
- }
-#endif
#elif defined HAVE_SCF5249
#endif
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 3a69b37953..0ef79c8561 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -117,15 +117,31 @@ void ide_power_enable(bool on)
#ifdef NEEDS_ATA_POWER_ON
if(on)
{
+#ifdef ATA_POWER_PLAYERSTYLE
+ if (read_rom_version() > 451) /* new players only */
+ {
+ or_b(0x10, &PBDRL);
+ touched = true;
+ }
+#else
or_b(0x20, &PADRL);
touched = true;
+#endif
}
#endif
#ifdef HAVE_ATA_POWER_OFF
if(!on)
{
+#ifdef ATA_POWER_PLAYERSTYLE
+ if (read_rom_version() > 451) /* new players only */
+ {
+ and_b(~0x10, &PBDRL);
+ touched = true;
+ }
+#else
and_b(~0x20, &PADRL);
touched = true;
+#endif
}
#endif
@@ -133,8 +149,13 @@ void ide_power_enable(bool on)
of other bits on same port, while input and floating high */
if (touched)
{
+#ifdef ATA_POWER_PLAYERSTYLE
+ or_b(0x10, &PBIORL); /* PB4 is an output */
+ PBCR2 &= ~0x0300; /* GPIO for PB4 */
+#else
or_b(0x20, &PAIORL); /* PA5 is an output */
PACR2 &= 0xFBFF; /* GPIO for PA5 */
+#endif
}
}
#endif /* !HAVE_MMC */
@@ -143,10 +164,22 @@ void ide_power_enable(bool on)
bool ide_powered(void)
{
#if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF)
+#ifdef ATA_POWER_PLAYERSTYLE
+ if (read_rom_version() > 451) /* new players only */
+ {
+ if ((PBCR2 & 0x0300) || !(PBIOR & 0x0010)) /* not configured for output */
+ return false; /* would be floating low, disk off */
+ else
+ return (PBDR & 0x0010) != 0;
+ }
+ else
+ return true; /* old player: always on */
+#else
if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */
return true; /* would be floating high, disk on */
else
return (PADR & 0x0020) != 0;
+#endif /* ATA_POWER_PLAYERSTYLE */
#else
return true; /* pretend always powered if not controlable */
#endif
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 0b75f6eefa..5a8f080669 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -19,6 +19,13 @@
/* Define this if you have a DAC3550A */
#define HAVE_DAC3550A
+/* Define this if you need to power on ATA */
+#define NEEDS_ATA_POWER_ON
+
+/* Define this if you control ata power player style
+ (with PB4, new player only) */
+#define ATA_POWER_PLAYERSTYLE
+
/* Define this to the CPU frequency */
#define CPU_FREQ 12000000 /* cycle time ~83.3ns */