Index: apps/codecs/spc.c =================================================================== --- apps/codecs/spc.c (revision 29882) +++ apps/codecs/spc.c (working copy) @@ -190,7 +190,7 @@ /**************** Codec ****************/ enum {SAMPLE_RATE = 32000}; -static struct Spc_Emu spc_emu IDATA_ATTR CACHEALIGN_ATTR; +static struct Spc_Emu spc_emu IBSS_ATTR_SPC CACHEALIGN_ATTR; #if SPC_DUAL_CORE /** Implementations for pipelined dual-core operation **/ Index: apps/codecs/asap.c =================================================================== --- apps/codecs/asap.c (revision 29882) +++ apps/codecs/asap.c (working copy) @@ -27,7 +27,7 @@ #define CHUNK_SIZE (1024*2) static byte samples[CHUNK_SIZE] IBSS_ATTR; /* The sample buffer */ -static ASAP_State asap; /* asap codec state */ +static ASAP_State asap IBSS_ATTR; /* asap codec state */ /* this is the codec entry point */ enum codec_status codec_main(enum codec_entry_call_reason reason) @@ -76,7 +76,7 @@ /* Sample depth is 16 bit little endian */ ci->configure(DSP_SET_SAMPLE_DEPTH, 16); /* Stereo or Mono output ? */ - if(asap.module_info.channels ==1) + if(asap.module_info->channels ==1) { ci->configure(DSP_SET_STEREO_MODE, STEREO_MONO); bytesPerSample = 2; @@ -89,8 +89,8 @@ /* reset eleapsed */ ci->set_elapsed(0); - song = asap.module_info.default_song; - duration = asap.module_info.durations[song]; + song = asap.module_info->default_song; + duration = asap.module_info->durations[song]; if (duration < 0) duration = 180 * 1000; Index: apps/codecs/nsf.c =================================================================== --- apps/codecs/nsf.c (revision 29882) +++ apps/codecs/nsf.c (working copy) @@ -29,20 +29,35 @@ CODEC_HEADER -/* arm doesn't benefit from IRAM? */ -#ifdef CPU_ARM -#undef ICODE_ATTR -#define ICODE_ATTR -#undef IDATA_ATTR -#define IDATA_ATTR +#if (CONFIG_CPU == MCF5250) +#define ICODE_INSTEAD_OF_INLINE +/* Enough IRAM to move additional data and code to it. */ +#define IBSS_ATTR_NSF_LARGE_IRAM IBSS_ATTR +#define ICONST_ATTR_NSF_LARGE_IRAM ICONST_ATTR + +#elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) +#define ICODE_INSTEAD_OF_INLINE +/* Enough IRAM to move additional data and code to it. */ +#define IBSS_ATTR_NSF_LARGE_IRAM IBSS_ATTR +#define ICONST_ATTR_NSF_LARGE_IRAM ICONST_ATTR + +#elif defined(CPU_S5L870X) +#define ICODE_INSTEAD_OF_INLINE +/* Very large IRAM. Move even more data to it. */ +#define IBSS_ATTR_NSF_LARGE_IRAM IBSS_ATTR +#define ICONST_ATTR_NSF_LARGE_IRAM ICONST_ATTR + #else #define ICODE_INSTEAD_OF_INLINE +/* Not enough IRAM available. */ +#define IBSS_ATTR_NSF_LARGE_IRAM +#define ICONST_ATTR_NSF_LARGE_IRAM #endif /* Maximum number of bytes to process in one iteration */ #define WAV_CHUNK_SIZE (1024*2) -static int16_t samples[WAV_CHUNK_SIZE] IBSS_ATTR; +static int16_t samples[WAV_CHUNK_SIZE] IBSS_ATTR MEM_ALIGN_ATTR; #define ZEROMEMORY(addr,size) memset(addr,0,size) @@ -172,7 +187,7 @@ /****************** tables */ static const int32_t ModulationTable[8] ICONST_ATTR = {0,1,2,4,0,-4,-2,-1}; -const uint16_t DMC_FREQ_TABLE[2][0x10] = { +const uint16_t DMC_FREQ_TABLE[2][0x10] ICONST_ATTR_NSF_LARGE_IRAM = { /* NTSC */ {0x1AC,0x17C,0x154,0x140,0x11E,0x0FE,0x0E2,0x0D6,0x0BE,0x0A0,0x08E,0x080, 0x06A,0x054,0x048,0x036}, @@ -181,15 +196,15 @@ 0x062,0x04E,0x042,0x032} }; -const uint8_t DUTY_CYCLE_TABLE[4] = {2,4,8,12}; +const uint8_t DUTY_CYCLE_TABLE[4] ICONST_ATTR_NSF_LARGE_IRAM = {2,4,8,12}; -const uint8_t LENGTH_COUNTER_TABLE[0x20] = { +const uint8_t LENGTH_COUNTER_TABLE[0x20] ICONST_ATTR_NSF_LARGE_IRAM = { 0x0A,0xFE,0x14,0x02,0x28,0x04,0x50,0x06,0xA0,0x08,0x3C,0x0A,0x0E,0x0C,0x1A, 0x0E,0x0C,0x10,0x18,0x12,0x30,0x14,0x60,0x16,0xC0,0x18,0x48,0x1A,0x10,0x1C, 0x20,0x1E }; -const uint16_t NOISE_FREQ_TABLE[0x10] = { +const uint16_t NOISE_FREQ_TABLE[0x10] ICONST_ATTR_NSF_LARGE_IRAM = { 0x004,0x008,0x010,0x020,0x040,0x060,0x080,0x0A0,0x0CA,0x0FE,0x17C,0x1FC, 0x2FA,0x3F8,0x7F2,0xFE4 }; @@ -589,7 +604,7 @@ int32_t nPopCount; }; -int16_t FDS_nOutputTable_L[4][0x21][0x40]; +int16_t FDS_nOutputTable_L[4][0x21][0x40] IBSS_ATTR_NSF_LARGE_IRAM MEM_ALIGN_ATTR; struct FME07Wave { @@ -610,7 +625,7 @@ int32_t nMixL; }; -int16_t FME07_nOutputTable_L[0x10] IDATA_ATTR; +int16_t FME07_nOutputTable_L[0x10] IDATA_ATTR MEM_ALIGN_ATTR; struct N106Wave { @@ -650,7 +665,7 @@ int32_t nMixL[8]; }; -int16_t N106_nOutputTable_L[0x10][0x10]; +int16_t N106_nOutputTable_L[0x10][0x10] IBSS_ATTR_NSF_LARGE_IRAM MEM_ALIGN_ATTR; struct VRC6PulseWave { @@ -675,7 +690,7 @@ }; -int16_t VRC6Pulse_nOutputTable_L[0x10] IDATA_ATTR; +int16_t VRC6Pulse_nOutputTable_L[0x10] IDATA_ATTR MEM_ALIGN_ATTR; struct VRC6SawWave { @@ -697,7 +712,7 @@ }; -int16_t VRC6Saw_nOutputTable_L[0x20] IDATA_ATTR; +int16_t VRC6Saw_nOutputTable_L[0x20] IDATA_ATTR MEM_ALIGN_ATTR; struct Wave_Squares { @@ -735,7 +750,7 @@ int32_t nMixL; }; -int16_t Squares_nOutputTable_L[0x10][0x10] IDATA_ATTR; +int16_t Squares_nOutputTable_L[0x10][0x10] IDATA_ATTR MEM_ALIGN_ATTR; struct Wave_TND { @@ -1161,16 +1176,16 @@ * Memory */ /* RAM: 0x0000 - 0x07FF */ -uint8_t pRAM[0x800] IDATA_ATTR; +uint8_t pRAM[0x800] IBSS_ATTR_NSF_LARGE_IRAM MEM_ALIGN_ATTR; /* SRAM: 0x6000 - 0x7FFF (non-FDS only) */ -uint8_t pSRAM[0x2000]; +uint8_t pSRAM[0x2000] IBSS_ATTR_NSF_LARGE_IRAM MEM_ALIGN_ATTR; /* ExRAM: 0x5C00 - 0x5FF5 (MMC5 only) * Also holds NSF player code (at 0x5000 - 0x500F) */ -uint8_t pExRAM[0x1000]; +uint8_t pExRAM[0x1000] IBSS_ATTR_NSF_LARGE_IRAM MEM_ALIGN_ATTR; /* Full ROM buffer */ uint8_t* pROM_Full IDATA_ATTR; -uint16_t main_nOutputTable_L[0x8000]; +uint16_t main_nOutputTable_L[0x8000] MEM_ALIGN_ATTR; uint8_t* pROM[10] IDATA_ATTR;/* ROM banks (point to areas in pROM_Full) */ /* 0x8000 - 0xFFFF */ @@ -1188,8 +1203,8 @@ typedef uint8_t ( *ReadProc)(uint16_t); typedef void ( *WriteProc)(uint16_t,uint8_t); -ReadProc ReadMemory[0x10] IDATA_ATTR; -WriteProc WriteMemory[0x10] IDATA_ATTR; +ReadProc ReadMemory[0x10] IDATA_ATTR MEM_ALIGN_ATTR; +WriteProc WriteMemory[0x10] IDATA_ATTR MEM_ALIGN_ATTR; /* * 6502 Registers / Mode @@ -3541,7 +3556,7 @@ /* Lookup Tables */ /* the number of CPU cycles used for each instruction */ -static const uint8_t CPU_Cycles[0x100] = { +static const uint8_t CPU_Cycles[0x100] ICONST_ATTR_NSF_LARGE_IRAM = { 7,6,0,8,3,3,5,5,3,2,2,2,4,4,6,6, 2,5,0,8,4,4,6,6,2,4,2,7,4,4,7,7, 6,6,0,8,3,3,5,5,4,2,2,2,4,4,6,6, @@ -3560,7 +3575,7 @@ 2,5,0,8,4,4,6,6,2,4,2,7,4,4,7,7 }; /* the status of the NZ flags for the given value */ -static const uint8_t NZTable[0x100] = { +static const uint8_t NZTable[0x100] ICONST_ATTR_NSF_LARGE_IRAM = { Z_FLAG,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, Index: apps/codecs/libasap/asap.c =================================================================== --- apps/codecs/libasap/asap.c (revision 29882) +++ apps/codecs/libasap/asap.c (working copy) @@ -23,6 +23,9 @@ #include "asap_internal.h" +static byte s_memory[65536]; +static ASAP_ModuleInfo s_module_info; + #ifdef ASAP_ONLY_INFO #define GET_PLAYER(name) NULL @@ -35,7 +38,7 @@ { switch (addr & 0xff1f) { case 0xd014: - return ast _ module_info.ntsc ? 0xf : 1; + return ast _ module_info->ntsc ? 0xf : 1; case 0xd20a: case 0xd21a: return PokeySound_GetRandom(ast, addr, ast _ cycle); @@ -91,7 +94,7 @@ else ast _ cycle = ast _ next_scanline_cycle + 106; } - else if ((addr & 0xff00) == ast _ module_info.covox_addr) { + else if ((addr & 0xff00) == ast _ module_info->covox_addr) { V(PokeyState PTR, pst); addr &= 3; if (addr == 0 || addr == 3) @@ -1379,8 +1382,11 @@ P(ASAP_State PTR, ast), P(STRING, filename), P(CONST BYTEARRAY, module), P(int, module_len))) { + /* Set up ast */ + ast _ memory = s_memory; + ast _ module_info = &s_module_info; ast _ silence_cycles = 0; - return parse_file(ast, ADDRESSOF ast _ module_info, filename, module, module_len); + return parse_file(ast, ast _ module_info, filename, module, module_len); } FUNC(void, ASAP_DetectSilence, (P(ASAP_State PTR, ast), P(int, seconds))) @@ -1416,7 +1422,7 @@ ast _ current_duration = duration; ast _ blocks_played = 0; ast _ silence_cycles_counter = ast _ silence_cycles; - ast _ extra_pokey_mask = ast _ module_info.channels > 1 ? 0x10 : 0; + ast _ extra_pokey_mask = ast _ module_info->channels > 1 ? 0x10 : 0; ast _ consol = 8; ast _ covox[0] = CAST(byte) 0x80; ast _ covox[1] = CAST(byte) 0x80; @@ -1433,9 +1439,9 @@ ast _ timer2_cycle = NEVER; ast _ timer4_cycle = NEVER; ast _ irqst = 0xff; - switch (ast _ module_info.type) { + switch (ast _ module_info->type) { case ASAP_TYPE_SAP_B: - call_6502_init(ast, ast _ module_info.init, song, 0, 0); + call_6502_init(ast, ast _ module_info->init, song, 0, 0); break; case ASAP_TYPE_SAP_C: #ifndef ASAP_ONLY_SAP @@ -1444,8 +1450,8 @@ case ASAP_TYPE_CMR: case ASAP_TYPE_CMS: #endif - call_6502_init(ast, ast _ module_info.player + 3, 0x70, ast _ module_info.music, ast _ module_info.music >> 8); - call_6502_init(ast, ast _ module_info.player + 3, 0x00, song, 0); + call_6502_init(ast, ast _ module_info->player + 3, 0x70, ast _ module_info->music, ast _ module_info->music >> 8); + call_6502_init(ast, ast _ module_info->player + 3, 0x00, song, 0); break; case ASAP_TYPE_SAP_D: case ASAP_TYPE_SAP_S: @@ -1453,23 +1459,23 @@ ast _ cpu_x = 0x00; ast _ cpu_y = 0x00; ast _ cpu_s = 0xff; - ast _ cpu_pc = ast _ module_info.init; + ast _ cpu_pc = ast _ module_info->init; break; #ifndef ASAP_ONLY_SAP case ASAP_TYPE_DLT: - call_6502_init(ast, ast _ module_info.player + 0x100, 0x00, 0x00, ast _ module_info.song_pos[song]); + call_6502_init(ast, ast _ module_info->player + 0x100, 0x00, 0x00, ast _ module_info->song_pos[song]); break; case ASAP_TYPE_MPT: - call_6502_init(ast, ast _ module_info.player, 0x00, ast _ module_info.music >> 8, ast _ module_info.music); - call_6502_init(ast, ast _ module_info.player, 0x02, ast _ module_info.song_pos[song], 0); + call_6502_init(ast, ast _ module_info->player, 0x00, ast _ module_info->music >> 8, ast _ module_info->music); + call_6502_init(ast, ast _ module_info->player, 0x02, ast _ module_info->song_pos[song], 0); break; case ASAP_TYPE_RMT: - call_6502_init(ast, ast _ module_info.player, ast _ module_info.song_pos[song], ast _ module_info.music, ast _ module_info.music >> 8); + call_6502_init(ast, ast _ module_info->player, ast _ module_info->song_pos[song], ast _ module_info->music, ast _ module_info->music >> 8); break; case ASAP_TYPE_TMC: case ASAP_TYPE_TM2: - call_6502_init(ast, ast _ module_info.player, 0x70, ast _ module_info.music >> 8, ast _ module_info.music); - call_6502_init(ast, ast _ module_info.player, 0x00, song, 0); + call_6502_init(ast, ast _ module_info->player, 0x70, ast _ module_info->music >> 8, ast _ module_info->music); + call_6502_init(ast, ast _ module_info->player, 0x00, song, 0); ast _ tmc_per_frame_counter = 1; break; #endif @@ -1485,11 +1491,11 @@ FUNC(abool, call_6502_player, (P(ASAP_State PTR, ast))) { - V(int, player) = ast _ module_info.player; + V(int, player) = ast _ module_info->player; PokeySound_StartFrame(ast); - switch (ast _ module_info.type) { + switch (ast _ module_info->type) { case ASAP_TYPE_SAP_B: - call_6502(ast, player, ast _ module_info.fastplay); + call_6502(ast, player, ast _ module_info->fastplay); break; case ASAP_TYPE_SAP_C: #ifndef ASAP_ONLY_SAP @@ -1498,7 +1504,7 @@ case ASAP_TYPE_CMR: case ASAP_TYPE_CMS: #endif - call_6502(ast, player + 6, ast _ module_info.fastplay); + call_6502(ast, player + 6, ast _ module_info->fastplay); break; case ASAP_TYPE_SAP_D: if (player >= 0) { @@ -1525,10 +1531,10 @@ dPutByte(RETURN_FROM_PLAYER_ADDR + 5, 0x40); /* RTI */ ast _ cpu_pc = player; } - Cpu_RunScanlines(ast, ast _ module_info.fastplay); + Cpu_RunScanlines(ast, ast _ module_info->fastplay); break; case ASAP_TYPE_SAP_S: - Cpu_RunScanlines(ast, ast _ module_info.fastplay); + Cpu_RunScanlines(ast, ast _ module_info->fastplay); { V(int, i) = dGetByte(0x45) - 1; dPutByte(0x45, i); @@ -1538,28 +1544,28 @@ break; #ifndef ASAP_ONLY_SAP case ASAP_TYPE_DLT: - call_6502(ast, player + 0x103, ast _ module_info.fastplay); + call_6502(ast, player + 0x103, ast _ module_info->fastplay); break; case ASAP_TYPE_MPT: case ASAP_TYPE_RMT: case ASAP_TYPE_TM2: - call_6502(ast, player + 3, ast _ module_info.fastplay); + call_6502(ast, player + 3, ast _ module_info->fastplay); break; case ASAP_TYPE_TMC: if (--ast _ tmc_per_frame_counter <= 0) { ast _ tmc_per_frame_counter = ast _ tmc_per_frame; - call_6502(ast, player + 3, ast _ module_info.fastplay); + call_6502(ast, player + 3, ast _ module_info->fastplay); } else - call_6502(ast, player + 6, ast _ module_info.fastplay); + call_6502(ast, player + 6, ast _ module_info->fastplay); break; #endif } - PokeySound_EndFrame(ast, ast _ module_info.fastplay * 114); + PokeySound_EndFrame(ast, ast _ module_info->fastplay * 114); if (ast _ silence_cycles > 0) { if (PokeySound_IsSilent(ADDRESSOF ast _ base_pokey) && PokeySound_IsSilent(ADDRESSOF ast _ extra_pokey)) { - ast _ silence_cycles_counter -= ast _ module_info.fastplay * 114; + ast _ silence_cycles_counter -= ast _ module_info->fastplay * 114; if (ast _ silence_cycles_counter <= 0) return FALSE; } @@ -1606,7 +1612,7 @@ P(CONST ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(ASAP_SampleFormat, format))) { V(int, use_16bit) = format != ASAP_FORMAT_U8 ? 1 : 0; - V(int, block_size) = ast _ module_info.channels << use_16bit; + V(int, block_size) = ast _ module_info->channels << use_16bit; V(int, bytes_per_second) = ASAP_SAMPLE_RATE * block_size; V(int, total_blocks) = milliseconds_to_blocks(ast _ current_duration); V(int, n_bytes) = (total_blocks - ast _ blocks_played) * block_size; @@ -1629,7 +1635,7 @@ buffer[19] = 0; buffer[20] = 1; buffer[21] = 0; - buffer[22] = CAST(byte) ast _ module_info.channels; + buffer[22] = CAST(byte) ast _ module_info->channels; buffer[23] = 0; serialize_int(buffer, 24, ASAP_SAMPLE_RATE); serialize_int(buffer, 28, bytes_per_second); @@ -1656,7 +1662,7 @@ #ifdef ACTIONSCRIPT block_shift = 0; #else - block_shift = (ast _ module_info.channels - 1) + (format != ASAP_FORMAT_U8 ? 1 : 0); + block_shift = (ast _ module_info->channels - 1) + (format != ASAP_FORMAT_U8 ? 1 : 0); #endif buffer_blocks = buffer_len >> block_shift; if (ast _ current_duration > 0) { Index: apps/codecs/libasap/asap_internal.h =================================================================== --- apps/codecs/libasap/asap_internal.h (revision 29882) +++ apps/codecs/libasap/asap_internal.h (working copy) @@ -109,7 +109,7 @@ #define PutByte(addr, data) do { if (((addr) & 0xf900) == 0xd000) ASAP_PutByte(ast, addr, data); else dPutByte(addr, data); } while (FALSE) #define RMW_GetByte(dest, addr) do { if (((addr) >> 8) == 0xd2) { dest = ASAP_GetByte(ast, addr); ast _ cycle--; ASAP_PutByte(ast, addr, dest); ast _ cycle++; } else dest = dGetByte(addr); } while (FALSE) -#define ASAP_MAIN_CLOCK(ast) ((ast) _ module_info.ntsc ? 1789772 : 1773447) +#define ASAP_MAIN_CLOCK(ast) ((ast) _ module_info->ntsc ? 1789772 : 1773447) #define CYCLE_TO_SAMPLE(cycle) TO_INT(((cycle) * ASAP_SAMPLE_RATE + ast _ sample_offset) / ASAP_MAIN_CLOCK(ast)) #endif /* _ASAP_INTERNAL_H_ */ Index: apps/codecs/libasap/acpu.c =================================================================== --- apps/codecs/libasap/acpu.c (revision 29882) +++ apps/codecs/libasap/acpu.c (working copy) @@ -286,7 +286,7 @@ cycle = ast _ cycle; if (cycle >= ast _ nearest_event_cycle) { if (cycle >= ast _ next_scanline_cycle) { - if (++ast _ scanline_number == (ast _ module_info.ntsc ? 262 : 312)) + if (++ast _ scanline_number == (ast _ module_info->ntsc ? 262 : 312)) ast _ scanline_number = 0; ast _ cycle = cycle += 9; ast _ next_scanline_cycle += 114; @@ -337,7 +337,7 @@ case 0xb2: case 0xd2: case 0xf2: - ast _ scanline_number = (ast _ scanline_number + scanlines - 1) % (ast _ module_info.ntsc ? 262 : 312); + ast _ scanline_number = (ast _ scanline_number + scanlines - 1) % (ast _ module_info->ntsc ? 262 : 312); scanlines = 1; ast _ cycle = cycle_limit; break; Index: apps/codecs/libasap/asap.h =================================================================== --- apps/codecs/libasap/asap.h (revision 29882) +++ apps/codecs/libasap/asap.h (working copy) @@ -179,7 +179,7 @@ int samples; int iir_acc_left; int iir_acc_right; - ASAP_ModuleInfo module_info; + ASAP_ModuleInfo *module_info; int tmc_per_frame; int tmc_per_frame_counter; int current_song; @@ -189,7 +189,7 @@ int silence_cycles_counter; byte poly9_lookup[511]; byte poly17_lookup[16385]; - byte memory[65536]; + byte *memory; } ASAP_State; /* Parses the string in the "mm:ss.xxx" format Index: apps/codecs/libspc/spc_codec.h =================================================================== --- apps/codecs/libspc/spc_codec.h (revision 29882) +++ apps/codecs/libspc/spc_codec.h (working copy) @@ -62,7 +62,7 @@ #define SPC_NOECHO 0 #elif defined(CPU_COLDFIRE) /* Cache BRR waves */ - #define SPC_BRRCACHE 1 + #define SPC_BRRCACHE 1 /* Disable gaussian interpolation */ #define SPC_NOINTERP 1 @@ -71,7 +71,7 @@ #define SPC_NOECHO 0 #elif defined (CPU_PP) && SPC_DUAL_CORE /* Cache BRR waves */ - #define SPC_BRRCACHE 1 + #define SPC_BRRCACHE 1 /* Disable gaussian interpolation */ #define SPC_NOINTERP 1 @@ -89,20 +89,41 @@ #define SPC_NOECHO 1 #endif -#ifdef CPU_ARM +#if (CONFIG_CPU == MCF5250) +#define IBSS_ATTR_SPC IBSS_ATTR +#define ICODE_ATTR_SPC ICODE_ATTR +#define ICONST_ATTR_SPC ICONST_ATTR +/* Not enough IRAM available to move further data to it. */ +#define IBSS_ATTR_SPC_LARGE_IRAM -#if CONFIG_CPU != PP5002 - #undef ICODE_ATTR - #define ICODE_ATTR +#elif (CONFIG_CPU == PP5020) +/* spc is slower on PP5020 when moving data to IRAM. */ +#define IBSS_ATTR_SPC +#define ICODE_ATTR_SPC +#define ICONST_ATTR_SPC +/* Not enough IRAM available to move further data to it. */ +#define IBSS_ATTR_SPC_LARGE_IRAM - #undef IDATA_ATTR - #define IDATA_ATTR +#elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) +#define IBSS_ATTR_SPC IBSS_ATTR +#define ICODE_ATTR_SPC ICODE_ATTR +#define ICONST_ATTR_SPC ICONST_ATTR +/* Not enough IRAM available to move further data to it. */ +#define IBSS_ATTR_SPC_LARGE_IRAM - #undef ICONST_ATTR - #define ICONST_ATTR +#elif defined(CPU_S5L870X) +#define IBSS_ATTR_SPC IBSS_ATTR +#define ICODE_ATTR_SPC ICODE_ATTR +#define ICONST_ATTR_SPC ICONST_ATTR +/* Very large IRAM. Move even more data to it. */ +#define IBSS_ATTR_SPC_LARGE_IRAM IBSS_ATTR - #undef IBSS_ATTR - #define IBSS_ATTR +#else +#define IBSS_ATTR_SPC IBSS_ATTR +#define ICODE_ATTR_SPC ICODE_ATTR +#define ICONST_ATTR_SPC ICONST_ATTR +/* Not enough IRAM available to move further data to it. */ +#define IBSS_ATTR_SPC_LARGE_IRAM #endif #if SPC_DUAL_CORE @@ -111,7 +132,6 @@ #undef SHAREDDATA_ATTR #define SHAREDDATA_ATTR __attribute__((section(".idata"))) #endif -#endif /* Samples per channel per iteration */ #if defined(CPU_PP) && NUM_CORES == 1 @@ -192,7 +212,7 @@ #define RAM ram.ram extern struct cpu_ram_t ram; -long CPU_run( THIS, long start_time ) ICODE_ATTR; +long CPU_run( THIS, long start_time ) ICODE_ATTR_SPC; void CPU_Init( THIS ); /* The DSP portion (awe!) */ @@ -375,7 +395,7 @@ #endif }; -void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) ICODE_ATTR; +void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) ICODE_ATTR_SPC; void DSP_reset( struct Spc_Dsp* this ); static inline void DSP_run( struct Spc_Dsp* this, long count, int32_t* out ) @@ -412,7 +432,7 @@ int counter; }; -void Timer_run_( struct Timer* t, long time ) ICODE_ATTR; +void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC; static inline void Timer_run( struct Timer* t, long time ) { @@ -461,7 +481,7 @@ int SPC_load_spc( THIS, const void* data, long size ); /**************** DSP interaction ****************/ -void DSP_write( struct Spc_Dsp* this, int i, int data ) ICODE_ATTR; +void DSP_write( struct Spc_Dsp* this, int i, int data ) ICODE_ATTR_SPC; static inline int DSP_read( struct Spc_Dsp* this, int i ) { @@ -469,7 +489,7 @@ return this->r.reg [i]; } -void SPC_run_dsp_( THIS, long time ) ICODE_ATTR; +void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC; static inline void SPC_run_dsp( THIS, long time ) { @@ -477,10 +497,10 @@ SPC_run_dsp_( this, time ); } -int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR; -void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR; +int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR_SPC; +void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR_SPC; /**************** Sample generation ****************/ -int SPC_play( THIS, long count, int32_t* out ) ICODE_ATTR; +int SPC_play( THIS, long count, int32_t* out ) ICODE_ATTR_SPC; #endif /* _SPC_CODEC_H_ */ Index: apps/codecs/libspc/spc_dsp.c =================================================================== --- apps/codecs/libspc/spc_dsp.c (revision 29882) +++ apps/codecs/libspc/spc_dsp.c (working copy) @@ -28,8 +28,7 @@ #include "spc_profiler.h" #if defined(CPU_COLDFIRE) || defined (CPU_ARM) -int32_t fir_buf[FIR_BUF_CNT] - __attribute__ ((aligned (FIR_BUF_ALIGN*1))) IBSS_ATTR; +int32_t fir_buf[FIR_BUF_CNT] IBSS_ATTR_SPC MEM_ALIGN_ATTR; #endif #if SPC_BRRCACHE /* a little extra for samples that go past end */ @@ -80,7 +79,7 @@ #if SPC_BRRCACHE static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, struct voice_t* voice, - struct raw_voice_t const* const raw_voice ) ICODE_ATTR; + struct raw_voice_t const* const raw_voice ) ICODE_ATTR_SPC; static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, struct voice_t* voice, struct raw_voice_t const* const raw_voice ) @@ -248,7 +247,7 @@ static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, struct src_dir const* const sd, struct raw_voice_t const* const raw_voice, - const int key_on_delay, const int vbit) ICODE_ATTR; + const int key_on_delay, const int vbit) ICODE_ATTR_SPC; static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, struct src_dir const* const sd, struct raw_voice_t const* const raw_voice, @@ -385,7 +384,7 @@ /* each rate divides exactly into 0x7800 without remainder */ int const env_rate_init = 0x7800; - static unsigned short const env_rates [0x20] ICONST_ATTR = + static unsigned short const env_rates [0x20] ICONST_ATTR_SPC = { 0x0000, 0x000F, 0x0014, 0x0018, 0x001E, 0x0028, 0x0030, 0x003C, 0x0050, 0x0060, 0x0078, 0x00A0, 0x00C0, 0x00F0, 0x0140, 0x0180, @@ -767,7 +766,7 @@ #if !SPC_NOINTERP /* Interleved gauss table (to improve cache coherency). */ /* gauss [i * 2 + j] = normal_gauss [(1 - j) * 256 + i] */ - static short const gauss [512] = + static short const gauss [512] ICONST_ATTR_SPC = { 370,1305, 366,1305, 362,1304, 358,1304, 354,1304, 351,1304, 347,1304, 343,1303, 339,1303, 336,1303, 332,1302, 328,1302, 325,1301, 321,1300, 318,1300, 314,1299, Index: apps/codecs/libspc/spc_emu.c =================================================================== --- apps/codecs/libspc/spc_emu.c (revision 29882) +++ apps/codecs/libspc/spc_emu.c (working copy) @@ -28,7 +28,7 @@ /* DSP Based on Brad Martin's OpenSPC DSP emulator */ /* tag reading from sexyspc by John Brawn (John_Brawn@yahoo.com) and others */ -struct cpu_ram_t ram CACHEALIGN_ATTR; +struct cpu_ram_t ram IBSS_ATTR_SPC_LARGE_IRAM CACHEALIGN_ATTR; /**************** Timers ****************/ Index: apps/codecs/libspc/spc_cpu.c =================================================================== --- apps/codecs/libspc/spc_cpu.c (revision 29882) +++ apps/codecs/libspc/spc_cpu.c (working copy) @@ -65,7 +65,7 @@ #define MEM_BIT() CPU_mem_bit( this, pc, spc_time_ ) static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) - ICODE_ATTR; + ICODE_ATTR_SPC; static unsigned CPU_mem_bit( THIS, uint8_t const* pc, long const spc_time_ ) {