summaryrefslogtreecommitdiff
path: root/bootloader/x1000.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/x1000.c')
-rw-r--r--bootloader/x1000.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/bootloader/x1000.c b/bootloader/x1000.c
index 8b1dae3050..1c9f3cd2fa 100644
--- a/bootloader/x1000.c
+++ b/bootloader/x1000.c
@@ -56,15 +56,8 @@
56#include <stdio.h> 56#include <stdio.h>
57#include <stdarg.h> 57#include <stdarg.h>
58 58
59void init_lcd(void);
60void init_usb(void);
61int init_disk(void);
62
63void usb_mode(void);
64
65/* Flags to indicate if hardware was already initialized */ 59/* Flags to indicate if hardware was already initialized */
66bool usb_inited = false; 60bool usb_inited = false;
67bool disk_inited = false;
68 61
69/* Set to true if a SYS_USB_CONNECTED event is seen 62/* Set to true if a SYS_USB_CONNECTED event is seen
70 * Set to false if a SYS_USB_DISCONNECTED event is seen */ 63 * Set to false if a SYS_USB_DISCONNECTED event is seen */
@@ -80,26 +73,6 @@ void init_usb(void)
80 usb_inited = true; 73 usb_inited = true;
81} 74}
82 75
83int init_disk(void)
84{
85 if(disk_inited)
86 return 0;
87
88 while(!storage_present(IF_MD(0))) {
89 splash2(0, "Insert SD card", "Press " BL_QUIT_NAME " for recovery");
90 if(get_button(HZ/4) == BL_QUIT)
91 return -1;
92 }
93
94 if(disk_mount_all() <= 0) {
95 splash(5*HZ, "Cannot mount disk");
96 return -1;
97 }
98
99 disk_inited = true;
100 return 0;
101}
102
103void usb_mode(void) 76void usb_mode(void)
104{ 77{
105 init_usb(); 78 init_usb();
@@ -137,6 +110,11 @@ void main(void)
137 110
138 filesystem_init(); 111 filesystem_init();
139 112
113 /* It's OK if this doesn't mount anything. Any disk access should
114 * be guarded by a call to check_disk() to see if the disk is really
115 * present, blocking with an "insert SD card" prompt if appropriate. */
116 disk_mount_all();
117
140 /* If USB booting, the user probably needs to enter recovery mode; 118 /* If USB booting, the user probably needs to enter recovery mode;
141 * let's not force them to hold down the recovery key. */ 119 * let's not force them to hold down the recovery key. */
142 bool recovery_mode = get_boot_flag(BOOT_FLAG_USB_BOOT); 120 bool recovery_mode = get_boot_flag(BOOT_FLAG_USB_BOOT);