diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-07-19 08:08:33 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-07-19 08:08:33 +0000 |
commit | e628b5c941f01a709dc2d8e988b9ed5bd035e8c9 (patch) | |
tree | e540a0921ad691c76543711d1423ecdba17675fd | |
parent | e8da7e6b15674b55b8a38c23da2303fd424c5467 (diff) | |
download | rockbox-e628b5c941f01a709dc2d8e988b9ed5bd035e8c9.tar.gz rockbox-e628b5c941f01a709dc2d8e988b9ed5bd035e8c9.zip |
iriver bootloader: slightly faster startup, backlight off in usb mode, minor code policing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7192 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/main.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/bootloader/main.c b/bootloader/main.c index db34533df7..fd8049e5e6 100644 --- a/bootloader/main.c +++ b/bootloader/main.c | |||
@@ -175,9 +175,11 @@ void main(void) | |||
175 | int data; | 175 | int data; |
176 | int adc_battery, battery_voltage, batt_int, batt_frac; | 176 | int adc_battery, battery_voltage, batt_int, batt_frac; |
177 | 177 | ||
178 | /* Read the buttons early */ | 178 | /* We want to read the buttons as early as possible, before the user |
179 | releases the ON button */ | ||
179 | 180 | ||
180 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs */ | 181 | /* Set GPIO33, GPIO37, GPIO38 and GPIO52 as general purpose inputs |
182 | (The ON and Hold buttons on the main unit and the remote) */ | ||
181 | or_l(0x00100062, &GPIO1_FUNCTION); | 183 | or_l(0x00100062, &GPIO1_FUNCTION); |
182 | and_l(~0x00100062, &GPIO1_ENABLE); | 184 | and_l(~0x00100062, &GPIO1_ENABLE); |
183 | 185 | ||
@@ -192,7 +194,17 @@ void main(void) | |||
192 | or_l(0x00020000, &GPIO1_ENABLE); | 194 | or_l(0x00020000, &GPIO1_ENABLE); |
193 | or_l(0x00020000, &GPIO1_FUNCTION); | 195 | or_l(0x00020000, &GPIO1_FUNCTION); |
194 | 196 | ||
197 | /* Set the default state of the hard drive power to OFF */ | ||
198 | ide_power_enable(false); | ||
199 | |||
195 | power_init(); | 200 | power_init(); |
201 | |||
202 | /* Power on the hard drive early, to speed up the loading */ | ||
203 | if(!((on_button && button_hold()) || | ||
204 | (rc_on_button && remote_button_hold()))) { | ||
205 | ide_power_enable(true); | ||
206 | } | ||
207 | |||
196 | system_init(); | 208 | system_init(); |
197 | kernel_init(); | 209 | kernel_init(); |
198 | 210 | ||
@@ -212,12 +224,14 @@ void main(void) | |||
212 | 224 | ||
213 | lcd_setfont(FONT_SYSFIXED); | 225 | lcd_setfont(FONT_SYSFIXED); |
214 | 226 | ||
215 | snprintf(buf, sizeof(buf), "Rockboot version %s", version); | 227 | lcd_puts(0, line++, "Rockbox boot loader"); |
228 | snprintf(buf, sizeof(buf), "Version %s", version); | ||
216 | lcd_puts(0, line++, buf); | 229 | lcd_puts(0, line++, buf); |
217 | lcd_update(); | 230 | lcd_update(); |
218 | 231 | ||
219 | sleep(HZ/50); /* Allow the button driver to check the buttons */ | 232 | sleep(HZ/50); /* Allow the button driver to check the buttons */ |
220 | 233 | ||
234 | /* Holding REC while starting runs the original firmware */ | ||
221 | if(((button_status() & BUTTON_REC) == BUTTON_REC) || | 235 | if(((button_status() & BUTTON_REC) == BUTTON_REC) || |
222 | ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC)) { | 236 | ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC)) { |
223 | lcd_puts(0, 8, "Starting original firmware..."); | 237 | lcd_puts(0, 8, "Starting original firmware..."); |
@@ -225,8 +239,10 @@ void main(void) | |||
225 | start_iriver_fw(); | 239 | start_iriver_fw(); |
226 | } | 240 | } |
227 | 241 | ||
228 | if(on_button & button_hold() || | 242 | /* Don't start if the Hold button is active on the device you |
229 | rc_on_button & remote_button_hold()) { | 243 | are starting with */ |
244 | if((on_button && button_hold()) || | ||
245 | (rc_on_button && remote_button_hold())) { | ||
230 | lcd_puts(0, 8, "HOLD switch on, power off..."); | 246 | lcd_puts(0, 8, "HOLD switch on, power off..."); |
231 | lcd_update(); | 247 | lcd_update(); |
232 | sleep(HZ*2); | 248 | sleep(HZ*2); |
@@ -280,6 +296,9 @@ void main(void) | |||
280 | { | 296 | { |
281 | ata_spin(); /* Prevent the drive from spinning down */ | 297 | ata_spin(); /* Prevent the drive from spinning down */ |
282 | sleep(HZ); | 298 | sleep(HZ); |
299 | |||
300 | /* Backlight OFF */ | ||
301 | or_l(0x00020000, &GPIO1_OUT); | ||
283 | } | 302 | } |
284 | 303 | ||
285 | system_reboot(); | 304 | system_reboot(); |