1
0
Fork 0
forked from len0rd/rockbox

RoLo now works on the iRiver

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6238 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-03-31 08:47:02 +00:00
parent e996e2ff91
commit bd42d31e5e
13 changed files with 106 additions and 28 deletions

View file

@ -39,8 +39,10 @@
#include "rolo.h"
#include "sprintf.h"
#ifndef SIMULATOR
static int boot_size = 0;
static int boot_cluster;
#endif
extern bool boot_changed;
int ft_build_playlist(struct tree_context* c, int start_index)
@ -241,6 +243,7 @@ int ft_load(struct tree_context* c, const char* tempdir)
if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) )
dptr->attr |= filetype_get_attr(entry->d_name);
#ifndef SIMULATOR
/* memorize/compare details about the boot file */
if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) {
if (boot_size) {
@ -251,7 +254,8 @@ int ft_load(struct tree_context* c, const char* tempdir)
boot_size = entry->size;
boot_cluster = entry->startcluster;
}
#endif
/* filter out non-visible files */
if (!(dptr->attr & ATTR_DIRECTORY) && (
(*c->dirfilter == SHOW_PLAYLIST &&

View file

@ -81,11 +81,7 @@ const struct filetype filetypes[] = {
#endif
{ ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK },
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP
{ ".ajz", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
#else
{ ".mod", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
#endif
{ BOOTFILE_EXT, TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
#endif /* #ifndef SIMULATOR */
};

View file

@ -113,12 +113,6 @@
#endif
#ifdef HAVE_LCD_BITMAP
#define BOOTFILE "ajbrec.ajz"
#else
#define BOOTFILE "archos.mod"
#endif
struct entry {
short attr; /* FAT attributes + file type flags */
unsigned long time_write; /* Last write time */

View file

@ -139,6 +139,8 @@ SECTIONS
{
.vectors :
{
loadaddress = .;
_loadaddress = .;
*(.resetvectors);
*(.vectors);
} > DRAM

View file

@ -78,4 +78,7 @@
#define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz"
#define BOOTFILE "ajbrec" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -56,4 +56,7 @@
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
#define BOOTFILE_EXT ".iriver"
#define BOOTFILE "rockbox" BOOTFILE_EXT
#endif

View file

@ -87,4 +87,7 @@
#define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz"
#define BOOTFILE "ajbrec" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -75,4 +75,7 @@
#define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz"
#define BOOTFILE "ajbrec" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -68,4 +68,7 @@
#define CONFIG_LCD LCD_SSD1801
#define BOOTFILE_EXT ".mod"
#define BOOTFILE "archos" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -72,4 +72,7 @@
#define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz"
#define BOOTFILE "ajbrec" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -78,4 +78,7 @@
#define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz"
#define BOOTFILE "ajbrec" BOOTFILE_EXT
#endif /* SIMULATOR */

View file

@ -29,8 +29,8 @@
#include "string.h"
#include "buffer.h"
#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730)
/* FIX: this doesn't work on iRiver or Gmini yet */
#if CONFIG_CPU != TCC730
/* FIX: this doesn't work on Gmini yet */
#define IRQ0_EDGE_TRIGGER 0x80
@ -46,11 +46,36 @@ static void rolo_error(const char *text)
lcd_stop_scroll();
}
#if CONFIG_CPU == SH7034
/* these are in assembler file "descramble.S" */
extern unsigned short descramble(const unsigned char* source,
unsigned char* dest, int length);
extern void rolo_restart(const unsigned char* source, unsigned char* dest,
int length);
#else
void rolo_restart(const unsigned char* source, unsigned char* dest,
long length) __attribute__ ((section (".icode")));
void rolo_restart(const unsigned char* source, unsigned char* dest,
long length)
{
long i;
for(i = 0;i < length;i++)
*dest++ = *source++;
#if CONFIG_CPU == MCF5249
asm volatile (" move.l #0,%d0");
asm volatile (" move.l #0x30000000,%d0");
asm volatile (" movec.l %d0,%vbr");
asm volatile (" move.l 0x30000000,%sp");
asm volatile (" move.l 0x30000004,%a0");
asm volatile (" jmp (%a0)");
#endif
}
#endif
/* This is assigned in the linker control file */
extern unsigned long loadaddress;
/***************************************************************************
*
@ -61,10 +86,15 @@ extern void rolo_restart(const unsigned char* source, unsigned char* dest,
int rolo_load(const char* filename)
{
int fd;
unsigned long length;
unsigned long file_length;
long length;
#ifdef IRIVER_H100
int i;
unsigned long checksum,file_checksum;
#else
long file_length;
unsigned short checksum,file_checksum;
unsigned char* ramstart = (void*)0x09000000;
#endif
unsigned char* ramstart = (void*)&loadaddress;
lcd_clear_display();
lcd_puts(0, 0, "ROLO...");
@ -79,8 +109,40 @@ int rolo_load(const char* filename)
return -1;
}
length = filesize(fd) - FIRMWARE_OFFSET_FILE_DATA;
#if CONFIG_CPU == MCF5249
/* Read and save checksum */
lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
if (read(fd, &file_checksum, 4) != 4) {
rolo_error("Error Reading checksum");
return -1;
}
lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
if (read(fd, mp3buf, length) != length) {
rolo_error("Error Reading File");
return -1;
}
checksum = 0;
for(i = 0;i < length;i++) {
checksum += mp3buf[i];
}
/* Verify checksum against file header */
if (checksum != file_checksum) {
rolo_error("Checksum Error");
return -1;
}
lcd_puts(0, 1, "Executing ");
lcd_update();
set_irq_level(HIGHEST_IRQ_LEVEL);
#else
/* Read file length from header and compare to real file length */
length=lseek(fd,0,SEEK_END)-FIRMWARE_OFFSET_FILE_DATA;
lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET);
if(read(fd, &file_length, 4) != 4) {
rolo_error("Error Reading File Length");
@ -90,7 +152,7 @@ int rolo_load(const char* filename)
rolo_error("File length mismatch");
return -1;
}
/* Read and save checksum */
lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
if (read(fd, &file_checksum, 2) != 2) {
@ -114,9 +176,8 @@ int rolo_load(const char* filename)
lcd_update();
checksum = descramble(mp3buf + length, mp3buf, length);
/* Verify checksum against file header */
if (checksum != file_checksum) {
rolo_error("Checksum Error");
return -1;
@ -125,10 +186,8 @@ int rolo_load(const char* filename)
lcd_puts(0, 1, "Executing ");
lcd_update();
/* Disable interrupts */
asm("mov #15<<4,r6\n"
"ldc r6,sr");
set_irq_level(HIGHEST_IRQ_LEVEL);
/* Calling these 2 initialization routines was necessary to get the
the origional Archos version of the firmware to load and execute. */
system_init(); /* Initialize system for restart */
@ -141,12 +200,12 @@ int rolo_load(const char* filename)
defined(ARCHOS_FMRECORDER)
PAIOR = 0x0FA0;
#endif
#endif
rolo_restart(mp3buf, ramstart, length);
return 0; /* this is never reached */
}
#else /* (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */
#else /* CONFIG_CPU != TCC730 */
int rolo_load(const char* filename)
{
/* dummy */
@ -154,4 +213,4 @@ int rolo_load(const char* filename)
return 0;
}
#endif /* ! (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */
#endif /* ! CONFIG_CPU != TCC730 */

View file

@ -47,6 +47,8 @@ SECTIONS
.data : AT ( _datacopy )
{
loadaddress = .;
_loadaddress = .;
_datastart = .;
*(.resetvectors);
*(.vectors);