diff options
author | James Buren <braewoods+rb@braewoods.net> | 2020-11-14 14:16:42 +0000 |
---|---|---|
committer | James Buren <braewoods+rb@braewoods.net> | 2020-11-14 14:16:42 +0000 |
commit | 37eabbfe51e7ed7938c51934921f28cd54a1140d (patch) | |
tree | 17e13ebdad8d44365b095537a9453217b8af3918 /bootloader | |
parent | 5a223080faa39fd13eb7befab272fcfa0163a506 (diff) | |
download | rockbox-37eabbfe51e7ed7938c51934921f28cd54a1140d.tar.gz rockbox-37eabbfe51e7ed7938c51934921f28cd54a1140d.zip |
h1x0/h300: remove trailing whitespace from bootloaders
Change-Id: I8f3bfbc8287c8f520894e0cd258066d4c7a02197
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/iriver_h1x0.c | 108 | ||||
-rw-r--r-- | bootloader/iriver_h300.c | 36 |
2 files changed, 72 insertions, 72 deletions
diff --git a/bootloader/iriver_h1x0.c b/bootloader/iriver_h1x0.c index f79c7c9aaf..e744b642b0 100644 --- a/bootloader/iriver_h1x0.c +++ b/bootloader/iriver_h1x0.c | |||
@@ -94,21 +94,21 @@ void start_flashed_romimage(void) | |||
94 | { | 94 | { |
95 | uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY; | 95 | uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY; |
96 | int *reset_vector; | 96 | int *reset_vector; |
97 | 97 | ||
98 | if (!detect_flashed_romimage()) | 98 | if (!detect_flashed_romimage()) |
99 | return ; | 99 | return ; |
100 | 100 | ||
101 | reset_vector = (int *)(&src[sizeof(struct flash_header)+4]); | 101 | reset_vector = (int *)(&src[sizeof(struct flash_header)+4]); |
102 | 102 | ||
103 | asm(" move.w #0x2700,%sr"); | 103 | asm(" move.w #0x2700,%sr"); |
104 | __reset_cookie(); | 104 | __reset_cookie(); |
105 | 105 | ||
106 | asm(" move.l %0,%%d0" :: "i"(DRAM_START)); | 106 | asm(" move.l %0,%%d0" :: "i"(DRAM_START)); |
107 | asm(" movec.l %d0,%vbr"); | 107 | asm(" movec.l %d0,%vbr"); |
108 | asm(" move.l %0,%%sp" :: "m"(reset_vector[0])); | 108 | asm(" move.l %0,%%sp" :: "m"(reset_vector[0])); |
109 | asm(" move.l %0,%%a0" :: "m"(reset_vector[1])); | 109 | asm(" move.l %0,%%a0" :: "m"(reset_vector[1])); |
110 | asm(" jmp (%a0)"); | 110 | asm(" jmp (%a0)"); |
111 | 111 | ||
112 | /* Failure */ | 112 | /* Failure */ |
113 | power_off(); | 113 | power_off(); |
114 | } | 114 | } |
@@ -121,14 +121,14 @@ void start_flashed_ramimage(void) | |||
121 | 121 | ||
122 | if (!detect_flashed_ramimage()) | 122 | if (!detect_flashed_ramimage()) |
123 | return; | 123 | return; |
124 | 124 | ||
125 | /* Load firmware from flash */ | 125 | /* Load firmware from flash */ |
126 | cpu_boost(true); | 126 | cpu_boost(true); |
127 | memcpy(&hdr, src, sizeof(struct flash_header)); | 127 | memcpy(&hdr, src, sizeof(struct flash_header)); |
128 | src += sizeof(struct flash_header); | 128 | src += sizeof(struct flash_header); |
129 | memcpy(buf, src, hdr.length); | 129 | memcpy(buf, src, hdr.length); |
130 | cpu_boost(false); | 130 | cpu_boost(false); |
131 | 131 | ||
132 | start_firmware(); | 132 | start_firmware(); |
133 | 133 | ||
134 | /* Failure */ | 134 | /* Failure */ |
@@ -144,25 +144,25 @@ void shutdown(void) | |||
144 | firmware_settings.bl_version = 0; | 144 | firmware_settings.bl_version = 0; |
145 | eeprom_settings_store(); | 145 | eeprom_settings_store(); |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | /* We need to gracefully spin down the disk to prevent clicks. */ | 148 | /* We need to gracefully spin down the disk to prevent clicks. */ |
149 | if (ide_powered()) | 149 | if (ide_powered()) |
150 | { | 150 | { |
151 | /* Make sure ATA has been initialized. */ | 151 | /* Make sure ATA has been initialized. */ |
152 | storage_init(); | 152 | storage_init(); |
153 | 153 | ||
154 | /* And put the disk into sleep immediately. */ | 154 | /* And put the disk into sleep immediately. */ |
155 | storage_sleepnow(); | 155 | storage_sleepnow(); |
156 | } | 156 | } |
157 | 157 | ||
158 | sleep(HZ*2); | 158 | sleep(HZ*2); |
159 | 159 | ||
160 | /* Backlight OFF */ | 160 | /* Backlight OFF */ |
161 | backlight_hw_off(); | 161 | backlight_hw_off(); |
162 | #ifdef HAVE_REMOTE_LCD | 162 | #ifdef HAVE_REMOTE_LCD |
163 | remote_backlight_hw_off(); | 163 | remote_backlight_hw_off(); |
164 | #endif | 164 | #endif |
165 | 165 | ||
166 | __reset_cookie(); | 166 | __reset_cookie(); |
167 | power_off(); | 167 | power_off(); |
168 | } | 168 | } |
@@ -171,14 +171,14 @@ void shutdown(void) | |||
171 | void check_battery(void) | 171 | void check_battery(void) |
172 | { | 172 | { |
173 | int battery_voltage, batt_int, batt_frac; | 173 | int battery_voltage, batt_int, batt_frac; |
174 | 174 | ||
175 | battery_voltage = _battery_voltage(); | 175 | battery_voltage = _battery_voltage(); |
176 | batt_int = battery_voltage / 1000; | 176 | batt_int = battery_voltage / 1000; |
177 | batt_frac = (battery_voltage % 1000) / 10; | 177 | batt_frac = (battery_voltage % 1000) / 10; |
178 | 178 | ||
179 | printf("Batt: %d.%02dV", batt_int, batt_frac); | 179 | printf("Batt: %d.%02dV", batt_int, batt_frac); |
180 | 180 | ||
181 | if (battery_voltage <= 310) | 181 | if (battery_voltage <= 310) |
182 | { | 182 | { |
183 | printf("WARNING! BATTERY LOW!!"); | 183 | printf("WARNING! BATTERY LOW!!"); |
184 | sleep(HZ*2); | 184 | sleep(HZ*2); |
@@ -190,13 +190,13 @@ void initialize_eeprom(void) | |||
190 | { | 190 | { |
191 | if (detect_original_firmware()) | 191 | if (detect_original_firmware()) |
192 | return ; | 192 | return ; |
193 | 193 | ||
194 | if (!eeprom_settings_init()) | 194 | if (!eeprom_settings_init()) |
195 | { | 195 | { |
196 | recovery_mode = true; | 196 | recovery_mode = true; |
197 | return ; | 197 | return ; |
198 | } | 198 | } |
199 | 199 | ||
200 | /* If bootloader version has not been reset, disk might | 200 | /* If bootloader version has not been reset, disk might |
201 | * not be intact. */ | 201 | * not be intact. */ |
202 | if (firmware_settings.bl_version || !firmware_settings.disk_clean) | 202 | if (firmware_settings.bl_version || !firmware_settings.disk_clean) |
@@ -204,7 +204,7 @@ void initialize_eeprom(void) | |||
204 | firmware_settings.disk_clean = false; | 204 | firmware_settings.disk_clean = false; |
205 | recovery_mode = true; | 205 | recovery_mode = true; |
206 | } | 206 | } |
207 | 207 | ||
208 | firmware_settings.bl_version = EEPROM_SETTINGS_BL_MINVER; | 208 | firmware_settings.bl_version = EEPROM_SETTINGS_BL_MINVER; |
209 | eeprom_settings_store(); | 209 | eeprom_settings_store(); |
210 | } | 210 | } |
@@ -213,33 +213,33 @@ void try_flashboot(void) | |||
213 | { | 213 | { |
214 | if (!firmware_settings.initialized) | 214 | if (!firmware_settings.initialized) |
215 | return ; | 215 | return ; |
216 | 216 | ||
217 | switch (firmware_settings.bootmethod) | 217 | switch (firmware_settings.bootmethod) |
218 | { | 218 | { |
219 | case BOOT_DISK: | 219 | case BOOT_DISK: |
220 | return; | 220 | return; |
221 | 221 | ||
222 | case BOOT_ROM: | 222 | case BOOT_ROM: |
223 | start_flashed_romimage(); | 223 | start_flashed_romimage(); |
224 | recovery_mode = true; | 224 | recovery_mode = true; |
225 | break; | 225 | break; |
226 | 226 | ||
227 | case BOOT_RAM: | 227 | case BOOT_RAM: |
228 | start_flashed_ramimage(); | 228 | start_flashed_ramimage(); |
229 | recovery_mode = true; | 229 | recovery_mode = true; |
230 | break; | 230 | break; |
231 | 231 | ||
232 | default: | 232 | default: |
233 | recovery_mode = true; | 233 | recovery_mode = true; |
234 | return; | 234 | return; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | static const char *options[] = { | 238 | static const char *options[] = { |
239 | "Boot from disk", | 239 | "Boot from disk", |
240 | "Boot RAM image", | 240 | "Boot RAM image", |
241 | "Boot ROM image", | 241 | "Boot ROM image", |
242 | "Shutdown" | 242 | "Shutdown" |
243 | }; | 243 | }; |
244 | 244 | ||
245 | #define FAILSAFE_OPTIONS 4 | 245 | #define FAILSAFE_OPTIONS 4 |
@@ -253,7 +253,7 @@ void failsafe_menu(void) | |||
253 | char buf[32]; | 253 | char buf[32]; |
254 | int i; | 254 | int i; |
255 | extern int line; | 255 | extern int line; |
256 | 256 | ||
257 | reset_screen(); | 257 | reset_screen(); |
258 | printf("Bootloader %s", rbversion); | 258 | printf("Bootloader %s", rbversion); |
259 | check_battery(); | 259 | check_battery(); |
@@ -270,7 +270,7 @@ void failsafe_menu(void) | |||
270 | if (defopt < 0 || defopt >= FAILSAFE_OPTIONS) | 270 | if (defopt < 0 || defopt >= FAILSAFE_OPTIONS) |
271 | defopt = option; | 271 | defopt = option; |
272 | } | 272 | } |
273 | 273 | ||
274 | while (current_tick - start_tick < TIMEOUT) | 274 | while (current_tick - start_tick < TIMEOUT) |
275 | { | 275 | { |
276 | /* Draw the menu. */ | 276 | /* Draw the menu. */ |
@@ -279,27 +279,27 @@ void failsafe_menu(void) | |||
279 | { | 279 | { |
280 | char *def = "[DEF]"; | 280 | char *def = "[DEF]"; |
281 | char *arrow = "->"; | 281 | char *arrow = "->"; |
282 | 282 | ||
283 | if (i != defopt) | 283 | if (i != defopt) |
284 | def = ""; | 284 | def = ""; |
285 | if (i != option) | 285 | if (i != option) |
286 | arrow = " "; | 286 | arrow = " "; |
287 | 287 | ||
288 | printf("%s %s %s", arrow, options[i], def); | 288 | printf("%s %s %s", arrow, options[i], def); |
289 | } | 289 | } |
290 | 290 | ||
291 | snprintf(buf, sizeof(buf), "Time left: %lds", | 291 | snprintf(buf, sizeof(buf), "Time left: %lds", |
292 | (TIMEOUT - (current_tick - start_tick)) / HZ); | 292 | (TIMEOUT - (current_tick - start_tick)) / HZ); |
293 | lcd_puts(0, 10, buf); | 293 | lcd_puts(0, 10, buf); |
294 | lcd_update(); | 294 | lcd_update(); |
295 | button = button_get_w_tmo(HZ); | 295 | button = button_get_w_tmo(HZ); |
296 | 296 | ||
297 | if (button == BUTTON_NONE || button & SYS_EVENT) | 297 | if (button == BUTTON_NONE || button & SYS_EVENT) |
298 | continue ; | 298 | continue ; |
299 | 299 | ||
300 | start_tick = current_tick; | 300 | start_tick = current_tick; |
301 | 301 | ||
302 | /* Ignore the ON/PLAY -button because it can cause trouble | 302 | /* Ignore the ON/PLAY -button because it can cause trouble |
303 | with the RTC alarm mod. */ | 303 | with the RTC alarm mod. */ |
304 | switch (button & ~(BUTTON_ON)) | 304 | switch (button & ~(BUTTON_ON)) |
305 | { | 305 | { |
@@ -308,7 +308,7 @@ void failsafe_menu(void) | |||
308 | if (option > 0) | 308 | if (option > 0) |
309 | option--; | 309 | option--; |
310 | break ; | 310 | break ; |
311 | 311 | ||
312 | case BUTTON_DOWN: | 312 | case BUTTON_DOWN: |
313 | case BUTTON_RC_FF: | 313 | case BUTTON_RC_FF: |
314 | if (option < FAILSAFE_OPTIONS-1) | 314 | if (option < FAILSAFE_OPTIONS-1) |
@@ -318,7 +318,7 @@ void failsafe_menu(void) | |||
318 | case BUTTON_SELECT: | 318 | case BUTTON_SELECT: |
319 | case BUTTON_RC_ON: | 319 | case BUTTON_RC_ON: |
320 | goto execute; | 320 | goto execute; |
321 | 321 | ||
322 | case BUTTON_REC: | 322 | case BUTTON_REC: |
323 | case BUTTON_RC_REC: | 323 | case BUTTON_RC_REC: |
324 | if (firmware_settings.initialized) | 324 | if (firmware_settings.initialized) |
@@ -330,9 +330,9 @@ void failsafe_menu(void) | |||
330 | break ; | 330 | break ; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | execute: | 334 | execute: |
335 | 335 | ||
336 | lcd_puts(0, 10, "Executing command..."); | 336 | lcd_puts(0, 10, "Executing command..."); |
337 | lcd_update(); | 337 | lcd_update(); |
338 | sleep(HZ); | 338 | sleep(HZ); |
@@ -342,18 +342,18 @@ void failsafe_menu(void) | |||
342 | { | 342 | { |
343 | case BOOT_DISK: | 343 | case BOOT_DISK: |
344 | return ; | 344 | return ; |
345 | 345 | ||
346 | case BOOT_RAM: | 346 | case BOOT_RAM: |
347 | start_flashed_ramimage(); | 347 | start_flashed_ramimage(); |
348 | printf("Image not found"); | 348 | printf("Image not found"); |
349 | break; | 349 | break; |
350 | 350 | ||
351 | case BOOT_ROM: | 351 | case BOOT_ROM: |
352 | start_flashed_romimage(); | 352 | start_flashed_romimage(); |
353 | printf("Image not found"); | 353 | printf("Image not found"); |
354 | break; | 354 | break; |
355 | } | 355 | } |
356 | 356 | ||
357 | shutdown(); | 357 | shutdown(); |
358 | } | 358 | } |
359 | #endif | 359 | #endif |
@@ -387,7 +387,7 @@ void main(void) | |||
387 | int data; | 387 | int data; |
388 | extern int line; /* From common.c */ | 388 | extern int line; /* From common.c */ |
389 | extern int remote_line; /* From common.c */ | 389 | extern int remote_line; /* From common.c */ |
390 | 390 | ||
391 | /* We want to read the buttons as early as possible, before the user | 391 | /* We want to read the buttons as early as possible, before the user |
392 | releases the ON button */ | 392 | releases the ON button */ |
393 | 393 | ||
@@ -416,11 +416,11 @@ void main(void) | |||
416 | } | 416 | } |
417 | 417 | ||
418 | __uda1380_reset_hi(); | 418 | __uda1380_reset_hi(); |
419 | 419 | ||
420 | /* Start with the main backlight OFF. */ | 420 | /* Start with the main backlight OFF. */ |
421 | backlight_hw_init(); | 421 | backlight_hw_init(); |
422 | backlight_hw_off(); | 422 | backlight_hw_off(); |
423 | 423 | ||
424 | /* Remote backlight ON */ | 424 | /* Remote backlight ON */ |
425 | #ifdef HAVE_REMOTE_LCD | 425 | #ifdef HAVE_REMOTE_LCD |
426 | remote_backlight_hw_on(); | 426 | remote_backlight_hw_on(); |
@@ -430,7 +430,7 @@ void main(void) | |||
430 | kernel_init(); | 430 | kernel_init(); |
431 | 431 | ||
432 | __uda1380_reset_lo(); | 432 | __uda1380_reset_lo(); |
433 | 433 | ||
434 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 434 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
435 | /* Set up waitstates for the peripherals */ | 435 | /* Set up waitstates for the peripherals */ |
436 | set_cpu_frequency(0); /* PLL off */ | 436 | set_cpu_frequency(0); /* PLL off */ |
@@ -443,7 +443,7 @@ void main(void) | |||
443 | #ifdef HAVE_EEPROM_SETTINGS | 443 | #ifdef HAVE_EEPROM_SETTINGS |
444 | initialize_eeprom(); | 444 | initialize_eeprom(); |
445 | #endif | 445 | #endif |
446 | 446 | ||
447 | usb_init(); | 447 | usb_init(); |
448 | /* A small delay after usb_init is necessary to read the I/O port correctly | 448 | /* A small delay after usb_init is necessary to read the I/O port correctly |
449 | (if ports are read _immediately_ after the init). */ | 449 | (if ports are read _immediately_ after the init). */ |
@@ -451,25 +451,25 @@ void main(void) | |||
451 | 451 | ||
452 | adc_init(); | 452 | adc_init(); |
453 | button_init(); | 453 | button_init(); |
454 | 454 | ||
455 | /* Only check remote hold status if remote power button was actually used. */ | 455 | /* Only check remote hold status if remote power button was actually used. */ |
456 | if (rc_on_button) | 456 | if (rc_on_button) |
457 | { | 457 | { |
458 | lcd_remote_init(); | 458 | lcd_remote_init(); |
459 | 459 | ||
460 | /* Allow the button driver to check the buttons */ | 460 | /* Allow the button driver to check the buttons */ |
461 | sleep(HZ/50); | 461 | sleep(HZ/50); |
462 | 462 | ||
463 | if (remote_button_hold()) | 463 | if (remote_button_hold()) |
464 | hold_status = true; | 464 | hold_status = true; |
465 | } | 465 | } |
466 | 466 | ||
467 | /* Check main hold switch status too. */ | 467 | /* Check main hold switch status too. */ |
468 | if (on_button && button_hold()) | 468 | if (on_button && button_hold()) |
469 | { | 469 | { |
470 | hold_status = true; | 470 | hold_status = true; |
471 | } | 471 | } |
472 | 472 | ||
473 | /* Power on the hard drive early, to speed up the loading. */ | 473 | /* Power on the hard drive early, to speed up the loading. */ |
474 | if (!hold_status | 474 | if (!hold_status |
475 | # ifdef HAVE_EEPROM_SETTINGS | 475 | # ifdef HAVE_EEPROM_SETTINGS |
@@ -479,7 +479,7 @@ void main(void) | |||
479 | { | 479 | { |
480 | ide_power_enable(true); | 480 | ide_power_enable(true); |
481 | } | 481 | } |
482 | 482 | ||
483 | # ifdef HAVE_EEPROM_SETTINGS | 483 | # ifdef HAVE_EEPROM_SETTINGS |
484 | if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) | 484 | if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) |
485 | try_flashboot(); | 485 | try_flashboot(); |
@@ -496,11 +496,11 @@ void main(void) | |||
496 | remote display here. */ | 496 | remote display here. */ |
497 | if (remote_detect()) | 497 | if (remote_detect()) |
498 | lcd_remote_on(); | 498 | lcd_remote_on(); |
499 | 499 | ||
500 | font_init(); | 500 | font_init(); |
501 | 501 | ||
502 | lcd_setfont(FONT_SYSFIXED); | 502 | lcd_setfont(FONT_SYSFIXED); |
503 | 503 | ||
504 | printf("Rockbox boot loader"); | 504 | printf("Rockbox boot loader"); |
505 | printf("Version %s", rbversion); | 505 | printf("Version %s", rbversion); |
506 | 506 | ||
@@ -524,7 +524,7 @@ void main(void) | |||
524 | printf("Hold switch on"); | 524 | printf("Hold switch on"); |
525 | shutdown(); | 525 | shutdown(); |
526 | } | 526 | } |
527 | 527 | ||
528 | #ifdef HAVE_EEPROM_SETTINGS | 528 | #ifdef HAVE_EEPROM_SETTINGS |
529 | failsafe_menu(); | 529 | failsafe_menu(); |
530 | #endif | 530 | #endif |
@@ -570,7 +570,7 @@ void main(void) | |||
570 | line = 0; | 570 | line = 0; |
571 | remote_line = 0; | 571 | remote_line = 0; |
572 | check_battery(); | 572 | check_battery(); |
573 | 573 | ||
574 | storage_spin(); /* Prevent the drive from spinning down */ | 574 | storage_spin(); /* Prevent the drive from spinning down */ |
575 | sleep(HZ); | 575 | sleep(HZ); |
576 | 576 | ||
@@ -642,9 +642,9 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation) | |||
642 | static unsigned short utf16_buf[SCROLL_LINE_SIZE]; | 642 | static unsigned short utf16_buf[SCROLL_LINE_SIZE]; |
643 | unsigned short *target; | 643 | unsigned short *target; |
644 | (void)orientation; | 644 | (void)orientation; |
645 | 645 | ||
646 | target = utf16_buf; | 646 | target = utf16_buf; |
647 | 647 | ||
648 | while (*str) | 648 | while (*str) |
649 | str = utf8decode(str, target++); | 649 | str = utf8decode(str, target++); |
650 | *target = 0; | 650 | *target = 0; |
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c index 286e123d53..4f4baf8cb5 100644 --- a/bootloader/iriver_h300.c +++ b/bootloader/iriver_h300.c | |||
@@ -89,22 +89,22 @@ void start_firmware(void) | |||
89 | void shutdown(void) | 89 | void shutdown(void) |
90 | { | 90 | { |
91 | printf("Shutting down..."); | 91 | printf("Shutting down..."); |
92 | 92 | ||
93 | /* We need to gracefully spin down the disk to prevent clicks. */ | 93 | /* We need to gracefully spin down the disk to prevent clicks. */ |
94 | if (ide_powered()) | 94 | if (ide_powered()) |
95 | { | 95 | { |
96 | /* Make sure ATA has been initialized. */ | 96 | /* Make sure ATA has been initialized. */ |
97 | storage_init(); | 97 | storage_init(); |
98 | 98 | ||
99 | /* And put the disk into sleep immediately. */ | 99 | /* And put the disk into sleep immediately. */ |
100 | storage_sleepnow(); | 100 | storage_sleepnow(); |
101 | } | 101 | } |
102 | 102 | ||
103 | sleep(HZ*2); | 103 | sleep(HZ*2); |
104 | 104 | ||
105 | backlight_hw_off(); | 105 | backlight_hw_off(); |
106 | remote_backlight_hw_off(); | 106 | remote_backlight_hw_off(); |
107 | 107 | ||
108 | __reset_cookie(); | 108 | __reset_cookie(); |
109 | power_off(); | 109 | power_off(); |
110 | } | 110 | } |
@@ -113,14 +113,14 @@ void shutdown(void) | |||
113 | void check_battery(void) | 113 | void check_battery(void) |
114 | { | 114 | { |
115 | int battery_voltage, batt_int, batt_frac; | 115 | int battery_voltage, batt_int, batt_frac; |
116 | 116 | ||
117 | battery_voltage = _battery_voltage(); | 117 | battery_voltage = _battery_voltage(); |
118 | batt_int = battery_voltage / 1000; | 118 | batt_int = battery_voltage / 1000; |
119 | batt_frac = (battery_voltage % 1000) / 10; | 119 | batt_frac = (battery_voltage % 1000) / 10; |
120 | 120 | ||
121 | printf("Batt: %d.%02dV", batt_int, batt_frac); | 121 | printf("Batt: %d.%02dV", batt_int, batt_frac); |
122 | 122 | ||
123 | if (battery_voltage <= 310) | 123 | if (battery_voltage <= 310) |
124 | { | 124 | { |
125 | printf("WARNING! BATTERY LOW!!"); | 125 | printf("WARNING! BATTERY LOW!!"); |
126 | sleep(HZ*2); | 126 | sleep(HZ*2); |
@@ -131,7 +131,7 @@ void check_battery(void) | |||
131 | extern unsigned char pcf50606_intregs[3]; | 131 | extern unsigned char pcf50606_intregs[3]; |
132 | 132 | ||
133 | /* From common.c */ | 133 | /* From common.c */ |
134 | extern int line; | 134 | extern int line; |
135 | extern int remote_line; | 135 | extern int remote_line; |
136 | 136 | ||
137 | void main(void) | 137 | void main(void) |
@@ -187,7 +187,7 @@ void main(void) | |||
187 | /* Start with the main backlight OFF. */ | 187 | /* Start with the main backlight OFF. */ |
188 | backlight_hw_init(); | 188 | backlight_hw_init(); |
189 | backlight_hw_off(); | 189 | backlight_hw_off(); |
190 | 190 | ||
191 | remote_backlight_hw_on(); | 191 | remote_backlight_hw_on(); |
192 | 192 | ||
193 | system_init(); | 193 | system_init(); |
@@ -202,7 +202,7 @@ void main(void) | |||
202 | 202 | ||
203 | adc_init(); | 203 | adc_init(); |
204 | button_init(); | 204 | button_init(); |
205 | 205 | ||
206 | lcd_init(); | 206 | lcd_init(); |
207 | lcd_remote_init(); | 207 | lcd_remote_init(); |
208 | font_init(); | 208 | font_init(); |
@@ -222,7 +222,7 @@ void main(void) | |||
222 | 222 | ||
223 | if(rtc_alarm) | 223 | if(rtc_alarm) |
224 | printf("RTC alarm detected"); | 224 | printf("RTC alarm detected"); |
225 | 225 | ||
226 | /* Don't start if the Hold button is active on the device you | 226 | /* Don't start if the Hold button is active on the device you |
227 | are starting with */ | 227 | are starting with */ |
228 | if ((on_button && button_hold()) || | 228 | if ((on_button && button_hold()) || |
@@ -230,7 +230,7 @@ void main(void) | |||
230 | { | 230 | { |
231 | hold_status = true; | 231 | hold_status = true; |
232 | } | 232 | } |
233 | if (hold_status && !rtc_alarm && (usb_detect() != USB_INSERTED) && | 233 | if (hold_status && !rtc_alarm && (usb_detect() != USB_INSERTED) && |
234 | !charger_inserted()) | 234 | !charger_inserted()) |
235 | { | 235 | { |
236 | if (detect_original_firmware()) | 236 | if (detect_original_firmware()) |
@@ -264,7 +264,7 @@ void main(void) | |||
264 | bool request_start = false; | 264 | bool request_start = false; |
265 | 265 | ||
266 | cpu_idle_mode(true); | 266 | cpu_idle_mode(true); |
267 | 267 | ||
268 | while(charger_inserted() && !request_start) | 268 | while(charger_inserted() && !request_start) |
269 | { | 269 | { |
270 | button = button_get_w_tmo(HZ); | 270 | button = button_get_w_tmo(HZ); |
@@ -274,7 +274,7 @@ void main(void) | |||
274 | case BUTTON_ON: | 274 | case BUTTON_ON: |
275 | request_start = true; | 275 | request_start = true; |
276 | break; | 276 | break; |
277 | 277 | ||
278 | case BUTTON_NONE: /* Timeout */ | 278 | case BUTTON_NONE: /* Timeout */ |
279 | 279 | ||
280 | if(charging_state()) | 280 | if(charging_state()) |
@@ -288,7 +288,7 @@ void main(void) | |||
288 | blink_toggle = true; | 288 | blink_toggle = true; |
289 | msg = complete_msg; | 289 | msg = complete_msg; |
290 | } | 290 | } |
291 | 291 | ||
292 | font_getstringsize(msg, &w, &h, FONT_SYSFIXED); | 292 | font_getstringsize(msg, &w, &h, FONT_SYSFIXED); |
293 | reset_screen(); | 293 | reset_screen(); |
294 | if(blink_toggle) | 294 | if(blink_toggle) |
@@ -306,7 +306,7 @@ void main(void) | |||
306 | 306 | ||
307 | cpu_idle_mode(false); | 307 | cpu_idle_mode(false); |
308 | } | 308 | } |
309 | 309 | ||
310 | usb_init(); | 310 | usb_init(); |
311 | 311 | ||
312 | /* A hack to enter USB mode without using the USB thread */ | 312 | /* A hack to enter USB mode without using the USB thread */ |
@@ -333,7 +333,7 @@ void main(void) | |||
333 | line = 0; | 333 | line = 0; |
334 | remote_line = 0; | 334 | remote_line = 0; |
335 | check_battery(); | 335 | check_battery(); |
336 | 336 | ||
337 | storage_spin(); /* Prevent the drive from spinning down */ | 337 | storage_spin(); /* Prevent the drive from spinning down */ |
338 | sleep(HZ); | 338 | sleep(HZ); |
339 | } | 339 | } |
@@ -408,9 +408,9 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation) | |||
408 | static unsigned short utf16_buf[SCROLL_LINE_SIZE]; | 408 | static unsigned short utf16_buf[SCROLL_LINE_SIZE]; |
409 | unsigned short *target; | 409 | unsigned short *target; |
410 | (void)orientation; | 410 | (void)orientation; |
411 | 411 | ||
412 | target = utf16_buf; | 412 | target = utf16_buf; |
413 | 413 | ||
414 | while (*str) | 414 | while (*str) |
415 | str = utf8decode(str, target++); | 415 | str = utf8decode(str, target++); |
416 | *target = 0; | 416 | *target = 0; |