summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-12-29 10:37:47 -0500
committerSolomon Peachy <pizza@shaftnet.org>2019-01-02 05:01:50 +0100
commit7e7ca0c85847e0b7eff094710cc5167df4e852da (patch)
tree74d8535926085b87e627f48cd9bae1309abffe51 /bootloader
parent35930ddb8d0c704abeb7619d9b6fc59b9dd6b909 (diff)
downloadrockbox-7e7ca0c85847e0b7eff094710cc5167df4e852da.tar.gz
rockbox-7e7ca0c85847e0b7eff094710cc5167df4e852da.tar.bz2
rockbox-7e7ca0c85847e0b7eff094710cc5167df4e852da.zip
Fix Xduoo X3 bootloader build, and silence all warnings.
Also enable USB bootloader mode Change-Id: I73224c2e694b9941993c89a114b48d2a907e0dfb
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/xduoox3.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/bootloader/xduoox3.c b/bootloader/xduoox3.c
index 3db87a866d..d38639bfd4 100644
--- a/bootloader/xduoox3.c
+++ b/bootloader/xduoox3.c
@@ -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 */