summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-11-14 14:29:18 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-11-14 14:29:18 +0000
commitaaa9a2cceedf45b04a85b206cd622a6fb1d9da77 (patch)
treee993961c0746ed1efd6d5c6a6ebbe976be1d2cd4 /bootloader
parent37eabbfe51e7ed7938c51934921f28cd54a1140d (diff)
downloadrockbox-aaa9a2cceedf45b04a85b206cd622a6fb1d9da77.tar.gz
rockbox-aaa9a2cceedf45b04a85b206cd622a6fb1d9da77.tar.bz2
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')
-rw-r--r--bootloader/iriver_h1x0.c25
-rw-r--r--bootloader/iriver_h300.c11
2 files changed, 10 insertions, 26 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 @@
#define DRAM_START 0x31000000
+/* From common.c */
+extern int line;
+extern int remote_line;
+
#ifdef HAVE_EEPROM_SETTINGS
static bool recovery_mode = false;
#endif
@@ -89,7 +93,6 @@ void start_firmware(void)
asm(" jmp (%a0)");
}
-#ifdef IRIVER_H100_SERIES
void start_flashed_romimage(void)
{
uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY;
@@ -134,7 +137,6 @@ void start_flashed_ramimage(void)
/* Failure */
power_off();
}
-#endif /* IRIVER_H100_SERIES */
void shutdown(void)
{
@@ -159,9 +161,7 @@ void shutdown(void)
/* Backlight OFF */
backlight_hw_off();
-#ifdef HAVE_REMOTE_LCD
remote_backlight_hw_off();
-#endif
__reset_cookie();
power_off();
@@ -252,7 +252,6 @@ void failsafe_menu(void)
int defopt = -1;
char buf[32];
int i;
- extern int line;
reset_screen();
printf("Bootloader %s", rbversion);
@@ -362,18 +361,14 @@ void failsafe_menu(void)
-> RESET signal */
inline static void __uda1380_reset_hi(void)
{
-#ifdef HAVE_UDA1380
or_l(1<<29, &GPIO_OUT);
or_l(1<<29, &GPIO_ENABLE);
or_l(1<<29, &GPIO_FUNCTION);
-#endif
}
inline static void __uda1380_reset_lo(void)
{
-#ifdef HAVE_UDA1380
and_l(~(1<<29), &GPIO_OUT);
-#endif
}
void main(void)
@@ -385,8 +380,6 @@ void main(void)
bool rec_button = false;
bool hold_status = false;
int data;
- extern int line; /* From common.c */
- extern int remote_line; /* From common.c */
/* We want to read the buttons as early as possible, before the user
releases the ON button */
@@ -422,22 +415,16 @@ void main(void)
backlight_hw_off();
/* Remote backlight ON */
-#ifdef HAVE_REMOTE_LCD
remote_backlight_hw_on();
-#endif
system_init();
kernel_init();
__uda1380_reset_lo();
-#ifdef HAVE_ADJUSTABLE_CPU_FREQ
/* Set up waitstates for the peripherals */
set_cpu_frequency(0); /* PLL off */
-#ifdef CPU_COLDFIRE
coldfire_set_pllcr_audio_bits(DEFAULT_PLLCR_AUDIO_BITS);
-#endif
-#endif
enable_irq();
#ifdef HAVE_EEPROM_SETTINGS
@@ -547,10 +534,8 @@ void main(void)
lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT-h)/2, msg);
lcd_update();
-#ifdef HAVE_REMOTE_LCD
lcd_remote_puts(0, 3, msg);
lcd_remote_update();
-#endif
#ifdef HAVE_EEPROM_SETTINGS
if (firmware_settings.initialized)
@@ -608,7 +593,7 @@ void main(void)
printf("Loading firmware");
i = load_firmware((unsigned char *)DRAM_START, BOOTFILE, MAX_LOADSIZE);
- if(i < 0)
+ if(i <= EFILE_EMPTY)
printf("Error: %s", loader_strerror(i));
if (i > 0)
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c
index 4f4baf8cb5..ee344d4165 100644
--- a/bootloader/iriver_h300.c
+++ b/bootloader/iriver_h300.c
@@ -58,6 +58,10 @@
#define DRAM_START 0x31000000
+/* From common.c */
+extern int line;
+extern int remote_line;
+
/* Reset the cookie for the crt0 crash check */
inline void __reset_cookie(void)
{
@@ -130,10 +134,6 @@ void check_battery(void)
/* From the pcf50606 driver */
extern unsigned char pcf50606_intregs[3];
-/* From common.c */
-extern int line;
-extern int remote_line;
-
void main(void)
{
int i;
@@ -144,7 +144,6 @@ void main(void)
bool hold_status = false;
int data;
bool rtc_alarm;
- int button;
int mask;
bool usb_charge = false;
@@ -267,7 +266,7 @@ void main(void)
while(charger_inserted() && !request_start)
{
- button = button_get_w_tmo(HZ);
+ long button = button_get_w_tmo(HZ);
switch(button)
{