diff options
-rw-r--r-- | apps/filetree.c | 6 | ||||
-rw-r--r-- | apps/tree.c | 6 | ||||
-rw-r--r-- | apps/tree.h | 6 | ||||
-rw-r--r-- | firmware/app.lds | 2 | ||||
-rw-r--r-- | firmware/export/config-fmrecorder.h | 3 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiosp.h | 3 | ||||
-rw-r--r-- | firmware/export/config-player.h | 3 | ||||
-rw-r--r-- | firmware/export/config-recorder.h | 3 | ||||
-rw-r--r-- | firmware/export/config-recorderv2.h | 3 | ||||
-rw-r--r-- | firmware/rolo.c | 91 | ||||
-rw-r--r-- | firmware/rom.lds | 2 |
13 files changed, 106 insertions, 28 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index c828f176ba..a3754ea190 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -39,8 +39,10 @@ | |||
39 | #include "rolo.h" | 39 | #include "rolo.h" |
40 | #include "sprintf.h" | 40 | #include "sprintf.h" |
41 | 41 | ||
42 | #ifndef SIMULATOR | ||
42 | static int boot_size = 0; | 43 | static int boot_size = 0; |
43 | static int boot_cluster; | 44 | static int boot_cluster; |
45 | #endif | ||
44 | extern bool boot_changed; | 46 | extern bool boot_changed; |
45 | 47 | ||
46 | int ft_build_playlist(struct tree_context* c, int start_index) | 48 | 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) | |||
241 | if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) | 243 | if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) |
242 | dptr->attr |= filetype_get_attr(entry->d_name); | 244 | dptr->attr |= filetype_get_attr(entry->d_name); |
243 | 245 | ||
246 | #ifndef SIMULATOR | ||
244 | /* memorize/compare details about the boot file */ | 247 | /* memorize/compare details about the boot file */ |
245 | if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) { | 248 | if ((c->currdir[1] == 0) && !strcasecmp(entry->d_name, BOOTFILE)) { |
246 | if (boot_size) { | 249 | if (boot_size) { |
@@ -251,7 +254,8 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
251 | boot_size = entry->size; | 254 | boot_size = entry->size; |
252 | boot_cluster = entry->startcluster; | 255 | boot_cluster = entry->startcluster; |
253 | } | 256 | } |
254 | 257 | #endif | |
258 | |||
255 | /* filter out non-visible files */ | 259 | /* filter out non-visible files */ |
256 | if (!(dptr->attr & ATTR_DIRECTORY) && ( | 260 | if (!(dptr->attr & ATTR_DIRECTORY) && ( |
257 | (*c->dirfilter == SHOW_PLAYLIST && | 261 | (*c->dirfilter == SHOW_PLAYLIST && |
diff --git a/apps/tree.c b/apps/tree.c index b7ad02a4aa..69bc8bc244 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -81,11 +81,7 @@ const struct filetype filetypes[] = { | |||
81 | #endif | 81 | #endif |
82 | { ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK }, | 82 | { ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK }, |
83 | #ifndef SIMULATOR | 83 | #ifndef SIMULATOR |
84 | #ifdef HAVE_LCD_BITMAP | 84 | { BOOTFILE_EXT, TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ }, |
85 | { ".ajz", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ }, | ||
86 | #else | ||
87 | { ".mod", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ }, | ||
88 | #endif | ||
89 | #endif /* #ifndef SIMULATOR */ | 85 | #endif /* #ifndef SIMULATOR */ |
90 | }; | 86 | }; |
91 | 87 | ||
diff --git a/apps/tree.h b/apps/tree.h index 239d0042f7..c3ab60c243 100644 --- a/apps/tree.h +++ b/apps/tree.h | |||
@@ -113,12 +113,6 @@ | |||
113 | 113 | ||
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | #ifdef HAVE_LCD_BITMAP | ||
117 | #define BOOTFILE "ajbrec.ajz" | ||
118 | #else | ||
119 | #define BOOTFILE "archos.mod" | ||
120 | #endif | ||
121 | |||
122 | struct entry { | 116 | struct entry { |
123 | short attr; /* FAT attributes + file type flags */ | 117 | short attr; /* FAT attributes + file type flags */ |
124 | unsigned long time_write; /* Last write time */ | 118 | unsigned long time_write; /* Last write time */ |
diff --git a/firmware/app.lds b/firmware/app.lds index b79a11094e..a7ca57e54e 100644 --- a/firmware/app.lds +++ b/firmware/app.lds | |||
@@ -139,6 +139,8 @@ SECTIONS | |||
139 | { | 139 | { |
140 | .vectors : | 140 | .vectors : |
141 | { | 141 | { |
142 | loadaddress = .; | ||
143 | _loadaddress = .; | ||
142 | *(.resetvectors); | 144 | *(.resetvectors); |
143 | *(.vectors); | 145 | *(.vectors); |
144 | } > DRAM | 146 | } > DRAM |
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index f5e82bbd12..ec410cb02a 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -78,4 +78,7 @@ | |||
78 | 78 | ||
79 | #define CONFIG_LCD LCD_SSD1815 | 79 | #define CONFIG_LCD LCD_SSD1815 |
80 | 80 | ||
81 | #define BOOTFILE_EXT ".ajz" | ||
82 | #define BOOTFILE "ajbrec" BOOTFILE_EXT | ||
83 | |||
81 | #endif /* SIMULATOR */ | 84 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 9c7ba6c1d3..d8453a96d1 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -56,4 +56,7 @@ | |||
56 | /* Define this if you have adjustable CPU frequency */ | 56 | /* Define this if you have adjustable CPU frequency */ |
57 | #define HAVE_ADJUSTABLE_CPU_FREQ | 57 | #define HAVE_ADJUSTABLE_CPU_FREQ |
58 | 58 | ||
59 | #define BOOTFILE_EXT ".iriver" | ||
60 | #define BOOTFILE "rockbox" BOOTFILE_EXT | ||
61 | |||
59 | #endif | 62 | #endif |
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 79e7adbe58..cce88e591b 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -87,4 +87,7 @@ | |||
87 | 87 | ||
88 | #define CONFIG_LCD LCD_SSD1815 | 88 | #define CONFIG_LCD LCD_SSD1815 |
89 | 89 | ||
90 | #define BOOTFILE_EXT ".ajz" | ||
91 | #define BOOTFILE "ajbrec" BOOTFILE_EXT | ||
92 | |||
90 | #endif /* SIMULATOR */ | 93 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index bda078a792..58cb4085ae 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h | |||
@@ -75,4 +75,7 @@ | |||
75 | 75 | ||
76 | #define CONFIG_LCD LCD_SSD1815 | 76 | #define CONFIG_LCD LCD_SSD1815 |
77 | 77 | ||
78 | #define BOOTFILE_EXT ".ajz" | ||
79 | #define BOOTFILE "ajbrec" BOOTFILE_EXT | ||
80 | |||
78 | #endif /* SIMULATOR */ | 81 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 6ca5663563..8b85bfdfae 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -68,4 +68,7 @@ | |||
68 | 68 | ||
69 | #define CONFIG_LCD LCD_SSD1801 | 69 | #define CONFIG_LCD LCD_SSD1801 |
70 | 70 | ||
71 | #define BOOTFILE_EXT ".mod" | ||
72 | #define BOOTFILE "archos" BOOTFILE_EXT | ||
73 | |||
71 | #endif /* SIMULATOR */ | 74 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 4d29b66fa0..a3a354feea 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -72,4 +72,7 @@ | |||
72 | 72 | ||
73 | #define CONFIG_LCD LCD_SSD1815 | 73 | #define CONFIG_LCD LCD_SSD1815 |
74 | 74 | ||
75 | #define BOOTFILE_EXT ".ajz" | ||
76 | #define BOOTFILE "ajbrec" BOOTFILE_EXT | ||
77 | |||
75 | #endif /* SIMULATOR */ | 78 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index 941946ace0..b9a011802c 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -78,4 +78,7 @@ | |||
78 | 78 | ||
79 | #define CONFIG_LCD LCD_SSD1815 | 79 | #define CONFIG_LCD LCD_SSD1815 |
80 | 80 | ||
81 | #define BOOTFILE_EXT ".ajz" | ||
82 | #define BOOTFILE "ajbrec" BOOTFILE_EXT | ||
83 | |||
81 | #endif /* SIMULATOR */ | 84 | #endif /* SIMULATOR */ |
diff --git a/firmware/rolo.c b/firmware/rolo.c index fccc9f38da..ceb70791cf 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include "string.h" | 29 | #include "string.h" |
30 | #include "buffer.h" | 30 | #include "buffer.h" |
31 | 31 | ||
32 | #if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) | 32 | #if CONFIG_CPU != TCC730 |
33 | /* FIX: this doesn't work on iRiver or Gmini yet */ | 33 | /* FIX: this doesn't work on Gmini yet */ |
34 | 34 | ||
35 | #define IRQ0_EDGE_TRIGGER 0x80 | 35 | #define IRQ0_EDGE_TRIGGER 0x80 |
36 | 36 | ||
@@ -46,11 +46,36 @@ static void rolo_error(const char *text) | |||
46 | lcd_stop_scroll(); | 46 | lcd_stop_scroll(); |
47 | } | 47 | } |
48 | 48 | ||
49 | #if CONFIG_CPU == SH7034 | ||
49 | /* these are in assembler file "descramble.S" */ | 50 | /* these are in assembler file "descramble.S" */ |
50 | extern unsigned short descramble(const unsigned char* source, | 51 | extern unsigned short descramble(const unsigned char* source, |
51 | unsigned char* dest, int length); | 52 | unsigned char* dest, int length); |
52 | extern void rolo_restart(const unsigned char* source, unsigned char* dest, | 53 | extern void rolo_restart(const unsigned char* source, unsigned char* dest, |
53 | int length); | 54 | int length); |
55 | #else | ||
56 | void rolo_restart(const unsigned char* source, unsigned char* dest, | ||
57 | long length) __attribute__ ((section (".icode"))); | ||
58 | void rolo_restart(const unsigned char* source, unsigned char* dest, | ||
59 | long length) | ||
60 | { | ||
61 | long i; | ||
62 | |||
63 | for(i = 0;i < length;i++) | ||
64 | *dest++ = *source++; | ||
65 | |||
66 | #if CONFIG_CPU == MCF5249 | ||
67 | asm volatile (" move.l #0,%d0"); | ||
68 | asm volatile (" move.l #0x30000000,%d0"); | ||
69 | asm volatile (" movec.l %d0,%vbr"); | ||
70 | asm volatile (" move.l 0x30000000,%sp"); | ||
71 | asm volatile (" move.l 0x30000004,%a0"); | ||
72 | asm volatile (" jmp (%a0)"); | ||
73 | #endif | ||
74 | } | ||
75 | #endif | ||
76 | |||
77 | /* This is assigned in the linker control file */ | ||
78 | extern unsigned long loadaddress; | ||
54 | 79 | ||
55 | /*************************************************************************** | 80 | /*************************************************************************** |
56 | * | 81 | * |
@@ -61,10 +86,15 @@ extern void rolo_restart(const unsigned char* source, unsigned char* dest, | |||
61 | int rolo_load(const char* filename) | 86 | int rolo_load(const char* filename) |
62 | { | 87 | { |
63 | int fd; | 88 | int fd; |
64 | unsigned long length; | 89 | long length; |
65 | unsigned long file_length; | 90 | #ifdef IRIVER_H100 |
91 | int i; | ||
92 | unsigned long checksum,file_checksum; | ||
93 | #else | ||
94 | long file_length; | ||
66 | unsigned short checksum,file_checksum; | 95 | unsigned short checksum,file_checksum; |
67 | unsigned char* ramstart = (void*)0x09000000; | 96 | #endif |
97 | unsigned char* ramstart = (void*)&loadaddress; | ||
68 | 98 | ||
69 | lcd_clear_display(); | 99 | lcd_clear_display(); |
70 | lcd_puts(0, 0, "ROLO..."); | 100 | lcd_puts(0, 0, "ROLO..."); |
@@ -79,8 +109,40 @@ int rolo_load(const char* filename) | |||
79 | return -1; | 109 | return -1; |
80 | } | 110 | } |
81 | 111 | ||
112 | length = filesize(fd) - FIRMWARE_OFFSET_FILE_DATA; | ||
113 | |||
114 | #if CONFIG_CPU == MCF5249 | ||
115 | /* Read and save checksum */ | ||
116 | lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); | ||
117 | if (read(fd, &file_checksum, 4) != 4) { | ||
118 | rolo_error("Error Reading checksum"); | ||
119 | return -1; | ||
120 | } | ||
121 | lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET); | ||
122 | |||
123 | if (read(fd, mp3buf, length) != length) { | ||
124 | rolo_error("Error Reading File"); | ||
125 | return -1; | ||
126 | } | ||
127 | |||
128 | checksum = 0; | ||
129 | |||
130 | for(i = 0;i < length;i++) { | ||
131 | checksum += mp3buf[i]; | ||
132 | } | ||
133 | |||
134 | /* Verify checksum against file header */ | ||
135 | if (checksum != file_checksum) { | ||
136 | rolo_error("Checksum Error"); | ||
137 | return -1; | ||
138 | } | ||
139 | |||
140 | lcd_puts(0, 1, "Executing "); | ||
141 | lcd_update(); | ||
142 | |||
143 | set_irq_level(HIGHEST_IRQ_LEVEL); | ||
144 | #else | ||
82 | /* Read file length from header and compare to real file length */ | 145 | /* Read file length from header and compare to real file length */ |
83 | length=lseek(fd,0,SEEK_END)-FIRMWARE_OFFSET_FILE_DATA; | ||
84 | lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET); | 146 | lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET); |
85 | if(read(fd, &file_length, 4) != 4) { | 147 | if(read(fd, &file_length, 4) != 4) { |
86 | rolo_error("Error Reading File Length"); | 148 | rolo_error("Error Reading File Length"); |
@@ -90,7 +152,7 @@ int rolo_load(const char* filename) | |||
90 | rolo_error("File length mismatch"); | 152 | rolo_error("File length mismatch"); |
91 | return -1; | 153 | return -1; |
92 | } | 154 | } |
93 | 155 | ||
94 | /* Read and save checksum */ | 156 | /* Read and save checksum */ |
95 | lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); | 157 | lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); |
96 | if (read(fd, &file_checksum, 2) != 2) { | 158 | if (read(fd, &file_checksum, 2) != 2) { |
@@ -114,9 +176,8 @@ int rolo_load(const char* filename) | |||
114 | lcd_update(); | 176 | lcd_update(); |
115 | 177 | ||
116 | checksum = descramble(mp3buf + length, mp3buf, length); | 178 | checksum = descramble(mp3buf + length, mp3buf, length); |
117 | 179 | ||
118 | /* Verify checksum against file header */ | 180 | /* Verify checksum against file header */ |
119 | |||
120 | if (checksum != file_checksum) { | 181 | if (checksum != file_checksum) { |
121 | rolo_error("Checksum Error"); | 182 | rolo_error("Checksum Error"); |
122 | return -1; | 183 | return -1; |
@@ -125,10 +186,8 @@ int rolo_load(const char* filename) | |||
125 | lcd_puts(0, 1, "Executing "); | 186 | lcd_puts(0, 1, "Executing "); |
126 | lcd_update(); | 187 | lcd_update(); |
127 | 188 | ||
128 | /* Disable interrupts */ | 189 | set_irq_level(HIGHEST_IRQ_LEVEL); |
129 | asm("mov #15<<4,r6\n" | 190 | |
130 | "ldc r6,sr"); | ||
131 | |||
132 | /* Calling these 2 initialization routines was necessary to get the | 191 | /* Calling these 2 initialization routines was necessary to get the |
133 | the origional Archos version of the firmware to load and execute. */ | 192 | the origional Archos version of the firmware to load and execute. */ |
134 | system_init(); /* Initialize system for restart */ | 193 | system_init(); /* Initialize system for restart */ |
@@ -141,12 +200,12 @@ int rolo_load(const char* filename) | |||
141 | defined(ARCHOS_FMRECORDER) | 200 | defined(ARCHOS_FMRECORDER) |
142 | PAIOR = 0x0FA0; | 201 | PAIOR = 0x0FA0; |
143 | #endif | 202 | #endif |
144 | 203 | #endif | |
145 | rolo_restart(mp3buf, ramstart, length); | 204 | rolo_restart(mp3buf, ramstart, length); |
146 | 205 | ||
147 | return 0; /* this is never reached */ | 206 | return 0; /* this is never reached */ |
148 | } | 207 | } |
149 | #else /* (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */ | 208 | #else /* CONFIG_CPU != TCC730 */ |
150 | int rolo_load(const char* filename) | 209 | int rolo_load(const char* filename) |
151 | { | 210 | { |
152 | /* dummy */ | 211 | /* dummy */ |
@@ -154,4 +213,4 @@ int rolo_load(const char* filename) | |||
154 | return 0; | 213 | return 0; |
155 | } | 214 | } |
156 | 215 | ||
157 | #endif /* ! (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) */ | 216 | #endif /* ! CONFIG_CPU != TCC730 */ |
diff --git a/firmware/rom.lds b/firmware/rom.lds index 749998b637..55346dc122 100644 --- a/firmware/rom.lds +++ b/firmware/rom.lds | |||
@@ -47,6 +47,8 @@ SECTIONS | |||
47 | 47 | ||
48 | .data : AT ( _datacopy ) | 48 | .data : AT ( _datacopy ) |
49 | { | 49 | { |
50 | loadaddress = .; | ||
51 | _loadaddress = .; | ||
50 | _datastart = .; | 52 | _datastart = .; |
51 | *(.resetvectors); | 53 | *(.resetvectors); |
52 | *(.vectors); | 54 | *(.vectors); |