summaryrefslogtreecommitdiff
path: root/bootloader/iaudio_coldfire.c
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/iaudio_coldfire.c
parent4071826c813f8e06e93e22049aee07ffc95c3460 (diff)
downloadrockbox-ed3ff1b0b5122e898f7310a9b5ed112a22e2828c.tar.gz
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/iaudio_coldfire.c')
-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)
67 67
68void start_firmware(void) 68void start_firmware(void)
69{ 69{
70 adc_close();
70 asm(" move.w #0x2700,%sr"); 71 asm(" move.w #0x2700,%sr");
71 __reset_cookie(); 72 __reset_cookie();
72 asm(" move.l %0,%%d0" :: "i"(DRAM_START)); 73 asm(" move.l %0,%%d0" :: "i"(DRAM_START));
@@ -126,16 +127,35 @@ void main(void)
126 int rc; 127 int rc;
127 bool rc_on_button = false; 128 bool rc_on_button = false;
128 bool on_button = false; 129 bool on_button = false;
129 bool rec_button = false; 130
130 bool hold_status = false; 131 /* We want to read the buttons as early as possible, before the user
132 releases the ON button */
133
134#ifdef IAUDIO_M3
135 or_l(0x80000000, &GPIO_FUNCTION); /* remote Play button */
136 and_l(~0x80000000, &GPIO_ENABLE);
137 or_l(0x00000202, &GPIO1_FUNCTION); /* main Hold & Play */
138
139 if ((GPIO1_READ & 0x000000002) == 0)
140 on_button = true;
141
142 if ((GPIO_READ & 0x80000000) == 0)
143 rc_on_button = true;
144#elif defined(IAUDIO_M5) || defined(IAUDIO_X5)
131 int data; 145 int data;
132 146
133 (void)rc_on_button; 147 or_l(0x0e000000, &GPIO_FUNCTION); /* main Hold & Power, remote Play */
134 (void)on_button; 148 and_l(~0x0e000000, &GPIO_ENABLE);
135 (void)rec_button; 149
136 (void)hold_status; 150 data = GPIO_READ;
137 (void)data;
138 151
152 if ((data & 0x04000000) == 0)
153 on_button = true;
154
155 if ((data & 0x02000000) == 0)
156 rc_on_button = true;
157#endif
158
139 power_init(); 159 power_init();
140 160
141 system_init(); 161 system_init();
@@ -153,6 +173,16 @@ void main(void)
153 font_init(); 173 font_init();
154 adc_init(); 174 adc_init();
155 button_init(); 175 button_init();
176
177 if ((!on_button || button_hold())
178 && (!rc_on_button || remote_button_hold())
179 && !charger_inserted())
180 {
181 /* No need to check for USB connection here, as USB is handled
182 * in the cowon loader. */
183 printf("Hold switch on");
184 shutdown();
185 }
156 186
157 printf("Rockbox boot loader"); 187 printf("Rockbox boot loader");
158 printf("Version %s", version); 188 printf("Version %s", version);