summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-13 16:41:14 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-08-13 16:41:14 +0000
commita1145a1d040dd52b2b5d0e7fe965b6507475bbe2 (patch)
tree988f845d688974dd7db1950243ef09cc39ed443c
parent724a2d2514578297a7fe21dc4c17a7b51a25758d (diff)
downloadrockbox-a1145a1d040dd52b2b5d0e7fe965b6507475bbe2.tar.gz
rockbox-a1145a1d040dd52b2b5d0e7fe965b6507475bbe2.zip
Remove all IRAM attributes from libGME to be able to restart the IRAM optimization on a clean code base. As first step move the sample buffers to IRAM which results in a 1-5% speedup for all codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30284 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/ay.c2
-rw-r--r--apps/codecs/gbs.c2
-rw-r--r--apps/codecs/hes.c2
-rw-r--r--apps/codecs/kss.c2
-rw-r--r--apps/codecs/libgme/ay_apu.h4
-rw-r--r--apps/codecs/libgme/ay_emu.c4
-rw-r--r--apps/codecs/libgme/blargg_common.h14
-rw-r--r--apps/codecs/libgme/blip_buffer.h28
-rw-r--r--apps/codecs/libgme/emu2413.h10
-rw-r--r--apps/codecs/libgme/emutables.h8
-rw-r--r--apps/codecs/libgme/gb_apu.c4
-rw-r--r--apps/codecs/libgme/gb_apu.h8
-rw-r--r--apps/codecs/libgme/gb_cpu.h2
-rw-r--r--apps/codecs/libgme/gb_cpu_run.h2
-rw-r--r--apps/codecs/libgme/gb_oscs.c8
-rw-r--r--apps/codecs/libgme/gb_oscs.h32
-rw-r--r--apps/codecs/libgme/gbs_emu.c4
-rw-r--r--apps/codecs/libgme/gbs_emu.h24
-rw-r--r--apps/codecs/libgme/hes_apu.c4
-rw-r--r--apps/codecs/libgme/hes_apu.h8
-rw-r--r--apps/codecs/libgme/hes_apu_adpcm.c6
-rw-r--r--apps/codecs/libgme/hes_apu_adpcm.h6
-rw-r--r--apps/codecs/libgme/hes_cpu.c2
-rw-r--r--apps/codecs/libgme/hes_cpu.h4
-rw-r--r--apps/codecs/libgme/hes_emu.c26
-rw-r--r--apps/codecs/libgme/hes_emu.h14
-rw-r--r--apps/codecs/libgme/kss_emu.h14
-rw-r--r--apps/codecs/libgme/kss_scc_apu.h4
-rw-r--r--apps/codecs/libgme/multi_buffer.h14
-rw-r--r--apps/codecs/libgme/nes_apu.c2
-rw-r--r--apps/codecs/libgme/nes_apu.h12
-rw-r--r--apps/codecs/libgme/nes_fds_apu.c2
-rw-r--r--apps/codecs/libgme/nes_fds_apu.h4
-rw-r--r--apps/codecs/libgme/nes_fme7_apu.c2
-rw-r--r--apps/codecs/libgme/nes_fme7_apu.h2
-rw-r--r--apps/codecs/libgme/nes_namco_apu.h4
-rw-r--r--apps/codecs/libgme/nes_oscs.c6
-rw-r--r--apps/codecs/libgme/nes_oscs.h16
-rw-r--r--apps/codecs/libgme/nes_vrc6_apu.h4
-rw-r--r--apps/codecs/libgme/nes_vrc7_apu.h6
-rw-r--r--apps/codecs/libgme/nsf_emu.c8
-rw-r--r--apps/codecs/libgme/nsf_emu.h26
-rw-r--r--apps/codecs/libgme/opl_apu.h6
-rw-r--r--apps/codecs/libgme/opltables.h14
-rw-r--r--apps/codecs/libgme/resampler.h2
-rw-r--r--apps/codecs/libgme/sgc_emu.c6
-rw-r--r--apps/codecs/libgme/sgc_emu.h8
-rw-r--r--apps/codecs/libgme/sms_apu.c2
-rw-r--r--apps/codecs/libgme/sms_apu.h6
-rw-r--r--apps/codecs/libgme/sms_fm_apu.c2
-rw-r--r--apps/codecs/libgme/sms_fm_apu.h4
-rw-r--r--apps/codecs/libgme/vgm_emu.c2
-rw-r--r--apps/codecs/libgme/vgm_emu.h2
-rw-r--r--apps/codecs/libgme/ym2413_emu.h4
-rw-r--r--apps/codecs/libgme/ym2612_emu.c8
-rw-r--r--apps/codecs/libgme/ym2612_emu.h6
-rw-r--r--apps/codecs/libgme/ymtables.h8
-rw-r--r--apps/codecs/nsf.c2
-rw-r--r--apps/codecs/sgc.c2
-rw-r--r--apps/codecs/vgm.c2
60 files changed, 214 insertions, 228 deletions
diff --git a/apps/codecs/ay.c b/apps/codecs/ay.c
index ecadcc957b..48261fbfb4 100644
--- a/apps/codecs/ay.c
+++ b/apps/codecs/ay.c
@@ -10,7 +10,7 @@ CODEC_HEADER
10#define CHUNK_SIZE (1024*2) 10#define CHUNK_SIZE (1024*2)
11 11
12static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 12static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
13static struct Ay_Emu ay_emu IDATA_ATTR CACHEALIGN_ATTR; 13static struct Ay_Emu ay_emu;
14 14
15/****************** rockbox interface ******************/ 15/****************** rockbox interface ******************/
16 16
diff --git a/apps/codecs/gbs.c b/apps/codecs/gbs.c
index bc6d31e6b8..5d3154911b 100644
--- a/apps/codecs/gbs.c
+++ b/apps/codecs/gbs.c
@@ -10,7 +10,7 @@ CODEC_HEADER
10#define CHUNK_SIZE (1024*2) 10#define CHUNK_SIZE (1024*2)
11 11
12static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 12static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
13static struct Gbs_Emu gbs_emu IDATA_ATTR CACHEALIGN_ATTR; 13static struct Gbs_Emu gbs_emu;
14 14
15/****************** rockbox interface ******************/ 15/****************** rockbox interface ******************/
16 16
diff --git a/apps/codecs/hes.c b/apps/codecs/hes.c
index 598d787594..8c216ed060 100644
--- a/apps/codecs/hes.c
+++ b/apps/codecs/hes.c
@@ -10,7 +10,7 @@ CODEC_HEADER
10#define CHUNK_SIZE (1024*2) 10#define CHUNK_SIZE (1024*2)
11 11
12static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 12static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
13static struct Hes_Emu hes_emu IDATA_ATTR CACHEALIGN_ATTR; 13static struct Hes_Emu hes_emu;
14 14
15/****************** rockbox interface ******************/ 15/****************** rockbox interface ******************/
16 16
diff --git a/apps/codecs/kss.c b/apps/codecs/kss.c
index 4d482a3f5c..62dd05551e 100644
--- a/apps/codecs/kss.c
+++ b/apps/codecs/kss.c
@@ -10,7 +10,7 @@ CODEC_HEADER
10#define CHUNK_SIZE (1024*2) 10#define CHUNK_SIZE (1024*2)
11 11
12static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 12static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
13static struct Kss_Emu kss_emu IDATA_ATTR CACHEALIGN_ATTR; 13static struct Kss_Emu kss_emu;
14 14
15/****************** rockbox interface ******************/ 15/****************** rockbox interface ******************/
16 16
diff --git a/apps/codecs/libgme/ay_apu.h b/apps/codecs/libgme/ay_apu.h
index a18e3e7860..3df6ba1118 100644
--- a/apps/codecs/libgme/ay_apu.h
+++ b/apps/codecs/libgme/ay_apu.h
@@ -46,8 +46,8 @@ void Ay_apu_init( struct Ay_Apu* this );
46static inline void Ay_apu_write_addr( struct Ay_Apu* this, int data ) { this->addr_ = data & 0x0F; } 46static inline void Ay_apu_write_addr( struct Ay_Apu* this, int data ) { this->addr_ = data & 0x0F; }
47 47
48// Emulates to time t, then writes to current data register 48// Emulates to time t, then writes to current data register
49void run_until( struct Ay_Apu* this, blip_time_t final_end_time ) ICODE_ATTR;; 49void run_until( struct Ay_Apu* this, blip_time_t final_end_time );;
50void write_data_( struct Ay_Apu* this, int addr, int data ) ICODE_ATTR; 50void write_data_( struct Ay_Apu* this, int addr, int data );
51static inline void Ay_apu_write_data( struct Ay_Apu* this, blip_time_t t, int data ) { run_until( this, t ); write_data_( this, this->addr_, data ); } 51static inline void Ay_apu_write_data( struct Ay_Apu* this, blip_time_t t, int data ) { run_until( this, t ); write_data_( this, this->addr_, data ); }
52 52
53// Reads from current data register 53// Reads from current data register
diff --git a/apps/codecs/libgme/ay_emu.c b/apps/codecs/libgme/ay_emu.c
index b537883a6d..e961797dd3 100644
--- a/apps/codecs/libgme/ay_emu.c
+++ b/apps/codecs/libgme/ay_emu.c
@@ -359,7 +359,7 @@ void Sound_set_tempo( struct Ay_Emu *this, int t )
359 this->play_period = (blip_time_t) ((p * FP_ONE_TEMPO) / t); 359 this->play_period = (blip_time_t) ((p * FP_ONE_TEMPO) / t);
360} 360}
361 361
362void fill_buf( struct Ay_Emu *this ) ICODE_ATTR;; 362void fill_buf( struct Ay_Emu *this );;
363blargg_err_t Ay_start_track( struct Ay_Emu *this, int track ) 363blargg_err_t Ay_start_track( struct Ay_Emu *this, int track )
364{ 364{
365 clear_track_vars( this ); 365 clear_track_vars( this );
@@ -543,7 +543,7 @@ blargg_err_t Track_seek( struct Ay_Emu *this, long msec )
543 return Track_skip( this, time - this->out_time ); 543 return Track_skip( this, time - this->out_time );
544} 544}
545 545
546blargg_err_t play_( struct Ay_Emu *this, long count, sample_t* out ) ICODE_ATTR; 546blargg_err_t play_( struct Ay_Emu *this, long count, sample_t* out );
547static blargg_err_t skip_( struct Ay_Emu *this, long count ) 547static blargg_err_t skip_( struct Ay_Emu *this, long count )
548{ 548{
549 // for long skip, mute sound 549 // for long skip, mute sound
diff --git a/apps/codecs/libgme/blargg_common.h b/apps/codecs/libgme/blargg_common.h
index 0f955e5151..74125bb808 100644
--- a/apps/codecs/libgme/blargg_common.h
+++ b/apps/codecs/libgme/blargg_common.h
@@ -25,20 +25,6 @@
25#define FP_ONE_GAIN (1LL << 24) 25#define FP_ONE_GAIN (1LL << 24)
26#define FP_ONE_VOLUME FP_ONE_GAIN 26#define FP_ONE_VOLUME FP_ONE_GAIN
27 27
28#if 1 /* IRAM configuration is not yet active for all libGME codecs. */
29 #undef ICODE_ATTR
30 #define ICODE_ATTR
31
32 #undef IDATA_ATTR
33 #define IDATA_ATTR
34
35 #undef ICONST_ATTR
36 #define ICONST_ATTR
37
38 #undef IBSS_ATTR
39 #define IBSS_ATTR
40#endif
41
42// BLARGG_RESTRICT: equivalent to C99's restrict, where supported 28// BLARGG_RESTRICT: equivalent to C99's restrict, where supported
43#if __GNUC__ >= 3 || _MSC_VER >= 1100 29#if __GNUC__ >= 3 || _MSC_VER >= 1100
44 #define BLARGG_RESTRICT __restrict 30 #define BLARGG_RESTRICT __restrict
diff --git a/apps/codecs/libgme/blip_buffer.h b/apps/codecs/libgme/blip_buffer.h
index d03e1c0998..f9f1f6e969 100644
--- a/apps/codecs/libgme/blip_buffer.h
+++ b/apps/codecs/libgme/blip_buffer.h
@@ -65,12 +65,12 @@ struct Blip_Buffer {
65}; 65};
66 66
67// not documented yet 67// not documented yet
68void Blip_set_modified( struct Blip_Buffer* this ) ICODE_ATTR; 68void Blip_set_modified( struct Blip_Buffer* this );
69int Blip_clear_modified( struct Blip_Buffer* this ) ICODE_ATTR; 69int Blip_clear_modified( struct Blip_Buffer* this );
70void Blip_remove_silence( struct Blip_Buffer* this, long count ) ICODE_ATTR; 70void Blip_remove_silence( struct Blip_Buffer* this, long count );
71blip_resampled_time_t Blip_resampled_duration( struct Blip_Buffer* this, int t ) ICODE_ATTR; 71blip_resampled_time_t Blip_resampled_duration( struct Blip_Buffer* this, int t );
72blip_resampled_time_t Blip_resampled_time( struct Blip_Buffer* this, blip_time_t t ) ICODE_ATTR; 72blip_resampled_time_t Blip_resampled_time( struct Blip_Buffer* this, blip_time_t t );
73blip_resampled_time_t Blip_clock_rate_factor( struct Blip_Buffer* this, long clock_rate ) ICODE_ATTR; 73blip_resampled_time_t Blip_clock_rate_factor( struct Blip_Buffer* this, long clock_rate );
74 74
75// Initializes Blip_Buffer structure 75// Initializes Blip_Buffer structure
76void Blip_init( struct Blip_Buffer* this ); 76void Blip_init( struct Blip_Buffer* this );
@@ -92,13 +92,13 @@ static inline void Blip_set_clock_rate( struct Blip_Buffer* this, long cps )
92// End current time frame of specified duration and make its samples available 92// End current time frame of specified duration and make its samples available
93// (along with any still-unread samples) for reading with read_samples(). Begins 93// (along with any still-unread samples) for reading with read_samples(). Begins
94// a new time frame at the end of the current frame. 94// a new time frame at the end of the current frame.
95void Blip_end_frame( struct Blip_Buffer* this, blip_time_t time ) ICODE_ATTR; 95void Blip_end_frame( struct Blip_Buffer* this, blip_time_t time );
96 96
97// Read at most 'max_samples' out of buffer into 'dest', removing them from from 97// Read at most 'max_samples' out of buffer into 'dest', removing them from from
98// the buffer. Returns number of samples actually read and removed. If stereo is 98// the buffer. Returns number of samples actually read and removed. If stereo is
99// true, increments 'dest' one extra time after writing each sample, to allow 99// true, increments 'dest' one extra time after writing each sample, to allow
100// easy interleving of two channels into a stereo output buffer. 100// easy interleving of two channels into a stereo output buffer.
101long Blip_read_samples( struct Blip_Buffer* this, blip_sample_t* dest, long max_samples, int stereo ) ICODE_ATTR; 101long Blip_read_samples( struct Blip_Buffer* this, blip_sample_t* dest, long max_samples, int stereo );
102 102
103// Additional optional features 103// Additional optional features
104 104
@@ -141,20 +141,20 @@ static inline long Blip_samples_avail( struct Blip_Buffer* this )
141} 141}
142 142
143// Remove 'count' samples from those waiting to be read 143// Remove 'count' samples from those waiting to be read
144void Blip_remove_samples( struct Blip_Buffer* this, long count ) ICODE_ATTR; 144void Blip_remove_samples( struct Blip_Buffer* this, long count );
145 145
146// Experimental features 146// Experimental features
147 147
148// Count number of clocks needed until 'count' samples will be available. 148// Count number of clocks needed until 'count' samples will be available.
149// If buffer can't even hold 'count' samples, returns number of clocks until 149// If buffer can't even hold 'count' samples, returns number of clocks until
150// buffer becomes full. 150// buffer becomes full.
151blip_time_t Blip_count_clocks( struct Blip_Buffer* this, long count ) ICODE_ATTR; 151blip_time_t Blip_count_clocks( struct Blip_Buffer* this, long count );
152 152
153// Number of raw samples that can be mixed within frame of specified duration. 153// Number of raw samples that can be mixed within frame of specified duration.
154long Blip_count_samples( struct Blip_Buffer* this, blip_time_t duration ) ICODE_ATTR; 154long Blip_count_samples( struct Blip_Buffer* this, blip_time_t duration );
155 155
156// Mix 'count' samples from 'buf' into buffer. 156// Mix 'count' samples from 'buf' into buffer.
157void Blip_mix_samples( struct Blip_Buffer* this, blip_sample_t const* buf, long count ) ICODE_ATTR; 157void Blip_mix_samples( struct Blip_Buffer* this, blip_sample_t const* buf, long count );
158 158
159// Range specifies the greatest expected change in amplitude. Calculate it 159// Range specifies the greatest expected change in amplitude. Calculate it
160// by finding the difference between the maximum and minimum expected 160// by finding the difference between the maximum and minimum expected
@@ -170,10 +170,10 @@ struct Blip_Synth {
170void Synth_init( struct Blip_Synth* this ); 170void Synth_init( struct Blip_Synth* this );
171 171
172// Set overall volume of waveform 172// Set overall volume of waveform
173void Synth_volume( struct Blip_Synth* this, int v ) ICODE_ATTR; 173void Synth_volume( struct Blip_Synth* this, int v );
174 174
175// Get/set Blip_Buffer used for output 175// Get/set Blip_Buffer used for output
176const struct Blip_Buffer* Synth_output( struct Blip_Synth* this ) ICODE_ATTR; 176const struct Blip_Buffer* Synth_output( struct Blip_Synth* this );
177 177
178// Low-level interface 178// Low-level interface
179 179
diff --git a/apps/codecs/libgme/emu2413.h b/apps/codecs/libgme/emu2413.h
index 9ee4513ff3..89d6e4dbd5 100644
--- a/apps/codecs/libgme/emu2413.h
+++ b/apps/codecs/libgme/emu2413.h
@@ -132,14 +132,14 @@ EMU2413_API void OPLL_set_internal_mute(OPLL *, e_uint32 mute);
132EMU2413_API e_uint32 OPLL_is_internal_muted(OPLL *); 132EMU2413_API e_uint32 OPLL_is_internal_muted(OPLL *);
133 133
134/* Port/Register access */ 134/* Port/Register access */
135EMU2413_API void OPLL_writeIO(OPLL *, e_uint32 reg, e_uint32 val); ICODE_ATTR 135EMU2413_API void OPLL_writeIO(OPLL *, e_uint32 reg, e_uint32 val);
136EMU2413_API void OPLL_writeReg(OPLL *, e_uint32 reg, e_uint32 val); ICODE_ATTR 136EMU2413_API void OPLL_writeReg(OPLL *, e_uint32 reg, e_uint32 val);
137EMU2413_API e_uint32 OPLL_read(OPLL *, e_uint32 port); 137EMU2413_API e_uint32 OPLL_read(OPLL *, e_uint32 port);
138 138
139/* Synthsize */ 139/* Synthsize */
140EMU2413_API e_int16 OPLL_calc(OPLL *) ; ICODE_ATTR 140EMU2413_API e_int16 OPLL_calc(OPLL *) ;
141EMU2413_API void OPLL_calc_stereo(OPLL *, e_int32 out[2]) ; ICODE_ATTR 141EMU2413_API void OPLL_calc_stereo(OPLL *, e_int32 out[2]) ;
142EMU2413_API e_int16 *OPLL_update_buffer(OPLL *, e_uint32 length) ; ICODE_ATTR 142EMU2413_API e_int16 *OPLL_update_buffer(OPLL *, e_uint32 length) ;
143 143
144/* Misc */ 144/* Misc */
145EMU2413_API void OPLL_setPatch(OPLL *, const e_uint8 *dump) ; 145EMU2413_API void OPLL_setPatch(OPLL *, const e_uint8 *dump) ;
diff --git a/apps/codecs/libgme/emutables.h b/apps/codecs/libgme/emutables.h
index 53fb324cdd..173ecd22c6 100644
--- a/apps/codecs/libgme/emutables.h
+++ b/apps/codecs/libgme/emutables.h
@@ -6,7 +6,7 @@
6 6
7#include "emutypes.h" 7#include "emutypes.h"
8 8
9static const e_uint16 sin_coeff[] ICONST_ATTR = { 9static const e_uint16 sin_coeff[] = {
10 255, 203, 171, 152, 139, 129, 120, 10 255, 203, 171, 152, 139, 129, 120,
11 113, 107, 102, 97, 92, 88, 85, 11 113, 107, 102, 97, 92, 88, 85,
12 81, 78, 75, 72, 70, 67, 65, 12 81, 78, 75, 72, 70, 67, 65,
@@ -28,7 +28,7 @@ static const e_uint16 sin_coeff[] ICONST_ATTR = {
28 0, 0, 28 0, 0,
29}; 29};
30 30
31static const e_int32 pm_coeff[] ICONST_ATTR = { 31static const e_int32 pm_coeff[] = {
32 256, 256, 256, 256, 256, 256, 256, 32 256, 256, 256, 256, 256, 256, 256,
33 256, 256, 256, 256, 256, 256, 256, 33 256, 256, 256, 256, 256, 256, 256,
34 256, 256, 256, 256, 256, 256, 256, 34 256, 256, 256, 256, 256, 256, 256,
@@ -68,7 +68,7 @@ static const e_int32 pm_coeff[] ICONST_ATTR = {
68 255, 255, 255, 255, 68 255, 255, 255, 255,
69}; 69};
70 70
71static const e_int16 db2lin_coeff[] ICONST_ATTR = { 71static const e_int16 db2lin_coeff[] = {
72 255, 249, 244, 239, 233, 228, 224, 72 255, 249, 244, 239, 233, 228, 224,
73 219, 214, 209, 205, 201, 196, 192, 73 219, 214, 209, 205, 201, 196, 192,
74 188, 184, 180, 176, 172, 169, 165, 74 188, 184, 180, 176, 172, 169, 165,
@@ -145,7 +145,7 @@ static const e_int16 db2lin_coeff[] ICONST_ATTR = {
145 0, 145 0,
146}; 146};
147 147
148static const e_uint16 ar_adjust_coeff[] ICONST_ATTR = { 148static const e_uint16 ar_adjust_coeff[] = {
149 127, 108, 98, 90, 84, 80, 75, 149 127, 108, 98, 90, 84, 80, 75,
150 72, 69, 66, 64, 61, 59, 57, 150 72, 69, 66, 64, 61, 59, 57,
151 56, 54, 52, 51, 49, 48, 47, 151 56, 54, 52, 51, 49, 48, 47,
diff --git a/apps/codecs/libgme/gb_apu.c b/apps/codecs/libgme/gb_apu.c
index 44dd6c8e6c..e8bf3afcf5 100644
--- a/apps/codecs/libgme/gb_apu.c
+++ b/apps/codecs/libgme/gb_apu.c
@@ -136,7 +136,7 @@ void Apu_reset( struct Gb_Apu* this, enum gb_mode_t mode, bool agb_wave )
136 reset_lengths( this ); 136 reset_lengths( this );
137 137
138 // Load initial wave RAM 138 // Load initial wave RAM
139 static byte const initial_wave [2] [16] ICONST_ATTR = { 139 static byte const initial_wave [2] [16] = {
140 {0x84,0x40,0x43,0xAA,0x2D,0x78,0x92,0x3C,0x60,0x59,0x59,0xB0,0x34,0xB8,0x2E,0xDA}, 140 {0x84,0x40,0x43,0xAA,0x2D,0x78,0x92,0x3C,0x60,0x59,0x59,0xB0,0x34,0xB8,0x2E,0xDA},
141 {0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF}, 141 {0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF},
142 }; 142 };
@@ -383,7 +383,7 @@ int Apu_read_register( struct Gb_Apu* this, blip_time_t time, int addr )
383 return Wave_read( &this->wave, addr ); 383 return Wave_read( &this->wave, addr );
384 384
385 // Value read back has some bits always set 385 // Value read back has some bits always set
386 static byte const masks [] ICONST_ATTR = { 386 static byte const masks [] = {
387 0x80,0x3F,0x00,0xFF,0xBF, 387 0x80,0x3F,0x00,0xFF,0xBF,
388 0xFF,0x3F,0x00,0xFF,0xBF, 388 0xFF,0x3F,0x00,0xFF,0xBF,
389 0x7F,0xFF,0x9F,0xFF,0xBF, 389 0x7F,0xFF,0x9F,0xFF,0xBF,
diff --git a/apps/codecs/libgme/gb_apu.h b/apps/codecs/libgme/gb_apu.h
index 642db8f32f..69307b9840 100644
--- a/apps/codecs/libgme/gb_apu.h
+++ b/apps/codecs/libgme/gb_apu.h
@@ -49,16 +49,16 @@ struct Gb_Apu {
49void Apu_init( struct Gb_Apu* this ); 49void Apu_init( struct Gb_Apu* this );
50 50
51// Emulates to time t, then writes data to addr 51// Emulates to time t, then writes data to addr
52void Apu_write_register( struct Gb_Apu* this, blip_time_t t, int addr, int data ) ICODE_ATTR; 52void Apu_write_register( struct Gb_Apu* this, blip_time_t t, int addr, int data );
53 53
54// Emulates to time t, then subtracts t from the current time. 54// Emulates to time t, then subtracts t from the current time.
55// OK if previous write call had time slightly after t. 55// OK if previous write call had time slightly after t.
56void Apu_end_frame( struct Gb_Apu* this,blip_time_t t ) ICODE_ATTR; 56void Apu_end_frame( struct Gb_Apu* this,blip_time_t t );
57 57
58// More features 58// More features
59 59
60// Emulates to time t, then reads from addr 60// Emulates to time t, then reads from addr
61int Apu_read_register( struct Gb_Apu* this, blip_time_t t, int addr ) ICODE_ATTR; 61int Apu_read_register( struct Gb_Apu* this, blip_time_t t, int addr );
62 62
63// Resets hardware to state after power, BEFORE boot ROM runs. Mode selects 63// Resets hardware to state after power, BEFORE boot ROM runs. Mode selects
64// sound hardware. If agb_wave is true, enables AGB's extra wave features. 64// sound hardware. If agb_wave is true, enables AGB's extra wave features.
@@ -80,6 +80,6 @@ void Apu_reduce_clicks( struct Gb_Apu* this, bool reduce );
80void Apu_set_tempo( struct Gb_Apu* this, int t ); 80void Apu_set_tempo( struct Gb_Apu* this, int t );
81 81
82 82
83void write_osc( struct Gb_Apu* this, int reg, int old_data, int data ) ICODE_ATTR; 83void write_osc( struct Gb_Apu* this, int reg, int old_data, int data );
84 84
85#endif 85#endif
diff --git a/apps/codecs/libgme/gb_cpu.h b/apps/codecs/libgme/gb_cpu.h
index 3a3b1d6101..37b22141d7 100644
--- a/apps/codecs/libgme/gb_cpu.h
+++ b/apps/codecs/libgme/gb_cpu.h
@@ -54,7 +54,7 @@ void Cpu_reset( struct Gb_Cpu* this, void* unmapped );
54 54
55// Maps code memory (memory accessed via the program counter). Start and size 55// Maps code memory (memory accessed via the program counter). Start and size
56// must be multiple of page_size. 56// must be multiple of page_size.
57void Cpu_map_code( struct Gb_Cpu* this, addr_t start, int size, void* code ) ICODE_ATTR; 57void Cpu_map_code( struct Gb_Cpu* this, addr_t start, int size, void* code );
58 58
59// Current time. 59// Current time.
60static inline int Cpu_time( struct Gb_Cpu* this ) { return this->cpu_state->time; } 60static inline int Cpu_time( struct Gb_Cpu* this ) { return this->cpu_state->time; }
diff --git a/apps/codecs/libgme/gb_cpu_run.h b/apps/codecs/libgme/gb_cpu_run.h
index 86f06fa859..1ea8b59249 100644
--- a/apps/codecs/libgme/gb_cpu_run.h
+++ b/apps/codecs/libgme/gb_cpu_run.h
@@ -172,7 +172,7 @@ loop:
172 172
173#define GET_ADDR() GET_LE16( instr ) 173#define GET_ADDR() GET_LE16( instr )
174 174
175 static byte const instr_times [256*2] ICONST_ATTR = { 175 static byte const instr_times [256*2] = {
176 // 0 1 2 3 4 5 6 7 8 9 A B C D E F 176 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
177 4,12, 8, 8, 4, 4, 8, 4,20, 8, 8, 8, 4, 4, 8, 4,// 0 177 4,12, 8, 8, 4, 4, 8, 4,20, 8, 8, 8, 4, 4, 8, 4,// 0
178 4,12, 8, 8, 4, 4, 8, 4,12, 8, 8, 8, 4, 4, 8, 4,// 1 178 4,12, 8, 8, 4, 4, 8, 4,12, 8, 8, 8, 4, 4, 8, 4,// 1
diff --git a/apps/codecs/libgme/gb_oscs.c b/apps/codecs/libgme/gb_oscs.c
index 5c9b816d21..b136e3b218 100644
--- a/apps/codecs/libgme/gb_oscs.c
+++ b/apps/codecs/libgme/gb_oscs.c
@@ -395,8 +395,8 @@ void write_osc( struct Gb_Apu* this, int reg, int old_data, int data )
395void Square_run( struct Gb_Square* this, blip_time_t time, blip_time_t end_time ) 395void Square_run( struct Gb_Square* this, blip_time_t time, blip_time_t end_time )
396{ 396{
397 // Calc duty and phase 397 // Calc duty and phase
398 static byte const duty_offsets [4] ICONST_ATTR = { 1, 1, 3, 7 }; 398 static byte const duty_offsets [4] = { 1, 1, 3, 7 };
399 static byte const duties [4] ICONST_ATTR = { 1, 2, 4, 6 }; 399 static byte const duties [4] = { 1, 2, 4, 6 };
400 400
401 struct Gb_Osc* osc = &this->osc; 401 struct Gb_Osc* osc = &this->osc;
402 int const duty_code = osc->regs [1] >> 6; 402 int const duty_code = osc->regs [1] >> 6;
@@ -595,7 +595,7 @@ void Noise_run( struct Gb_Noise* this, blip_time_t time, blip_time_t end_time )
595 } 595 }
596 596
597 // Run timer and calculate time of next LFSR clock 597 // Run timer and calculate time of next LFSR clock
598 static byte const period1s [8] ICONST_ATTR = { 1, 2, 4, 6, 8, 10, 12, 14 }; 598 static byte const period1s [8] = { 1, 2, 4, 6, 8, 10, 12, 14 };
599 int const period1 = period1s [osc->regs [3] & 7] * clk_mul; 599 int const period1 = period1s [osc->regs [3] & 7] * clk_mul;
600 600
601 #ifdef GB_APU_FAST 601 #ifdef GB_APU_FAST
@@ -680,7 +680,7 @@ void Wave_run( struct Gb_Wave* this, blip_time_t time, blip_time_t end_time )
680 int const volume_shift = shifts [volume_idx]; 680 int const volume_shift = shifts [volume_idx];
681 int const volume_mul = 1; 681 int const volume_mul = 1;
682#else 682#else
683 static byte const volumes [8] ICONST_ATTR = { 0, 4, 2, 1, 3, 3, 3, 3 }; 683 static byte const volumes [8] = { 0, 4, 2, 1, 3, 3, 3, 3 };
684 int const volume_shift = 2 + 4; 684 int const volume_shift = 2 + 4;
685 int const volume_idx = this->osc.regs [2] >> 5 & (this->agb_mask | 3); // 2 bits on DMG/CGB, 3 on AGB 685 int const volume_idx = this->osc.regs [2] >> 5 & (this->agb_mask | 3); // 2 bits on DMG/CGB, 3 on AGB
686 int const volume_mul = volumes [volume_idx]; 686 int const volume_mul = volumes [volume_idx];
diff --git a/apps/codecs/libgme/gb_oscs.h b/apps/codecs/libgme/gb_oscs.h
index 0cc9d3f567..7245b4ca50 100644
--- a/apps/codecs/libgme/gb_oscs.h
+++ b/apps/codecs/libgme/gb_oscs.h
@@ -37,9 +37,9 @@ struct Gb_Osc {
37// 11-bit frequency in NRx3 and NRx4 37// 11-bit frequency in NRx3 and NRx4
38static inline int Osc_frequency( struct Gb_Osc* this ) { return (this->regs [4] & 7) * 0x100 + this->regs [3]; } 38static inline int Osc_frequency( struct Gb_Osc* this ) { return (this->regs [4] & 7) * 0x100 + this->regs [3]; }
39 39
40void Osc_update_amp( struct Gb_Osc* this, blip_time_t, int new_amp ) ICODE_ATTR; 40void Osc_update_amp( struct Gb_Osc* this, blip_time_t, int new_amp );
41int Osc_write_trig( struct Gb_Osc* this, int frame_phase, int max_len, int old_data ) ICODE_ATTR; 41int Osc_write_trig( struct Gb_Osc* this, int frame_phase, int max_len, int old_data );
42void Osc_clock_length( struct Gb_Osc* this ) ICODE_ATTR; 42void Osc_clock_length( struct Gb_Osc* this );
43void Osc_reset( struct Gb_Osc* this ); 43void Osc_reset( struct Gb_Osc* this );
44 44
45// Square 45// Square
@@ -61,9 +61,9 @@ struct Gb_Square {
61 bool sweep_neg; 61 bool sweep_neg;
62}; 62};
63 63
64bool Square_write_register( struct Gb_Square* this, int frame_phase, int reg, int old_data, int data ) ICODE_ATTR; 64bool Square_write_register( struct Gb_Square* this, int frame_phase, int reg, int old_data, int data );
65void Square_run( struct Gb_Square* this, blip_time_t, blip_time_t ) ICODE_ATTR; 65void Square_run( struct Gb_Square* this, blip_time_t, blip_time_t );
66void Square_clock_envelope( struct Gb_Square* this ) ICODE_ATTR; 66void Square_clock_envelope( struct Gb_Square* this );
67 67
68static inline void Square_reset( struct Gb_Square* this ) 68static inline void Square_reset( struct Gb_Square* this )
69{ 69{
@@ -84,8 +84,8 @@ static inline int Square_reload_env_timer( struct Gb_Square* this )
84 84
85// Sweep square 85// Sweep square
86 86
87void clock_sweep( struct Gb_Square* this ) ICODE_ATTR; 87void clock_sweep( struct Gb_Square* this );
88void Sweep_write_register( struct Gb_Square* this, int frame_phase, int reg, int old_data, int data ) ICODE_ATTR; 88void Sweep_write_register( struct Gb_Square* this, int frame_phase, int reg, int old_data, int data );
89 89
90static inline void Sweep_reset( struct Gb_Square* this ) 90static inline void Sweep_reset( struct Gb_Square* this )
91{ 91{
@@ -100,8 +100,8 @@ static inline void Sweep_reset( struct Gb_Square* this )
100 this->osc.delay = 0x40000000; // TODO: something less hacky (never clocked until first trigger) 100 this->osc.delay = 0x40000000; // TODO: something less hacky (never clocked until first trigger)
101} 101}
102 102
103void calc_sweep( struct Gb_Square* this, bool update ) ICODE_ATTR; 103void calc_sweep( struct Gb_Square* this, bool update );
104void reload_sweep_timer( struct Gb_Square* this ) ICODE_ATTR; 104void reload_sweep_timer( struct Gb_Square* this );
105 105
106// Noise 106// Noise
107 107
@@ -117,8 +117,8 @@ struct Gb_Noise {
117 int divider; // noise has more complex frequency divider setup 117 int divider; // noise has more complex frequency divider setup
118}; 118};
119 119
120void Noise_run( struct Gb_Noise* this, blip_time_t, blip_time_t ) ICODE_ATTR; 120void Noise_run( struct Gb_Noise* this, blip_time_t, blip_time_t );
121void Noise_write_register( struct Gb_Noise* this, int frame_phase, int reg, int old_data, int data ) ICODE_ATTR; 121void Noise_write_register( struct Gb_Noise* this, int frame_phase, int reg, int old_data, int data );
122 122
123static inline void Noise_reset( struct Gb_Noise* this ) 123static inline void Noise_reset( struct Gb_Noise* this )
124{ 124{
@@ -130,7 +130,7 @@ static inline void Noise_reset( struct Gb_Noise* this )
130 this->osc.delay = 4 * clk_mul; // TODO: remove? 130 this->osc.delay = 4 * clk_mul; // TODO: remove?
131} 131}
132 132
133void Noise_clock_envelope( struct Gb_Noise* this ) ICODE_ATTR; 133void Noise_clock_envelope( struct Gb_Noise* this );
134 134
135// Non-zero if DAC is enabled 135// Non-zero if DAC is enabled
136static inline int Noise_dac_enabled( struct Gb_Noise* this) { return this->osc.regs [2] & 0xF8; } 136static inline int Noise_dac_enabled( struct Gb_Noise* this) { return this->osc.regs [2] & 0xF8; }
@@ -159,8 +159,8 @@ struct Gb_Wave {
159 uint8_t* wave_ram; // 32 bytes (64 nybbles), stored in APU 159 uint8_t* wave_ram; // 32 bytes (64 nybbles), stored in APU
160}; 160};
161 161
162void Wave_write_register( struct Gb_Wave* this, int frame_phase, int reg, int old_data, int data ) ICODE_ATTR; 162void Wave_write_register( struct Gb_Wave* this, int frame_phase, int reg, int old_data, int data );
163void Wave_run( struct Gb_Wave* this, blip_time_t, blip_time_t ) ICODE_ATTR; 163void Wave_run( struct Gb_Wave* this, blip_time_t, blip_time_t );
164 164
165static inline void Wave_reset( struct Gb_Wave* this ) 165static inline void Wave_reset( struct Gb_Wave* this )
166{ 166{
@@ -179,7 +179,7 @@ void corrupt_wave( struct Gb_Wave* this );
179static inline uint8_t* wave_bank( struct Gb_Wave* this ) { return &this->wave_ram [(~this->osc.regs [0] & bank40_mask) >> 2 & this->agb_mask]; } 179static inline uint8_t* wave_bank( struct Gb_Wave* this ) { return &this->wave_ram [(~this->osc.regs [0] & bank40_mask) >> 2 & this->agb_mask]; }
180 180
181// Wave index that would be accessed, or -1 if no access would occur 181// Wave index that would be accessed, or -1 if no access would occur
182int wave_access( struct Gb_Wave* this, int addr ) ICODE_ATTR; 182int wave_access( struct Gb_Wave* this, int addr );
183 183
184// Reads/writes wave RAM 184// Reads/writes wave RAM
185static inline int Wave_read( struct Gb_Wave* this, int addr ) 185static inline int Wave_read( struct Gb_Wave* this, int addr )
diff --git a/apps/codecs/libgme/gbs_emu.c b/apps/codecs/libgme/gbs_emu.c
index d0780fc0b9..640ea43a70 100644
--- a/apps/codecs/libgme/gbs_emu.c
+++ b/apps/codecs/libgme/gbs_emu.c
@@ -17,7 +17,7 @@ License along with this module; if not, write to the Free Software Foundation,
17Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 17Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18 18
19 19
20const char gme_wrong_file_type [] ICONST_ATTR = "Wrong file type for this emulator"; 20const char gme_wrong_file_type [] = "Wrong file type for this emulator";
21 21
22int const idle_addr = 0xF00D; 22int const idle_addr = 0xF00D;
23int const tempo_unit = 16; 23int const tempo_unit = 16;
@@ -334,7 +334,7 @@ blargg_err_t Gbs_start_track( struct Gbs_Emu* this, int track )
334 Buffer_clear( &this->stereo_buf ); 334 Buffer_clear( &this->stereo_buf );
335 335
336 // Reset APU to state expected by most rips 336 // Reset APU to state expected by most rips
337 static byte const sound_data [] ICONST_ATTR = { 337 static byte const sound_data [] = {
338 0x80, 0xBF, 0x00, 0x00, 0xB8, // square 1 DAC disabled 338 0x80, 0xBF, 0x00, 0x00, 0xB8, // square 1 DAC disabled
339 0x00, 0x3F, 0x00, 0x00, 0xB8, // square 2 DAC disabled 339 0x00, 0x3F, 0x00, 0x00, 0xB8, // square 2 DAC disabled
340 0x7F, 0xFF, 0x9F, 0x00, 0xB8, // wave DAC disabled 340 0x7F, 0xFF, 0x9F, 0x00, 0xB8, // wave DAC disabled
diff --git a/apps/codecs/libgme/gbs_emu.h b/apps/codecs/libgme/gbs_emu.h
index 5a4ac2dfd9..b73f106d8f 100644
--- a/apps/codecs/libgme/gbs_emu.h
+++ b/apps/codecs/libgme/gbs_emu.h
@@ -126,7 +126,7 @@ blargg_err_t Gbs_start_track( struct Gbs_Emu* this, int );
126 126
127// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation 127// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation
128// errors set warning string, and major errors also end track. 128// errors set warning string, and major errors also end track.
129blargg_err_t Gbs_play( struct Gbs_Emu* this, long count, sample_t* buf ) ICODE_ATTR; 129blargg_err_t Gbs_play( struct Gbs_Emu* this, long count, sample_t* buf );
130 130
131// Track status/control 131// Track status/control
132// Number of milliseconds (1000 msec = 1 second) played since beginning of track 132// Number of milliseconds (1000 msec = 1 second) played since beginning of track
@@ -178,16 +178,16 @@ static inline void Sound_set_gain( struct Gbs_Emu* this, int g )
178 178
179// Emulation (You shouldn't touch these) 179// Emulation (You shouldn't touch these)
180 180
181blargg_err_t Run_clocks( struct Gbs_Emu* this, blip_time_t duration ) ICODE_ATTR; 181blargg_err_t Run_clocks( struct Gbs_Emu* this, blip_time_t duration );
182void Set_bank( struct Gbs_Emu* this, int ) ICODE_ATTR; 182void Set_bank( struct Gbs_Emu* this, int );
183void Update_timer( struct Gbs_Emu* this ) ICODE_ATTR; 183void Update_timer( struct Gbs_Emu* this );
184 184
185// Runs CPU until time becomes >= 0 185// Runs CPU until time becomes >= 0
186void Run_cpu( struct Gbs_Emu* this ) ICODE_ATTR; 186void Run_cpu( struct Gbs_Emu* this );
187 187
188// Reads/writes memory and I/O 188// Reads/writes memory and I/O
189int Read_mem( struct Gbs_Emu* this, addr_t addr ) ICODE_ATTR; 189int Read_mem( struct Gbs_Emu* this, addr_t addr );
190void Write_mem( struct Gbs_Emu* this, addr_t addr, int data ) ICODE_ATTR; 190void Write_mem( struct Gbs_Emu* this, addr_t addr, int data );
191 191
192// Current time 192// Current time
193static inline blip_time_t Time( struct Gbs_Emu* this ) 193static inline blip_time_t Time( struct Gbs_Emu* this )
@@ -195,10 +195,10 @@ static inline blip_time_t Time( struct Gbs_Emu* this )
195 return Cpu_time( &this->cpu ) + this->end_time; 195 return Cpu_time( &this->cpu ) + this->end_time;
196} 196}
197 197
198void Jsr_then_stop( struct Gbs_Emu* this, byte const [] ) ICODE_ATTR; 198void Jsr_then_stop( struct Gbs_Emu* this, byte const [] );
199void Write_io_inline( struct Gbs_Emu* this, int offset, int data, int base ) ICODE_ATTR; 199void Write_io_inline( struct Gbs_Emu* this, int offset, int data, int base );
200void Write_io_( struct Gbs_Emu* this, int offset, int data ) ICODE_ATTR; 200void Write_io_( struct Gbs_Emu* this, int offset, int data );
201int Read_io( struct Gbs_Emu* this, int offset ) ICODE_ATTR; 201int Read_io( struct Gbs_Emu* this, int offset );
202void Write_io( struct Gbs_Emu* this, int offset, int data ) ICODE_ATTR; 202void Write_io( struct Gbs_Emu* this, int offset, int data );
203 203
204#endif 204#endif
diff --git a/apps/codecs/libgme/hes_apu.c b/apps/codecs/libgme/hes_apu.c
index a3af054548..2a831426f5 100644
--- a/apps/codecs/libgme/hes_apu.c
+++ b/apps/codecs/libgme/hes_apu.c
@@ -18,10 +18,10 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18 18
19enum { center_waves = 1 }; // reduces asymmetry and clamping when starting notes 19enum { center_waves = 1 }; // reduces asymmetry and clamping when starting notes
20 20
21static void Apu_balance_changed( struct Hes_Apu* this, struct Hes_Osc* osc ) ICODE_ATTR; 21static void Apu_balance_changed( struct Hes_Apu* this, struct Hes_Osc* osc );
22static void Apu_balance_changed( struct Hes_Apu* this, struct Hes_Osc* osc ) 22static void Apu_balance_changed( struct Hes_Apu* this, struct Hes_Osc* osc )
23{ 23{
24 static short const log_table [32] ICONST_ATTR = { // ~1.5 db per step 24 static short const log_table [32] = { // ~1.5 db per step
25 #define ENTRY( factor ) (short) (factor * amp_range / 31.0 + 0.5) 25 #define ENTRY( factor ) (short) (factor * amp_range / 31.0 + 0.5)
26 ENTRY( 0.000000 ),ENTRY( 0.005524 ),ENTRY( 0.006570 ),ENTRY( 0.007813 ), 26 ENTRY( 0.000000 ),ENTRY( 0.005524 ),ENTRY( 0.006570 ),ENTRY( 0.007813 ),
27 ENTRY( 0.009291 ),ENTRY( 0.011049 ),ENTRY( 0.013139 ),ENTRY( 0.015625 ), 27 ENTRY( 0.009291 ),ENTRY( 0.011049 ),ENTRY( 0.013139 ),ENTRY( 0.015625 ),
diff --git a/apps/codecs/libgme/hes_apu.h b/apps/codecs/libgme/hes_apu.h
index fcdcbab786..8f8a525108 100644
--- a/apps/codecs/libgme/hes_apu.h
+++ b/apps/codecs/libgme/hes_apu.h
@@ -31,7 +31,7 @@ struct Hes_Osc
31 unsigned char control; 31 unsigned char control;
32}; 32};
33 33
34void Osc_run_until( struct Hes_Osc* this, struct Blip_Synth* synth, blip_time_t ) ICODE_ATTR; 34void Osc_run_until( struct Hes_Osc* this, struct Blip_Synth* synth, blip_time_t );
35 35
36struct Hes_Apu { 36struct Hes_Apu {
37 struct Hes_Osc oscs [osc_count]; 37 struct Hes_Osc oscs [osc_count];
@@ -47,9 +47,9 @@ void Apu_init( struct Hes_Apu* this );
47// Reset HES apu couns chip 47// Reset HES apu couns chip
48void Apu_reset( struct Hes_Apu* this ); 48void Apu_reset( struct Hes_Apu* this );
49 49
50void Apu_osc_output( struct Hes_Apu* this, int index, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right ) ICODE_ATTR; 50void Apu_osc_output( struct Hes_Apu* this, int index, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right );
51void Apu_write_data( struct Hes_Apu* this, blip_time_t, int addr, int data ) ICODE_ATTR; 51void Apu_write_data( struct Hes_Apu* this, blip_time_t, int addr, int data );
52void Apu_end_frame( struct Hes_Apu* this, blip_time_t ) ICODE_ATTR; 52void Apu_end_frame( struct Hes_Apu* this, blip_time_t );
53 53
54static inline void Apu_volume( struct Hes_Apu* this, int v ) { Synth_volume( &this->synth, (v*9)/5 / osc_count / amp_range ); } 54static inline void Apu_volume( struct Hes_Apu* this, int v ) { Synth_volume( &this->synth, (v*9)/5 / osc_count / amp_range ); }
55#endif 55#endif
diff --git a/apps/codecs/libgme/hes_apu_adpcm.c b/apps/codecs/libgme/hes_apu_adpcm.c
index 66512dc702..69ac7120d0 100644
--- a/apps/codecs/libgme/hes_apu_adpcm.c
+++ b/apps/codecs/libgme/hes_apu_adpcm.c
@@ -55,7 +55,7 @@ static short stepsize[49] = {
55 876, 963,1060,1166,1282,1411,1552 55 876, 963,1060,1166,1282,1411,1552
56}; 56};
57 57
58static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code ) ICODE_ATTR; 58static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code );
59static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code ) 59static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code )
60{ 60{
61 struct State* state = &this->state; 61 struct State* state = &this->state;
@@ -87,7 +87,7 @@ static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code )
87 state->ad_sample = 2047; 87 state->ad_sample = 2047;
88 } 88 }
89 89
90 static int const steps [8] ICONST_ATTR = { 90 static int const steps [8] = {
91 -1, -1, -1, -1, 2, 4, 6, 8 91 -1, -1, -1, -1, 2, 4, 6, 8
92 }; 92 };
93 state->ad_ref_index += steps [c]; 93 state->ad_ref_index += steps [c];
@@ -99,7 +99,7 @@ static int Adpcm_decode( struct Hes_Apu_Adpcm* this,int code )
99 return state->ad_sample; 99 return state->ad_sample;
100} 100}
101 101
102static void Adpcm_run_until( struct Hes_Apu_Adpcm* this, blip_time_t end_time ) ICODE_ATTR; 102static void Adpcm_run_until( struct Hes_Apu_Adpcm* this, blip_time_t end_time );
103static void Adpcm_run_until( struct Hes_Apu_Adpcm* this, blip_time_t end_time ) 103static void Adpcm_run_until( struct Hes_Apu_Adpcm* this, blip_time_t end_time )
104{ 104{
105 struct State* state = &this->state; 105 struct State* state = &this->state;
diff --git a/apps/codecs/libgme/hes_apu_adpcm.h b/apps/codecs/libgme/hes_apu_adpcm.h
index d8d024ee34..4a2afb3e2a 100644
--- a/apps/codecs/libgme/hes_apu_adpcm.h
+++ b/apps/codecs/libgme/hes_apu_adpcm.h
@@ -75,14 +75,14 @@ static inline void Adpcm_set_output( struct Hes_Apu_Adpcm* this, int chan, struc
75} 75}
76 76
77// Emulates to time t, then writes data to addr 77// Emulates to time t, then writes data to addr
78void Adpcm_write_data( struct Hes_Apu_Adpcm* this, blip_time_t t, int addr, int data ) ICODE_ATTR; 78void Adpcm_write_data( struct Hes_Apu_Adpcm* this, blip_time_t t, int addr, int data );
79 79
80// Emulates to time t, then reads from addr 80// Emulates to time t, then reads from addr
81int Adpcm_read_data( struct Hes_Apu_Adpcm* this, blip_time_t t, int addr ) ICODE_ATTR; 81int Adpcm_read_data( struct Hes_Apu_Adpcm* this, blip_time_t t, int addr );
82 82
83// Emulates to time t, then subtracts t from the current time. 83// Emulates to time t, then subtracts t from the current time.
84// OK if previous write call had time slightly after t. 84// OK if previous write call had time slightly after t.
85void Adpcm_end_frame( struct Hes_Apu_Adpcm* this,blip_time_t t ) ICODE_ATTR; 85void Adpcm_end_frame( struct Hes_Apu_Adpcm* this,blip_time_t t );
86 86
87// Sets overall volume, where 1.0 is normal 87// Sets overall volume, where 1.0 is normal
88static inline void Adpcm_volume( struct Hes_Apu_Adpcm* this, int v ) { Synth_volume( &this->synth, (v*3)/5 / adpcm_osc_count / adpcm_amp_range ); } 88static inline void Adpcm_volume( struct Hes_Apu_Adpcm* this, int v ) { Synth_volume( &this->synth, (v*3)/5 / adpcm_osc_count / adpcm_amp_range ); }
diff --git a/apps/codecs/libgme/hes_cpu.c b/apps/codecs/libgme/hes_cpu.c
index 60ea099905..74b90593f2 100644
--- a/apps/codecs/libgme/hes_cpu.c
+++ b/apps/codecs/libgme/hes_cpu.c
@@ -185,7 +185,7 @@ loop:
185 #endif 185 #endif
186 186
187 // TODO: each reference lists slightly different timing values, ugh 187 // TODO: each reference lists slightly different timing values, ugh
188 static uint8_t const clock_table [256] ICONST_ATTR = 188 static uint8_t const clock_table [256] =
189 {// 0 1 2 3 4 5 6 7 8 9 A B C D E F 189 {// 0 1 2 3 4 5 6 7 8 9 A B C D E F
190 1,7,3, 4,6,4,6,7,3,2,2,2,7,5,7,6,// 0 190 1,7,3, 4,6,4,6,7,3,2,2,2,7,5,7,6,// 0
191 4,7,7, 4,6,4,6,7,2,5,2,2,7,5,7,6,// 1 191 4,7,7, 4,6,4,6,7,2,5,2,2,7,5,7,6,// 1
diff --git a/apps/codecs/libgme/hes_cpu.h b/apps/codecs/libgme/hes_cpu.h
index f3bcf7d4cf..4d76c83a3b 100644
--- a/apps/codecs/libgme/hes_cpu.h
+++ b/apps/codecs/libgme/hes_cpu.h
@@ -65,9 +65,9 @@ void Cpu_reset( struct Hes_Cpu* this );
65 65
66// Set end_time and run CPU from current time. Returns true if any illegal 66// Set end_time and run CPU from current time. Returns true if any illegal
67// instructions were encountered. 67// instructions were encountered.
68bool Cpu_run( struct Hes_Emu* this, hes_time_t end_time ) ICODE_ATTR; 68bool Cpu_run( struct Hes_Emu* this, hes_time_t end_time );
69 69
70void Cpu_set_mmr( struct Hes_Emu* this, int reg, int bank ) ICODE_ATTR; 70void Cpu_set_mmr( struct Hes_Emu* this, int reg, int bank );
71 71
72// Time of ning of next instruction to be executed 72// Time of ning of next instruction to be executed
73static inline hes_time_t Cpu_time( struct Hes_Cpu* this ) 73static inline hes_time_t Cpu_time( struct Hes_Cpu* this )
diff --git a/apps/codecs/libgme/hes_emu.c b/apps/codecs/libgme/hes_emu.c
index 3ef87d9f71..a428bee3fd 100644
--- a/apps/codecs/libgme/hes_emu.c
+++ b/apps/codecs/libgme/hes_emu.c
@@ -29,7 +29,7 @@ int const silence_threshold = 0x10;
29long const fade_block_size = 512; 29long const fade_block_size = 512;
30int const fade_shift = 8; // fade ends with gain at 1.0 / (1 << fade_shift) 30int const fade_shift = 8; // fade ends with gain at 1.0 / (1 << fade_shift)
31 31
32const char gme_wrong_file_type [] ICONST_ATTR = "Wrong file type for this emulator"; 32const char gme_wrong_file_type [] = "Wrong file type for this emulator";
33 33
34static void clear_track_vars( struct Hes_Emu* this ) 34static void clear_track_vars( struct Hes_Emu* this )
35{ 35{
@@ -151,7 +151,7 @@ blargg_err_t Hes_load( struct Hes_Emu* this, void* data, long size )
151 151
152// Emulation 152// Emulation
153 153
154void recalc_timer_load( struct Hes_Emu* this ) ICODE_ATTR; 154void recalc_timer_load( struct Hes_Emu* this );
155void recalc_timer_load( struct Hes_Emu* this ) 155void recalc_timer_load( struct Hes_Emu* this )
156{ 156{
157 this->timer.load = this->timer.raw_load * this->timer_base + 1; 157 this->timer.load = this->timer.raw_load * this->timer_base + 1;
@@ -159,8 +159,8 @@ void recalc_timer_load( struct Hes_Emu* this )
159 159
160// Hardware 160// Hardware
161 161
162void irq_changed( struct Hes_Emu* this ) ICODE_ATTR; 162void irq_changed( struct Hes_Emu* this );
163void run_until( struct Hes_Emu* this, hes_time_t present ) ICODE_ATTR; 163void run_until( struct Hes_Emu* this, hes_time_t present );
164void Cpu_write_vdp( struct Hes_Emu* this, int addr, int data ) 164void Cpu_write_vdp( struct Hes_Emu* this, int addr, int data )
165{ 165{
166 switch ( addr ) 166 switch ( addr )
@@ -419,7 +419,7 @@ void irq_changed( struct Hes_Emu* this )
419 this->cpu.end_time, (this->cpu.irq_time = time) ); 419 this->cpu.end_time, (this->cpu.irq_time = time) );
420} 420}
421 421
422static void adjust_time( blargg_long* time, hes_time_t delta ) ICODE_ATTR; 422static void adjust_time( blargg_long* time, hes_time_t delta );
423static void adjust_time( blargg_long* time, hes_time_t delta ) 423static void adjust_time( blargg_long* time, hes_time_t delta )
424{ 424{
425 if ( *time < (blargg_long)future_hes_time ) 425 if ( *time < (blargg_long)future_hes_time )
@@ -430,7 +430,7 @@ static void adjust_time( blargg_long* time, hes_time_t delta )
430 } 430 }
431} 431}
432 432
433blargg_err_t run_clocks( struct Hes_Emu* this, blip_time_t* duration_ ) ICODE_ATTR; 433blargg_err_t run_clocks( struct Hes_Emu* this, blip_time_t* duration_ );
434blargg_err_t run_clocks( struct Hes_Emu* this, blip_time_t* duration_ ) 434blargg_err_t run_clocks( struct Hes_Emu* this, blip_time_t* duration_ )
435{ 435{
436 blip_time_t duration = *duration_; // cache 436 blip_time_t duration = *duration_; // cache
@@ -463,7 +463,7 @@ blargg_err_t run_clocks( struct Hes_Emu* this, blip_time_t* duration_ )
463 return 0; 463 return 0;
464} 464}
465 465
466blargg_err_t play_( struct Hes_Emu* this, long count, sample_t* out ) ICODE_ATTR; 466blargg_err_t play_( struct Hes_Emu* this, long count, sample_t* out );
467blargg_err_t play_( struct Hes_Emu* this, long count, sample_t* out ) 467blargg_err_t play_( struct Hes_Emu* this, long count, sample_t* out )
468{ 468{
469 long remain = count; 469 long remain = count;
@@ -557,7 +557,7 @@ void Sound_set_tempo( struct Hes_Emu* this, int t )
557 this->tempo_ = t; 557 this->tempo_ = t;
558} 558}
559 559
560void fill_buf( struct Hes_Emu* this ) ICODE_ATTR; 560void fill_buf( struct Hes_Emu* this );
561blargg_err_t Hes_start_track( struct Hes_Emu* this, int track ) 561blargg_err_t Hes_start_track( struct Hes_Emu* this, int track )
562{ 562{
563 clear_track_vars( this ); 563 clear_track_vars( this );
@@ -654,7 +654,7 @@ blargg_err_t Track_seek( struct Hes_Emu* this, long msec )
654 return Track_skip( this, time - this->out_time ); 654 return Track_skip( this, time - this->out_time );
655} 655}
656 656
657blargg_err_t skip_( struct Hes_Emu* this, long count ) ICODE_ATTR; 657blargg_err_t skip_( struct Hes_Emu* this, long count );
658blargg_err_t skip_( struct Hes_Emu* this, long count ) 658blargg_err_t skip_( struct Hes_Emu* this, long count )
659{ 659{
660 // for long skip, mute sound 660 // for long skip, mute sound
@@ -726,7 +726,7 @@ void Track_set_fade( struct Hes_Emu* this, long start_msec, long length_msec )
726} 726}
727 727
728// unit / pow( 2.0, (double) x / step ) 728// unit / pow( 2.0, (double) x / step )
729static int int_log( blargg_long x, int step, int unit ) ICODE_ATTR; 729static int int_log( blargg_long x, int step, int unit );
730static int int_log( blargg_long x, int step, int unit ) 730static int int_log( blargg_long x, int step, int unit )
731{ 731{
732 int shift = x / step; 732 int shift = x / step;
@@ -734,7 +734,7 @@ static int int_log( blargg_long x, int step, int unit )
734 return ((unit - fraction) + (fraction >> 1)) >> shift; 734 return ((unit - fraction) + (fraction >> 1)) >> shift;
735} 735}
736 736
737void handle_fade( struct Hes_Emu* this, long out_count, sample_t* out ) ICODE_ATTR; 737void handle_fade( struct Hes_Emu* this, long out_count, sample_t* out );
738void handle_fade( struct Hes_Emu* this, long out_count, sample_t* out ) 738void handle_fade( struct Hes_Emu* this, long out_count, sample_t* out )
739{ 739{
740 int i; 740 int i;
@@ -759,7 +759,7 @@ void handle_fade( struct Hes_Emu* this, long out_count, sample_t* out )
759 759
760// Silence detection 760// Silence detection
761 761
762void emu_play( struct Hes_Emu* this, long count, sample_t* out ) ICODE_ATTR; 762void emu_play( struct Hes_Emu* this, long count, sample_t* out );
763void emu_play( struct Hes_Emu* this, long count, sample_t* out ) 763void emu_play( struct Hes_Emu* this, long count, sample_t* out )
764{ 764{
765 check( current_track_ >= 0 ); 765 check( current_track_ >= 0 );
@@ -775,7 +775,7 @@ void emu_play( struct Hes_Emu* this, long count, sample_t* out )
775} 775}
776 776
777// number of consecutive silent samples at end 777// number of consecutive silent samples at end
778static long count_silence( sample_t* begin, long size ) ICODE_ATTR; 778static long count_silence( sample_t* begin, long size );
779static long count_silence( sample_t* begin, long size ) 779static long count_silence( sample_t* begin, long size )
780{ 780{
781 sample_t first = *begin; 781 sample_t first = *begin;
diff --git a/apps/codecs/libgme/hes_emu.h b/apps/codecs/libgme/hes_emu.h
index be9264455b..0dcd29a9c6 100644
--- a/apps/codecs/libgme/hes_emu.h
+++ b/apps/codecs/libgme/hes_emu.h
@@ -136,7 +136,7 @@ blargg_err_t Hes_start_track( struct Hes_Emu* this, int );
136 136
137// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation 137// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation
138// errors set warning string, and major errors also end track. 138// errors set warning string, and major errors also end track.
139blargg_err_t Hes_play( struct Hes_Emu* this, long count, sample_t* buf ) ICODE_ATTR; 139blargg_err_t Hes_play( struct Hes_Emu* this, long count, sample_t* buf );
140 140
141// Track status/control 141// Track status/control
142// Number of milliseconds (1000 msec = 1 second) played since ning of track 142// Number of milliseconds (1000 msec = 1 second) played since ning of track
@@ -188,13 +188,13 @@ static inline void Sound_set_gain( struct Hes_Emu* this, int g )
188 188
189// Emulation (You shouldn't touch these) 189// Emulation (You shouldn't touch these)
190 190
191int Cpu_read( struct Hes_Emu* this, hes_addr_t ) ICODE_ATTR; 191int Cpu_read( struct Hes_Emu* this, hes_addr_t );
192void Cpu_write( struct Hes_Emu* this, hes_addr_t, int ) ICODE_ATTR; 192void Cpu_write( struct Hes_Emu* this, hes_addr_t, int );
193void Cpu_write_vdp( struct Hes_Emu* this, int addr, int data ) ICODE_ATTR; 193void Cpu_write_vdp( struct Hes_Emu* this, int addr, int data );
194int Cpu_done( struct Hes_Emu* this ) ICODE_ATTR; 194int Cpu_done( struct Hes_Emu* this );
195 195
196int Emu_cpu_read( struct Hes_Emu* this, hes_addr_t ) ICODE_ATTR; 196int Emu_cpu_read( struct Hes_Emu* this, hes_addr_t );
197void Emu_cpu_write( struct Hes_Emu* this, hes_addr_t, int data ) ICODE_ATTR; 197void Emu_cpu_write( struct Hes_Emu* this, hes_addr_t, int data );
198 198
199static inline byte const* Emu_cpu_set_mmr( struct Hes_Emu* this, int page, int bank ) 199static inline byte const* Emu_cpu_set_mmr( struct Hes_Emu* this, int page, int bank )
200{ 200{
diff --git a/apps/codecs/libgme/kss_emu.h b/apps/codecs/libgme/kss_emu.h
index 646b18ea35..43df964fcc 100644
--- a/apps/codecs/libgme/kss_emu.h
+++ b/apps/codecs/libgme/kss_emu.h
@@ -155,7 +155,7 @@ blargg_err_t Kss_start_track( struct Kss_Emu* this, int track );
155 155
156// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation 156// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation
157// errors set warning string, and major errors also end track. 157// errors set warning string, and major errors also end track.
158blargg_err_t Kss_play( struct Kss_Emu* this, long count, sample_t* buf ) ICODE_ATTR; 158blargg_err_t Kss_play( struct Kss_Emu* this, long count, sample_t* buf );
159 159
160// Track status/control 160// Track status/control
161 161
@@ -210,13 +210,13 @@ static inline void Sound_set_gain( struct Kss_Emu* this, int g )
210} 210}
211 211
212// Emulation (You shouldn't touch these 212// Emulation (You shouldn't touch these
213void cpu_write( struct Kss_Emu* this, kss_addr_t, int ) ICODE_ATTR; 213void cpu_write( struct Kss_Emu* this, kss_addr_t, int );
214int cpu_in( struct Kss_Emu* this, kss_time_t, kss_addr_t ) ICODE_ATTR; 214int cpu_in( struct Kss_Emu* this, kss_time_t, kss_addr_t );
215void cpu_out( struct Kss_Emu* this, kss_time_t, kss_addr_t, int ) ICODE_ATTR; 215void cpu_out( struct Kss_Emu* this, kss_time_t, kss_addr_t, int );
216 216
217void cpu_write_( struct Kss_Emu* this, kss_addr_t addr, int data ) ICODE_ATTR; 217void cpu_write_( struct Kss_Emu* this, kss_addr_t addr, int data );
218bool run_cpu( struct Kss_Emu* this, kss_time_t end ) ICODE_ATTR; 218bool run_cpu( struct Kss_Emu* this, kss_time_t end );
219void jsr( struct Kss_Emu* this, byte const addr [] ) ICODE_ATTR; 219void jsr( struct Kss_Emu* this, byte const addr [] );
220 220
221static inline int sms_psg_enabled( struct Kss_Emu* this ) { return this->chip_flags & sms_psg_flag; } 221static inline int sms_psg_enabled( struct Kss_Emu* this ) { return this->chip_flags & sms_psg_flag; }
222static inline int sms_fm_enabled( struct Kss_Emu* this ) { return this->chip_flags & sms_fm_flag; } 222static inline int sms_fm_enabled( struct Kss_Emu* this ) { return this->chip_flags & sms_fm_flag; }
diff --git a/apps/codecs/libgme/kss_scc_apu.h b/apps/codecs/libgme/kss_scc_apu.h
index 26425b38c7..bb20d1d64a 100644
--- a/apps/codecs/libgme/kss_scc_apu.h
+++ b/apps/codecs/libgme/kss_scc_apu.h
@@ -42,10 +42,10 @@ static inline void Scc_set_output( struct Scc_Apu* this, int index, struct Blip_
42} 42}
43 43
44// Emulates to time t, then writes data to reg 44// Emulates to time t, then writes data to reg
45void Scc_write( struct Scc_Apu* this, blip_time_t time, int addr, int data ) ICODE_ATTR; 45void Scc_write( struct Scc_Apu* this, blip_time_t time, int addr, int data );
46 46
47// Emulates to time t, then subtracts t from the current time. 47// Emulates to time t, then subtracts t from the current time.
48// OK if previous write call had time slightly after t. 48// OK if previous write call had time slightly after t.
49void Scc_end_frame( struct Scc_Apu* this, blip_time_t end_time ) ICODE_ATTR; 49void Scc_end_frame( struct Scc_Apu* this, blip_time_t end_time );
50 50
51#endif 51#endif
diff --git a/apps/codecs/libgme/multi_buffer.h b/apps/codecs/libgme/multi_buffer.h
index 26f302380c..cfdae4f077 100644
--- a/apps/codecs/libgme/multi_buffer.h
+++ b/apps/codecs/libgme/multi_buffer.h
@@ -38,18 +38,18 @@ void Buffer_clock_rate( struct Stereo_Buffer* this, long );
38void Buffer_bass_freq( struct Stereo_Buffer* this, int ); 38void Buffer_bass_freq( struct Stereo_Buffer* this, int );
39void Buffer_clear( struct Stereo_Buffer* this ); 39void Buffer_clear( struct Stereo_Buffer* this );
40struct channel_t Buffer_channel( struct Stereo_Buffer* this ); 40struct channel_t Buffer_channel( struct Stereo_Buffer* this );
41void Buffer_end_frame( struct Stereo_Buffer* this, blip_time_t ) ICODE_ATTR; 41void Buffer_end_frame( struct Stereo_Buffer* this, blip_time_t );
42 42
43long Buffer_read_samples( struct Stereo_Buffer* this, blip_sample_t*, long ) ICODE_ATTR; 43long Buffer_read_samples( struct Stereo_Buffer* this, blip_sample_t*, long );
44 44
45// Count of changes to channel configuration. Incremented whenever 45// Count of changes to channel configuration. Incremented whenever
46// a change is made to any of the Blip_Buffers for any channel. 46// a change is made to any of the Blip_Buffers for any channel.
47unsigned Buffer_channels_changed_count( struct Stereo_Buffer* this ) ICODE_ATTR; 47unsigned Buffer_channels_changed_count( struct Stereo_Buffer* this );
48void Buffer_channels_changed( struct Stereo_Buffer* this ) ICODE_ATTR; 48void Buffer_channels_changed( struct Stereo_Buffer* this );
49 49
50void Buffer_mix_stereo_no_center( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; 50void Buffer_mix_stereo_no_center( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
51void Buffer_mix_stereo( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; 51void Buffer_mix_stereo( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
52void Buffer_mix_mono( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; 52void Buffer_mix_mono( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
53 53
54// Number of samples per output frame (1 = mono, 2 = stereo) 54// Number of samples per output frame (1 = mono, 2 = stereo)
55static inline int Buffer_samples_per_frame( struct Stereo_Buffer* this ) 55static inline int Buffer_samples_per_frame( struct Stereo_Buffer* this )
diff --git a/apps/codecs/libgme/nes_apu.c b/apps/codecs/libgme/nes_apu.c
index d4e6e8df4d..7d2814b3d8 100644
--- a/apps/codecs/libgme/nes_apu.c
+++ b/apps/codecs/libgme/nes_apu.c
@@ -272,7 +272,7 @@ void Apu_end_frame( struct Nes_Apu* this, nes_time_t end_time )
272 272
273// registers 273// registers
274 274
275static const unsigned char length_table [0x20] ICONST_ATTR = { 275static const unsigned char length_table [0x20] = {
276 0x0A, 0xFE, 0x14, 0x02, 0x28, 0x04, 0x50, 0x06, 276 0x0A, 0xFE, 0x14, 0x02, 0x28, 0x04, 0x50, 0x06,
277 0xA0, 0x08, 0x3C, 0x0A, 0x0E, 0x0C, 0x1A, 0x0E, 277 0xA0, 0x08, 0x3C, 0x0A, 0x0E, 0x0C, 0x1A, 0x0E,
278 0x0C, 0x10, 0x18, 0x12, 0x30, 0x14, 0x60, 0x16, 278 0x0C, 0x10, 0x18, 0x12, 0x30, 0x14, 0x60, 0x16,
diff --git a/apps/codecs/libgme/nes_apu.h b/apps/codecs/libgme/nes_apu.h
index eb85a03f13..11f1f26cc7 100644
--- a/apps/codecs/libgme/nes_apu.h
+++ b/apps/codecs/libgme/nes_apu.h
@@ -48,22 +48,22 @@ struct Nes_Apu {
48void Apu_init( struct Nes_Apu* this ); 48void Apu_init( struct Nes_Apu* this );
49 49
50// Set buffer to generate all sound into, or disable sound if NULL 50// Set buffer to generate all sound into, or disable sound if NULL
51void Apu_output( struct Nes_Apu* this, struct Blip_Buffer* ) ICODE_ATTR; 51void Apu_output( struct Nes_Apu* this, struct Blip_Buffer* );
52 52
53// All time values are the number of cpu clock cycles relative to the 53// All time values are the number of cpu clock cycles relative to the
54// beginning of the current time frame. Before resetting the cpu clock 54// beginning of the current time frame. Before resetting the cpu clock
55// count, call end_frame( last_cpu_time ). 55// count, call end_frame( last_cpu_time ).
56 56
57// Write to register (0x4000-0x4017, except 0x4014 and 0x4016) 57// Write to register (0x4000-0x4017, except 0x4014 and 0x4016)
58void Apu_write_register( struct Nes_Apu* this, nes_time_t, addr_t, int data ) ICODE_ATTR; 58void Apu_write_register( struct Nes_Apu* this, nes_time_t, addr_t, int data );
59 59
60// Read from status register at 0x4015 60// Read from status register at 0x4015
61int Apu_read_status( struct Nes_Apu* this, nes_time_t ) ICODE_ATTR; 61int Apu_read_status( struct Nes_Apu* this, nes_time_t );
62 62
63// Run all oscillators up to specified time, end current time frame, then 63// Run all oscillators up to specified time, end current time frame, then
64// start a new time frame at time 0. Time frames have no effect on emulation 64// start a new time frame at time 0. Time frames have no effect on emulation
65// and each can be whatever length is convenient. 65// and each can be whatever length is convenient.
66void Apu_end_frame( struct Nes_Apu* this, nes_time_t ) ICODE_ATTR; 66void Apu_end_frame( struct Nes_Apu* this, nes_time_t );
67 67
68// Additional optional features (can be ignored without any problem) 68// Additional optional features (can be ignored without any problem)
69 69
@@ -81,7 +81,7 @@ void Apu_volume( struct Nes_Apu* this, int );
81 81
82// Run DMC until specified time, so that any DMC memory reads can be 82// Run DMC until specified time, so that any DMC memory reads can be
83// accounted for (i.e. inserting cpu wait states). 83// accounted for (i.e. inserting cpu wait states).
84void Apu_run_until( struct Nes_Apu* this, nes_time_t ) ICODE_ATTR; 84void Apu_run_until( struct Nes_Apu* this, nes_time_t );
85 85
86// Set sound output of specific oscillator to buffer. If buffer is NULL, 86// Set sound output of specific oscillator to buffer. If buffer is NULL,
87// the specified oscillator is muted and emulation accuracy is reduced. 87// the specified oscillator is muted and emulation accuracy is reduced.
@@ -129,6 +129,6 @@ static inline nes_time_t Dmc_next_read_time( struct Nes_Dmc* this )
129 129
130// Time when next DMC memory read will occur 130// Time when next DMC memory read will occur
131static inline nes_time_t Apu_next_dmc_read_time( struct Nes_Apu* this ) { return Dmc_next_read_time( &this->dmc ); } 131static inline nes_time_t Apu_next_dmc_read_time( struct Nes_Apu* this ) { return Dmc_next_read_time( &this->dmc ); }
132void Apu_irq_changed( struct Nes_Apu* this ) ICODE_ATTR; 132void Apu_irq_changed( struct Nes_Apu* this );
133 133
134#endif 134#endif
diff --git a/apps/codecs/libgme/nes_fds_apu.c b/apps/codecs/libgme/nes_fds_apu.c
index d021cfd289..dc0775d5d3 100644
--- a/apps/codecs/libgme/nes_fds_apu.c
+++ b/apps/codecs/libgme/nes_fds_apu.c
@@ -42,7 +42,7 @@ void Fds_reset( struct Nes_Fds_Apu* this )
42 this->mod_pos = 0; 42 this->mod_pos = 0;
43 this->mod_write_pos = 0; 43 this->mod_write_pos = 0;
44 44
45 static byte const initial_regs [0x0B] ICONST_ATTR = { 45 static byte const initial_regs [0x0B] = {
46 0x80, // disable envelope 46 0x80, // disable envelope
47 0, 0, 0xC0, // disable wave and lfo 47 0, 0, 0xC0, // disable wave and lfo
48 0x80, // disable sweep 48 0x80, // disable sweep
diff --git a/apps/codecs/libgme/nes_fds_apu.h b/apps/codecs/libgme/nes_fds_apu.h
index 951aff0ee9..8dac3b721a 100644
--- a/apps/codecs/libgme/nes_fds_apu.h
+++ b/apps/codecs/libgme/nes_fds_apu.h
@@ -68,7 +68,7 @@ static inline void Fds_set_output( struct Nes_Fds_Apu* this, int i, struct Blip_
68 this->output_ = b; 68 this->output_ = b;
69} 69}
70 70
71void Fds_run_until( struct Nes_Fds_Apu* this, blip_time_t ) ICODE_ATTR; 71void Fds_run_until( struct Nes_Fds_Apu* this, blip_time_t );
72static inline void Fds_end_frame( struct Nes_Fds_Apu* this, blip_time_t end_time ) 72static inline void Fds_end_frame( struct Nes_Fds_Apu* this, blip_time_t end_time )
73{ 73{
74 if ( end_time > this->last_time ) 74 if ( end_time > this->last_time )
@@ -77,7 +77,7 @@ static inline void Fds_end_frame( struct Nes_Fds_Apu* this, blip_time_t end_time
77 assert( this->last_time >= 0 ); 77 assert( this->last_time >= 0 );
78} 78}
79 79
80void Fds_write_( struct Nes_Fds_Apu* this, unsigned addr, int data ) ICODE_ATTR; 80void Fds_write_( struct Nes_Fds_Apu* this, unsigned addr, int data );
81static inline void Fds_write( struct Nes_Fds_Apu* this, blip_time_t time, unsigned addr, int data ) 81static inline void Fds_write( struct Nes_Fds_Apu* this, blip_time_t time, unsigned addr, int data )
82{ 82{
83 Fds_run_until( this, time ); 83 Fds_run_until( this, time );
diff --git a/apps/codecs/libgme/nes_fme7_apu.c b/apps/codecs/libgme/nes_fme7_apu.c
index 068a21f1bf..8a2c21ea26 100644
--- a/apps/codecs/libgme/nes_fme7_apu.c
+++ b/apps/codecs/libgme/nes_fme7_apu.c
@@ -40,7 +40,7 @@ void Fme7_reset( struct Nes_Fme7_Apu* this )
40 memset( this->delays, 0, sizeof this->delays ); 40 memset( this->delays, 0, sizeof this->delays );
41} 41}
42 42
43static unsigned char const amp_table [16] ICONST_ATTR = 43static unsigned char const amp_table [16] =
44{ 44{
45 #define ENTRY( n ) (unsigned char) (n * amp_range + 0.5) 45 #define ENTRY( n ) (unsigned char) (n * amp_range + 0.5)
46 ENTRY(0.0000), ENTRY(0.0078), ENTRY(0.0110), ENTRY(0.0156), 46 ENTRY(0.0000), ENTRY(0.0078), ENTRY(0.0110), ENTRY(0.0156),
diff --git a/apps/codecs/libgme/nes_fme7_apu.h b/apps/codecs/libgme/nes_fme7_apu.h
index 0d6bef0f3e..353d82d1df 100644
--- a/apps/codecs/libgme/nes_fme7_apu.h
+++ b/apps/codecs/libgme/nes_fme7_apu.h
@@ -63,7 +63,7 @@ static inline void Fme7_output( struct Nes_Fme7_Apu* this, struct Blip_Buffer* b
63static inline void Fme7_write_latch( struct Nes_Fme7_Apu* this, int data ) { this->latch = data; } 63static inline void Fme7_write_latch( struct Nes_Fme7_Apu* this, int data ) { this->latch = data; }
64 64
65// (addr & addr_mask) == data_addr 65// (addr & addr_mask) == data_addr
66void Fme7_run_until( struct Nes_Fme7_Apu* this, blip_time_t end_time ) ICODE_ATTR; 66void Fme7_run_until( struct Nes_Fme7_Apu* this, blip_time_t end_time );
67static inline void Fme7_write_data( struct Nes_Fme7_Apu* this, blip_time_t time, int data ) 67static inline void Fme7_write_data( struct Nes_Fme7_Apu* this, blip_time_t time, int data )
68{ 68{
69 if ( (unsigned) this->latch >= fme7_reg_count ) 69 if ( (unsigned) this->latch >= fme7_reg_count )
diff --git a/apps/codecs/libgme/nes_namco_apu.h b/apps/codecs/libgme/nes_namco_apu.h
index 5f9f1c84a0..c47eacc4bb 100644
--- a/apps/codecs/libgme/nes_namco_apu.h
+++ b/apps/codecs/libgme/nes_namco_apu.h
@@ -37,7 +37,7 @@ void Namco_init( struct Nes_Namco_Apu* this );
37void Namco_output( struct Nes_Namco_Apu* this, struct Blip_Buffer* ); 37void Namco_output( struct Nes_Namco_Apu* this, struct Blip_Buffer* );
38 38
39void Namco_reset( struct Nes_Namco_Apu* this ); 39void Namco_reset( struct Nes_Namco_Apu* this );
40void Namco_end_frame( struct Nes_Namco_Apu* this, blip_time_t ) ICODE_ATTR; 40void Namco_end_frame( struct Nes_Namco_Apu* this, blip_time_t );
41 41
42static inline uint8_t* namco_access( struct Nes_Namco_Apu* this ) 42static inline uint8_t* namco_access( struct Nes_Namco_Apu* this )
43{ 43{
@@ -61,7 +61,7 @@ static inline void Namco_osc_output( struct Nes_Namco_Apu* this, int i, struct B
61} 61}
62 62
63// Read/write data register is at 0x4800 63// Read/write data register is at 0x4800
64void Namco_run_until( struct Nes_Namco_Apu* this, blip_time_t ) ICODE_ATTR; 64void Namco_run_until( struct Nes_Namco_Apu* this, blip_time_t );
65static inline void Namco_write_data( struct Nes_Namco_Apu* this, blip_time_t time, int data ) 65static inline void Namco_write_data( struct Nes_Namco_Apu* this, blip_time_t time, int data )
66{ 66{
67 Namco_run_until( this, time ); 67 Namco_run_until( this, time );
diff --git a/apps/codecs/libgme/nes_oscs.c b/apps/codecs/libgme/nes_oscs.c
index 8682cc60e2..a790c4d8a2 100644
--- a/apps/codecs/libgme/nes_oscs.c
+++ b/apps/codecs/libgme/nes_oscs.c
@@ -326,7 +326,7 @@ int Dmc_count_reads( struct Nes_Dmc* this, nes_time_t time, nes_time_t* last_rea
326 return count; 326 return count;
327} 327}
328 328
329static short const dmc_period_table [2] [16] ICONST_ATTR = { 329static short const dmc_period_table [2] [16] = {
330 {428, 380, 340, 320, 286, 254, 226, 214, // NTSC 330 {428, 380, 340, 320, 286, 254, 226, 214, // NTSC
331 190, 160, 142, 128, 106, 84, 72, 54}, 331 190, 160, 142, 128, 106, 84, 72, 54},
332 332
@@ -340,7 +340,7 @@ inline void Dmc_reload_sample( struct Nes_Dmc* this )
340 this->osc.length_counter = this->osc.regs [3] * 0x10 + 1; 340 this->osc.length_counter = this->osc.regs [3] * 0x10 + 1;
341} 341}
342 342
343static byte const dac_table [128] ICONST_ATTR = 343static byte const dac_table [128] =
344{ 344{
345 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9,10,11,12,13,14, 345 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9,10,11,12,13,14,
346 15,15,16,17,18,19,20,20,21,22,23,24,24,25,26,27, 346 15,15,16,17,18,19,20,20,21,22,23,24,24,25,26,27,
@@ -479,7 +479,7 @@ void Dmc_run( struct Nes_Dmc* this, nes_time_t time, nes_time_t end_time )
479 479
480// Nes_Noise 480// Nes_Noise
481 481
482static short const noise_period_table [16] ICONST_ATTR = { 482static short const noise_period_table [16] = {
483 0x004, 0x008, 0x010, 0x020, 0x040, 0x060, 0x080, 0x0A0, 483 0x004, 0x008, 0x010, 0x020, 0x040, 0x060, 0x080, 0x0A0,
484 0x0CA, 0x0FE, 0x17C, 0x1FC, 0x2FA, 0x3F8, 0x7F2, 0xFE4 484 0x0CA, 0x0FE, 0x17C, 0x1FC, 0x2FA, 0x3F8, 0x7F2, 0xFE4
485}; 485};
diff --git a/apps/codecs/libgme/nes_oscs.h b/apps/codecs/libgme/nes_oscs.h
index a358e01786..8d7f4ae817 100644
--- a/apps/codecs/libgme/nes_oscs.h
+++ b/apps/codecs/libgme/nes_oscs.h
@@ -153,13 +153,13 @@ struct Nes_Dmc
153}; 153};
154 154
155void Dmc_start( struct Nes_Dmc* this ); 155void Dmc_start( struct Nes_Dmc* this );
156void Dmc_write_register( struct Nes_Dmc* this, int, int ) ICODE_ATTR; 156void Dmc_write_register( struct Nes_Dmc* this, int, int );
157void Dmc_run( struct Nes_Dmc* this, nes_time_t, nes_time_t ) ICODE_ATTR; 157void Dmc_run( struct Nes_Dmc* this, nes_time_t, nes_time_t );
158void Dmc_recalc_irq( struct Nes_Dmc* this ) ICODE_ATTR; 158void Dmc_recalc_irq( struct Nes_Dmc* this );
159void Dmc_fill_buffer( struct Nes_Dmc* this ) ICODE_ATTR; 159void Dmc_fill_buffer( struct Nes_Dmc* this );
160void Dmc_reload_sample( struct Nes_Dmc* this ) ICODE_ATTR; 160void Dmc_reload_sample( struct Nes_Dmc* this );
161void Dmc_reset( struct Nes_Dmc* this ) ICODE_ATTR; 161void Dmc_reset( struct Nes_Dmc* this );
162 162
163int Dmc_count_reads( struct Nes_Dmc* this, nes_time_t, nes_time_t* ) ICODE_ATTR; 163int Dmc_count_reads( struct Nes_Dmc* this, nes_time_t, nes_time_t* );
164 164
165#endif 165#endif
diff --git a/apps/codecs/libgme/nes_vrc6_apu.h b/apps/codecs/libgme/nes_vrc6_apu.h
index 39ed006100..8f3cbf4629 100644
--- a/apps/codecs/libgme/nes_vrc6_apu.h
+++ b/apps/codecs/libgme/nes_vrc6_apu.h
@@ -39,12 +39,12 @@ struct Nes_Vrc6_Apu {
39void Vrc6_init( struct Nes_Vrc6_Apu* this ); 39void Vrc6_init( struct Nes_Vrc6_Apu* this );
40void Vrc6_reset( struct Nes_Vrc6_Apu* this ); 40void Vrc6_reset( struct Nes_Vrc6_Apu* this );
41void Vrc6_output( struct Nes_Vrc6_Apu* this, struct Blip_Buffer* ); 41void Vrc6_output( struct Nes_Vrc6_Apu* this, struct Blip_Buffer* );
42void Vrc6_end_frame( struct Nes_Vrc6_Apu* this, blip_time_t ) ICODE_ATTR; 42void Vrc6_end_frame( struct Nes_Vrc6_Apu* this, blip_time_t );
43 43
44// Oscillator 0 write-only registers are at $9000-$9002 44// Oscillator 0 write-only registers are at $9000-$9002
45// Oscillator 1 write-only registers are at $A000-$A002 45// Oscillator 1 write-only registers are at $A000-$A002
46// Oscillator 2 write-only registers are at $B000-$B002 46// Oscillator 2 write-only registers are at $B000-$B002
47void Vrc6_write_osc( struct Nes_Vrc6_Apu* this, blip_time_t, int osc, int reg, int data ) ICODE_ATTR; 47void Vrc6_write_osc( struct Nes_Vrc6_Apu* this, blip_time_t, int osc, int reg, int data );
48 48
49static inline void Vrc6_osc_output( struct Nes_Vrc6_Apu* this, int i, struct Blip_Buffer* buf ) 49static inline void Vrc6_osc_output( struct Nes_Vrc6_Apu* this, int i, struct Blip_Buffer* buf )
50{ 50{
diff --git a/apps/codecs/libgme/nes_vrc7_apu.h b/apps/codecs/libgme/nes_vrc7_apu.h
index b37dfd63b0..1f45a435db 100644
--- a/apps/codecs/libgme/nes_vrc7_apu.h
+++ b/apps/codecs/libgme/nes_vrc7_apu.h
@@ -28,10 +28,10 @@ struct Nes_Vrc7_Apu {
28void Vrc7_init( struct Nes_Vrc7_Apu* this ); 28void Vrc7_init( struct Nes_Vrc7_Apu* this );
29void Vrc7_reset( struct Nes_Vrc7_Apu* this ); 29void Vrc7_reset( struct Nes_Vrc7_Apu* this );
30void Vrc7_set_rate( struct Nes_Vrc7_Apu* this, int r ); 30void Vrc7_set_rate( struct Nes_Vrc7_Apu* this, int r );
31void Vrc7_end_frame( struct Nes_Vrc7_Apu* this, blip_time_t ) ICODE_ATTR; 31void Vrc7_end_frame( struct Nes_Vrc7_Apu* this, blip_time_t );
32 32
33void Vrc7_write_reg( struct Nes_Vrc7_Apu* this, int reg ) ICODE_ATTR; 33void Vrc7_write_reg( struct Nes_Vrc7_Apu* this, int reg );
34void Vrc7_write_data( struct Nes_Vrc7_Apu* this, blip_time_t, int data ) ICODE_ATTR; 34void Vrc7_write_data( struct Nes_Vrc7_Apu* this, blip_time_t, int data );
35 35
36void output_changed( struct Nes_Vrc7_Apu* this ); 36void output_changed( struct Nes_Vrc7_Apu* this );
37static inline void Vrc7_set_output( struct Nes_Vrc7_Apu* this, int i, struct Blip_Buffer* buf ) 37static inline void Vrc7_set_output( struct Nes_Vrc7_Apu* this, int i, struct Blip_Buffer* buf )
diff --git a/apps/codecs/libgme/nsf_emu.c b/apps/codecs/libgme/nsf_emu.c
index 79a15e21f2..d4d5753460 100644
--- a/apps/codecs/libgme/nsf_emu.c
+++ b/apps/codecs/libgme/nsf_emu.c
@@ -18,7 +18,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18 18
19#include "blargg_source.h" 19#include "blargg_source.h"
20 20
21const char gme_wrong_file_type [] ICONST_ATTR = "Wrong file type for this emulator"; 21const char gme_wrong_file_type [] = "Wrong file type for this emulator";
22long const clock_divisor = 12; 22long const clock_divisor = 12;
23 23
24int const stereo = 2; // number of channels for stereo 24int const stereo = 2; // number of channels for stereo
@@ -859,7 +859,7 @@ blargg_err_t Track_seek( struct Nsf_Emu* this, long msec )
859 return Track_skip( this, time - this->out_time ); 859 return Track_skip( this, time - this->out_time );
860} 860}
861 861
862blargg_err_t skip_( struct Nsf_Emu* this, long count ) ICODE_ATTR; 862blargg_err_t skip_( struct Nsf_Emu* this, long count );
863blargg_err_t Track_skip( struct Nsf_Emu* this, long count ) 863blargg_err_t Track_skip( struct Nsf_Emu* this, long count )
864{ 864{
865 require( this->current_track >= 0 ); // start_track() must have been called already 865 require( this->current_track >= 0 ); // start_track() must have been called already
@@ -890,7 +890,7 @@ blargg_err_t Track_skip( struct Nsf_Emu* this, long count )
890 return 0; 890 return 0;
891} 891}
892 892
893blargg_err_t play_( struct Nsf_Emu* this, long count, sample_t* out ) ICODE_ATTR; 893blargg_err_t play_( struct Nsf_Emu* this, long count, sample_t* out );
894blargg_err_t skip_( struct Nsf_Emu* this, long count ) 894blargg_err_t skip_( struct Nsf_Emu* this, long count )
895{ 895{
896 // for long skip, mute sound 896 // for long skip, mute sound
@@ -960,7 +960,7 @@ static void handle_fade( struct Nsf_Emu* this, long out_count, sample_t* out )
960 960
961// Silence detection 961// Silence detection
962 962
963void emu_play( struct Nsf_Emu* this, long count, sample_t* out ) ICODE_ATTR; 963void emu_play( struct Nsf_Emu* this, long count, sample_t* out );
964void emu_play( struct Nsf_Emu* this, long count, sample_t* out ) 964void emu_play( struct Nsf_Emu* this, long count, sample_t* out )
965{ 965{
966 check( current_track_ >= 0 ); 966 check( current_track_ >= 0 );
diff --git a/apps/codecs/libgme/nsf_emu.h b/apps/codecs/libgme/nsf_emu.h
index 513443226c..adb5b8e153 100644
--- a/apps/codecs/libgme/nsf_emu.h
+++ b/apps/codecs/libgme/nsf_emu.h
@@ -209,13 +209,13 @@ static inline void Sound_set_gain( struct Nsf_Emu* this, int g )
209 209
210blargg_err_t run_clocks( struct Nsf_Emu* this, blip_time_t* duration, int ); 210blargg_err_t run_clocks( struct Nsf_Emu* this, blip_time_t* duration, int );
211 211
212void map_memory( struct Nsf_Emu* this ) ICODE_ATTR; 212void map_memory( struct Nsf_Emu* this );
213void write_bank( struct Nsf_Emu* this, int index, int data ) ICODE_ATTR; 213void write_bank( struct Nsf_Emu* this, int index, int data );
214int cpu_read( struct Nsf_Emu* this, addr_t ) ICODE_ATTR; 214int cpu_read( struct Nsf_Emu* this, addr_t );
215void cpu_write( struct Nsf_Emu* this, addr_t, int ) ICODE_ATTR; 215void cpu_write( struct Nsf_Emu* this, addr_t, int );
216void push_byte( struct Nsf_Emu* this, int ) ICODE_ATTR; 216void push_byte( struct Nsf_Emu* this, int );
217addr_t get_addr( byte const [] ) ICODE_ATTR; 217addr_t get_addr( byte const [] );
218bool run_cpu_until( struct Nsf_Emu* this, nes_time_t end ) ICODE_ATTR; 218bool run_cpu_until( struct Nsf_Emu* this, nes_time_t end );
219 219
220// Sets clocks between calls to play routine to p + 1/2 clock 220// Sets clocks between calls to play routine to p + 1/2 clock
221static inline void set_play_period( struct Nsf_Emu* this, int p ) { this->play_period = p; } 221static inline void set_play_period( struct Nsf_Emu* this, int p ) { this->play_period = p; }
@@ -224,26 +224,26 @@ static inline void set_play_period( struct Nsf_Emu* this, int p ) { this->play_p
224static inline nes_time_t play_time( struct Nsf_Emu* this ) { return this->next_play; } 224static inline nes_time_t play_time( struct Nsf_Emu* this ) { return this->next_play; }
225 225
226// Emulates to at least time t. Might emulate a few clocks extra. 226// Emulates to at least time t. Might emulate a few clocks extra.
227void run_until( struct Nsf_Emu* this, nes_time_t t ) ICODE_ATTR; 227void run_until( struct Nsf_Emu* this, nes_time_t t );
228 228
229// Runs cpu to at least time t and returns false, or returns true 229// Runs cpu to at least time t and returns false, or returns true
230// if it encounters illegal instruction (halt). 230// if it encounters illegal instruction (halt).
231bool run_cpu_until( struct Nsf_Emu* this, nes_time_t t ) ICODE_ATTR; 231bool run_cpu_until( struct Nsf_Emu* this, nes_time_t t );
232 232
233// cpu calls through to these to access memory (except instructions) 233// cpu calls through to these to access memory (except instructions)
234int read_mem( struct Nsf_Emu* this, addr_t ) ICODE_ATTR; 234int read_mem( struct Nsf_Emu* this, addr_t );
235void write_mem( struct Nsf_Emu* this, addr_t, int ) ICODE_ATTR; 235void write_mem( struct Nsf_Emu* this, addr_t, int );
236 236
237// Address of play routine 237// Address of play routine
238static inline addr_t play_addr( struct Nsf_Emu* this ) { return get_addr( this->header.play_addr ); } 238static inline addr_t play_addr( struct Nsf_Emu* this ) { return get_addr( this->header.play_addr ); }
239 239
240// Same as run_until, except emulation stops for any event (routine returned, 240// Same as run_until, except emulation stops for any event (routine returned,
241// play routine called, illegal instruction). 241// play routine called, illegal instruction).
242void run_once( struct Nsf_Emu* this, nes_time_t ) ICODE_ATTR; 242void run_once( struct Nsf_Emu* this, nes_time_t );
243 243
244// Reads byte as cpu would when executing code. Only works for RAM/ROM, 244// Reads byte as cpu would when executing code. Only works for RAM/ROM,
245// NOT I/O like sound chips. 245// NOT I/O like sound chips.
246int read_code( struct Nsf_Emu* this, addr_t addr ) ICODE_ATTR; 246int read_code( struct Nsf_Emu* this, addr_t addr );
247 247
248static inline byte* fdsram( struct Nsf_Emu* this ) { return &this->high_ram [fdsram_offset]; } 248static inline byte* fdsram( struct Nsf_Emu* this ) { return &this->high_ram [fdsram_offset]; }
249static inline byte* sram( struct Nsf_Emu* this ) { return this->high_ram; } 249static inline byte* sram( struct Nsf_Emu* this ) { return this->high_ram; }
diff --git a/apps/codecs/libgme/opl_apu.h b/apps/codecs/libgme/opl_apu.h
index 53fc912c4c..5ea8185f5f 100644
--- a/apps/codecs/libgme/opl_apu.h
+++ b/apps/codecs/libgme/opl_apu.h
@@ -51,12 +51,12 @@ static inline void Opl_osc_output( struct Opl_Apu* this, int i, struct Blip_Buff
51} 51}
52 52
53static inline void Opl_set_output( struct Opl_Apu* this, struct Blip_Buffer* buf ) { Opl_osc_output( this, 0, buf ); } 53static inline void Opl_set_output( struct Opl_Apu* this, struct Blip_Buffer* buf ) { Opl_osc_output( this, 0, buf ); }
54void Opl_end_frame( struct Opl_Apu* this, blip_time_t ) ICODE_ATTR; 54void Opl_end_frame( struct Opl_Apu* this, blip_time_t );
55 55
56static inline void Opl_write_addr( struct Opl_Apu* this, int data ) { this->addr = data; } 56static inline void Opl_write_addr( struct Opl_Apu* this, int data ) { this->addr = data; }
57void Opl_write_data( struct Opl_Apu* this, blip_time_t, int data ) ICODE_ATTR; 57void Opl_write_data( struct Opl_Apu* this, blip_time_t, int data );
58 58
59int Opl_read( struct Opl_Apu* this, blip_time_t, int port ) ICODE_ATTR; 59int Opl_read( struct Opl_Apu* this, blip_time_t, int port );
60 60
61static inline bool Opl_supported( void ) { return true; } 61static inline bool Opl_supported( void ) { return true; }
62 62
diff --git a/apps/codecs/libgme/opltables.h b/apps/codecs/libgme/opltables.h
index 1414f2264b..6ec10eaa6e 100644
--- a/apps/codecs/libgme/opltables.h
+++ b/apps/codecs/libgme/opltables.h
@@ -4,7 +4,7 @@
4/* Precalculated emu8950 tables for use in Rockbox, 4/* Precalculated emu8950 tables for use in Rockbox,
5 Calculated for 44Khz sampling rate */ 5 Calculated for 44Khz sampling rate */
6 6
7static const short ar_adjust_coeff[] ICONST_ATTR = { 7static const short ar_adjust_coeff[] = {
8 255, 227, 210, 198, 189, 181, 175, 170, 165, 161, 157, 8 255, 227, 210, 198, 189, 181, 175, 170, 165, 161, 157,
9 153, 150, 147, 144, 141, 139, 136, 134, 132, 130, 128, 9 153, 150, 147, 144, 141, 139, 136, 134, 132, 130, 128,
10 126, 125, 123, 121, 120, 118, 117, 115, 114, 113, 112, 10 126, 125, 123, 121, 120, 118, 117, 115, 114, 113, 112,
@@ -54,7 +54,7 @@ static const short ar_adjust_coeff[] ICONST_ATTR = {
54 0, 0, 0, 0, 0 54 0, 0, 0, 0, 0
55}; 55};
56 56
57static const short db2lin_coeff[] ICONST_ATTR = { 57static const short db2lin_coeff[] = {
58 2047, 2003, 1960, 1918, 1877, 1837, 1798, 1759, 1722, 1685, 1649, 58 2047, 2003, 1960, 1918, 1877, 1837, 1798, 1759, 1722, 1685, 1649,
59 1614, 1579, 1546, 1513, 1480, 1449, 1418, 1387, 1358, 1329, 1300, 59 1614, 1579, 1546, 1513, 1480, 1449, 1418, 1387, 1358, 1329, 1300,
60 1273, 1245, 1219, 1193, 1167, 1142, 1118, 1094, 1071, 1048, 1025, 60 1273, 1245, 1219, 1193, 1167, 1142, 1118, 1094, 1071, 1048, 1025,
@@ -104,7 +104,7 @@ static const short db2lin_coeff[] ICONST_ATTR = {
104 0, 0, 0, 0, 0, 0 104 0, 0, 0, 0, 0, 0
105}; 105};
106 106
107static const short sin_coeff[] ICONST_ATTR = { 107static const short sin_coeff[] = {
108 511, 235, 203, 185, 171, 161, 152, 145, 139, 134, 129, 108 511, 235, 203, 185, 171, 161, 152, 145, 139, 134, 129,
109 124, 120, 117, 113, 110, 107, 104, 102, 99, 97, 95, 109 124, 120, 117, 113, 110, 107, 104, 102, 99, 97, 95,
110 92, 90, 88, 87, 85, 83, 81, 80, 78, 77, 75, 110 92, 90, 88, 87, 85, 83, 81, 80, 78, 77, 75,
@@ -131,7 +131,7 @@ static const short sin_coeff[] ICONST_ATTR = {
131 0, 0, 0, 131 0, 0, 0,
132}; 132};
133 133
134static const short pm0_coeff[] ICONST_ATTR = { 134static const short pm0_coeff[] = {
135 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 135 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
136 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 136 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
137 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 137 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
@@ -158,7 +158,7 @@ static const short pm0_coeff[] ICONST_ATTR = {
158 255, 255, 255, 158 255, 255, 255,
159}; 159};
160 160
161static const short pm1_coeff[] ICONST_ATTR = { 161static const short pm1_coeff[] = {
162 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 162 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
163 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 257, 163 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 257,
164 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 164 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
@@ -185,7 +185,7 @@ static const short pm1_coeff[] ICONST_ATTR = {
185 255, 255, 255, 185 255, 255, 255,
186}; 186};
187 187
188static const short am0_coeff[] ICONST_ATTR = { 188static const short am0_coeff[] = {
189 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 189 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
190 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 190 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
191 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 191 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -212,7 +212,7 @@ static const short am0_coeff[] ICONST_ATTR = {
212 2, 2, 2, 212 2, 2, 2,
213}; 213};
214 214
215static const short am1_coeff[] ICONST_ATTR = { 215static const short am1_coeff[] = {
216 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 216 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15,
217 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 217 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19,
218 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 218 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21,
diff --git a/apps/codecs/libgme/resampler.h b/apps/codecs/libgme/resampler.h
index 741bdb50a4..3106b84d35 100644
--- a/apps/codecs/libgme/resampler.h
+++ b/apps/codecs/libgme/resampler.h
@@ -47,7 +47,7 @@ static inline void Resampler_init( struct Resampler* this )
47blargg_err_t Resampler_reset( struct Resampler* this, int max_pairs ); 47blargg_err_t Resampler_reset( struct Resampler* this, int max_pairs );
48void Resampler_resize( struct Resampler* this, int pairs_per_frame ); 48void Resampler_resize( struct Resampler* this, int pairs_per_frame );
49 49
50void Resampler_play( struct Resampler* this, long count, dsample_t* out, struct Stereo_Buffer* ) ICODE_ATTR; 50void Resampler_play( struct Resampler* this, long count, dsample_t* out, struct Stereo_Buffer* );
51 51
52static inline void Resampler_set_callback(struct Resampler* this, int (*func)( void*, blip_time_t, int, dsample_t* ), void* user_data ) 52static inline void Resampler_set_callback(struct Resampler* this, int (*func)( void*, blip_time_t, int, dsample_t* ), void* user_data )
53{ 53{
diff --git a/apps/codecs/libgme/sgc_emu.c b/apps/codecs/libgme/sgc_emu.c
index a25bdbc070..3c3586611c 100644
--- a/apps/codecs/libgme/sgc_emu.c
+++ b/apps/codecs/libgme/sgc_emu.c
@@ -306,7 +306,7 @@ void Sound_set_tempo( struct Sgc_Emu* this, int t )
306 this->play_period = (int) ((clock_rate( this ) * FP_ONE_TEMPO) / (this->header.rate ? 50 : 60) / t); 306 this->play_period = (int) ((clock_rate( this ) * FP_ONE_TEMPO) / (this->header.rate ? 50 : 60) / t);
307} 307}
308 308
309void fill_buf( struct Sgc_Emu* this ) ICODE_ATTR; 309void fill_buf( struct Sgc_Emu* this );
310blargg_err_t Sgc_start_track( struct Sgc_Emu* this, int track ) 310blargg_err_t Sgc_start_track( struct Sgc_Emu* this, int track )
311{ 311{
312 clear_track_vars( this ); 312 clear_track_vars( this );
@@ -430,7 +430,7 @@ blargg_err_t Track_seek( struct Sgc_Emu* this, long msec )
430 return Track_skip( this, time - this->out_time ); 430 return Track_skip( this, time - this->out_time );
431} 431}
432 432
433blargg_err_t skip_( struct Sgc_Emu* this, long count ) ICODE_ATTR; 433blargg_err_t skip_( struct Sgc_Emu* this, long count );
434blargg_err_t Track_skip( struct Sgc_Emu* this, long count ) 434blargg_err_t Track_skip( struct Sgc_Emu* this, long count )
435{ 435{
436 require( this->current_track >= 0 ); // start_track() must have been called already 436 require( this->current_track >= 0 ); // start_track() must have been called already
@@ -463,7 +463,7 @@ blargg_err_t Track_skip( struct Sgc_Emu* this, long count )
463 return 0; 463 return 0;
464} 464}
465 465
466blargg_err_t play_( struct Sgc_Emu* this, long count, sample_t* out ) ICODE_ATTR; 466blargg_err_t play_( struct Sgc_Emu* this, long count, sample_t* out );
467blargg_err_t skip_( struct Sgc_Emu* this, long count ) 467blargg_err_t skip_( struct Sgc_Emu* this, long count )
468{ 468{
469 // for long skip, mute sound 469 // for long skip, mute sound
diff --git a/apps/codecs/libgme/sgc_emu.h b/apps/codecs/libgme/sgc_emu.h
index 720e8d2460..779ef2d923 100644
--- a/apps/codecs/libgme/sgc_emu.h
+++ b/apps/codecs/libgme/sgc_emu.h
@@ -191,9 +191,9 @@ static inline bool sega_mapping( struct Sgc_Emu* this )
191 191
192// Emulation (You shouldn't touch these) 192// Emulation (You shouldn't touch these)
193 193
194bool run_cpu( struct Sgc_Emu* this, cpu_time_t end_time ) ICODE_ATTR; 194bool run_cpu( struct Sgc_Emu* this, cpu_time_t end_time );
195void cpu_out( struct Sgc_Emu* this, cpu_time_t time, addr_t addr, int data ) ICODE_ATTR; 195void cpu_out( struct Sgc_Emu* this, cpu_time_t time, addr_t addr, int data );
196void cpu_write( struct Sgc_Emu* this, addr_t addr, int data ) ICODE_ATTR; 196void cpu_write( struct Sgc_Emu* this, addr_t addr, int data );
197void jsr( struct Sgc_Emu* this, byte addr [2] ) ICODE_ATTR; 197void jsr( struct Sgc_Emu* this, byte addr [2] );
198 198
199#endif 199#endif
diff --git a/apps/codecs/libgme/sms_apu.c b/apps/codecs/libgme/sms_apu.c
index 12435f406d..965e4836c4 100644
--- a/apps/codecs/libgme/sms_apu.c
+++ b/apps/codecs/libgme/sms_apu.c
@@ -139,7 +139,7 @@ static void run_until( struct Sms_Apu* this, blip_time_t end_time )
139 if ( out ) 139 if ( out )
140 { 140 {
141 // volumes [i] ~= 64 * pow( 1.26, 15 - i ) / pow( 1.26, 15 ) 141 // volumes [i] ~= 64 * pow( 1.26, 15 - i ) / pow( 1.26, 15 )
142 static unsigned char const volumes [16] ICONST_ATTR = { 142 static unsigned char const volumes [16] = {
143 64, 50, 40, 32, 25, 20, 16, 13, 10, 8, 6, 5, 4, 3, 2, 0 143 64, 50, 40, 32, 25, 20, 16, 13, 10, 8, 6, 5, 4, 3, 2, 0
144 }; 144 };
145 145
diff --git a/apps/codecs/libgme/sms_apu.h b/apps/codecs/libgme/sms_apu.h
index e0225138e5..f887dc611e 100644
--- a/apps/codecs/libgme/sms_apu.h
+++ b/apps/codecs/libgme/sms_apu.h
@@ -43,14 +43,14 @@ void Sms_apu_init( struct Sms_Apu* this );
43void Sms_apu_set_output( struct Sms_Apu* this, int i, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right); 43void Sms_apu_set_output( struct Sms_Apu* this, int i, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right);
44 44
45// Emulates to time t, then writes data to Game Gear left/right assignment byte 45// Emulates to time t, then writes data to Game Gear left/right assignment byte
46void Sms_apu_write_ggstereo( struct Sms_Apu* this, blip_time_t t, int data ) ICODE_ATTR; 46void Sms_apu_write_ggstereo( struct Sms_Apu* this, blip_time_t t, int data );
47 47
48// Emulates to time t, then writes data 48// Emulates to time t, then writes data
49void Sms_apu_write_data( struct Sms_Apu* this, blip_time_t t, int data ) ICODE_ATTR; 49void Sms_apu_write_data( struct Sms_Apu* this, blip_time_t t, int data );
50 50
51// Emulates to time t, then subtracts t from the current time. 51// Emulates to time t, then subtracts t from the current time.
52// OK if previous write call had time slightly after t. 52// OK if previous write call had time slightly after t.
53void Sms_apu_end_frame( struct Sms_Apu* this, blip_time_t t ) ICODE_ATTR; 53void Sms_apu_end_frame( struct Sms_Apu* this, blip_time_t t );
54 54
55// More features 55// More features
56 56
diff --git a/apps/codecs/libgme/sms_fm_apu.c b/apps/codecs/libgme/sms_fm_apu.c
index 5240405ad1..6fd00545d6 100644
--- a/apps/codecs/libgme/sms_fm_apu.c
+++ b/apps/codecs/libgme/sms_fm_apu.c
@@ -28,7 +28,7 @@ void Fm_apu_reset( struct Sms_Fm_Apu* this )
28 Ym2413_reset( &this->apu ); 28 Ym2413_reset( &this->apu );
29} 29}
30 30
31void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ) ICODE_ATTR; 31void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time );
32void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t time, int data ) 32void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t time, int data )
33{ 33{
34 if ( time > this->next_time ) 34 if ( time > this->next_time )
diff --git a/apps/codecs/libgme/sms_fm_apu.h b/apps/codecs/libgme/sms_fm_apu.h
index 0dd882b0f4..cf8cd6c5cb 100644
--- a/apps/codecs/libgme/sms_fm_apu.h
+++ b/apps/codecs/libgme/sms_fm_apu.h
@@ -36,8 +36,8 @@ static inline void Fm_apu_volume( struct Sms_Fm_Apu* this, int v ) { Synth_volum
36void Fm_apu_reset( struct Sms_Fm_Apu* this ); 36void Fm_apu_reset( struct Sms_Fm_Apu* this );
37 37
38static inline void Fm_apu_write_addr( struct Sms_Fm_Apu* this, int data ) { this->addr = data; } 38static inline void Fm_apu_write_addr( struct Sms_Fm_Apu* this, int data ) { this->addr = data; }
39void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t, int data ) ICODE_ATTR; 39void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t, int data );
40 40
41void Fm_apu_end_frame( struct Sms_Fm_Apu* this, blip_time_t t ) ICODE_ATTR; 41void Fm_apu_end_frame( struct Sms_Fm_Apu* this, blip_time_t t );
42 42
43#endif 43#endif
diff --git a/apps/codecs/libgme/vgm_emu.c b/apps/codecs/libgme/vgm_emu.c
index b442b3e84b..d599056bca 100644
--- a/apps/codecs/libgme/vgm_emu.c
+++ b/apps/codecs/libgme/vgm_emu.c
@@ -407,7 +407,7 @@ static blargg_err_t play_( struct Vgm_Emu* this, long count, sample_t* out )
407 407
408static inline int command_len( int command ) 408static inline int command_len( int command )
409{ 409{
410 static byte const lens [0x10] ICONST_ATTR = { 410 static byte const lens [0x10] = {
411 // 0 1 2 3 4 5 6 7 8 9 A B C D E F 411 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
412 1,1,1,2,2,3,1,1,1,1,3,3,4,4,5,5 412 1,1,1,2,2,3,1,1,1,1,3,3,4,4,5,5
413 }; 413 };
diff --git a/apps/codecs/libgme/vgm_emu.h b/apps/codecs/libgme/vgm_emu.h
index 65993dbd5d..bc04086e9d 100644
--- a/apps/codecs/libgme/vgm_emu.h
+++ b/apps/codecs/libgme/vgm_emu.h
@@ -155,7 +155,7 @@ blargg_err_t Vgm_start_track( struct Vgm_Emu* this );
155 155
156// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation 156// Generate 'count' samples info 'buf'. Output is in stereo. Any emulation
157// errors set warning string, and major errors also end track. 157// errors set warning string, and major errors also end track.
158blargg_err_t Vgm_play( struct Vgm_Emu* this, long count, sample_t* buf ) ICODE_ATTR; 158blargg_err_t Vgm_play( struct Vgm_Emu* this, long count, sample_t* buf );
159 159
160// Track status/control 160// Track status/control
161 161
diff --git a/apps/codecs/libgme/ym2413_emu.h b/apps/codecs/libgme/ym2413_emu.h
index 7efb8e2fab..68d8fe3d8f 100644
--- a/apps/codecs/libgme/ym2413_emu.h
+++ b/apps/codecs/libgme/ym2413_emu.h
@@ -34,10 +34,10 @@ void Ym2413_reset( struct Ym2413_Emu* this );
34void Ym2413_mute_voices( struct Ym2413_Emu* this, int mask ); 34void Ym2413_mute_voices( struct Ym2413_Emu* this, int mask );
35 35
36// Writes data to addr 36// Writes data to addr
37void Ym2413_write( struct Ym2413_Emu* this, int addr, int data ) ICODE_ATTR; 37void Ym2413_write( struct Ym2413_Emu* this, int addr, int data );
38 38
39// Runs and writes pair_count*2 samples to output 39// Runs and writes pair_count*2 samples to output
40void Ym2413_run( struct Ym2413_Emu* this, int pair_count, short* out ) ICODE_ATTR; 40void Ym2413_run( struct Ym2413_Emu* this, int pair_count, short* out );
41 41
42static inline void Ym2413_enable( struct Ym2413_Emu* this, bool b ) { this->last_time = b ? 0 : disabled_time; } 42static inline void Ym2413_enable( struct Ym2413_Emu* this, bool b ) { this->last_time = b ? 0 : disabled_time; }
43static inline bool Ym2413_enabled( struct Ym2413_Emu* this ) { return this->last_time != disabled_time; } 43static inline bool Ym2413_enabled( struct Ym2413_Emu* this ) { return this->last_time != disabled_time; }
diff --git a/apps/codecs/libgme/ym2612_emu.c b/apps/codecs/libgme/ym2612_emu.c
index 2162d73850..970e4462e1 100644
--- a/apps/codecs/libgme/ym2612_emu.c
+++ b/apps/codecs/libgme/ym2612_emu.c
@@ -43,7 +43,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
43 43
44const int output_bits = 14; 44const int output_bits = 14;
45 45
46static const unsigned char DT_DEF_TAB [4 * 32] ICONST_ATTR = 46static const unsigned char DT_DEF_TAB [4 * 32] =
47{ 47{
48// FD = 0 48// FD = 0
49 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -62,7 +62,7 @@ static const unsigned char DT_DEF_TAB [4 * 32] ICONST_ATTR =
62 8 , 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 20, 22, 22, 22, 22 62 8 , 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 20, 22, 22, 22, 22
63}; 63};
64 64
65static const unsigned char FKEY_TAB [16] ICONST_ATTR = 65static const unsigned char FKEY_TAB [16] =
66{ 66{
67 0, 0, 0, 0, 67 0, 0, 0, 0,
68 0, 0, 0, 1, 68 0, 0, 0, 1,
@@ -70,12 +70,12 @@ static const unsigned char FKEY_TAB [16] ICONST_ATTR =
70 3, 3, 3, 3 70 3, 3, 3, 3
71}; 71};
72 72
73static const unsigned char LFO_AMS_TAB [4] ICONST_ATTR = 73static const unsigned char LFO_AMS_TAB [4] =
74{ 74{
75 31, 4, 1, 0 75 31, 4, 1, 0
76}; 76};
77 77
78static const unsigned char LFO_FMS_TAB [8] ICONST_ATTR = 78static const unsigned char LFO_FMS_TAB [8] =
79{ 79{
80 LFO_FMS_BASE * 0, LFO_FMS_BASE * 1, 80 LFO_FMS_BASE * 0, LFO_FMS_BASE * 1,
81 LFO_FMS_BASE * 2, LFO_FMS_BASE * 3, 81 LFO_FMS_BASE * 2, LFO_FMS_BASE * 3,
diff --git a/apps/codecs/libgme/ym2612_emu.h b/apps/codecs/libgme/ym2612_emu.h
index 9ca1989ced..4b8b5c0e94 100644
--- a/apps/codecs/libgme/ym2612_emu.h
+++ b/apps/codecs/libgme/ym2612_emu.h
@@ -208,13 +208,13 @@ void Ym2612_reset( struct Ym2612_Emu* this_ );
208void Ym2612_mute_voices( struct Ym2612_Emu* this_, int mask ); 208void Ym2612_mute_voices( struct Ym2612_Emu* this_, int mask );
209 209
210// Writes addr to register 0 then data to register 1 210// Writes addr to register 0 then data to register 1
211void Ym2612_write0( struct Ym2612_Emu* this_, int addr, int data ) ICODE_ATTR; 211void Ym2612_write0( struct Ym2612_Emu* this_, int addr, int data );
212 212
213// Writes addr to register 2 then data to register 3 213// Writes addr to register 2 then data to register 3
214void Ym2612_write1( struct Ym2612_Emu* this_, int addr, int data ) ICODE_ATTR; 214void Ym2612_write1( struct Ym2612_Emu* this_, int addr, int data );
215 215
216// Runs and adds pair_count*2 samples into current output buffer contents 216// Runs and adds pair_count*2 samples into current output buffer contents
217void Ym2612_run( struct Ym2612_Emu* this_, int pair_count, short* out ) ICODE_ATTR; 217void Ym2612_run( struct Ym2612_Emu* this_, int pair_count, short* out );
218 218
219static inline void Ym2612_enable( struct Ym2612_Emu* this_, bool b ) { this_->last_time = b ? 0 : ym2612_disabled_time; } 219static inline void Ym2612_enable( struct Ym2612_Emu* this_, bool b ) { this_->last_time = b ? 0 : ym2612_disabled_time; }
220static inline bool Ym2612_enabled( struct Ym2612_Emu* this_ ) { return this_->last_time != ym2612_disabled_time; } 220static inline bool Ym2612_enabled( struct Ym2612_Emu* this_ ) { return this_->last_time != ym2612_disabled_time; }
diff --git a/apps/codecs/libgme/ymtables.h b/apps/codecs/libgme/ymtables.h
index 4e8f62a39b..51812c1b57 100644
--- a/apps/codecs/libgme/ymtables.h
+++ b/apps/codecs/libgme/ymtables.h
@@ -3,7 +3,7 @@
3 3
4/* Precompiled ym2612 tables for use in Rockbox */ 4/* Precompiled ym2612 tables for use in Rockbox */
5 5
6static const int tl_coeff[] ICONST_ATTR = { 6static const int tl_coeff[] = {
7 268435455, 267712100, 266990695, 266271234, 265553712, 264838123, 264124462, 263412725, 262702906, 261994999, 261289000, 7 268435455, 267712100, 266990695, 266271234, 265553712, 264838123, 264124462, 263412725, 262702906, 261994999, 261289000,
8 260584903, 259882704, 259182396, 258483976, 257787438, 257092777, 256399988, 255709066, 255020006, 254332802, 253647450, 8 260584903, 259882704, 259182396, 258483976, 257787438, 257092777, 256399988, 255709066, 255020006, 254332802, 253647450,
9 252963945, 252282282, 251602456, 250924462, 250248294, 249573949, 248901421, 248230705, 247561797, 246894691, 246229383, 9 252963945, 252282282, 251602456, 250924462, 250248294, 249573949, 248901421, 248230705, 247561797, 246894691, 246229383,
@@ -309,7 +309,7 @@ static const int tl_coeff[] ICONST_ATTR = {
309 34345, 34253, 34160, 34068, 33976, 33885 309 34345, 34253, 34160, 34068, 33976, 33885
310}; 310};
311 311
312static const short sindb_coeff[] ICONST_ATTR = { 312static const short sindb_coeff[] = {
313 2401, 2144, 1994, 1887, 1804, 1737, 1680, 1630, 1587, 1548, 1512, 1480, 1450, 313 2401, 2144, 1994, 1887, 1804, 1737, 1680, 1630, 1587, 1548, 1512, 1480, 1450,
314 1423, 1397, 1373, 1351, 1330, 1310, 1291, 1273, 1255, 1239, 1223, 1208, 1194, 314 1423, 1397, 1373, 1351, 1330, 1310, 1291, 1273, 1255, 1239, 1223, 1208, 1194,
315 1180, 1166, 1153, 1141, 1128, 1117, 1105, 1094, 1084, 1073, 1063, 1053, 1043, 315 1180, 1166, 1153, 1141, 1128, 1117, 1105, 1094, 1084, 1073, 1063, 1053, 1043,
@@ -392,7 +392,7 @@ static const short sindb_coeff[] ICONST_ATTR = {
392}; 392};
393 393
394 394
395static const short lfo_freq_coeff[] ICONST_ATTR = { 395static const short lfo_freq_coeff[] = {
396 0, 3, 6, 9, 12, 15, 18, 21, 25, 28, 31, 34, 37, 396 0, 3, 6, 9, 12, 15, 18, 21, 25, 28, 31, 34, 37,
397 40, 43, 46, 50, 53, 56, 59, 62, 65, 68, 71, 74, 78, 397 40, 43, 46, 50, 53, 56, 59, 62, 65, 68, 71, 74, 78,
398 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 115, 118, 398 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 115, 118,
@@ -474,7 +474,7 @@ static const short lfo_freq_coeff[] ICONST_ATTR = {
474 -31, -28, -25, -21, -18, -15, -12, -9, -6, -3 474 -31, -28, -25, -21, -18, -15, -12, -9, -6, -3
475}; 475};
476 476
477static const short lfo_env_coeff[] ICONST_ATTR = { 477static const short lfo_env_coeff[] = {
478 251, 253, 254, 256, 257, 259, 260, 262, 264, 265, 267, 268, 270, 478 251, 253, 254, 256, 257, 259, 260, 262, 264, 265, 267, 268, 270,
479 271, 273, 274, 276, 277, 279, 281, 282, 284, 285, 287, 288, 290, 479 271, 273, 274, 276, 277, 279, 281, 282, 284, 285, 287, 288, 290,
480 291, 293, 294, 296, 297, 299, 300, 302, 303, 305, 306, 308, 309, 480 291, 293, 294, 296, 297, 299, 300, 302, 303, 305, 306, 308, 309,
diff --git a/apps/codecs/nsf.c b/apps/codecs/nsf.c
index a556f75b27..8899501e05 100644
--- a/apps/codecs/nsf.c
+++ b/apps/codecs/nsf.c
@@ -12,7 +12,7 @@ CODEC_HEADER
12#define CHUNK_SIZE (1024*2) 12#define CHUNK_SIZE (1024*2)
13 13
14static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 14static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
15static struct Nsf_Emu nsf_emu IDATA_ATTR CACHEALIGN_ATTR; 15static struct Nsf_Emu nsf_emu;
16 16
17/****************** rockbox interface ******************/ 17/****************** rockbox interface ******************/
18 18
diff --git a/apps/codecs/sgc.c b/apps/codecs/sgc.c
index e5f0299980..2f1f3f88bc 100644
--- a/apps/codecs/sgc.c
+++ b/apps/codecs/sgc.c
@@ -10,7 +10,7 @@ CODEC_HEADER
10#define CHUNK_SIZE (1024*2) 10#define CHUNK_SIZE (1024*2)
11 11
12static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 12static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
13static struct Sgc_Emu sgc_emu IDATA_ATTR CACHEALIGN_ATTR; 13static struct Sgc_Emu sgc_emu;
14 14
15/* Coleco Bios */ 15/* Coleco Bios */
16/* Colecovision not supported yet 16/* Colecovision not supported yet
diff --git a/apps/codecs/vgm.c b/apps/codecs/vgm.c
index 89bfd1937b..9c8619c7b8 100644
--- a/apps/codecs/vgm.c
+++ b/apps/codecs/vgm.c
@@ -16,7 +16,7 @@ CODEC_HEADER
16#define MAINMEMBUF 0 16#define MAINMEMBUF 0
17 17
18static int16_t samples[CHUNK_SIZE] IBSS_ATTR; 18static int16_t samples[CHUNK_SIZE] IBSS_ATTR;
19static struct Vgm_Emu vgm_emu IDATA_ATTR CACHEALIGN_ATTR; 19static struct Vgm_Emu vgm_emu;
20 20
21static void *inflatebuf; /* heap for gunzip */ 21static void *inflatebuf; /* heap for gunzip */
22static char *songbuf; /* destination for uncompressed song */ 22static char *songbuf; /* destination for uncompressed song */