summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-12-16 22:24:57 +0000
committerJens Arnold <amiconn@rockbox.org>2004-12-16 22:24:57 +0000
commit78acda25b37747f9a883ccf1ad14f7710f9a3374 (patch)
treeba9b124474554ba1a027f04e81208a98dd055111
parent68dd081a32c5afc05e632635f9c1569c4cb6096f (diff)
downloadrockbox-78acda25b37747f9a883ccf1ad14f7710f9a3374.tar.gz
rockbox-78acda25b37747f9a883ccf1ad14f7710f9a3374.zip
Player: Correctly probe the ability of the box to control HD power. This is not determined by the ROM version.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5486 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--flash/bootloader/bootloader.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c
index 370ac5bee5..d5ce509cce 100644
--- a/flash/bootloader/bootloader.c
+++ b/flash/bootloader/bootloader.c
@@ -122,12 +122,24 @@ void PlatformInit(void)
#endif
#if defined PLATFORM_PLAYER
- BRR1 = 0x19; /* 14400 Baud for monitor */
- PACR2 &= 0xFFFC; /* GPIO for PA0 (charger detection, input by default) */
- if (FW_VERSION > 451 && (PADRL & 0x01))
- { /* "new" Player and charger not plugged? */
- PBDR |= 0x0010; /* set PB4 to 1 to power-up the harddisk early */
- PBIOR |= 0x0010; /* make PB4 an output */
+ BRR1 = 0x19; /* 14400 Baud for monitor */
+ PBDRL |= 0x10; /* set PB4 to 1 to power the hd early (and prepare for
+ * probing in case the charger is connected) */
+ PBIORL |= 0x10; /* make PB4 an output */
+ PACR2 &= 0xFFFC; /* GPIO for PA0 (charger detection, input by default) */
+ if (!(PADRL & 0x01)) /* charger plugged? */
+ { /* we need to probe whether the box is able to control hd power */
+ int i;
+
+ PBIORL &= ~0x10; /* set PB4 to input */
+ /* wait whether it goes low, max. ~1 ms */
+ for (i = 0; (PBDRL & 0x10) && i < 1000; i++);
+
+ if (~(PBDRL & 0x10)) /* pulled low -> power controllable */
+ PBDRL &= 0x10; /* set PB4 low */
+ else /* still floating high -> not controllable */
+ PBDRL |= 0x10; /* set PB4 high */
+ PBIORL |= 0x10; /* ..and output again */
}
#elif defined PLATFORM_RECORDER
BRR1 = 0x02; /* 115200 Baud for monitor */