1
0
Fork 0
forked from len0rd/rockbox

Fix Xduoo X3 bootloader build, and silence all warnings.

Also enable USB bootloader mode

Change-Id: I73224c2e694b9941993c89a114b48d2a907e0dfb
This commit is contained in:
Solomon Peachy 2018-12-29 10:37:47 -05:00
parent 35930ddb8d
commit 7e7ca0c858
4 changed files with 136 additions and 6 deletions

View file

@ -44,6 +44,7 @@
extern void show_logo(void);
extern void power_off(void);
#ifdef HAVE_BOOTLOADER_USB_MODE
static void show_splash(int timeout, const char *msg)
{
reset_screen();
@ -88,6 +89,7 @@ static void usb_mode(void)
}
}
}
#endif
static int boot_rockbox(void)
{
@ -95,11 +97,17 @@ static int boot_rockbox(void)
void (*kernel_entry)(void);
printf("Mounting disk...\n");
rc = disk_mount_all();
if (rc <= 0)
while((rc = disk_mount_all()) <= 0)
{
verbose = true;
error(EDISK,rc, true);
#ifdef HAVE_BOOTLOADER_USB_MODE
error(EDISK, rc, false);
usb_start_monitoring();
usb_mode();
#else
error(EDISK, rc, true);
#endif
}
printf("Loading firmware...\n");
@ -119,6 +127,7 @@ static int boot_rockbox(void)
}
}
#if 0
static void reset_configuration(void)
{
int rc;
@ -135,6 +144,7 @@ static void reset_configuration(void)
else
show_splash(HZ/2, "Couldn't reset configuration!");
}
#endif
int main(void)
{
@ -151,8 +161,6 @@ int main(void)
show_logo();
filesystem_init();
rc = storage_init();
if(rc)
{
@ -160,6 +168,22 @@ int main(void)
error(EATA, rc, true);
}
filesystem_init();
#ifdef HAVE_BOOTLOADER_USB_MODE
button_init_device();
int btn = button_read_device();
usb_init();
/* Enter USB mode if USB is plugged and PLAY button is pressed */
if(btn & BUTTON_PLAY) {
usb_start_monitoring();
if(usb_detect() == USB_INSERTED)
usb_mode();
}
#endif /* HAVE_BOOTLOADER_USB_MODE */
/* Don't mount the disks yet, there could be file system/partition errors
which are fixable in USB mode */