h1x0/h300: remove trailing whitespace from bootloaders

Change-Id: I8f3bfbc8287c8f520894e0cd258066d4c7a02197
This commit is contained in:
James Buren 2020-11-14 14:16:42 +00:00
parent 5a223080fa
commit 37eabbfe51
2 changed files with 72 additions and 72 deletions

View file

@ -94,21 +94,21 @@ void start_flashed_romimage(void)
{ {
uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY; uint8_t *src = (uint8_t *)FLASH_ROMIMAGE_ENTRY;
int *reset_vector; int *reset_vector;
if (!detect_flashed_romimage()) if (!detect_flashed_romimage())
return ; return ;
reset_vector = (int *)(&src[sizeof(struct flash_header)+4]); reset_vector = (int *)(&src[sizeof(struct flash_header)+4]);
asm(" move.w #0x2700,%sr"); asm(" move.w #0x2700,%sr");
__reset_cookie(); __reset_cookie();
asm(" move.l %0,%%d0" :: "i"(DRAM_START)); asm(" move.l %0,%%d0" :: "i"(DRAM_START));
asm(" movec.l %d0,%vbr"); asm(" movec.l %d0,%vbr");
asm(" move.l %0,%%sp" :: "m"(reset_vector[0])); asm(" move.l %0,%%sp" :: "m"(reset_vector[0]));
asm(" move.l %0,%%a0" :: "m"(reset_vector[1])); asm(" move.l %0,%%a0" :: "m"(reset_vector[1]));
asm(" jmp (%a0)"); asm(" jmp (%a0)");
/* Failure */ /* Failure */
power_off(); power_off();
} }
@ -121,14 +121,14 @@ void start_flashed_ramimage(void)
if (!detect_flashed_ramimage()) if (!detect_flashed_ramimage())
return; return;
/* Load firmware from flash */ /* Load firmware from flash */
cpu_boost(true); cpu_boost(true);
memcpy(&hdr, src, sizeof(struct flash_header)); memcpy(&hdr, src, sizeof(struct flash_header));
src += sizeof(struct flash_header); src += sizeof(struct flash_header);
memcpy(buf, src, hdr.length); memcpy(buf, src, hdr.length);
cpu_boost(false); cpu_boost(false);
start_firmware(); start_firmware();
/* Failure */ /* Failure */
@ -144,25 +144,25 @@ void shutdown(void)
firmware_settings.bl_version = 0; firmware_settings.bl_version = 0;
eeprom_settings_store(); eeprom_settings_store();
#endif #endif
/* We need to gracefully spin down the disk to prevent clicks. */ /* We need to gracefully spin down the disk to prevent clicks. */
if (ide_powered()) if (ide_powered())
{ {
/* Make sure ATA has been initialized. */ /* Make sure ATA has been initialized. */
storage_init(); storage_init();
/* And put the disk into sleep immediately. */ /* And put the disk into sleep immediately. */
storage_sleepnow(); storage_sleepnow();
} }
sleep(HZ*2); sleep(HZ*2);
/* Backlight OFF */ /* Backlight OFF */
backlight_hw_off(); backlight_hw_off();
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
remote_backlight_hw_off(); remote_backlight_hw_off();
#endif #endif
__reset_cookie(); __reset_cookie();
power_off(); power_off();
} }
@ -171,14 +171,14 @@ void shutdown(void)
void check_battery(void) void check_battery(void)
{ {
int battery_voltage, batt_int, batt_frac; int battery_voltage, batt_int, batt_frac;
battery_voltage = _battery_voltage(); battery_voltage = _battery_voltage();
batt_int = battery_voltage / 1000; batt_int = battery_voltage / 1000;
batt_frac = (battery_voltage % 1000) / 10; batt_frac = (battery_voltage % 1000) / 10;
printf("Batt: %d.%02dV", batt_int, batt_frac); printf("Batt: %d.%02dV", batt_int, batt_frac);
if (battery_voltage <= 310) if (battery_voltage <= 310)
{ {
printf("WARNING! BATTERY LOW!!"); printf("WARNING! BATTERY LOW!!");
sleep(HZ*2); sleep(HZ*2);
@ -190,13 +190,13 @@ void initialize_eeprom(void)
{ {
if (detect_original_firmware()) if (detect_original_firmware())
return ; return ;
if (!eeprom_settings_init()) if (!eeprom_settings_init())
{ {
recovery_mode = true; recovery_mode = true;
return ; return ;
} }
/* If bootloader version has not been reset, disk might /* If bootloader version has not been reset, disk might
* not be intact. */ * not be intact. */
if (firmware_settings.bl_version || !firmware_settings.disk_clean) if (firmware_settings.bl_version || !firmware_settings.disk_clean)
@ -204,7 +204,7 @@ void initialize_eeprom(void)
firmware_settings.disk_clean = false; firmware_settings.disk_clean = false;
recovery_mode = true; recovery_mode = true;
} }
firmware_settings.bl_version = EEPROM_SETTINGS_BL_MINVER; firmware_settings.bl_version = EEPROM_SETTINGS_BL_MINVER;
eeprom_settings_store(); eeprom_settings_store();
} }
@ -213,33 +213,33 @@ void try_flashboot(void)
{ {
if (!firmware_settings.initialized) if (!firmware_settings.initialized)
return ; return ;
switch (firmware_settings.bootmethod) switch (firmware_settings.bootmethod)
{ {
case BOOT_DISK: case BOOT_DISK:
return; return;
case BOOT_ROM: case BOOT_ROM:
start_flashed_romimage(); start_flashed_romimage();
recovery_mode = true; recovery_mode = true;
break; break;
case BOOT_RAM: case BOOT_RAM:
start_flashed_ramimage(); start_flashed_ramimage();
recovery_mode = true; recovery_mode = true;
break; break;
default: default:
recovery_mode = true; recovery_mode = true;
return; return;
} }
} }
static const char *options[] = { static const char *options[] = {
"Boot from disk", "Boot from disk",
"Boot RAM image", "Boot RAM image",
"Boot ROM image", "Boot ROM image",
"Shutdown" "Shutdown"
}; };
#define FAILSAFE_OPTIONS 4 #define FAILSAFE_OPTIONS 4
@ -253,7 +253,7 @@ void failsafe_menu(void)
char buf[32]; char buf[32];
int i; int i;
extern int line; extern int line;
reset_screen(); reset_screen();
printf("Bootloader %s", rbversion); printf("Bootloader %s", rbversion);
check_battery(); check_battery();
@ -270,7 +270,7 @@ void failsafe_menu(void)
if (defopt < 0 || defopt >= FAILSAFE_OPTIONS) if (defopt < 0 || defopt >= FAILSAFE_OPTIONS)
defopt = option; defopt = option;
} }
while (current_tick - start_tick < TIMEOUT) while (current_tick - start_tick < TIMEOUT)
{ {
/* Draw the menu. */ /* Draw the menu. */
@ -279,27 +279,27 @@ void failsafe_menu(void)
{ {
char *def = "[DEF]"; char *def = "[DEF]";
char *arrow = "->"; char *arrow = "->";
if (i != defopt) if (i != defopt)
def = ""; def = "";
if (i != option) if (i != option)
arrow = " "; arrow = " ";
printf("%s %s %s", arrow, options[i], def); printf("%s %s %s", arrow, options[i], def);
} }
snprintf(buf, sizeof(buf), "Time left: %lds", snprintf(buf, sizeof(buf), "Time left: %lds",
(TIMEOUT - (current_tick - start_tick)) / HZ); (TIMEOUT - (current_tick - start_tick)) / HZ);
lcd_puts(0, 10, buf); lcd_puts(0, 10, buf);
lcd_update(); lcd_update();
button = button_get_w_tmo(HZ); button = button_get_w_tmo(HZ);
if (button == BUTTON_NONE || button & SYS_EVENT) if (button == BUTTON_NONE || button & SYS_EVENT)
continue ; continue ;
start_tick = current_tick; start_tick = current_tick;
/* Ignore the ON/PLAY -button because it can cause trouble /* Ignore the ON/PLAY -button because it can cause trouble
with the RTC alarm mod. */ with the RTC alarm mod. */
switch (button & ~(BUTTON_ON)) switch (button & ~(BUTTON_ON))
{ {
@ -308,7 +308,7 @@ void failsafe_menu(void)
if (option > 0) if (option > 0)
option--; option--;
break ; break ;
case BUTTON_DOWN: case BUTTON_DOWN:
case BUTTON_RC_FF: case BUTTON_RC_FF:
if (option < FAILSAFE_OPTIONS-1) if (option < FAILSAFE_OPTIONS-1)
@ -318,7 +318,7 @@ void failsafe_menu(void)
case BUTTON_SELECT: case BUTTON_SELECT:
case BUTTON_RC_ON: case BUTTON_RC_ON:
goto execute; goto execute;
case BUTTON_REC: case BUTTON_REC:
case BUTTON_RC_REC: case BUTTON_RC_REC:
if (firmware_settings.initialized) if (firmware_settings.initialized)
@ -330,9 +330,9 @@ void failsafe_menu(void)
break ; break ;
} }
} }
execute: execute:
lcd_puts(0, 10, "Executing command..."); lcd_puts(0, 10, "Executing command...");
lcd_update(); lcd_update();
sleep(HZ); sleep(HZ);
@ -342,18 +342,18 @@ void failsafe_menu(void)
{ {
case BOOT_DISK: case BOOT_DISK:
return ; return ;
case BOOT_RAM: case BOOT_RAM:
start_flashed_ramimage(); start_flashed_ramimage();
printf("Image not found"); printf("Image not found");
break; break;
case BOOT_ROM: case BOOT_ROM:
start_flashed_romimage(); start_flashed_romimage();
printf("Image not found"); printf("Image not found");
break; break;
} }
shutdown(); shutdown();
} }
#endif #endif
@ -387,7 +387,7 @@ void main(void)
int data; int data;
extern int line; /* From common.c */ extern int line; /* From common.c */
extern int remote_line; /* From common.c */ extern int remote_line; /* From common.c */
/* We want to read the buttons as early as possible, before the user /* We want to read the buttons as early as possible, before the user
releases the ON button */ releases the ON button */
@ -416,11 +416,11 @@ void main(void)
} }
__uda1380_reset_hi(); __uda1380_reset_hi();
/* Start with the main backlight OFF. */ /* Start with the main backlight OFF. */
backlight_hw_init(); backlight_hw_init();
backlight_hw_off(); backlight_hw_off();
/* Remote backlight ON */ /* Remote backlight ON */
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
remote_backlight_hw_on(); remote_backlight_hw_on();
@ -430,7 +430,7 @@ void main(void)
kernel_init(); kernel_init();
__uda1380_reset_lo(); __uda1380_reset_lo();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
/* Set up waitstates for the peripherals */ /* Set up waitstates for the peripherals */
set_cpu_frequency(0); /* PLL off */ set_cpu_frequency(0); /* PLL off */
@ -443,7 +443,7 @@ void main(void)
#ifdef HAVE_EEPROM_SETTINGS #ifdef HAVE_EEPROM_SETTINGS
initialize_eeprom(); initialize_eeprom();
#endif #endif
usb_init(); usb_init();
/* A small delay after usb_init is necessary to read the I/O port correctly /* A small delay after usb_init is necessary to read the I/O port correctly
(if ports are read _immediately_ after the init). */ (if ports are read _immediately_ after the init). */
@ -451,25 +451,25 @@ void main(void)
adc_init(); adc_init();
button_init(); button_init();
/* Only check remote hold status if remote power button was actually used. */ /* Only check remote hold status if remote power button was actually used. */
if (rc_on_button) if (rc_on_button)
{ {
lcd_remote_init(); lcd_remote_init();
/* Allow the button driver to check the buttons */ /* Allow the button driver to check the buttons */
sleep(HZ/50); sleep(HZ/50);
if (remote_button_hold()) if (remote_button_hold())
hold_status = true; hold_status = true;
} }
/* Check main hold switch status too. */ /* Check main hold switch status too. */
if (on_button && button_hold()) if (on_button && button_hold())
{ {
hold_status = true; hold_status = true;
} }
/* Power on the hard drive early, to speed up the loading. */ /* Power on the hard drive early, to speed up the loading. */
if (!hold_status if (!hold_status
# ifdef HAVE_EEPROM_SETTINGS # ifdef HAVE_EEPROM_SETTINGS
@ -479,7 +479,7 @@ void main(void)
{ {
ide_power_enable(true); ide_power_enable(true);
} }
# ifdef HAVE_EEPROM_SETTINGS # ifdef HAVE_EEPROM_SETTINGS
if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode)
try_flashboot(); try_flashboot();
@ -496,11 +496,11 @@ void main(void)
remote display here. */ remote display here. */
if (remote_detect()) if (remote_detect())
lcd_remote_on(); lcd_remote_on();
font_init(); font_init();
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
printf("Rockbox boot loader"); printf("Rockbox boot loader");
printf("Version %s", rbversion); printf("Version %s", rbversion);
@ -524,7 +524,7 @@ void main(void)
printf("Hold switch on"); printf("Hold switch on");
shutdown(); shutdown();
} }
#ifdef HAVE_EEPROM_SETTINGS #ifdef HAVE_EEPROM_SETTINGS
failsafe_menu(); failsafe_menu();
#endif #endif
@ -570,7 +570,7 @@ void main(void)
line = 0; line = 0;
remote_line = 0; remote_line = 0;
check_battery(); check_battery();
storage_spin(); /* Prevent the drive from spinning down */ storage_spin(); /* Prevent the drive from spinning down */
sleep(HZ); sleep(HZ);
@ -642,9 +642,9 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation)
static unsigned short utf16_buf[SCROLL_LINE_SIZE]; static unsigned short utf16_buf[SCROLL_LINE_SIZE];
unsigned short *target; unsigned short *target;
(void)orientation; (void)orientation;
target = utf16_buf; target = utf16_buf;
while (*str) while (*str)
str = utf8decode(str, target++); str = utf8decode(str, target++);
*target = 0; *target = 0;

View file

@ -89,22 +89,22 @@ void start_firmware(void)
void shutdown(void) void shutdown(void)
{ {
printf("Shutting down..."); printf("Shutting down...");
/* We need to gracefully spin down the disk to prevent clicks. */ /* We need to gracefully spin down the disk to prevent clicks. */
if (ide_powered()) if (ide_powered())
{ {
/* Make sure ATA has been initialized. */ /* Make sure ATA has been initialized. */
storage_init(); storage_init();
/* And put the disk into sleep immediately. */ /* And put the disk into sleep immediately. */
storage_sleepnow(); storage_sleepnow();
} }
sleep(HZ*2); sleep(HZ*2);
backlight_hw_off(); backlight_hw_off();
remote_backlight_hw_off(); remote_backlight_hw_off();
__reset_cookie(); __reset_cookie();
power_off(); power_off();
} }
@ -113,14 +113,14 @@ void shutdown(void)
void check_battery(void) void check_battery(void)
{ {
int battery_voltage, batt_int, batt_frac; int battery_voltage, batt_int, batt_frac;
battery_voltage = _battery_voltage(); battery_voltage = _battery_voltage();
batt_int = battery_voltage / 1000; batt_int = battery_voltage / 1000;
batt_frac = (battery_voltage % 1000) / 10; batt_frac = (battery_voltage % 1000) / 10;
printf("Batt: %d.%02dV", batt_int, batt_frac); printf("Batt: %d.%02dV", batt_int, batt_frac);
if (battery_voltage <= 310) if (battery_voltage <= 310)
{ {
printf("WARNING! BATTERY LOW!!"); printf("WARNING! BATTERY LOW!!");
sleep(HZ*2); sleep(HZ*2);
@ -131,7 +131,7 @@ void check_battery(void)
extern unsigned char pcf50606_intregs[3]; extern unsigned char pcf50606_intregs[3];
/* From common.c */ /* From common.c */
extern int line; extern int line;
extern int remote_line; extern int remote_line;
void main(void) void main(void)
@ -187,7 +187,7 @@ void main(void)
/* Start with the main backlight OFF. */ /* Start with the main backlight OFF. */
backlight_hw_init(); backlight_hw_init();
backlight_hw_off(); backlight_hw_off();
remote_backlight_hw_on(); remote_backlight_hw_on();
system_init(); system_init();
@ -202,7 +202,7 @@ void main(void)
adc_init(); adc_init();
button_init(); button_init();
lcd_init(); lcd_init();
lcd_remote_init(); lcd_remote_init();
font_init(); font_init();
@ -222,7 +222,7 @@ void main(void)
if(rtc_alarm) if(rtc_alarm)
printf("RTC alarm detected"); printf("RTC alarm detected");
/* Don't start if the Hold button is active on the device you /* Don't start if the Hold button is active on the device you
are starting with */ are starting with */
if ((on_button && button_hold()) || if ((on_button && button_hold()) ||
@ -230,7 +230,7 @@ void main(void)
{ {
hold_status = true; hold_status = true;
} }
if (hold_status && !rtc_alarm && (usb_detect() != USB_INSERTED) && if (hold_status && !rtc_alarm && (usb_detect() != USB_INSERTED) &&
!charger_inserted()) !charger_inserted())
{ {
if (detect_original_firmware()) if (detect_original_firmware())
@ -264,7 +264,7 @@ void main(void)
bool request_start = false; bool request_start = false;
cpu_idle_mode(true); cpu_idle_mode(true);
while(charger_inserted() && !request_start) while(charger_inserted() && !request_start)
{ {
button = button_get_w_tmo(HZ); button = button_get_w_tmo(HZ);
@ -274,7 +274,7 @@ void main(void)
case BUTTON_ON: case BUTTON_ON:
request_start = true; request_start = true;
break; break;
case BUTTON_NONE: /* Timeout */ case BUTTON_NONE: /* Timeout */
if(charging_state()) if(charging_state())
@ -288,7 +288,7 @@ void main(void)
blink_toggle = true; blink_toggle = true;
msg = complete_msg; msg = complete_msg;
} }
font_getstringsize(msg, &w, &h, FONT_SYSFIXED); font_getstringsize(msg, &w, &h, FONT_SYSFIXED);
reset_screen(); reset_screen();
if(blink_toggle) if(blink_toggle)
@ -306,7 +306,7 @@ void main(void)
cpu_idle_mode(false); cpu_idle_mode(false);
} }
usb_init(); usb_init();
/* A hack to enter USB mode without using the USB thread */ /* A hack to enter USB mode without using the USB thread */
@ -333,7 +333,7 @@ void main(void)
line = 0; line = 0;
remote_line = 0; remote_line = 0;
check_battery(); check_battery();
storage_spin(); /* Prevent the drive from spinning down */ storage_spin(); /* Prevent the drive from spinning down */
sleep(HZ); sleep(HZ);
} }
@ -408,9 +408,9 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation)
static unsigned short utf16_buf[SCROLL_LINE_SIZE]; static unsigned short utf16_buf[SCROLL_LINE_SIZE];
unsigned short *target; unsigned short *target;
(void)orientation; (void)orientation;
target = utf16_buf; target = utf16_buf;
while (*str) while (*str)
str = utf8decode(str, target++); str = utf8decode(str, target++);
*target = 0; *target = 0;