diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-15 19:40:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch) | |
tree | 98ec96946eeb2ae709cb0528cc6998e21bb9b290 /firmware/rolo.c | |
parent | 17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff) | |
download | rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip |
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets
Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'firmware/rolo.c')
-rw-r--r-- | firmware/rolo.c | 113 |
1 files changed, 2 insertions, 111 deletions
diff --git a/firmware/rolo.c b/firmware/rolo.c index 1d164b4668..9a527e9074 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -123,10 +123,7 @@ static void rolo_error(const char *text) | |||
123 | lcd_scroll_stop(); | 123 | lcd_scroll_stop(); |
124 | } | 124 | } |
125 | 125 | ||
126 | #if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX | 126 | #if CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX |
127 | /* these are in assembler file "descramble.S" for SH7034 */ | ||
128 | extern unsigned short descramble(const unsigned char* source, | ||
129 | unsigned char* dest, int length); | ||
130 | /* this is in firmware/target/arm/imx31/rolo_restart.c for IMX31 */ | 127 | /* this is in firmware/target/arm/imx31/rolo_restart.c for IMX31 */ |
131 | /* this is in firmware/target/arm/rk27xx/rolo_restart.c for rk27xx */ | 128 | /* this is in firmware/target/arm/rk27xx/rolo_restart.c for rk27xx */ |
132 | extern void rolo_restart(const unsigned char* source, unsigned char* dest, | 129 | extern void rolo_restart(const unsigned char* source, unsigned char* dest, |
@@ -299,113 +296,7 @@ int rolo_load(const char* filename) | |||
299 | /* never reached */ | 296 | /* never reached */ |
300 | return 0; | 297 | return 0; |
301 | } | 298 | } |
302 | #else /* defined(CPU_SH) */ | 299 | #endif /* CPU_COLDFIRE | CPU_ARM | CPU_MIPS */ |
303 | int rolo_load(const char* filename) | ||
304 | { | ||
305 | int fd; | ||
306 | long length; | ||
307 | long file_length; | ||
308 | unsigned short checksum,file_checksum; | ||
309 | unsigned char* ramstart = (void*)&loadaddress; | ||
310 | unsigned char* filebuf; | ||
311 | size_t filebuf_size; | ||
312 | |||
313 | lcd_clear_display(); | ||
314 | lcd_puts(0, 0, "ROLO..."); | ||
315 | lcd_puts(0, 1, "Loading"); | ||
316 | lcd_update(); | ||
317 | #ifdef HAVE_REMOTE_LCD | ||
318 | lcd_remote_clear_display(); | ||
319 | lcd_remote_puts(0, 0, "ROLO..."); | ||
320 | lcd_remote_puts(0, 1, "Loading"); | ||
321 | lcd_remote_update(); | ||
322 | #endif | ||
323 | |||
324 | audio_stop(); | ||
325 | |||
326 | fd = open(filename, O_RDONLY); | ||
327 | if(-1 == fd) { | ||
328 | rolo_error("File not found"); | ||
329 | return -1; | ||
330 | } | ||
331 | |||
332 | length = filesize(fd) - FIRMWARE_OFFSET_FILE_DATA; | ||
333 | |||
334 | /* get the system buffer. release only in case of error, otherwise | ||
335 | * we don't return anyway */ | ||
336 | rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL); | ||
337 | filebuf = core_get_data(rolo_handle); | ||
338 | |||
339 | /* Read file length from header and compare to real file length */ | ||
340 | lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET); | ||
341 | if(read(fd, &file_length, 4) != 4) { | ||
342 | rolo_error("Error Reading File Length"); | ||
343 | return -1; | ||
344 | } | ||
345 | if (length != file_length) { | ||
346 | rolo_error("File length mismatch"); | ||
347 | return -1; | ||
348 | } | ||
349 | |||
350 | /* Read and save checksum */ | ||
351 | lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); | ||
352 | if (read(fd, &file_checksum, 2) != 2) { | ||
353 | rolo_error("Error Reading checksum"); | ||
354 | return -1; | ||
355 | } | ||
356 | lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET); | ||
357 | |||
358 | /* verify that file can be read and descrambled */ | ||
359 | if ((size_t)((2*length)+4) >= filebuf_size) { | ||
360 | rolo_error("Not enough room to load file"); | ||
361 | return -1; | ||
362 | } | ||
363 | |||
364 | if (read(fd, &filebuf[length], length) != (int)length) { | ||
365 | rolo_error("Error Reading File"); | ||
366 | return -1; | ||
367 | } | ||
368 | |||
369 | lcd_puts(0, 1, "Descramble"); | ||
370 | lcd_update(); | ||
371 | |||
372 | checksum = descramble(filebuf + length, filebuf, length); | ||
373 | |||
374 | /* Verify checksum against file header */ | ||
375 | if (checksum != file_checksum) { | ||
376 | rolo_error("Checksum Error"); | ||
377 | return -1; | ||
378 | } | ||
379 | |||
380 | #ifdef HAVE_STORAGE_FLUSH | ||
381 | lcd_puts(0, 1, "Flushing "); | ||
382 | lcd_update(); | ||
383 | storage_flush(); | ||
384 | #endif | ||
385 | |||
386 | lcd_puts(0, 1, "Executing "); | ||
387 | lcd_update(); | ||
388 | |||
389 | set_irq_level(HIGHEST_IRQ_LEVEL); | ||
390 | |||
391 | /* Calling these 2 initialization routines was necessary to get the | ||
392 | the origional Archos version of the firmware to load and execute. */ | ||
393 | system_init(); /* Initialize system for restart */ | ||
394 | i2c_init(); /* Init i2c bus - it seems like a good idea */ | ||
395 | ICR = IRQ0_EDGE_TRIGGER; /* Make IRQ0 edge triggered */ | ||
396 | TSTR = 0xE0; /* disable all timers */ | ||
397 | /* model-specific de-init, needed when flashed */ | ||
398 | /* Especially the Archos software is picky about this */ | ||
399 | #if defined(ARCHOS_RECORDER) || defined(ARCHOS_RECORDERV2) || \ | ||
400 | defined(ARCHOS_FMRECORDER) | ||
401 | PAIOR = 0x0FA0; | ||
402 | #endif | ||
403 | rolo_restart(filebuf, ramstart, length); | ||
404 | |||
405 | return 0; /* this is never reached */ | ||
406 | (void)checksum; (void)file_checksum; | ||
407 | } | ||
408 | #endif /* */ | ||
409 | #else /* !defined(IRIVER_IFP7XX_SERIES) */ | 300 | #else /* !defined(IRIVER_IFP7XX_SERIES) */ |
410 | int rolo_load(const char* filename) | 301 | int rolo_load(const char* filename) |
411 | { | 302 | { |