summaryrefslogtreecommitdiff
path: root/apps/codecs/libspc/spc_emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libspc/spc_emu.c')
-rw-r--r--apps/codecs/libspc/spc_emu.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/codecs/libspc/spc_emu.c b/apps/codecs/libspc/spc_emu.c
index 0ad1329a6b..5ea5b0cdeb 100644
--- a/apps/codecs/libspc/spc_emu.c
+++ b/apps/codecs/libspc/spc_emu.c
@@ -32,7 +32,8 @@ struct cpu_ram_t ram IBSS_ATTR_SPC_LARGE_IRAM CACHEALIGN_ATTR;
32 32
33/**************** Timers ****************/ 33/**************** Timers ****************/
34 34
35void Timer_run_( struct Timer* t, long time ) 35static void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC;
36static void Timer_run_( struct Timer* t, long time )
36{ 37{
37 /* when disabled, next_tick should always be in the future */ 38 /* when disabled, next_tick should always be in the future */
38 assert( t->enabled ); 39 assert( t->enabled );
@@ -50,6 +51,12 @@ void Timer_run_( struct Timer* t, long time )
50 t->count = elapsed; 51 t->count = elapsed;
51} 52}
52 53
54static inline void Timer_run( struct Timer* t, long time )
55{
56 if ( time >= t->next_tick )
57 Timer_run_( t, time );
58}
59
53/**************** SPC emulator ****************/ 60/**************** SPC emulator ****************/
54/* 1.024 MHz clock / 32000 samples per second */ 61/* 1.024 MHz clock / 32000 samples per second */
55 62
@@ -179,7 +186,8 @@ int SPC_load_spc( THIS, const void* data, long size )
179} 186}
180 187
181/**************** DSP interaction ****************/ 188/**************** DSP interaction ****************/
182void SPC_run_dsp_( THIS, long time ) 189static void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC;
190static void SPC_run_dsp_( THIS, long time )
183{ 191{
184 /* divide by CLOCKS_PER_SAMPLE */ 192 /* divide by CLOCKS_PER_SAMPLE */
185 int count = ((time - this->next_dsp) >> 5) + 1; 193 int count = ((time - this->next_dsp) >> 5) + 1;
@@ -189,6 +197,12 @@ void SPC_run_dsp_( THIS, long time )
189 DSP_run( &this->dsp, count, buf ); 197 DSP_run( &this->dsp, count, buf );
190} 198}
191 199
200static inline void SPC_run_dsp( THIS, long time )
201{
202 if ( time >= this->next_dsp )
203 SPC_run_dsp_( this, time );
204}
205
192int SPC_read( THIS, unsigned addr, long const time ) 206int SPC_read( THIS, unsigned addr, long const time )
193{ 207{
194 int result = RAM [addr]; 208 int result = RAM [addr];