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:
parent
e996e2ff91
commit
bd42d31e5e
13 changed files with 106 additions and 28 deletions
|
@ -39,8 +39,10 @@
|
||||||
#include "rolo.h"
|
#include "rolo.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
static int boot_size = 0;
|
static int boot_size = 0;
|
||||||
static int boot_cluster;
|
static int boot_cluster;
|
||||||
|
#endif
|
||||||
extern bool boot_changed;
|
extern bool boot_changed;
|
||||||
|
|
||||||
int ft_build_playlist(struct tree_context* c, int start_index)
|
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) )
|
if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) )
|
||||||
dptr->attr |= filetype_get_attr(entry->d_name);
|
dptr->attr |= filetype_get_attr(entry->d_name);
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
/* memorize/compare details about the boot file */
|
/* memorize/compare details about the boot file */
|
||||||
if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) {
|
if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) {
|
||||||
if (boot_size) {
|
if (boot_size) {
|
||||||
|
@ -251,7 +254,8 @@ int ft_load(struct tree_context* c, const char* tempdir)
|
||||||
boot_size = entry->size;
|
boot_size = entry->size;
|
||||||
boot_cluster = entry->startcluster;
|
boot_cluster = entry->startcluster;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* filter out non-visible files */
|
/* filter out non-visible files */
|
||||||
if (!(dptr->attr & ATTR_DIRECTORY) && (
|
if (!(dptr->attr & ATTR_DIRECTORY) && (
|
||||||
(*c->dirfilter == SHOW_PLAYLIST &&
|
(*c->dirfilter == SHOW_PLAYLIST &&
|
||||||
|
|
|
@ -81,11 +81,7 @@ const struct filetype filetypes[] = {
|
||||||
#endif
|
#endif
|
||||||
{ ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK },
|
{ ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK },
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
#ifdef HAVE_LCD_BITMAP
|
{ BOOTFILE_EXT, TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
|
||||||
{ ".ajz", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
|
|
||||||
#else
|
|
||||||
{ ".mod", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
|
|
||||||
#endif
|
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,12 +113,6 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
#define BOOTFILE "ajbrec.ajz"
|
|
||||||
#else
|
|
||||||
#define BOOTFILE "archos.mod"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct entry {
|
struct entry {
|
||||||
short attr; /* FAT attributes + file type flags */
|
short attr; /* FAT attributes + file type flags */
|
||||||
unsigned long time_write; /* Last write time */
|
unsigned long time_write; /* Last write time */
|
||||||
|
|
|
@ -139,6 +139,8 @@ SECTIONS
|
||||||
{
|
{
|
||||||
.vectors :
|
.vectors :
|
||||||
{
|
{
|
||||||
|
loadaddress = .;
|
||||||
|
_loadaddress = .;
|
||||||
*(.resetvectors);
|
*(.resetvectors);
|
||||||
*(.vectors);
|
*(.vectors);
|
||||||
} > DRAM
|
} > DRAM
|
||||||
|
|
|
@ -78,4 +78,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".ajz"
|
||||||
|
#define BOOTFILE "ajbrec" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -56,4 +56,7 @@
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".iriver"
|
||||||
|
#define BOOTFILE "rockbox" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -87,4 +87,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".ajz"
|
||||||
|
#define BOOTFILE "ajbrec" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -75,4 +75,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".ajz"
|
||||||
|
#define BOOTFILE "ajbrec" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -68,4 +68,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1801
|
#define CONFIG_LCD LCD_SSD1801
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".mod"
|
||||||
|
#define BOOTFILE "archos" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -72,4 +72,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".ajz"
|
||||||
|
#define BOOTFILE "ajbrec" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -78,4 +78,7 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_SSD1815
|
#define CONFIG_LCD LCD_SSD1815
|
||||||
|
|
||||||
|
#define BOOTFILE_EXT ".ajz"
|
||||||
|
#define BOOTFILE "ajbrec" BOOTFILE_EXT
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730)
|
#if CONFIG_CPU != TCC730
|
||||||
/* FIX: this doesn't work on iRiver or Gmini yet */
|
/* FIX: this doesn't work on Gmini yet */
|
||||||
|
|
||||||
#define IRQ0_EDGE_TRIGGER 0x80
|
#define IRQ0_EDGE_TRIGGER 0x80
|
||||||
|
|
||||||
|
@ -46,11 +46,36 @@ static void rolo_error(const char *text)
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_CPU == SH7034
|
||||||
/* these are in assembler file "descramble.S" */
|
/* these are in assembler file "descramble.S" */
|
||||||
extern unsigned short descramble(const unsigned char* source,
|
extern unsigned short descramble(const unsigned char* source,
|
||||||
unsigned char* dest, int length);
|
unsigned char* dest, int length);
|
||||||
extern void rolo_restart(const unsigned char* source, unsigned char* dest,
|
extern void rolo_restart(const unsigned char* source, unsigned char* dest,
|
||||||
int length);
|
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 rolo_load(const char* filename)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
unsigned long length;
|
long length;
|
||||||
unsigned long file_length;
|
#ifdef IRIVER_H100
|
||||||
|
int i;
|
||||||
|
unsigned long checksum,file_checksum;
|
||||||
|
#else
|
||||||
|
long file_length;
|
||||||
unsigned short checksum,file_checksum;
|
unsigned short checksum,file_checksum;
|
||||||
unsigned char* ramstart = (void*)0x09000000;
|
#endif
|
||||||
|
unsigned char* ramstart = (void*)&loadaddress;
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0, 0, "ROLO...");
|
lcd_puts(0, 0, "ROLO...");
|
||||||
|
@ -79,8 +109,40 @@ int rolo_load(const char* filename)
|
||||||
return -1;
|
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 */
|
/* 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);
|
lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET);
|
||||||
if(read(fd, &file_length, 4) != 4) {
|
if(read(fd, &file_length, 4) != 4) {
|
||||||
rolo_error("Error Reading File Length");
|
rolo_error("Error Reading File Length");
|
||||||
|
@ -90,7 +152,7 @@ int rolo_load(const char* filename)
|
||||||
rolo_error("File length mismatch");
|
rolo_error("File length mismatch");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read and save checksum */
|
/* Read and save checksum */
|
||||||
lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
|
lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
|
||||||
if (read(fd, &file_checksum, 2) != 2) {
|
if (read(fd, &file_checksum, 2) != 2) {
|
||||||
|
@ -114,9 +176,8 @@ int rolo_load(const char* filename)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
checksum = descramble(mp3buf + length, mp3buf, length);
|
checksum = descramble(mp3buf + length, mp3buf, length);
|
||||||
|
|
||||||
/* Verify checksum against file header */
|
/* Verify checksum against file header */
|
||||||
|
|
||||||
if (checksum != file_checksum) {
|
if (checksum != file_checksum) {
|
||||||
rolo_error("Checksum Error");
|
rolo_error("Checksum Error");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -125,10 +186,8 @@ int rolo_load(const char* filename)
|
||||||
lcd_puts(0, 1, "Executing ");
|
lcd_puts(0, 1, "Executing ");
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
/* Disable interrupts */
|
set_irq_level(HIGHEST_IRQ_LEVEL);
|
||||||
asm("mov #15<<4,r6\n"
|
|
||||||
"ldc r6,sr");
|
|
||||||
|
|
||||||
/* Calling these 2 initialization routines was necessary to get the
|
/* Calling these 2 initialization routines was necessary to get the
|
||||||
the origional Archos version of the firmware to load and execute. */
|
the origional Archos version of the firmware to load and execute. */
|
||||||
system_init(); /* Initialize system for restart */
|
system_init(); /* Initialize system for restart */
|
||||||
|
@ -141,12 +200,12 @@ int rolo_load(const char* filename)
|
||||||
defined(ARCHOS_FMRECORDER)
|
defined(ARCHOS_FMRECORDER)
|
||||||
PAIOR = 0x0FA0;
|
PAIOR = 0x0FA0;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
rolo_restart(mp3buf, ramstart, length);
|
rolo_restart(mp3buf, ramstart, length);
|
||||||
|
|
||||||
return 0; /* this is never reached */
|
return 0; /* this is never reached */
|
||||||
}
|
}
|
||||||
#else /* (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */
|
#else /* CONFIG_CPU != TCC730 */
|
||||||
int rolo_load(const char* filename)
|
int rolo_load(const char* filename)
|
||||||
{
|
{
|
||||||
/* dummy */
|
/* dummy */
|
||||||
|
@ -154,4 +213,4 @@ int rolo_load(const char* filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ! (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */
|
#endif /* ! CONFIG_CPU != TCC730 */
|
||||||
|
|
|
@ -47,6 +47,8 @@ SECTIONS
|
||||||
|
|
||||||
.data : AT ( _datacopy )
|
.data : AT ( _datacopy )
|
||||||
{
|
{
|
||||||
|
loadaddress = .;
|
||||||
|
_loadaddress = .;
|
||||||
_datastart = .;
|
_datastart = .;
|
||||||
*(.resetvectors);
|
*(.resetvectors);
|
||||||
*(.vectors);
|
*(.vectors);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue