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

View file

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