summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c8
-rw-r--r--apps/codecs.h24
-rw-r--r--apps/codecs/codec_crt0.c4
-rw-r--r--apps/codecs/mpa.c2
-rw-r--r--apps/codecs/spc.c6
-rw-r--r--apps/playback.c4
-rw-r--r--apps/plugin.c12
-rw-r--r--apps/plugin.h21
-rw-r--r--apps/plugins/mpegplayer/alloc.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c8
-rw-r--r--apps/plugins/rockboy/dynarec.c2
-rw-r--r--apps/plugins/test_codec.c6
13 files changed, 32 insertions, 69 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 231b612358..4fcf9ce02f 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -113,9 +113,9 @@ struct codec_api ci = {
113 semaphore_release, 113 semaphore_release,
114#endif 114#endif
115 115
116#ifdef CACHE_FUNCTIONS_AS_CALL 116#if NUM_CORES > 1
117 flush_icache, 117 cpucache_flush,
118 invalidate_icache, 118 cpucache_invalidate,
119#endif 119#endif
120 120
121 /* strings and memory */ 121 /* strings and memory */
@@ -232,7 +232,7 @@ static int codec_load_ram(int size, struct codec_api *api)
232 } 232 }
233 233
234 *(hdr->api) = api; 234 *(hdr->api) = api;
235 invalidate_icache(); 235 cpucache_invalidate();
236 status = hdr->entry_point(); 236 status = hdr->entry_point();
237 237
238 sim_codec_close(pd); 238 sim_codec_close(pd);
diff --git a/apps/codecs.h b/apps/codecs.h
index 3eab1d35c2..c2358e1750 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -170,9 +170,9 @@ struct codec_api {
170 void (*semaphore_release)(struct semaphore *s); 170 void (*semaphore_release)(struct semaphore *s);
171#endif /* NUM_CORES */ 171#endif /* NUM_CORES */
172 172
173#ifdef CACHE_FUNCTIONS_AS_CALL 173#if NUM_CORES > 1
174 void (*flush_icache)(void); 174 void (*cpucache_flush)(void);
175 void (*invalidate_icache)(void); 175 void (*cpucache_invalidate)(void);
176#endif 176#endif
177 177
178 /* strings and memory */ 178 /* strings and memory */
@@ -297,22 +297,4 @@ int codec_load_file(const char* codec, struct codec_api *api);
297enum codec_status codec_start(void); 297enum codec_status codec_start(void);
298enum codec_status codec_main(void); 298enum codec_status codec_main(void);
299 299
300#ifndef CACHE_FUNCTION_WRAPPERS
301
302#ifdef CACHE_FUNCTIONS_AS_CALL
303#define CACHE_FUNCTION_WRAPPERS(api) \
304 void flush_icache(void) \
305 { \
306 (api)->flush_icache(); \
307 } \
308 void invalidate_icache(void) \
309 { \
310 (api)->invalidate_icache(); \
311 }
312#else
313#define CACHE_FUNCTION_WRAPPERS(api)
314#endif /* CACHE_FUNCTIONS_AS_CALL */
315
316#endif /* CACHE_FUNCTION_WRAPPERS */
317
318#endif 300#endif
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c
index 467e115de9..09b6982246 100644
--- a/apps/codecs/codec_crt0.c
+++ b/apps/codecs/codec_crt0.c
@@ -34,8 +34,6 @@ extern unsigned char plugin_end_addr[];
34 34
35extern enum codec_status codec_main(void); 35extern enum codec_status codec_main(void);
36 36
37CACHE_FUNCTION_WRAPPERS(ci);
38
39enum codec_status codec_start(void) 37enum codec_status codec_start(void)
40{ 38{
41#ifndef SIMULATOR 39#ifndef SIMULATOR
@@ -47,7 +45,7 @@ enum codec_status codec_start(void)
47#endif 45#endif
48#if NUM_CORES > 1 46#if NUM_CORES > 1
49 /* writeback cleared iedata and bss areas */ 47 /* writeback cleared iedata and bss areas */
50 flush_icache(); 48 ci->cpucache_flush();
51#endif 49#endif
52 return codec_main(); 50 return codec_main();
53} 51}
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 1a0b03c272..1b71bde79e 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -268,7 +268,7 @@ static void mad_synth_thread_quit(void)
268 die=1; 268 die=1;
269 ci->semaphore_release(&synth_pending_sem); 269 ci->semaphore_release(&synth_pending_sem);
270 ci->thread_wait(mad_synth_thread_id); 270 ci->thread_wait(mad_synth_thread_id);
271 invalidate_icache(); 271 ci->cpucache_invalidate();
272} 272}
273#else 273#else
274static inline void mad_synth_thread_ready(void) 274static inline void mad_synth_thread_ready(void)
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 5ac594431a..6ceb704c7c 100644
--- a/apps/codecs/spc.c
+++ b/apps/codecs/spc.c
@@ -302,7 +302,7 @@ static bool emu_thread_process_msg(struct sample_queue_chunk *chunk)
302 if (id == SPC_EMU_LOAD) 302 if (id == SPC_EMU_LOAD)
303 { 303 {
304 struct spc_load *ld = (struct spc_load *)chunk->data; 304 struct spc_load *ld = (struct spc_load *)chunk->data;
305 invalidate_icache(); 305 ci->cpucache_invalidate();
306 SPC_Init(&spc_emu); 306 SPC_Init(&spc_emu);
307 sample_queue.retval = SPC_load_spc(&spc_emu, ld->buf, ld->size); 307 sample_queue.retval = SPC_load_spc(&spc_emu, ld->buf, ld->size);
308 308
@@ -376,7 +376,7 @@ static bool spc_emu_start(void)
376static inline int load_spc_buffer(uint8_t *buf, size_t size) 376static inline int load_spc_buffer(uint8_t *buf, size_t size)
377{ 377{
378 struct spc_load ld = { buf, size }; 378 struct spc_load ld = { buf, size };
379 flush_icache(); 379 ci->cpucache_flush();
380 return emu_thread_send_msg(SPC_EMU_LOAD, (intptr_t)&ld); 380 return emu_thread_send_msg(SPC_EMU_LOAD, (intptr_t)&ld);
381} 381}
382 382
@@ -386,7 +386,7 @@ static inline void spc_emu_quit(void)
386 emu_thread_send_msg(SPC_EMU_QUIT, 0); 386 emu_thread_send_msg(SPC_EMU_QUIT, 0);
387 /* Wait for emu thread to be killed */ 387 /* Wait for emu thread to be killed */
388 ci->thread_wait(emu_thread_id); 388 ci->thread_wait(emu_thread_id);
389 invalidate_icache(); 389 ci->cpucache_invalidate();
390 } 390 }
391} 391}
392 392
diff --git a/apps/playback.c b/apps/playback.c
index 55c1878d4e..deaebfbdf0 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1317,9 +1317,9 @@ static void codec_thread(void)
1317 queue_reply(&codec_queue, 1); 1317 queue_reply(&codec_queue, 1);
1318 if ((void*)ev.data != NULL) 1318 if ((void*)ev.data != NULL)
1319 { 1319 {
1320 invalidate_icache(); 1320 cpucache_invalidate();
1321 ((void (*)(void))ev.data)(); 1321 ((void (*)(void))ev.data)();
1322 flush_icache(); 1322 cpucache_flush();
1323 } 1323 }
1324 break; 1324 break;
1325 1325
diff --git a/apps/plugin.c b/apps/plugin.c
index 3b14b0032f..f9f1c53617 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -327,9 +327,9 @@ static const struct plugin_api rockbox_api = {
327 trigger_cpu_boost, 327 trigger_cpu_boost,
328 cancel_cpu_boost, 328 cancel_cpu_boost,
329#endif 329#endif
330#ifdef CACHE_FUNCTIONS_AS_CALL 330#if NUM_CORES > 1
331 flush_icache, 331 cpucache_flush,
332 invalidate_icache, 332 cpucache_invalidate,
333#endif 333#endif
334 timer_register, 334 timer_register,
335 timer_unregister, 335 timer_unregister,
@@ -694,7 +694,7 @@ int plugin_load(const char* plugin, const void* parameter)
694#if NUM_CORES > 1 694#if NUM_CORES > 1
695 /* Make sure COP cache is flushed and invalidated before loading */ 695 /* Make sure COP cache is flushed and invalidated before loading */
696 my_core = switch_core(CURRENT_CORE ^ 1); 696 my_core = switch_core(CURRENT_CORE ^ 1);
697 invalidate_icache(); 697 cpucache_invalidate();
698 switch_core(my_core); 698 switch_core(my_core);
699#endif 699#endif
700 700
@@ -742,7 +742,7 @@ int plugin_load(const char* plugin, const void* parameter)
742 lcd_remote_update(); 742 lcd_remote_update();
743#endif 743#endif
744 744
745 invalidate_icache(); 745 cpucache_invalidate();
746 oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL); 746 oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
747 747
748 rc = hdr->entry_point(parameter); 748 rc = hdr->entry_point(parameter);
@@ -854,7 +854,7 @@ void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size,
854 memset(iramcopy, 0, iram_size); 854 memset(iramcopy, 0, iram_size);
855#if NUM_CORES > 1 855#if NUM_CORES > 1
856 /* writeback cleared iedata and iramcopy areas */ 856 /* writeback cleared iedata and iramcopy areas */
857 flush_icache(); 857 cpucache_flush();
858#endif 858#endif
859} 859}
860#endif /* PLUGIN_USE_IRAM */ 860#endif /* PLUGIN_USE_IRAM */
diff --git a/apps/plugin.h b/apps/plugin.h
index 9ebf793d3f..715f2ec512 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -438,9 +438,9 @@ struct plugin_api {
438 void (*trigger_cpu_boost)(void); 438 void (*trigger_cpu_boost)(void);
439 void (*cancel_cpu_boost)(void); 439 void (*cancel_cpu_boost)(void);
440#endif 440#endif
441#ifdef CACHE_FUNCTIONS_AS_CALL 441#if NUM_CORES > 1
442 void (*flush_icache)(void); 442 void (*cpucache_flush)(void);
443 void (*invalidate_icache)(void); 443 void (*cpucache_invalidate)(void);
444#endif 444#endif
445 bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), 445 bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
446 long cycles, int int_prio, 446 long cycles, int int_prio,
@@ -854,20 +854,5 @@ extern const struct plugin_api *rb;
854enum plugin_status plugin_start(const void* parameter) 854enum plugin_status plugin_start(const void* parameter)
855 NO_PROF_ATTR; 855 NO_PROF_ATTR;
856 856
857#undef CACHE_FUNCTION_WRAPPERS
858#ifdef CACHE_FUNCTIONS_AS_CALL
859#define CACHE_FUNCTION_WRAPPERS \
860 void flush_icache(void) \
861 { \
862 rb->flush_icache(); \
863 } \
864 void invalidate_icache(void) \
865 { \
866 rb->invalidate_icache(); \
867 }
868#else
869#define CACHE_FUNCTION_WRAPPERS
870#endif /* CACHE_FUNCTIONS_AS_CALL */
871
872#endif /* __PCTOOL__ */ 857#endif /* __PCTOOL__ */
873#endif 858#endif
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index a69b6accf8..da92f8754a 100644
--- a/apps/plugins/mpegplayer/alloc.c
+++ b/apps/plugins/mpegplayer/alloc.c
@@ -149,7 +149,7 @@ bool mpeg_alloc_init(unsigned char *buf, size_t mallocsize)
149 return false; 149 return false;
150 } 150 }
151 151
152 IF_COP(invalidate_icache()); 152 IF_COP(rb->cpucache_invalidate());
153 return true; 153 return true;
154} 154}
155 155
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 6e8f9350f8..eaf8f246c6 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -296,8 +296,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
296#endif 296#endif
297#endif 297#endif
298 298
299CACHE_FUNCTION_WRAPPERS;
300
301/* One thing we can do here for targets with remotes is having a display 299/* One thing we can do here for targets with remotes is having a display
302 * always on the remote instead of always forcing a popup on the main display */ 300 * always on the remote instead of always forcing a popup on the main display */
303 301
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 8b84686a3b..6d60e64131 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -524,7 +524,7 @@ static void video_thread_msg(struct video_thread_data *td)
524 } 524 }
525 else 525 else
526 { 526 {
527 IF_COP(invalidate_icache()); 527 IF_COP(rb->cpucache_invalidate());
528 vo_lock(); 528 vo_lock();
529 rb->lcd_update(); 529 rb->lcd_update();
530 vo_unlock(); 530 vo_unlock();
@@ -996,7 +996,7 @@ bool video_thread_init(void)
996{ 996{
997 intptr_t rep; 997 intptr_t rep;
998 998
999 IF_COP(flush_icache()); 999 IF_COP(rb->cpucache_flush());
1000 1000
1001 video_str.hdr.q = &video_str_queue; 1001 video_str.hdr.q = &video_str_queue;
1002 rb->queue_init(video_str.hdr.q, false); 1002 rb->queue_init(video_str.hdr.q, false);
@@ -1014,7 +1014,7 @@ bool video_thread_init(void)
1014 1014
1015 /* Wait for thread to initialize */ 1015 /* Wait for thread to initialize */
1016 rep = str_send_msg(&video_str, STREAM_NULL, 0); 1016 rep = str_send_msg(&video_str, STREAM_NULL, 0);
1017 IF_COP(invalidate_icache()); 1017 IF_COP(rb->cpucache_invalidate());
1018 1018
1019 return rep == 0; /* Normally STREAM_NULL should be ignored */ 1019 return rep == 0; /* Normally STREAM_NULL should be ignored */
1020} 1020}
@@ -1026,7 +1026,7 @@ void video_thread_exit(void)
1026 { 1026 {
1027 str_post_msg(&video_str, STREAM_QUIT, 0); 1027 str_post_msg(&video_str, STREAM_QUIT, 0);
1028 rb->thread_wait(video_str.thread); 1028 rb->thread_wait(video_str.thread);
1029 IF_COP(invalidate_icache()); 1029 IF_COP(rb->cpucache_invalidate());
1030 video_str.thread = 0; 1030 video_str.thread = 0;
1031 } 1031 }
1032} 1032}
diff --git a/apps/plugins/rockboy/dynarec.c b/apps/plugins/rockboy/dynarec.c
index 7c466de986..afe6caaf1a 100644
--- a/apps/plugins/rockboy/dynarec.c
+++ b/apps/plugins/rockboy/dynarec.c
@@ -1905,7 +1905,7 @@ void dynamic_recompile (struct dynarec_block *newblock)
1905 PC=oldpc; 1905 PC=oldpc;
1906 setmallocpos(dynapointer); 1906 setmallocpos(dynapointer);
1907 newblock->length=dynapointer-newblock->block; 1907 newblock->length=dynapointer-newblock->block;
1908 invalidate_icache(); 1908 IF_COP(rb->cpucache_invalidate());
1909 snprintf(meow,499,"/dyna_0x%x_code.rb",PC); 1909 snprintf(meow,499,"/dyna_0x%x_code.rb",PC);
1910 fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC); 1910 fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC);
1911 if(fd>=0) 1911 if(fd>=0)
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index ec5c8e9800..3260360882 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -480,9 +480,9 @@ static void init_ci(void)
480 ci.profile_func_exit = rb->profile_func_exit; 480 ci.profile_func_exit = rb->profile_func_exit;
481#endif 481#endif
482 482
483#ifdef CACHE_FUNCTIONS_AS_CALL 483#if NUM_CORES > 1
484 ci.invalidate_icache = invalidate_icache; 484 ci.cpucache_invalidate = rb->cpucache_invalidate;
485 ci.flush_icache = flush_icache; 485 ci.cpucache_flush = rb->cpucache_flush;
486#endif 486#endif
487 487
488#if NUM_CORES > 1 488#if NUM_CORES > 1