diff options
-rw-r--r-- | apps/codecs/libspc/spc_codec.h | 64 | ||||
-rw-r--r-- | apps/codecs/libspc/spc_cpu.c | 2 | ||||
-rw-r--r-- | apps/codecs/libspc/spc_dsp.c | 11 | ||||
-rw-r--r-- | apps/codecs/libspc/spc_emu.c | 2 | ||||
-rw-r--r-- | apps/codecs/spc.c | 2 |
5 files changed, 50 insertions, 31 deletions
diff --git a/apps/codecs/libspc/spc_codec.h b/apps/codecs/libspc/spc_codec.h index f4f69dd758..391540cb19 100644 --- a/apps/codecs/libspc/spc_codec.h +++ b/apps/codecs/libspc/spc_codec.h | |||
@@ -89,20 +89,41 @@ | |||
89 | #define SPC_NOECHO 1 | 89 | #define SPC_NOECHO 1 |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | #ifdef CPU_ARM | 92 | #if (CONFIG_CPU == MCF5250) |
93 | #define IBSS_ATTR_SPC IBSS_ATTR | ||
94 | #define ICODE_ATTR_SPC ICODE_ATTR | ||
95 | #define ICONST_ATTR_SPC ICONST_ATTR | ||
96 | /* Not enough IRAM available to move further data to it. */ | ||
97 | #define IBSS_ATTR_SPC_LARGE_IRAM | ||
98 | |||
99 | #elif (CONFIG_CPU == PP5020) | ||
100 | /* spc is slower on PP5020 when moving data to IRAM. */ | ||
101 | #define IBSS_ATTR_SPC | ||
102 | #define ICODE_ATTR_SPC | ||
103 | #define ICONST_ATTR_SPC | ||
104 | /* Not enough IRAM available to move further data to it. */ | ||
105 | #define IBSS_ATTR_SPC_LARGE_IRAM | ||
106 | |||
107 | #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) | ||
108 | #define IBSS_ATTR_SPC IBSS_ATTR | ||
109 | #define ICODE_ATTR_SPC ICODE_ATTR | ||
110 | #define ICONST_ATTR_SPC ICONST_ATTR | ||
111 | /* Not enough IRAM available to move further data to it. */ | ||
112 | #define IBSS_ATTR_SPC_LARGE_IRAM | ||
113 | |||
114 | #elif defined(CPU_S5L870X) | ||
115 | #define IBSS_ATTR_SPC IBSS_ATTR | ||
116 | #define ICODE_ATTR_SPC ICODE_ATTR | ||
117 | #define ICONST_ATTR_SPC ICONST_ATTR | ||
118 | /* Very large IRAM. Move even more data to it. */ | ||
119 | #define IBSS_ATTR_SPC_LARGE_IRAM IBSS_ATTR | ||
93 | 120 | ||
94 | #if CONFIG_CPU != PP5002 | 121 | #else |
95 | #undef ICODE_ATTR | 122 | #define IBSS_ATTR_SPC IBSS_ATTR |
96 | #define ICODE_ATTR | 123 | #define ICODE_ATTR_SPC ICODE_ATTR |
97 | 124 | #define ICONST_ATTR_SPC ICONST_ATTR | |
98 | #undef IDATA_ATTR | 125 | /* Not enough IRAM available to move further data to it. */ |
99 | #define IDATA_ATTR | 126 | #define IBSS_ATTR_SPC_LARGE_IRAM |
100 | |||
101 | #undef ICONST_ATTR | ||
102 | #define ICONST_ATTR | ||
103 | |||
104 | #undef IBSS_ATTR | ||
105 | #define IBSS_ATTR | ||
106 | #endif | 127 | #endif |
107 | 128 | ||
108 | #if SPC_DUAL_CORE | 129 | #if SPC_DUAL_CORE |
@@ -111,7 +132,6 @@ | |||
111 | #undef SHAREDDATA_ATTR | 132 | #undef SHAREDDATA_ATTR |
112 | #define SHAREDDATA_ATTR __attribute__((section(".idata"))) | 133 | #define SHAREDDATA_ATTR __attribute__((section(".idata"))) |
113 | #endif | 134 | #endif |
114 | #endif | ||
115 | 135 | ||
116 | /* Samples per channel per iteration */ | 136 | /* Samples per channel per iteration */ |
117 | #if defined(CPU_PP) && NUM_CORES == 1 | 137 | #if defined(CPU_PP) && NUM_CORES == 1 |
@@ -192,7 +212,7 @@ struct cpu_ram_t | |||
192 | #define RAM ram.ram | 212 | #define RAM ram.ram |
193 | extern struct cpu_ram_t ram; | 213 | extern struct cpu_ram_t ram; |
194 | 214 | ||
195 | long CPU_run( THIS, long start_time ) ICODE_ATTR; | 215 | long CPU_run( THIS, long start_time ) ICODE_ATTR_SPC; |
196 | void CPU_Init( THIS ); | 216 | void CPU_Init( THIS ); |
197 | 217 | ||
198 | /* The DSP portion (awe!) */ | 218 | /* The DSP portion (awe!) */ |
@@ -375,7 +395,7 @@ struct Spc_Dsp | |||
375 | #endif | 395 | #endif |
376 | }; | 396 | }; |
377 | 397 | ||
378 | void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) ICODE_ATTR; | 398 | void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) ICODE_ATTR_SPC; |
379 | void DSP_reset( struct Spc_Dsp* this ); | 399 | void DSP_reset( struct Spc_Dsp* this ); |
380 | 400 | ||
381 | static inline void DSP_run( struct Spc_Dsp* this, long count, int32_t* out ) | 401 | static inline void DSP_run( struct Spc_Dsp* this, long count, int32_t* out ) |
@@ -412,7 +432,7 @@ struct Timer | |||
412 | int counter; | 432 | int counter; |
413 | }; | 433 | }; |
414 | 434 | ||
415 | void Timer_run_( struct Timer* t, long time ) ICODE_ATTR; | 435 | void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC; |
416 | 436 | ||
417 | static inline void Timer_run( struct Timer* t, long time ) | 437 | static inline void Timer_run( struct Timer* t, long time ) |
418 | { | 438 | { |
@@ -461,7 +481,7 @@ void SPC_Init( THIS ); | |||
461 | int SPC_load_spc( THIS, const void* data, long size ); | 481 | int SPC_load_spc( THIS, const void* data, long size ); |
462 | 482 | ||
463 | /**************** DSP interaction ****************/ | 483 | /**************** DSP interaction ****************/ |
464 | void DSP_write( struct Spc_Dsp* this, int i, int data ) ICODE_ATTR; | 484 | void DSP_write( struct Spc_Dsp* this, int i, int data ) ICODE_ATTR_SPC; |
465 | 485 | ||
466 | static inline int DSP_read( struct Spc_Dsp* this, int i ) | 486 | static inline int DSP_read( struct Spc_Dsp* this, int i ) |
467 | { | 487 | { |
@@ -469,7 +489,7 @@ static inline int DSP_read( struct Spc_Dsp* this, int i ) | |||
469 | return this->r.reg [i]; | 489 | return this->r.reg [i]; |
470 | } | 490 | } |
471 | 491 | ||
472 | void SPC_run_dsp_( THIS, long time ) ICODE_ATTR; | 492 | void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC; |
473 | 493 | ||
474 | static inline void SPC_run_dsp( THIS, long time ) | 494 | static inline void SPC_run_dsp( THIS, long time ) |
475 | { | 495 | { |
@@ -477,10 +497,10 @@ static inline void SPC_run_dsp( THIS, long time ) | |||
477 | SPC_run_dsp_( this, time ); | 497 | SPC_run_dsp_( this, time ); |
478 | } | 498 | } |
479 | 499 | ||
480 | int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR; | 500 | int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR_SPC; |
481 | void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR; | 501 | void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR_SPC; |
482 | 502 | ||
483 | /**************** Sample generation ****************/ | 503 | /**************** Sample generation ****************/ |
484 | int SPC_play( THIS, long count, int32_t* out ) ICODE_ATTR; | 504 | int SPC_play( THIS, long count, int32_t* out ) ICODE_ATTR_SPC; |
485 | 505 | ||
486 | #endif /* _SPC_CODEC_H_ */ | 506 | #endif /* _SPC_CODEC_H_ */ |
diff --git a/apps/codecs/libspc/spc_cpu.c b/apps/codecs/libspc/spc_cpu.c index d308e6e27c..23dcc257de 100644 --- a/apps/codecs/libspc/spc_cpu.c +++ b/apps/codecs/libspc/spc_cpu.c | |||
@@ -65,7 +65,7 @@ static unsigned char const cycle_table [0x100] = { | |||
65 | #define MEM_BIT() CPU_mem_bit( this, pc, spc_time_ ) | 65 | #define MEM_BIT() CPU_mem_bit( this, pc, spc_time_ ) |
66 | 66 | ||
67 | static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) | 67 | static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) |
68 | ICODE_ATTR; | 68 | ICODE_ATTR_SPC; |
69 | 69 | ||
70 | static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) | 70 | static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) |
71 | { | 71 | { |
diff --git a/apps/codecs/libspc/spc_dsp.c b/apps/codecs/libspc/spc_dsp.c index b4fc57158b..4b289caeda 100644 --- a/apps/codecs/libspc/spc_dsp.c +++ b/apps/codecs/libspc/spc_dsp.c | |||
@@ -28,8 +28,7 @@ | |||
28 | #include "spc_profiler.h" | 28 | #include "spc_profiler.h" |
29 | 29 | ||
30 | #if defined(CPU_COLDFIRE) || defined (CPU_ARM) | 30 | #if defined(CPU_COLDFIRE) || defined (CPU_ARM) |
31 | int32_t fir_buf[FIR_BUF_CNT] | 31 | int32_t fir_buf[FIR_BUF_CNT] IBSS_ATTR_SPC MEM_ALIGN_ATTR; |
32 | __attribute__ ((aligned (FIR_BUF_ALIGN*1))) IBSS_ATTR; | ||
33 | #endif | 32 | #endif |
34 | #if SPC_BRRCACHE | 33 | #if SPC_BRRCACHE |
35 | /* a little extra for samples that go past end */ | 34 | /* a little extra for samples that go past end */ |
@@ -80,7 +79,7 @@ void DSP_write( struct Spc_Dsp* this, int i, int data ) | |||
80 | #if SPC_BRRCACHE | 79 | #if SPC_BRRCACHE |
81 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, | 80 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, |
82 | struct voice_t* voice, | 81 | struct voice_t* voice, |
83 | struct raw_voice_t const* const raw_voice ) ICODE_ATTR; | 82 | struct raw_voice_t const* const raw_voice ) ICODE_ATTR_SPC; |
84 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, | 83 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, |
85 | struct voice_t* voice, | 84 | struct voice_t* voice, |
86 | struct raw_voice_t const* const raw_voice ) | 85 | struct raw_voice_t const* const raw_voice ) |
@@ -248,7 +247,7 @@ wave_in_cache:; | |||
248 | static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, | 247 | static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, |
249 | struct src_dir const* const sd, | 248 | struct src_dir const* const sd, |
250 | struct raw_voice_t const* const raw_voice, | 249 | struct raw_voice_t const* const raw_voice, |
251 | const int key_on_delay, const int vbit) ICODE_ATTR; | 250 | const int key_on_delay, const int vbit) ICODE_ATTR_SPC; |
252 | static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, | 251 | static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, |
253 | struct src_dir const* const sd, | 252 | struct src_dir const* const sd, |
254 | struct raw_voice_t const* const raw_voice, | 253 | struct raw_voice_t const* const raw_voice, |
@@ -385,7 +384,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) | |||
385 | 384 | ||
386 | /* each rate divides exactly into 0x7800 without remainder */ | 385 | /* each rate divides exactly into 0x7800 without remainder */ |
387 | int const env_rate_init = 0x7800; | 386 | int const env_rate_init = 0x7800; |
388 | static unsigned short const env_rates [0x20] ICONST_ATTR = | 387 | static unsigned short const env_rates [0x20] ICONST_ATTR_SPC = |
389 | { | 388 | { |
390 | 0x0000, 0x000F, 0x0014, 0x0018, 0x001E, 0x0028, 0x0030, 0x003C, | 389 | 0x0000, 0x000F, 0x0014, 0x0018, 0x001E, 0x0028, 0x0030, 0x003C, |
391 | 0x0050, 0x0060, 0x0078, 0x00A0, 0x00C0, 0x00F0, 0x0140, 0x0180, | 390 | 0x0050, 0x0060, 0x0078, 0x00A0, 0x00C0, 0x00F0, 0x0140, 0x0180, |
@@ -767,7 +766,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) | |||
767 | #if !SPC_NOINTERP | 766 | #if !SPC_NOINTERP |
768 | /* Interleved gauss table (to improve cache coherency). */ | 767 | /* Interleved gauss table (to improve cache coherency). */ |
769 | /* gauss [i * 2 + j] = normal_gauss [(1 - j) * 256 + i] */ | 768 | /* gauss [i * 2 + j] = normal_gauss [(1 - j) * 256 + i] */ |
770 | static short const gauss [512] = | 769 | static short const gauss [512] ICONST_ATTR_SPC = |
771 | { | 770 | { |
772 | 370,1305, 366,1305, 362,1304, 358,1304, 354,1304, 351,1304, 347,1304, 343,1303, | 771 | 370,1305, 366,1305, 362,1304, 358,1304, 354,1304, 351,1304, 347,1304, 343,1303, |
773 | 339,1303, 336,1303, 332,1302, 328,1302, 325,1301, 321,1300, 318,1300, 314,1299, | 772 | 339,1303, 336,1303, 332,1302, 328,1302, 325,1301, 321,1300, 318,1300, 314,1299, |
diff --git a/apps/codecs/libspc/spc_emu.c b/apps/codecs/libspc/spc_emu.c index 1bebc86d9a..0ad1329a6b 100644 --- a/apps/codecs/libspc/spc_emu.c +++ b/apps/codecs/libspc/spc_emu.c | |||
@@ -28,7 +28,7 @@ | |||
28 | /* DSP Based on Brad Martin's OpenSPC DSP emulator */ | 28 | /* DSP Based on Brad Martin's OpenSPC DSP emulator */ |
29 | /* tag reading from sexyspc by John Brawn (John_Brawn@yahoo.com) and others */ | 29 | /* tag reading from sexyspc by John Brawn (John_Brawn@yahoo.com) and others */ |
30 | 30 | ||
31 | struct cpu_ram_t ram CACHEALIGN_ATTR; | 31 | struct cpu_ram_t ram IBSS_ATTR_SPC_LARGE_IRAM CACHEALIGN_ATTR; |
32 | 32 | ||
33 | /**************** Timers ****************/ | 33 | /**************** Timers ****************/ |
34 | 34 | ||
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c index 1b49761810..80c28abbc1 100644 --- a/apps/codecs/spc.c +++ b/apps/codecs/spc.c | |||
@@ -190,7 +190,7 @@ static int LoadID666(unsigned char *buf) { | |||
190 | 190 | ||
191 | /**************** Codec ****************/ | 191 | /**************** Codec ****************/ |
192 | enum {SAMPLE_RATE = 32000}; | 192 | enum {SAMPLE_RATE = 32000}; |
193 | static struct Spc_Emu spc_emu IDATA_ATTR CACHEALIGN_ATTR; | 193 | static struct Spc_Emu spc_emu IBSS_ATTR_SPC CACHEALIGN_ATTR; |
194 | 194 | ||
195 | #if SPC_DUAL_CORE | 195 | #if SPC_DUAL_CORE |
196 | /** Implementations for pipelined dual-core operation **/ | 196 | /** Implementations for pipelined dual-core operation **/ |