diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/xduoox3.c | 34 |
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 @@ | |||
44 | extern void show_logo(void); | 44 | extern void show_logo(void); |
45 | extern void power_off(void); | 45 | extern void power_off(void); |
46 | 46 | ||
47 | #ifdef HAVE_BOOTLOADER_USB_MODE | ||
47 | static void show_splash(int timeout, const char *msg) | 48 | static void show_splash(int timeout, const char *msg) |
48 | { | 49 | { |
49 | reset_screen(); | 50 | reset_screen(); |
@@ -88,6 +89,7 @@ static void usb_mode(void) | |||
88 | } | 89 | } |
89 | } | 90 | } |
90 | } | 91 | } |
92 | #endif | ||
91 | 93 | ||
92 | static int boot_rockbox(void) | 94 | static int boot_rockbox(void) |
93 | { | 95 | { |
@@ -95,11 +97,17 @@ static int boot_rockbox(void) | |||
95 | void (*kernel_entry)(void); | 97 | void (*kernel_entry)(void); |
96 | 98 | ||
97 | printf("Mounting disk...\n"); | 99 | printf("Mounting disk...\n"); |
98 | rc = disk_mount_all(); | 100 | |
99 | if (rc <= 0) | 101 | while((rc = disk_mount_all()) <= 0) |
100 | { | 102 | { |
101 | verbose = true; | 103 | verbose = true; |
102 | error(EDISK,rc, true); | 104 | #ifdef HAVE_BOOTLOADER_USB_MODE |
105 | error(EDISK, rc, false); | ||
106 | usb_start_monitoring(); | ||
107 | usb_mode(); | ||
108 | #else | ||
109 | error(EDISK, rc, true); | ||
110 | #endif | ||
103 | } | 111 | } |
104 | 112 | ||
105 | printf("Loading firmware...\n"); | 113 | printf("Loading firmware...\n"); |
@@ -119,6 +127,7 @@ static int boot_rockbox(void) | |||
119 | } | 127 | } |
120 | } | 128 | } |
121 | 129 | ||
130 | #if 0 | ||
122 | static void reset_configuration(void) | 131 | static void reset_configuration(void) |
123 | { | 132 | { |
124 | int rc; | 133 | int rc; |
@@ -135,6 +144,7 @@ static void reset_configuration(void) | |||
135 | else | 144 | else |
136 | show_splash(HZ/2, "Couldn't reset configuration!"); | 145 | show_splash(HZ/2, "Couldn't reset configuration!"); |
137 | } | 146 | } |
147 | #endif | ||
138 | 148 | ||
139 | int main(void) | 149 | int main(void) |
140 | { | 150 | { |
@@ -151,8 +161,6 @@ int main(void) | |||
151 | 161 | ||
152 | show_logo(); | 162 | show_logo(); |
153 | 163 | ||
154 | filesystem_init(); | ||
155 | |||
156 | rc = storage_init(); | 164 | rc = storage_init(); |
157 | if(rc) | 165 | if(rc) |
158 | { | 166 | { |
@@ -160,6 +168,22 @@ int main(void) | |||
160 | error(EATA, rc, true); | 168 | error(EATA, rc, true); |
161 | } | 169 | } |
162 | 170 | ||
171 | filesystem_init(); | ||
172 | |||
173 | #ifdef HAVE_BOOTLOADER_USB_MODE | ||
174 | button_init_device(); | ||
175 | int btn = button_read_device(); | ||
176 | |||
177 | usb_init(); | ||
178 | |||
179 | /* Enter USB mode if USB is plugged and PLAY button is pressed */ | ||
180 | if(btn & BUTTON_PLAY) { | ||
181 | usb_start_monitoring(); | ||
182 | if(usb_detect() == USB_INSERTED) | ||
183 | usb_mode(); | ||
184 | } | ||
185 | #endif /* HAVE_BOOTLOADER_USB_MODE */ | ||
186 | |||
163 | /* Don't mount the disks yet, there could be file system/partition errors | 187 | /* Don't mount the disks yet, there could be file system/partition errors |
164 | which are fixable in USB mode */ | 188 | which are fixable in USB mode */ |
165 | 189 | ||