summaryrefslogtreecommitdiff
path: root/bootloader/x1000/utils.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-19 13:54:25 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-24 23:40:07 +0000
commitfbe9e4ac10001f931b2f3b9898e3292d36e8cc7c (patch)
treea2508a2e40e21f4591d971e4c3952ada50c59882 /bootloader/x1000/utils.c
parent41a8b874d2f088896cfaebecdff81c4b98f65a2a (diff)
downloadrockbox-fbe9e4ac10001f931b2f3b9898e3292d36e8cc7c.tar.gz
rockbox-fbe9e4ac10001f931b2f3b9898e3292d36e8cc7c.zip
x1000: bootloader: refactor splash/splash2
Allow the use of printf formatting and multiple lines of text using newlines in the string. Change-Id: I65919bf29c16c34c38cf3995e02d2ddbbaa4bdf3
Diffstat (limited to 'bootloader/x1000/utils.c')
-rw-r--r--bootloader/x1000/utils.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/bootloader/x1000/utils.c b/bootloader/x1000/utils.c
index faeab40739..681ddbbd62 100644
--- a/bootloader/x1000/utils.c
+++ b/bootloader/x1000/utils.c
@@ -46,13 +46,13 @@ int check_disk(bool wait)
46 return DISK_ABSENT; 46 return DISK_ABSENT;
47 47
48 while(!storage_present(IF_MD(0))) { 48 while(!storage_present(IF_MD(0))) {
49 splash2(0, "Insert SD card", "Press " BL_QUIT_NAME " to cancel"); 49 splashf(0, "Insert SD card\nPress " BL_QUIT_NAME " to cancel");
50 if(get_button(HZ/4) == BL_QUIT) 50 if(get_button(HZ/4) == BL_QUIT)
51 return DISK_CANCELED; 51 return DISK_CANCELED;
52 } 52 }
53 53
54 /* a lie intended to give time for mounting the disk in the background */ 54 /* a lie intended to give time for mounting the disk in the background */
55 splash(HZ, "Scanning disk"); 55 splashf(HZ, "Scanning disk");
56 56
57 return DISK_PRESENT; 57 return DISK_PRESENT;
58} 58}
@@ -60,19 +60,19 @@ int check_disk(bool wait)
60void usb_mode(void) 60void usb_mode(void)
61{ 61{
62 if(!is_usb_connected) 62 if(!is_usb_connected)
63 splash2(0, "Waiting for USB", "Press " BL_QUIT_NAME " to cancel"); 63 splashf(0, "Waiting for USB\nPress " BL_QUIT_NAME " to cancel");
64 64
65 while(!is_usb_connected) 65 while(!is_usb_connected)
66 if(get_button(TIMEOUT_BLOCK) == BL_QUIT) 66 if(get_button(TIMEOUT_BLOCK) == BL_QUIT)
67 return; 67 return;
68 68
69 splash(0, "USB mode"); 69 splashf(0, "USB mode");
70 usb_acknowledge(SYS_USB_CONNECTED_ACK); 70 usb_acknowledge(SYS_USB_CONNECTED_ACK);
71 71
72 while(is_usb_connected) 72 while(is_usb_connected)
73 get_button(TIMEOUT_BLOCK); 73 get_button(TIMEOUT_BLOCK);
74 74
75 splash(3*HZ, "USB disconnected"); 75 splashf(3*HZ, "USB disconnected");
76} 76}
77 77
78int load_rockbox(const char* filename, size_t* sizep) 78int load_rockbox(const char* filename, size_t* sizep)
@@ -82,7 +82,7 @@ int load_rockbox(const char* filename, size_t* sizep)
82 82
83 int handle = core_alloc_maximum("rockbox", sizep, &buflib_ops_locked); 83 int handle = core_alloc_maximum("rockbox", sizep, &buflib_ops_locked);
84 if(handle < 0) { 84 if(handle < 0) {
85 splash(5*HZ, "Out of memory"); 85 splashf(5*HZ, "Out of memory");
86 return -2; 86 return -2;
87 } 87 }
88 88
@@ -90,7 +90,7 @@ int load_rockbox(const char* filename, size_t* sizep)
90 int rc = load_firmware(loadbuffer, filename, *sizep); 90 int rc = load_firmware(loadbuffer, filename, *sizep);
91 if(rc <= 0) { 91 if(rc <= 0) {
92 core_free(handle); 92 core_free(handle);
93 splash2(5*HZ, "Error loading Rockbox", loader_strerror(rc)); 93 splashf(5*HZ, "Error loading Rockbox\n%s", loader_strerror(rc));
94 return -3; 94 return -3;
95 } 95 }
96 96
@@ -108,13 +108,13 @@ int load_uimage_file(const char* filename,
108 108
109 int fd = open(filename, O_RDONLY); 109 int fd = open(filename, O_RDONLY);
110 if(fd < 0) { 110 if(fd < 0) {
111 splash2(5*HZ, "Can't open file", filename); 111 splashf(5*HZ, "Can't open file\n%s", filename);
112 return -2; 112 return -2;
113 } 113 }
114 114
115 int handle = uimage_load(uh, sizep, uimage_fd_reader, (void*)(intptr_t)fd); 115 int handle = uimage_load(uh, sizep, uimage_fd_reader, (void*)(intptr_t)fd);
116 if(handle <= 0) { 116 if(handle <= 0) {
117 splash2(5*HZ, "Cannot load uImage", filename); 117 splashf(5*HZ, "Cannot load uImage\n%s", filename);
118 return -3; 118 return -3;
119 } 119 }
120 120
@@ -155,7 +155,7 @@ int load_uimage_flash(uint32_t addr, uint32_t length,
155 155
156 nand_lock(n.ndrv); 156 nand_lock(n.ndrv);
157 if(nand_open(n.ndrv) != NAND_SUCCESS) { 157 if(nand_open(n.ndrv) != NAND_SUCCESS) {
158 splash(5*HZ, "NAND open failed"); 158 splashf(5*HZ, "NAND open failed");
159 nand_unlock(n.ndrv); 159 nand_unlock(n.ndrv);
160 return -1; 160 return -1;
161 } 161 }
@@ -166,7 +166,7 @@ int load_uimage_flash(uint32_t addr, uint32_t length,
166 nand_unlock(n.ndrv); 166 nand_unlock(n.ndrv);
167 167
168 if(handle <= 0) { 168 if(handle <= 0) {
169 splash(5*HZ, "uImage load failed"); 169 splashf(5*HZ, "uImage load failed");
170 return -2; 170 return -2;
171 } 171 }
172 172