summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-17 23:47:38 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-17 23:47:38 +0000
commited3ff1b0b5122e898f7310a9b5ed112a22e2828c (patch)
tree10838a643bc95d0792e4bda21ad14a343b374751 /bootloader
parent4071826c813f8e06e93e22049aee07ffc95c3460 (diff)
downloadrockbox-ed3ff1b0b5122e898f7310a9b5ed112a22e2828c.tar.gz
rockbox-ed3ff1b0b5122e898f7310a9b5ed112a22e2828c.tar.bz2
rockbox-ed3ff1b0b5122e898f7310a9b5ed112a22e2828c.zip
Various coldfire fixes: (1) iAudio Bootloader: Check the status of main & remote power button vs. the respective hold switch, and shut down when on hold. On X5/M5 this check is not strictly necessary for the main unit, but left there to keep things uniform. (2) M3: Stop reading the ADC properly before leaving the bootloader, on RoLo, and on reboot, to make it work reliably after those transitions. (3) Disable all interrupt sources on system init to avoid premature ISR calls after enabling interrupts in general. (4) iAudios: Proper implementation of ide_powered(), avoiding nasty HDD clicks in the bootloader when powering down, e.g. because of Hold. (5) Slight optimisations.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16689 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/iaudio_coldfire.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/bootloader/iaudio_coldfire.c b/bootloader/iaudio_coldfire.c
index a80a202d41..bb7fbebd3e 100644
--- a/bootloader/iaudio_coldfire.c
+++ b/bootloader/iaudio_coldfire.c
@@ -67,6 +67,7 @@ inline void __reset_cookie(void)
void start_firmware(void)
{
+ adc_close();
asm(" move.w #0x2700,%sr");
__reset_cookie();
asm(" move.l %0,%%d0" :: "i"(DRAM_START));
@@ -126,16 +127,35 @@ void main(void)
int rc;
bool rc_on_button = false;
bool on_button = false;
- bool rec_button = false;
- bool hold_status = false;
+
+ /* We want to read the buttons as early as possible, before the user
+ releases the ON button */
+
+#ifdef IAUDIO_M3
+ or_l(0x80000000, &GPIO_FUNCTION); /* remote Play button */
+ and_l(~0x80000000, &GPIO_ENABLE);
+ or_l(0x00000202, &GPIO1_FUNCTION); /* main Hold & Play */
+
+ if ((GPIO1_READ & 0x000000002) == 0)
+ on_button = true;
+
+ if ((GPIO_READ & 0x80000000) == 0)
+ rc_on_button = true;
+#elif defined(IAUDIO_M5) || defined(IAUDIO_X5)
int data;
- (void)rc_on_button;
- (void)on_button;
- (void)rec_button;
- (void)hold_status;
- (void)data;
+ or_l(0x0e000000, &GPIO_FUNCTION); /* main Hold & Power, remote Play */
+ and_l(~0x0e000000, &GPIO_ENABLE);
+
+ data = GPIO_READ;
+ if ((data & 0x04000000) == 0)
+ on_button = true;
+
+ if ((data & 0x02000000) == 0)
+ rc_on_button = true;
+#endif
+
power_init();
system_init();
@@ -153,6 +173,16 @@ void main(void)
font_init();
adc_init();
button_init();
+
+ if ((!on_button || button_hold())
+ && (!rc_on_button || remote_button_hold())
+ && !charger_inserted())
+ {
+ /* No need to check for USB connection here, as USB is handled
+ * in the cowon loader. */
+ printf("Hold switch on");
+ shutdown();
+ }
printf("Rockbox boot loader");
printf("Version %s", version);