diff options
Diffstat (limited to 'firmware')
28 files changed, 32 insertions, 554 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index a05314160d..43519ffb3c 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -12,7 +12,6 @@ logf.c | |||
12 | #ifdef RB_PROFILE | 12 | #ifdef RB_PROFILE |
13 | profile.c | 13 | profile.c |
14 | #endif /* RB_PROFILE */ | 14 | #endif /* RB_PROFILE */ |
15 | hwcompat.c | ||
16 | kernel.c | 15 | kernel.c |
17 | rolo.c | 16 | rolo.c |
18 | thread.c | 17 | thread.c |
@@ -238,6 +237,7 @@ target/sh/memcpy-sh.S | |||
238 | target/sh/memmove-sh.S | 237 | target/sh/memmove-sh.S |
239 | target/sh/memset-sh.S | 238 | target/sh/memset-sh.S |
240 | target/sh/strlen-sh.S | 239 | target/sh/strlen-sh.S |
240 | target/sh/system-sh.c | ||
241 | #endif /* SIMULATOR */ | 241 | #endif /* SIMULATOR */ |
242 | 242 | ||
243 | #elif defined(CPU_COLDFIRE) | 243 | #elif defined(CPU_COLDFIRE) |
@@ -316,6 +316,7 @@ drivers/i2c.c | |||
316 | target/sh/archos/ata-archos.c | 316 | target/sh/archos/ata-archos.c |
317 | target/sh/archos/ata-as-archos.S | 317 | target/sh/archos/ata-as-archos.S |
318 | target/sh/archos/player/button-player.c | 318 | target/sh/archos/player/button-player.c |
319 | target/sh/archos/player/hwcompat-player.c | ||
319 | target/sh/archos/player/lcd-as-player.S | 320 | target/sh/archos/player/lcd-as-player.S |
320 | target/sh/archos/player/lcd-player.c | 321 | target/sh/archos/player/lcd-player.c |
321 | target/sh/archos/player/usb-player.c | 322 | target/sh/archos/player/usb-player.c |
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index d2c80e0ae0..35967d7d78 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "usb.h" | 28 | #include "usb.h" |
29 | #include "power.h" | 29 | #include "power.h" |
30 | #include "string.h" | 30 | #include "string.h" |
31 | #include "hwcompat.h" | ||
32 | #include "ata_idle_notify.h" | 31 | #include "ata_idle_notify.h" |
33 | #include "ata-target.h" | 32 | #include "ata-target.h" |
34 | 33 | ||
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c index 72520ac499..ccdc8c2443 100644 --- a/firmware/drivers/ata_flash.c +++ b/firmware/drivers/ata_flash.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "usb.h" | 36 | #include "usb.h" |
37 | #include "power.h" | 37 | #include "power.h" |
38 | #include "string.h" | 38 | #include "string.h" |
39 | #include "hwcompat.h" | ||
40 | */ | 39 | */ |
41 | 40 | ||
42 | #define SECTOR_SIZE (512) | 41 | #define SECTOR_SIZE (512) |
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 377d2444bf..847e282e3b 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -1163,7 +1163,7 @@ int ata_init(void) | |||
1163 | } | 1163 | } |
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
1166 | new_mmc_circuit = ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0); | 1166 | new_mmc_circuit = ((HW_MASK & MMC_CLOCK_POLARITY) != 0); |
1167 | ata_enable(true); | 1167 | ata_enable(true); |
1168 | 1168 | ||
1169 | if ( !initialized ) | 1169 | if ( !initialized ) |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index ec0ddeec41..b54238d085 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "system.h" | 28 | #include "system.h" |
29 | #include "font.h" | 29 | #include "font.h" |
30 | #include "hwcompat.h" | ||
31 | #include "rbunicode.h" | 30 | #include "rbunicode.h" |
32 | #include "bidi.h" | 31 | #include "bidi.h" |
33 | 32 | ||
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c index a8f910a426..6a1b7cde9a 100644 --- a/firmware/drivers/mas.c +++ b/firmware/drivers/mas.c | |||
@@ -286,7 +286,7 @@ void mas_reset(void) | |||
286 | or_b(0x01, &PADRH); | 286 | or_b(0x01, &PADRH); |
287 | sleep(HZ/5); | 287 | sleep(HZ/5); |
288 | #elif (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 288 | #elif (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
289 | if (read_hw_mask() & ATA_ADDRESS_200) | 289 | if (HW_MASK & ATA_ADDRESS_200) |
290 | { | 290 | { |
291 | and_b(~0x01, &PADRH); | 291 | and_b(~0x01, &PADRH); |
292 | sleep(HZ/100); | 292 | sleep(HZ/100); |
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 9334b8e54a..2a87cad2e1 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "power.h" | 25 | #include "power.h" |
26 | #include "hwcompat.h" | ||
27 | #include "logf.h" | 26 | #include "logf.h" |
28 | #include "pcf50605.h" | 27 | #include "pcf50605.h" |
29 | #include "pcf50606.h" | 28 | #include "pcf50606.h" |
diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h index 03fb161ce4..bffb76e3ef 100644 --- a/firmware/export/hwcompat.h +++ b/firmware/export/hwcompat.h | |||
@@ -22,6 +22,10 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "config.h" | 23 | #include "config.h" |
24 | 24 | ||
25 | #if (CONFIG_CPU == SH7034) && !defined(SIMULATOR) | ||
26 | |||
27 | #define ROM_VERSION (*(short *)0x020000fe) | ||
28 | |||
25 | /* Bit mask values for HW compatibility */ | 29 | /* Bit mask values for HW compatibility */ |
26 | #define ATA_ADDRESS_200 0x0100 | 30 | #define ATA_ADDRESS_200 0x0100 |
27 | #define USB_ACTIVE_HIGH 0x0100 | 31 | #define USB_ACTIVE_HIGH 0x0100 |
@@ -30,11 +34,16 @@ | |||
30 | #define MMC_CLOCK_POLARITY 0x0400 | 34 | #define MMC_CLOCK_POLARITY 0x0400 |
31 | #define TUNER_MODEL 0x0800 | 35 | #define TUNER_MODEL 0x0800 |
32 | 36 | ||
33 | int read_rom_version(void); | 37 | #ifdef ARCHOS_PLAYER |
34 | int read_hw_mask(void); | 38 | #define HW_MASK 0 |
39 | #else /* Recorders, Ondios */ | ||
40 | #define HW_MASK (*(short *)0x020000fc) | ||
41 | #endif | ||
42 | |||
43 | #endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */ | ||
35 | 44 | ||
36 | #ifdef ARCHOS_PLAYER | 45 | #ifdef ARCHOS_PLAYER |
37 | bool is_new_player(void); | 46 | bool is_new_player(void); |
38 | #endif | 47 | #endif |
39 | 48 | ||
40 | #endif | 49 | #endif /* HWCOMPAT_H */ |
diff --git a/firmware/export/system.h b/firmware/export/system.h index ea3092537c..b32d1d3a21 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -196,110 +196,14 @@ enum { | |||
196 | }; | 196 | }; |
197 | 197 | ||
198 | #ifndef SIMULATOR | 198 | #ifndef SIMULATOR |
199 | #ifdef CPU_COLDFIRE | 199 | #if defined(CPU_COLDFIRE) || (CONFIG_CPU == S3C2440) || (CONFIG_CPU == SH7034) |
200 | #include "system-target.h" | 200 | #include "system-target.h" |
201 | #endif | 201 | #endif |
202 | #endif | 202 | #endif |
203 | #ifndef SIMULATOR | ||
204 | #if CONFIG_CPU == S3C2440 | ||
205 | #include "system-target.h" | ||
206 | #endif | ||
207 | #endif | ||
208 | |||
209 | #if CONFIG_CPU == SH7034 | ||
210 | #define or_b(mask, address) \ | ||
211 | asm \ | ||
212 | ("or.b %0,@(r0,gbr)" \ | ||
213 | : \ | ||
214 | : /* %0 */ I_CONSTRAINT((char)(mask)), \ | ||
215 | /* %1 */ "z"(address-GBR)) | ||
216 | |||
217 | #define and_b(mask, address) \ | ||
218 | asm \ | ||
219 | ("and.b %0,@(r0,gbr)" \ | ||
220 | : \ | ||
221 | : /* %0 */ I_CONSTRAINT((char)(mask)), \ | ||
222 | /* %1 */ "z"(address-GBR)) | ||
223 | |||
224 | #define xor_b(mask, address) \ | ||
225 | asm \ | ||
226 | ("xor.b %0,@(r0,gbr)" \ | ||
227 | : \ | ||
228 | : /* %0 */ I_CONSTRAINT((char)(mask)), \ | ||
229 | /* %1 */ "z"(address-GBR)) | ||
230 | |||
231 | |||
232 | #endif /* CONFIG_CPU == SH7034 */ | ||
233 | 203 | ||
234 | #ifndef SIMULATOR | 204 | #ifndef SIMULATOR |
235 | 205 | ||
236 | /**************************************************************************** | 206 | #if defined(CPU_ARM) |
237 | * Interrupt level setting | ||
238 | * The level is left shifted 4 bits | ||
239 | ****************************************************************************/ | ||
240 | #if CONFIG_CPU == SH7034 | ||
241 | #define HIGHEST_IRQ_LEVEL (15<<4) | ||
242 | static inline int set_irq_level(int level) | ||
243 | { | ||
244 | int i; | ||
245 | /* Read the old level and set the new one */ | ||
246 | asm volatile ("stc sr, %0" : "=r" (i)); | ||
247 | asm volatile ("ldc %0, sr" : : "r" (level)); | ||
248 | return i; | ||
249 | } | ||
250 | |||
251 | static inline uint16_t swap16(uint16_t value) | ||
252 | /* | ||
253 | result[15..8] = value[ 7..0]; | ||
254 | result[ 7..0] = value[15..8]; | ||
255 | */ | ||
256 | { | ||
257 | uint16_t result; | ||
258 | asm volatile ("swap.b\t%1,%0" : "=r"(result) : "r"(value)); | ||
259 | return result; | ||
260 | } | ||
261 | |||
262 | static inline uint32_t SWAW32(uint32_t value) | ||
263 | /* | ||
264 | result[31..16] = value[15.. 0]; | ||
265 | result[15.. 0] = value[31..16]; | ||
266 | */ | ||
267 | { | ||
268 | uint32_t result; | ||
269 | asm volatile ("swap.w\t%1,%0" : "=r"(result) : "r"(value)); | ||
270 | return result; | ||
271 | } | ||
272 | |||
273 | static inline uint32_t swap32(uint32_t value) | ||
274 | /* | ||
275 | result[31..24] = value[ 7.. 0]; | ||
276 | result[23..16] = value[15.. 8]; | ||
277 | result[15.. 8] = value[23..16]; | ||
278 | result[ 7.. 0] = value[31..24]; | ||
279 | */ | ||
280 | { | ||
281 | asm volatile ("swap.b\t%0,%0\n" | ||
282 | "swap.w\t%0,%0\n" | ||
283 | "swap.b\t%0,%0\n" : "+r"(value)); | ||
284 | return value; | ||
285 | } | ||
286 | |||
287 | static inline uint32_t swap_odd_even32(uint32_t value) | ||
288 | { | ||
289 | /* | ||
290 | result[31..24],[15.. 8] = value[23..16],[ 7.. 0] | ||
291 | result[23..16],[ 7.. 0] = value[31..24],[15.. 8] | ||
292 | */ | ||
293 | asm volatile ("swap.b\t%0,%0\n" | ||
294 | "swap.w\t%0,%0\n" | ||
295 | "swap.b\t%0,%0\n" | ||
296 | "swap.w\t%0,%0\n" : "+r"(value)); | ||
297 | return value; | ||
298 | } | ||
299 | |||
300 | #define invalidate_icache() | ||
301 | |||
302 | #elif defined(CPU_ARM) | ||
303 | 207 | ||
304 | /* TODO: Implement set_irq_level and check CPU frequencies */ | 208 | /* TODO: Implement set_irq_level and check CPU frequencies */ |
305 | 209 | ||
diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h index 590e61dedb..2e286b4cbe 100644 --- a/firmware/export/tuner.h +++ b/firmware/export/tuner.h | |||
@@ -82,7 +82,7 @@ static inline void tuner_init(void) | |||
82 | { | 82 | { |
83 | #ifndef SIMULATOR | 83 | #ifndef SIMULATOR |
84 | #if CONFIG_TUNER == (S1A0903X01 | TEA5767) | 84 | #if CONFIG_TUNER == (S1A0903X01 | TEA5767) |
85 | if (read_hw_mask() & TUNER_MODEL) | 85 | if (HW_MASK & TUNER_MODEL) |
86 | { | 86 | { |
87 | _radio_set = philips_set; | 87 | _radio_set = philips_set; |
88 | _radio_get = philips_get; | 88 | _radio_get = philips_get; |
diff --git a/firmware/mp3_playback.c b/firmware/mp3_playback.c index bd6ba60777..b692a01746 100644 --- a/firmware/mp3_playback.c +++ b/firmware/mp3_playback.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "mas.h" | 32 | #include "mas.h" |
33 | #include "dac.h" | 33 | #include "dac.h" |
34 | #include "system.h" | 34 | #include "system.h" |
35 | #include "hwcompat.h" | ||
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | /* hacking into mpeg.c, recording is still there */ | 37 | /* hacking into mpeg.c, recording is still there */ |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 909a21dcda..a66a4d0f01 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -2911,7 +2911,7 @@ void audio_init(void) | |||
2911 | memset(trackdata, sizeof(trackdata), 0); | 2911 | memset(trackdata, sizeof(trackdata), 0); |
2912 | 2912 | ||
2913 | #if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) | 2913 | #if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) |
2914 | if(read_hw_mask() & PR_ACTIVE_HIGH) | 2914 | if (HW_MASK & PR_ACTIVE_HIGH) |
2915 | and_b(~0x08, &PADRH); | 2915 | and_b(~0x08, &PADRH); |
2916 | else | 2916 | else |
2917 | or_b(0x08, &PADRH); | 2917 | or_b(0x08, &PADRH); |
diff --git a/firmware/sound.c b/firmware/sound.c index 7004a40fb6..923a8693bd 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #endif | 29 | #endif |
30 | #include "dac.h" | 30 | #include "dac.h" |
31 | #include "system.h" | 31 | #include "system.h" |
32 | #include "hwcompat.h" | ||
33 | #if CONFIG_CODEC == SWCODEC | 32 | #if CONFIG_CODEC == SWCODEC |
34 | #include "pcm_playback.h" | 33 | #include "pcm_playback.h" |
35 | #endif | 34 | #endif |
@@ -282,7 +281,7 @@ static const unsigned int prescale_table[] = | |||
282 | }; | 281 | }; |
283 | 282 | ||
284 | /* convert tenth of dB volume (-780..+180) to dac3550 register value */ | 283 | /* convert tenth of dB volume (-780..+180) to dac3550 register value */ |
285 | static int tenthdb2reg(int db) | 284 | static int tenthdb2reg(int db) |
286 | { | 285 | { |
287 | if (db < -540) /* 3 dB steps */ | 286 | if (db < -540) /* 3 dB steps */ |
288 | return (db + 780) / 30; | 287 | return (db + 780) / 30; |
diff --git a/firmware/system.c b/firmware/system.c index 02d14e3ee6..7e7effe67d 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -171,407 +171,7 @@ bool detect_original_firmware(void) | |||
171 | return !(detect_flashed_ramimage() || detect_flashed_romimage()); | 171 | return !(detect_flashed_ramimage() || detect_flashed_romimage()); |
172 | } | 172 | } |
173 | 173 | ||
174 | #if CONFIG_CPU == SH7034 | 174 | #if defined(CPU_ARM) |
175 | #include "led.h" | ||
176 | #include "system.h" | ||
177 | #include "rolo.h" | ||
178 | |||
179 | static const char* const irqname[] = { | ||
180 | "", "", "", "", "IllInstr", "", "IllSltIn","","", | ||
181 | "CPUAdrEr", "DMAAdrEr", "NMI", "UserBrk", | ||
182 | "","","","","","","","","","","","","","","","","","","", | ||
183 | "Trap32","Trap33","Trap34","Trap35","Trap36","Trap37","Trap38","Trap39", | ||
184 | "Trap40","Trap41","Trap42","Trap43","Trap44","Trap45","Trap46","Trap47", | ||
185 | "Trap48","Trap49","Trap50","Trap51","Trap52","Trap53","Trap54","Trap55", | ||
186 | "Trap56","Trap57","Trap58","Trap59","Trap60","Trap61","Trap62","Trap63", | ||
187 | "Irq0","Irq1","Irq2","Irq3","Irq4","Irq5","Irq6","Irq7", | ||
188 | "Dma0","","Dma1","","Dma2","","Dma3","", | ||
189 | "IMIA0","IMIB0","OVI0","", "IMIA1","IMIB1","OVI1","", | ||
190 | "IMIA2","IMIB2","OVI2","", "IMIA3","IMIB3","OVI3","", | ||
191 | "IMIA4","IMIB4","OVI4","", | ||
192 | "Ser0Err","Ser0Rx","Ser0Tx","Ser0TE", | ||
193 | "Ser1Err","Ser1Rx","Ser1Tx","Ser1TE", | ||
194 | "ParityEr","A/D conv","","","Watchdog","DRAMRefr" | ||
195 | }; | ||
196 | |||
197 | #define RESERVE_INTERRUPT(number) "\t.long\t_UIE" #number "\n" | ||
198 | #define DEFAULT_INTERRUPT(name, number) "\t.weak\t_" #name \ | ||
199 | "\n\t.set\t_" #name ",_UIE" #number \ | ||
200 | "\n\t.long\t_" #name "\n" | ||
201 | |||
202 | asm ( | ||
203 | |||
204 | /* Vector table. | ||
205 | * Handled in asm because gcc 4.x doesn't allow weak aliases to symbols | ||
206 | * defined in an asm block -- silly. | ||
207 | * Reset vectors (0..3) are handled in crt0.S */ | ||
208 | |||
209 | ".section\t.vectors,\"aw\",@progbits\n" | ||
210 | DEFAULT_INTERRUPT (GII, 4) | ||
211 | RESERVE_INTERRUPT ( 5) | ||
212 | DEFAULT_INTERRUPT (ISI, 6) | ||
213 | RESERVE_INTERRUPT ( 7) | ||
214 | RESERVE_INTERRUPT ( 8) | ||
215 | DEFAULT_INTERRUPT (CPUAE, 9) | ||
216 | DEFAULT_INTERRUPT (DMAAE, 10) | ||
217 | DEFAULT_INTERRUPT (NMI, 11) | ||
218 | DEFAULT_INTERRUPT (UB, 12) | ||
219 | RESERVE_INTERRUPT ( 13) | ||
220 | RESERVE_INTERRUPT ( 14) | ||
221 | RESERVE_INTERRUPT ( 15) | ||
222 | RESERVE_INTERRUPT ( 16) /* TCB #0 */ | ||
223 | RESERVE_INTERRUPT ( 17) /* TCB #1 */ | ||
224 | RESERVE_INTERRUPT ( 18) /* TCB #2 */ | ||
225 | RESERVE_INTERRUPT ( 19) /* TCB #3 */ | ||
226 | RESERVE_INTERRUPT ( 20) /* TCB #4 */ | ||
227 | RESERVE_INTERRUPT ( 21) /* TCB #5 */ | ||
228 | RESERVE_INTERRUPT ( 22) /* TCB #6 */ | ||
229 | RESERVE_INTERRUPT ( 23) /* TCB #7 */ | ||
230 | RESERVE_INTERRUPT ( 24) /* TCB #8 */ | ||
231 | RESERVE_INTERRUPT ( 25) /* TCB #9 */ | ||
232 | RESERVE_INTERRUPT ( 26) /* TCB #10 */ | ||
233 | RESERVE_INTERRUPT ( 27) /* TCB #11 */ | ||
234 | RESERVE_INTERRUPT ( 28) /* TCB #12 */ | ||
235 | RESERVE_INTERRUPT ( 29) /* TCB #13 */ | ||
236 | RESERVE_INTERRUPT ( 30) /* TCB #14 */ | ||
237 | RESERVE_INTERRUPT ( 31) /* TCB #15 */ | ||
238 | DEFAULT_INTERRUPT (TRAPA32, 32) | ||
239 | DEFAULT_INTERRUPT (TRAPA33, 33) | ||
240 | DEFAULT_INTERRUPT (TRAPA34, 34) | ||
241 | DEFAULT_INTERRUPT (TRAPA35, 35) | ||
242 | DEFAULT_INTERRUPT (TRAPA36, 36) | ||
243 | DEFAULT_INTERRUPT (TRAPA37, 37) | ||
244 | DEFAULT_INTERRUPT (TRAPA38, 38) | ||
245 | DEFAULT_INTERRUPT (TRAPA39, 39) | ||
246 | DEFAULT_INTERRUPT (TRAPA40, 40) | ||
247 | DEFAULT_INTERRUPT (TRAPA41, 41) | ||
248 | DEFAULT_INTERRUPT (TRAPA42, 42) | ||
249 | DEFAULT_INTERRUPT (TRAPA43, 43) | ||
250 | DEFAULT_INTERRUPT (TRAPA44, 44) | ||
251 | DEFAULT_INTERRUPT (TRAPA45, 45) | ||
252 | DEFAULT_INTERRUPT (TRAPA46, 46) | ||
253 | DEFAULT_INTERRUPT (TRAPA47, 47) | ||
254 | DEFAULT_INTERRUPT (TRAPA48, 48) | ||
255 | DEFAULT_INTERRUPT (TRAPA49, 49) | ||
256 | DEFAULT_INTERRUPT (TRAPA50, 50) | ||
257 | DEFAULT_INTERRUPT (TRAPA51, 51) | ||
258 | DEFAULT_INTERRUPT (TRAPA52, 52) | ||
259 | DEFAULT_INTERRUPT (TRAPA53, 53) | ||
260 | DEFAULT_INTERRUPT (TRAPA54, 54) | ||
261 | DEFAULT_INTERRUPT (TRAPA55, 55) | ||
262 | DEFAULT_INTERRUPT (TRAPA56, 56) | ||
263 | DEFAULT_INTERRUPT (TRAPA57, 57) | ||
264 | DEFAULT_INTERRUPT (TRAPA58, 58) | ||
265 | DEFAULT_INTERRUPT (TRAPA59, 59) | ||
266 | DEFAULT_INTERRUPT (TRAPA60, 60) | ||
267 | DEFAULT_INTERRUPT (TRAPA61, 61) | ||
268 | DEFAULT_INTERRUPT (TRAPA62, 62) | ||
269 | DEFAULT_INTERRUPT (TRAPA63, 63) | ||
270 | DEFAULT_INTERRUPT (IRQ0, 64) | ||
271 | DEFAULT_INTERRUPT (IRQ1, 65) | ||
272 | DEFAULT_INTERRUPT (IRQ2, 66) | ||
273 | DEFAULT_INTERRUPT (IRQ3, 67) | ||
274 | DEFAULT_INTERRUPT (IRQ4, 68) | ||
275 | DEFAULT_INTERRUPT (IRQ5, 69) | ||
276 | DEFAULT_INTERRUPT (IRQ6, 70) | ||
277 | DEFAULT_INTERRUPT (IRQ7, 71) | ||
278 | DEFAULT_INTERRUPT (DEI0, 72) | ||
279 | RESERVE_INTERRUPT ( 73) | ||
280 | DEFAULT_INTERRUPT (DEI1, 74) | ||
281 | RESERVE_INTERRUPT ( 75) | ||
282 | DEFAULT_INTERRUPT (DEI2, 76) | ||
283 | RESERVE_INTERRUPT ( 77) | ||
284 | DEFAULT_INTERRUPT (DEI3, 78) | ||
285 | RESERVE_INTERRUPT ( 79) | ||
286 | DEFAULT_INTERRUPT (IMIA0, 80) | ||
287 | DEFAULT_INTERRUPT (IMIB0, 81) | ||
288 | DEFAULT_INTERRUPT (OVI0, 82) | ||
289 | RESERVE_INTERRUPT ( 83) | ||
290 | DEFAULT_INTERRUPT (IMIA1, 84) | ||
291 | DEFAULT_INTERRUPT (IMIB1, 85) | ||
292 | DEFAULT_INTERRUPT (OVI1, 86) | ||
293 | RESERVE_INTERRUPT ( 87) | ||
294 | DEFAULT_INTERRUPT (IMIA2, 88) | ||
295 | DEFAULT_INTERRUPT (IMIB2, 89) | ||
296 | DEFAULT_INTERRUPT (OVI2, 90) | ||
297 | RESERVE_INTERRUPT ( 91) | ||
298 | DEFAULT_INTERRUPT (IMIA3, 92) | ||
299 | DEFAULT_INTERRUPT (IMIB3, 93) | ||
300 | DEFAULT_INTERRUPT (OVI3, 94) | ||
301 | RESERVE_INTERRUPT ( 95) | ||
302 | DEFAULT_INTERRUPT (IMIA4, 96) | ||
303 | DEFAULT_INTERRUPT (IMIB4, 97) | ||
304 | DEFAULT_INTERRUPT (OVI4, 98) | ||
305 | RESERVE_INTERRUPT ( 99) | ||
306 | DEFAULT_INTERRUPT (REI0, 100) | ||
307 | DEFAULT_INTERRUPT (RXI0, 101) | ||
308 | DEFAULT_INTERRUPT (TXI0, 102) | ||
309 | DEFAULT_INTERRUPT (TEI0, 103) | ||
310 | DEFAULT_INTERRUPT (REI1, 104) | ||
311 | DEFAULT_INTERRUPT (RXI1, 105) | ||
312 | DEFAULT_INTERRUPT (TXI1, 106) | ||
313 | DEFAULT_INTERRUPT (TEI1, 107) | ||
314 | RESERVE_INTERRUPT ( 108) | ||
315 | DEFAULT_INTERRUPT (ADITI, 109) | ||
316 | |||
317 | /* UIE# block. | ||
318 | * Must go into the same section as the UIE() handler */ | ||
319 | |||
320 | "\t.text\n" | ||
321 | "_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
322 | "_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
323 | "_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
324 | "_UIE7:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
325 | "_UIE8:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
326 | "_UIE9:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
327 | "_UIE10:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
328 | "_UIE11:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
329 | "_UIE12:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
330 | "_UIE13:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
331 | "_UIE14:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
332 | "_UIE15:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
333 | "_UIE16:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
334 | "_UIE17:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
335 | "_UIE18:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
336 | "_UIE19:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
337 | "_UIE20:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
338 | "_UIE21:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
339 | "_UIE22:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
340 | "_UIE23:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
341 | "_UIE24:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
342 | "_UIE25:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
343 | "_UIE26:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
344 | "_UIE27:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
345 | "_UIE28:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
346 | "_UIE29:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
347 | "_UIE30:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
348 | "_UIE31:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
349 | "_UIE32:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
350 | "_UIE33:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
351 | "_UIE34:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
352 | "_UIE35:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
353 | "_UIE36:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
354 | "_UIE37:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
355 | "_UIE38:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
356 | "_UIE39:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
357 | "_UIE40:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
358 | "_UIE41:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
359 | "_UIE42:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
360 | "_UIE43:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
361 | "_UIE44:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
362 | "_UIE45:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
363 | "_UIE46:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
364 | "_UIE47:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
365 | "_UIE48:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
366 | "_UIE49:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
367 | "_UIE50:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
368 | "_UIE51:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
369 | "_UIE52:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
370 | "_UIE53:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
371 | "_UIE54:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
372 | "_UIE55:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
373 | "_UIE56:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
374 | "_UIE57:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
375 | "_UIE58:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
376 | "_UIE59:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
377 | "_UIE60:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
378 | "_UIE61:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
379 | "_UIE62:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
380 | "_UIE63:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
381 | "_UIE64:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
382 | "_UIE65:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
383 | "_UIE66:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
384 | "_UIE67:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
385 | "_UIE68:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
386 | "_UIE69:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
387 | "_UIE70:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
388 | "_UIE71:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
389 | "_UIE72:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
390 | "_UIE73:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
391 | "_UIE74:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
392 | "_UIE75:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
393 | "_UIE76:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
394 | "_UIE77:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
395 | "_UIE78:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
396 | "_UIE79:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
397 | "_UIE80:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
398 | "_UIE81:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
399 | "_UIE82:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
400 | "_UIE83:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
401 | "_UIE84:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
402 | "_UIE85:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
403 | "_UIE86:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
404 | "_UIE87:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
405 | "_UIE88:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
406 | "_UIE89:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
407 | "_UIE90:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
408 | "_UIE91:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
409 | "_UIE92:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
410 | "_UIE93:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
411 | "_UIE94:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
412 | "_UIE95:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
413 | "_UIE96:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
414 | "_UIE97:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
415 | "_UIE98:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
416 | "_UIE99:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
417 | "_UIE100:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
418 | "_UIE101:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
419 | "_UIE102:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
420 | "_UIE103:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
421 | "_UIE104:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
422 | "_UIE105:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
423 | "_UIE106:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
424 | "_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
425 | "_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
426 | "_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n" | ||
427 | |||
428 | ); | ||
429 | |||
430 | extern void UIE4(void); /* needed for calculating the UIE number */ | ||
431 | |||
432 | void UIE (unsigned int pc) __attribute__((section(".text"))); | ||
433 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | ||
434 | { | ||
435 | #if CONFIG_LED == LED_REAL | ||
436 | bool state = false; | ||
437 | int i = 0; | ||
438 | #endif | ||
439 | unsigned int n; | ||
440 | char str[32]; | ||
441 | |||
442 | asm volatile ("sts\tpr,%0" : "=r"(n)); | ||
443 | |||
444 | /* clear screen */ | ||
445 | lcd_clear_display (); | ||
446 | #ifdef HAVE_LCD_BITMAP | ||
447 | lcd_setfont(FONT_SYSFIXED); | ||
448 | #endif | ||
449 | /* output exception */ | ||
450 | n = (n - (unsigned)UIE4 + 12)>>2; /* get exception or interrupt number */ | ||
451 | snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]); | ||
452 | lcd_puts(0,0,str); | ||
453 | snprintf(str,sizeof(str),"at %08x",pc); | ||
454 | lcd_puts(0,1,str); | ||
455 | lcd_update (); | ||
456 | |||
457 | while (1) | ||
458 | { | ||
459 | #if CONFIG_LED == LED_REAL | ||
460 | if (--i <= 0) | ||
461 | { | ||
462 | state = !state; | ||
463 | led(state); | ||
464 | i = 240000; | ||
465 | } | ||
466 | #endif | ||
467 | |||
468 | /* try to restart firmware if ON is pressed */ | ||
469 | #if CONFIG_KEYPAD == PLAYER_PAD | ||
470 | if (!(PADRL & 0x20)) | ||
471 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
472 | #ifdef HAVE_FMADC | ||
473 | if (!(PCDR & 0x0008)) | ||
474 | #else | ||
475 | if (!(PBDRH & 0x01)) | ||
476 | #endif | ||
477 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
478 | if (!(PCDR & 0x0008)) | ||
479 | #endif | ||
480 | { | ||
481 | /* enable the watchguard timer, but don't service it */ | ||
482 | RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */ | ||
483 | TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */ | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | |||
488 | void system_init(void) | ||
489 | { | ||
490 | /* Disable all interrupts */ | ||
491 | IPRA = 0; | ||
492 | IPRB = 0; | ||
493 | IPRC = 0; | ||
494 | IPRD = 0; | ||
495 | IPRE = 0; | ||
496 | |||
497 | /* NMI level low, falling edge on all interrupts */ | ||
498 | ICR = 0; | ||
499 | |||
500 | /* Enable burst and RAS down mode on DRAM */ | ||
501 | DCR |= 0x5000; | ||
502 | |||
503 | /* Activate Warp mode (simultaneous internal and external mem access) */ | ||
504 | BCR |= 0x2000; | ||
505 | |||
506 | /* Bus state controller initializations. These are only necessary when | ||
507 | running from flash. */ | ||
508 | WCR1 = 0x40FD; /* Long wait states for CS6 (ATA), short for the rest. */ | ||
509 | WCR3 = 0x8000; /* WAIT is pulled up, 1 state inserted for CS6 */ | ||
510 | } | ||
511 | |||
512 | void system_reboot (void) | ||
513 | { | ||
514 | set_irq_level(HIGHEST_IRQ_LEVEL); | ||
515 | |||
516 | asm volatile ("ldc\t%0,vbr" : : "r"(0)); | ||
517 | |||
518 | PACR2 |= 0x4000; /* for coldstart detection */ | ||
519 | IPRA = 0; | ||
520 | IPRB = 0; | ||
521 | IPRC = 0; | ||
522 | IPRD = 0; | ||
523 | IPRE = 0; | ||
524 | ICR = 0; | ||
525 | |||
526 | asm volatile ("jmp @%0; mov.l @%1,r15" : : | ||
527 | "r"(*(int*)0),"r"(4)); | ||
528 | } | ||
529 | |||
530 | /* Utilise the user break controller to catch invalid memory accesses. */ | ||
531 | int system_memory_guard(int newmode) | ||
532 | { | ||
533 | static const struct { | ||
534 | unsigned long addr; | ||
535 | unsigned long mask; | ||
536 | unsigned short bbr; | ||
537 | } modes[MAXMEMGUARD] = { | ||
538 | /* catch nothing */ | ||
539 | { 0x00000000, 0x00000000, 0x0000 }, | ||
540 | /* catch writes to area 02 (flash ROM) */ | ||
541 | { 0x02000000, 0x00FFFFFF, 0x00F8 }, | ||
542 | /* catch all accesses to areas 00 (internal ROM) and 01 (free) */ | ||
543 | { 0x00000000, 0x01FFFFFF, 0x00FC } | ||
544 | }; | ||
545 | |||
546 | int oldmode = MEMGUARD_NONE; | ||
547 | int i; | ||
548 | |||
549 | /* figure out the old mode from what is in the UBC regs. If the register | ||
550 | values don't match any mode, assume MEMGUARD_NONE */ | ||
551 | for (i = MEMGUARD_NONE; i < MAXMEMGUARD; i++) | ||
552 | { | ||
553 | if (BAR == modes[i].addr && BAMR == modes[i].mask && | ||
554 | BBR == modes[i].bbr) | ||
555 | { | ||
556 | oldmode = i; | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | if (newmode == MEMGUARD_KEEP) | ||
562 | newmode = oldmode; | ||
563 | |||
564 | BBR = 0; /* switch off everything first */ | ||
565 | |||
566 | /* always set the UBC according to the mode, in case the old settings | ||
567 | didn't match any valid mode */ | ||
568 | BAR = modes[newmode].addr; | ||
569 | BAMR = modes[newmode].mask; | ||
570 | BBR = modes[newmode].bbr; | ||
571 | |||
572 | return oldmode; | ||
573 | } | ||
574 | #elif defined(CPU_ARM) | ||
575 | 175 | ||
576 | static const char* const uiename[] = { | 176 | static const char* const uiename[] = { |
577 | "Undefined instruction", "Prefetch abort", "Data abort" | 177 | "Undefined instruction", "Prefetch abort", "Data abort" |
diff --git a/firmware/target/arm/gigabeat/meg-fx/i2c-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/i2c-meg-fx.c index 770f4eb4e6..670d6cd04c 100644 --- a/firmware/target/arm/gigabeat/meg-fx/i2c-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/i2c-meg-fx.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | #include "kernel.h" | 22 | #include "kernel.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "hwcompat.h" | ||
25 | #include "logf.h" | 24 | #include "logf.h" |
26 | #include "debug.h" | 25 | #include "debug.h" |
27 | #include "string.h" | 26 | #include "string.h" |
diff --git a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c index f9cb35f884..e69eab432a 100644 --- a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c | |||
@@ -3,7 +3,6 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include "kernel.h" | 4 | #include "kernel.h" |
5 | #include "system.h" | 5 | #include "system.h" |
6 | #include "hwcompat.h" | ||
7 | #include "logf.h" | 6 | #include "logf.h" |
8 | #include "debug.h" | 7 | #include "debug.h" |
9 | #include "string.h" | 8 | #include "string.h" |
diff --git a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h index df7a654b36..3ea0917e86 100644 --- a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h +++ b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h | |||
@@ -3,7 +3,6 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include "kernel.h" | 4 | #include "kernel.h" |
5 | #include "system.h" | 5 | #include "system.h" |
6 | #include "hwcompat.h" | ||
7 | #include "logf.h" | 6 | #include "logf.h" |
8 | #include "debug.h" | 7 | #include "debug.h" |
9 | #include "string.h" | 8 | #include "string.h" |
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c index 8932b95cdd..4fde6faac1 100644 --- a/firmware/target/arm/ipod/power-ipod.c +++ b/firmware/target/arm/ipod/power-ipod.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "power.h" | 25 | #include "power.h" |
26 | #include "hwcompat.h" | ||
27 | #include "logf.h" | 26 | #include "logf.h" |
28 | #include "pcf50605.h" | 27 | #include "pcf50605.h" |
29 | #include "usb.h" | 28 | #include "usb.h" |
diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c index d85cdb70ab..63eb2dc189 100644 --- a/firmware/target/arm/iriver/h10/power-h10.c +++ b/firmware/target/arm/iriver/h10/power-h10.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | #include "system.h" | 29 | #include "system.h" |
30 | #include "power.h" | 30 | #include "power.h" |
31 | #include "hwcompat.h" | ||
32 | #include "logf.h" | 31 | #include "logf.h" |
33 | #include "usb.h" | 32 | #include "usb.h" |
34 | 33 | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c index 1c3cc2b4bf..4e4f585298 100644 --- a/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c +++ b/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "power.h" | 25 | #include "power.h" |
26 | #include "hwcompat.h" | ||
27 | #include "logf.h" | 26 | #include "logf.h" |
28 | #include "usb.h" | 27 | #include "usb.h" |
29 | 28 | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c index 1ab7534d4c..a22a227b15 100644 --- a/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c +++ b/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "button.h" | 32 | #include "button.h" |
33 | #include "sprintf.h" | 33 | #include "sprintf.h" |
34 | #include "string.h" | 34 | #include "string.h" |
35 | #include "hwcompat.h" | ||
36 | 35 | ||
37 | void usb_init_device(void) | 36 | void usb_init_device(void) |
38 | { | 37 | { |
diff --git a/firmware/target/arm/tatung/tpj1022/power-tpj1022.c b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c index e8bc4e1fb0..18835134a3 100644 --- a/firmware/target/arm/tatung/tpj1022/power-tpj1022.c +++ b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | #include "system.h" | 29 | #include "system.h" |
30 | #include "power.h" | 30 | #include "power.h" |
31 | #include "hwcompat.h" | ||
32 | #include "logf.h" | 31 | #include "logf.h" |
33 | #include "usb.h" | 32 | #include "usb.h" |
34 | 33 | ||
diff --git a/firmware/target/sh/archos/ata-archos.c b/firmware/target/sh/archos/ata-archos.c index 5ad30d6891..53276ce8df 100644 --- a/firmware/target/sh/archos/ata-archos.c +++ b/firmware/target/sh/archos/ata-archos.c | |||
@@ -57,7 +57,7 @@ void ata_device_init(void) | |||
57 | or_b(0x02, &PADRH); /* release ATA reset */ | 57 | or_b(0x02, &PADRH); /* release ATA reset */ |
58 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ | 58 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ |
59 | 59 | ||
60 | if (read_hw_mask() & ATA_ADDRESS_200) | 60 | if (HW_MASK & ATA_ADDRESS_200) |
61 | ata_control = ATA_CONTROL1; | 61 | ata_control = ATA_CONTROL1; |
62 | else | 62 | else |
63 | ata_control = ATA_CONTROL2; | 63 | ata_control = ATA_CONTROL2; |
diff --git a/firmware/target/sh/archos/fm_v2/usb-fm_v2.c b/firmware/target/sh/archos/fm_v2/usb-fm_v2.c index 2b4632e4f7..3dcc3559a3 100644 --- a/firmware/target/sh/archos/fm_v2/usb-fm_v2.c +++ b/firmware/target/sh/archos/fm_v2/usb-fm_v2.c | |||
@@ -30,7 +30,7 @@ bool usb_detect(void) | |||
30 | 30 | ||
31 | void usb_enable(bool on) | 31 | void usb_enable(bool on) |
32 | { | 32 | { |
33 | if(read_hw_mask() & USB_ACTIVE_HIGH) | 33 | if(HW_MASK & USB_ACTIVE_HIGH) |
34 | on = !on; | 34 | on = !on; |
35 | 35 | ||
36 | if(on) | 36 | if(on) |
diff --git a/firmware/target/sh/archos/lcd-archos-bitmap.c b/firmware/target/sh/archos/lcd-archos-bitmap.c index b458c81098..28600a9769 100644 --- a/firmware/target/sh/archos/lcd-archos-bitmap.c +++ b/firmware/target/sh/archos/lcd-archos-bitmap.c | |||
@@ -73,7 +73,7 @@ static int xoffset; /* needed for flip */ | |||
73 | 73 | ||
74 | int lcd_default_contrast(void) | 74 | int lcd_default_contrast(void) |
75 | { | 75 | { |
76 | return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; | 76 | return (HW_MASK & LCD_CONTRAST_BIAS) ? 31 : 49; |
77 | } | 77 | } |
78 | 78 | ||
79 | void lcd_set_contrast(int val) | 79 | void lcd_set_contrast(int val) |
diff --git a/firmware/target/sh/archos/ondio/usb-ondio.c b/firmware/target/sh/archos/ondio/usb-ondio.c index 7c09bf3877..c856f3ae2c 100644 --- a/firmware/target/sh/archos/ondio/usb-ondio.c +++ b/firmware/target/sh/archos/ondio/usb-ondio.c | |||
@@ -35,14 +35,14 @@ void usb_enable(bool on) | |||
35 | { | 35 | { |
36 | mmc_enable_int_flash_clock(!mmc_detect()); | 36 | mmc_enable_int_flash_clock(!mmc_detect()); |
37 | 37 | ||
38 | if (!(read_hw_mask() & MMC_CLOCK_POLARITY)) | 38 | if (!(HW_MASK & MMC_CLOCK_POLARITY)) |
39 | and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */ | 39 | and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */ |
40 | or_b(0x20, &PADRL); /* enable USB */ | 40 | or_b(0x20, &PADRL); /* enable USB */ |
41 | and_b(~0x08, &PADRL); /* assert card detect */ | 41 | and_b(~0x08, &PADRL); /* assert card detect */ |
42 | } | 42 | } |
43 | else | 43 | else |
44 | { | 44 | { |
45 | if (!(read_hw_mask() & MMC_CLOCK_POLARITY)) | 45 | if (!(HW_MASK & MMC_CLOCK_POLARITY)) |
46 | or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */ | 46 | or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */ |
47 | and_b(~0x20, &PADRL); /* disable USB */ | 47 | and_b(~0x20, &PADRL); /* disable USB */ |
48 | or_b(0x08, &PADRL); /* deassert card detect */ | 48 | or_b(0x08, &PADRL); /* deassert card detect */ |
diff --git a/firmware/hwcompat.c b/firmware/target/sh/archos/player/hwcompat-player.c index 756491c79d..71bdea383f 100644 --- a/firmware/hwcompat.c +++ b/firmware/target/sh/archos/player/hwcompat-player.c | |||
@@ -16,33 +16,11 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include <stdbool.h> | ||
20 | #include "config.h" | ||
21 | #include "debug.h" | ||
22 | 19 | ||
23 | int read_rom_version(void) | 20 | #include <stdbool.h> |
24 | { | 21 | #include "hwcompat.h" |
25 | int ver = *(short *)0x020000fe; | ||
26 | |||
27 | return ver; | ||
28 | } | ||
29 | |||
30 | int read_hw_mask(void) | ||
31 | { | ||
32 | #ifdef ARCHOS_PLAYER | ||
33 | int mask = 0; /* Fake value for simplicity */ | ||
34 | #else | ||
35 | int mask = *(short *)0x020000fc; | ||
36 | #endif | ||
37 | |||
38 | return mask; | ||
39 | } | ||
40 | 22 | ||
41 | #ifdef ARCHOS_PLAYER | ||
42 | bool is_new_player(void) | 23 | bool is_new_player(void) |
43 | { | 24 | { |
44 | int ver = read_rom_version(); | 25 | return (ROM_VERSION > 449) || (ROM_VERSION == 116); |
45 | 26 | } | |
46 | return (ver > 449) || (ver == 116); | ||
47 | } | ||
48 | #endif | ||
diff --git a/firmware/target/sh/archos/recorder/usb-recorder.c b/firmware/target/sh/archos/recorder/usb-recorder.c index 2934b32a3c..7ed237068e 100644 --- a/firmware/target/sh/archos/recorder/usb-recorder.c +++ b/firmware/target/sh/archos/recorder/usb-recorder.c | |||
@@ -30,7 +30,7 @@ bool usb_detect(void) | |||
30 | 30 | ||
31 | void usb_enable(bool on) | 31 | void usb_enable(bool on) |
32 | { | 32 | { |
33 | if(read_hw_mask() & USB_ACTIVE_HIGH) | 33 | if(HW_MASK & USB_ACTIVE_HIGH) |
34 | on = !on; | 34 | on = !on; |
35 | 35 | ||
36 | if(on) | 36 | if(on) |