diff options
author | James Buren <braewoods+rb@braewoods.net> | 2020-11-14 14:29:18 +0000 |
---|---|---|
committer | James Buren <braewoods+rb@braewoods.net> | 2020-11-14 14:29:18 +0000 |
commit | aaa9a2cceedf45b04a85b206cd622a6fb1d9da77 (patch) | |
tree | e993961c0746ed1efd6d5c6a6ebbe976be1d2cd4 /bootloader/iriver_h1x0.c | |
parent | 37eabbfe51e7ed7938c51934921f28cd54a1140d (diff) | |
download | rockbox-aaa9a2cceedf45b04a85b206cd622a6fb1d9da77.tar.gz rockbox-aaa9a2cceedf45b04a85b206cd622a6fb1d9da77.zip |
h1x0/h300: clean up the bootloader source a bit
First this removes most of the conditionals for the CPP as they
are always true for the targets that use the bootloader source.
Second this moves some global variable references around to reduce
some redundancy in the h1x0 bootloader source.
All of this is done to make it easier to compare the two bootloaders
as they are very heavily related to each other.
Change-Id: I7eb4a3106fb9fce6059797310d9e053a3d3ecf63
Diffstat (limited to 'bootloader/iriver_h1x0.c')
-rw-r--r-- | bootloader/iriver_h1x0.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/bootloader/iriver_h1x0.c b/bootloader/iriver_h1x0.c index e744b642b0..168bd29b67 100644 --- a/bootloader/iriver_h1x0.c +++ b/bootloader/iriver_h1x0.c | |||
@@ -57,6 +57,10 @@ | |||
57 | 57 | ||
58 | #define DRAM_START 0x31000000 | 58 | #define DRAM_START 0x31000000 |
59 | 59 | ||
60 | /* From common.c */ | ||
61 | extern int line; | ||
62 | extern int remote_line; | ||
63 | |||
60 | #ifdef HAVE_EEPROM_SETTINGS | 64 | #ifdef HAVE_EEPROM_SETTINGS |
61 | static bool recovery_mode = false; | 65 | static bool recovery_mode = false; |
62 | #endif | 66 | #endif |
@@ -89,7 +93,6 @@ void start_firmware(void) | |||
89 | asm(" jmp (%a0)"); | 93 | asm(" jmp (%a0)"); |
90 | } | 94 | } |
91 | 95 | ||
92 | #ifdef IRIVER_H100_SERIES | ||
93 | void start_flashed_romimage(void) | 96 | void start_flashed_romimage(void) |
94 | { | 97 | { |
95 | uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY; | 98 | uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY; |
@@ -134,7 +137,6 @@ void start_flashed_ramimage(void) | |||
134 | /* Failure */ | 137 | /* Failure */ |
135 | power_off(); | 138 | power_off(); |
136 | } | 139 | } |
137 | #endif /* IRIVER_H100_SERIES */ | ||
138 | 140 | ||
139 | void shutdown(void) | 141 | void shutdown(void) |
140 | { | 142 | { |
@@ -159,9 +161,7 @@ void shutdown(void) | |||
159 | 161 | ||
160 | /* Backlight OFF */ | 162 | /* Backlight OFF */ |
161 | backlight_hw_off(); | 163 | backlight_hw_off(); |
162 | #ifdef HAVE_REMOTE_LCD | ||
163 | remote_backlight_hw_off(); | 164 | remote_backlight_hw_off(); |
164 | #endif | ||
165 | 165 | ||
166 | __reset_cookie(); | 166 | __reset_cookie(); |
167 | power_off(); | 167 | power_off(); |
@@ -252,7 +252,6 @@ void failsafe_menu(void) | |||
252 | int defopt = -1; | 252 | int defopt = -1; |
253 | char buf[32]; | 253 | char buf[32]; |
254 | int i; | 254 | int i; |
255 | extern int line; | ||
256 | 255 | ||
257 | reset_screen(); | 256 | reset_screen(); |
258 | printf("Bootloader %s", rbversion); | 257 | printf("Bootloader %s", rbversion); |
@@ -362,18 +361,14 @@ void failsafe_menu(void) | |||
362 | -> RESET signal */ | 361 | -> RESET signal */ |
363 | inline static void __uda1380_reset_hi(void) | 362 | inline static void __uda1380_reset_hi(void) |
364 | { | 363 | { |
365 | #ifdef HAVE_UDA1380 | ||
366 | or_l(1<<29, &GPIO_OUT); | 364 | or_l(1<<29, &GPIO_OUT); |
367 | or_l(1<<29, &GPIO_ENABLE); | 365 | or_l(1<<29, &GPIO_ENABLE); |
368 | or_l(1<<29, &GPIO_FUNCTION); | 366 | or_l(1<<29, &GPIO_FUNCTION); |
369 | #endif | ||
370 | } | 367 | } |
371 | 368 | ||
372 | inline static void __uda1380_reset_lo(void) | 369 | inline static void __uda1380_reset_lo(void) |
373 | { | 370 | { |
374 | #ifdef HAVE_UDA1380 | ||
375 | and_l(~(1<<29), &GPIO_OUT); | 371 | and_l(~(1<<29), &GPIO_OUT); |
376 | #endif | ||
377 | } | 372 | } |
378 | 373 | ||
379 | void main(void) | 374 | void main(void) |
@@ -385,8 +380,6 @@ void main(void) | |||
385 | bool rec_button = false; | 380 | bool rec_button = false; |
386 | bool hold_status = false; | 381 | bool hold_status = false; |
387 | int data; | 382 | int data; |
388 | extern int line; /* From common.c */ | ||
389 | extern int remote_line; /* From common.c */ | ||
390 | 383 | ||
391 | /* We want to read the buttons as early as possible, before the user | 384 | /* We want to read the buttons as early as possible, before the user |
392 | releases the ON button */ | 385 | releases the ON button */ |
@@ -422,22 +415,16 @@ void main(void) | |||
422 | backlight_hw_off(); | 415 | backlight_hw_off(); |
423 | 416 | ||
424 | /* Remote backlight ON */ | 417 | /* Remote backlight ON */ |
425 | #ifdef HAVE_REMOTE_LCD | ||
426 | remote_backlight_hw_on(); | 418 | remote_backlight_hw_on(); |
427 | #endif | ||
428 | 419 | ||
429 | system_init(); | 420 | system_init(); |
430 | kernel_init(); | 421 | kernel_init(); |
431 | 422 | ||
432 | __uda1380_reset_lo(); | 423 | __uda1380_reset_lo(); |
433 | 424 | ||
434 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
435 | /* Set up waitstates for the peripherals */ | 425 | /* Set up waitstates for the peripherals */ |
436 | set_cpu_frequency(0); /* PLL off */ | 426 | set_cpu_frequency(0); /* PLL off */ |
437 | #ifdef CPU_COLDFIRE | ||
438 | coldfire_set_pllcr_audio_bits(DEFAULT_PLLCR_AUDIO_BITS); | 427 | coldfire_set_pllcr_audio_bits(DEFAULT_PLLCR_AUDIO_BITS); |
439 | #endif | ||
440 | #endif | ||
441 | enable_irq(); | 428 | enable_irq(); |
442 | 429 | ||
443 | #ifdef HAVE_EEPROM_SETTINGS | 430 | #ifdef HAVE_EEPROM_SETTINGS |
@@ -547,10 +534,8 @@ void main(void) | |||
547 | lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT-h)/2, msg); | 534 | lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT-h)/2, msg); |
548 | lcd_update(); | 535 | lcd_update(); |
549 | 536 | ||
550 | #ifdef HAVE_REMOTE_LCD | ||
551 | lcd_remote_puts(0, 3, msg); | 537 | lcd_remote_puts(0, 3, msg); |
552 | lcd_remote_update(); | 538 | lcd_remote_update(); |
553 | #endif | ||
554 | 539 | ||
555 | #ifdef HAVE_EEPROM_SETTINGS | 540 | #ifdef HAVE_EEPROM_SETTINGS |
556 | if (firmware_settings.initialized) | 541 | if (firmware_settings.initialized) |
@@ -608,7 +593,7 @@ void main(void) | |||
608 | 593 | ||
609 | printf("Loading firmware"); | 594 | printf("Loading firmware"); |
610 | i = load_firmware((unsigned char *)DRAM_START, BOOTFILE, MAX_LOADSIZE); | 595 | i = load_firmware((unsigned char *)DRAM_START, BOOTFILE, MAX_LOADSIZE); |
611 | if(i < 0) | 596 | if(i <= EFILE_EMPTY) |
612 | printf("Error: %s", loader_strerror(i)); | 597 | printf("Error: %s", loader_strerror(i)); |
613 | 598 | ||
614 | if (i > 0) | 599 | if (i > 0) |