summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/rolo.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/firmware/rolo.c b/firmware/rolo.c
index 6e7b3ba533..0988afbda9 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -45,6 +45,10 @@
45#define FIRMWARE_OFFSET_FILE_DATA 0x200 45#define FIRMWARE_OFFSET_FILE_DATA 0x200
46#endif 46#endif
47 47
48#ifdef RKW_FORMAT
49#include "rkw.h"
50#endif
51
48#if !defined(IRIVER_IFP7XX_SERIES) 52#if !defined(IRIVER_IFP7XX_SERIES)
49/* FIX: this doesn't work on iFP */ 53/* FIX: this doesn't work on iFP */
50 54
@@ -113,11 +117,12 @@ static void rolo_error(const char *text)
113 lcd_stop_scroll(); 117 lcd_stop_scroll();
114} 118}
115 119
116#if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L 120#if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX
117/* these are in assembler file "descramble.S" for SH7034 */ 121/* these are in assembler file "descramble.S" for SH7034 */
118extern unsigned short descramble(const unsigned char* source, 122extern unsigned short descramble(const unsigned char* source,
119 unsigned char* dest, int length); 123 unsigned char* dest, int length);
120/* this is in firmware/target/arm/imx31/rolo_restart.c for IMX31 */ 124/* this is in firmware/target/arm/imx31/rolo_restart.c for IMX31 */
125/* this is in firmware/target/arm/rk27xx/rolo_restart.c for rk27xx */
121extern void rolo_restart(const unsigned char* source, unsigned char* dest, 126extern void rolo_restart(const unsigned char* source, unsigned char* dest,
122 int length); 127 int length);
123#else 128#else
@@ -197,10 +202,67 @@ extern unsigned long loadaddress;
197 202
198/*************************************************************************** 203/***************************************************************************
199 * 204 *
200 * Name: rolo_load_app(char *filename,int scrambled) 205 * Name: rolo_load(const char *filename)
201 * Filename must be a fully defined filename including the path and extension 206 * Filename must be a fully defined filename including the path and extension
202 * 207 *
203 ***************************************************************************/ 208 ***************************************************************************/
209#ifdef RKW_FORMAT
210int rolo_load(const char* filename)
211{
212 unsigned char* ramstart = (void*)&loadaddress;
213 unsigned char* filebuf;
214 size_t filebuf_size;
215 int errno, length;
216
217 lcd_clear_display();
218 lcd_puts(0, 0, "ROLO...");
219 lcd_puts(0, 1, "Loading");
220 lcd_update();
221#ifdef HAVE_REMOTE_LCD
222 lcd_remote_clear_display();
223 lcd_remote_puts(0, 0, "ROLO...");
224 lcd_remote_puts(0, 1, "Loading");
225 lcd_remote_update();
226#endif
227
228 audio_stop();
229
230 /* get the system buffer. release only in case of error, otherwise
231 * we don't return anyway */
232 rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL);
233 filebuf = core_get_data(rolo_handle);
234
235 errno = load_rkw(filebuf, filename, filebuf_size);
236 if (errno < 0)
237 {
238 rolo_error(rkw_strerror(errno));
239 return -1;
240 }
241 else
242 length = errno;
243
244#ifdef HAVE_STORAGE_FLUSH
245 lcd_puts(0, 1, "Flushing storage buffers");
246 lcd_update();
247 storage_flush();
248#endif
249
250 lcd_puts(0, 1, "Executing");
251 lcd_update();
252#ifdef HAVE_REMOTE_LCD
253 lcd_remote_puts(0, 1, "Executing");
254 lcd_remote_update();
255#endif
256 adc_close();
257
258 disable_interrupt(IRQ_FIQ_STATUS);
259
260 rolo_restart(filebuf, ramstart, length);
261
262 /* never reached */
263 return 0;
264}
265#else
204int rolo_load(const char* filename) 266int rolo_load(const char* filename)
205{ 267{
206 int fd; 268 int fd;
@@ -395,6 +457,7 @@ int rolo_load(const char* filename)
395 return 0; /* this is never reached */ 457 return 0; /* this is never reached */
396 (void)checksum; (void)file_checksum; 458 (void)checksum; (void)file_checksum;
397} 459}
460#endif /* ifdef RKW_FORMAT */
398#else /* !defined(IRIVER_IFP7XX_SERIES) */ 461#else /* !defined(IRIVER_IFP7XX_SERIES) */
399int rolo_load(const char* filename) 462int rolo_load(const char* filename)
400{ 463{