diff options
Diffstat (limited to 'bootloader/iaudio_coldfire.c')
-rw-r--r-- | bootloader/iaudio_coldfire.c | 44 |
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 | ||
68 | void start_firmware(void) | 68 | void 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); |