summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-12-17 07:27:24 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-12-17 07:27:24 +0000
commit6a67707b5ec3b2c649c401550bb7fdef2b7c8d07 (patch)
treebfe31942a4abbaac09ad0f4226effdcef8bf097e /apps
parent43d7a75369286dc3b39b858df34f66b0b45de34e (diff)
downloadrockbox-6a67707b5ec3b2c649c401550bb7fdef2b7c8d07.tar.gz
rockbox-6a67707b5ec3b2c649c401550bb7fdef2b7c8d07.zip
Commit to certain names for cache coherency APIs and discard the aliases.
Wouldn't surprise me a bit to get some non-green. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codec_thread.c4
-rw-r--r--apps/codecs.c6
-rw-r--r--apps/codecs.h7
-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/plugin.c6
-rw-r--r--apps/plugin.h9
-rw-r--r--apps/plugins/fft/fft.c4
-rw-r--r--apps/plugins/mpegplayer/alloc.c2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c8
-rw-r--r--apps/plugins/plugin_crt0.c8
12 files changed, 34 insertions, 32 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c
index 0498858be2..39db741054 100644
--- a/apps/codec_thread.c
+++ b/apps/codec_thread.c
@@ -550,9 +550,9 @@ static void do_callback(void (* callback)(void))
550 550
551 if (callback) 551 if (callback)
552 { 552 {
553 cpucache_commit_discard(); 553 commit_discard_idcache();
554 callback(); 554 callback();
555 cpucache_commit(); 555 commit_dcache();
556 } 556 }
557} 557}
558 558
diff --git a/apps/codecs.c b/apps/codecs.c
index 93542e35ce..fafe4ac7a3 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -116,8 +116,8 @@ struct codec_api ci = {
116 semaphore_release, 116 semaphore_release,
117#endif 117#endif
118 118
119 cpucache_flush, 119 commit_dcache,
120 cpucache_invalidate, 120 commit_discard_dcache,
121 121
122 /* strings and memory */ 122 /* strings and memory */
123 strcpy, 123 strcpy,
@@ -165,6 +165,8 @@ struct codec_api ci = {
165 165
166 /* new stuff at the end, sort into place next time 166 /* new stuff at the end, sort into place next time
167 the API gets incompatible */ 167 the API gets incompatible */
168
169 commit_discard_idcache,
168}; 170};
169 171
170void codec_get_full_path(char *path, const char *codec_root_fn) 172void codec_get_full_path(char *path, const char *codec_root_fn)
diff --git a/apps/codecs.h b/apps/codecs.h
index f1e2a51eac..1334953b82 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -75,7 +75,7 @@
75#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ 75#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
76 76
77/* increase this every time the api struct changes */ 77/* increase this every time the api struct changes */
78#define CODEC_API_VERSION 43 78#define CODEC_API_VERSION 44
79 79
80/* update this to latest version if a change to the api struct breaks 80/* update this to latest version if a change to the api struct breaks
81 backwards compatibility (and please take the opportunity to sort in any 81 backwards compatibility (and please take the opportunity to sort in any
@@ -169,8 +169,8 @@ struct codec_api {
169 void (*semaphore_release)(struct semaphore *s); 169 void (*semaphore_release)(struct semaphore *s);
170#endif /* NUM_CORES */ 170#endif /* NUM_CORES */
171 171
172 void (*cpucache_flush)(void); 172 void (*commit_dcache)(void);
173 void (*cpucache_invalidate)(void); 173 void (*commit_discard_dcache)(void);
174 174
175 /* strings and memory */ 175 /* strings and memory */
176 char* (*strcpy)(char *dst, const char *src); 176 char* (*strcpy)(char *dst, const char *src);
@@ -223,6 +223,7 @@ struct codec_api {
223 223
224 /* new stuff at the end, sort into place next time 224 /* new stuff at the end, sort into place next time
225 the API gets incompatible */ 225 the API gets incompatible */
226 void (*commit_discard_idcache)(void);
226}; 227};
227 228
228/* codec header */ 229/* codec header */
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c
index 50a2d8b66a..e3c3321e54 100644
--- a/apps/codecs/codec_crt0.c
+++ b/apps/codecs/codec_crt0.c
@@ -45,7 +45,7 @@ enum codec_status codec_start(enum codec_entry_call_reason reason)
45 ci->memcpy(iramstart, iramcopy, iram_size); 45 ci->memcpy(iramstart, iramcopy, iram_size);
46 ci->memset(iedata, 0, ibss_size); 46 ci->memset(iedata, 0, ibss_size);
47 /* make the icache (if it exists) up to date with the new code */ 47 /* make the icache (if it exists) up to date with the new code */
48 ci->cpucache_invalidate(); 48 ci->commit_discard_idcache();
49 /* barrier to prevent reordering iram copy and BSS clearing, 49 /* barrier to prevent reordering iram copy and BSS clearing,
50 * because the BSS segment alias the IRAM copy. 50 * because the BSS segment alias the IRAM copy.
51 */ 51 */
@@ -56,7 +56,7 @@ enum codec_status codec_start(enum codec_entry_call_reason reason)
56 /* Some parts of bss may be used via a no-cache alias (at least 56 /* Some parts of bss may be used via a no-cache alias (at least
57 * portalplayer has this). If we don't clear the cache, those aliases 57 * portalplayer has this). If we don't clear the cache, those aliases
58 * may read garbage */ 58 * may read garbage */
59 ci->cpucache_invalidate(); 59 ci->commit_dcache();
60 } 60 }
61#endif /* CONFIG_PLATFORM */ 61#endif /* CONFIG_PLATFORM */
62 62
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index ac81f06cab..f9bf7e600f 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -274,7 +274,7 @@ static void mad_synth_thread_quit(void)
274 die = 1; 274 die = 1;
275 ci->semaphore_release(&synth_pending_sem); 275 ci->semaphore_release(&synth_pending_sem);
276 ci->thread_wait(mad_synth_thread_id); 276 ci->thread_wait(mad_synth_thread_id);
277 ci->cpucache_invalidate(); 277 ci->commit_discard_dcache();
278} 278}
279#else 279#else
280static inline void mad_synth_thread_ready(void) 280static inline void mad_synth_thread_ready(void)
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 94ac9ffadc..809562e2a0 100644
--- a/apps/codecs/spc.c
+++ b/apps/codecs/spc.c
@@ -295,7 +295,7 @@ static bool emu_thread_process_msg(struct sample_queue_chunk *chunk)
295 if (id == SPC_EMU_LOAD) 295 if (id == SPC_EMU_LOAD)
296 { 296 {
297 struct spc_load *ld = (struct spc_load *)chunk->data; 297 struct spc_load *ld = (struct spc_load *)chunk->data;
298 ci->cpucache_invalidate(); 298 ci->commit_discard_dcache();
299 SPC_Init(&spc_emu); 299 SPC_Init(&spc_emu);
300 sample_queue.retval = SPC_load_spc(&spc_emu, ld->buf, ld->size); 300 sample_queue.retval = SPC_load_spc(&spc_emu, ld->buf, ld->size);
301 301
@@ -368,7 +368,7 @@ static bool spc_emu_start(void)
368static inline int load_spc_buffer(uint8_t *buf, size_t size) 368static inline int load_spc_buffer(uint8_t *buf, size_t size)
369{ 369{
370 struct spc_load ld = { buf, size }; 370 struct spc_load ld = { buf, size };
371 ci->cpucache_flush(); 371 ci->commit_dcache();
372 return emu_thread_send_msg(SPC_EMU_LOAD, (intptr_t)&ld); 372 return emu_thread_send_msg(SPC_EMU_LOAD, (intptr_t)&ld);
373} 373}
374 374
@@ -378,7 +378,7 @@ static inline void spc_emu_quit(void)
378 emu_thread_send_msg(SPC_EMU_QUIT, 0); 378 emu_thread_send_msg(SPC_EMU_QUIT, 0);
379 /* Wait for emu thread to be killed */ 379 /* Wait for emu thread to be killed */
380 ci->thread_wait(emu_thread_id); 380 ci->thread_wait(emu_thread_id);
381 ci->cpucache_invalidate(); 381 ci->commit_discard_dcache();
382 } 382 }
383} 383}
384 384
diff --git a/apps/plugin.c b/apps/plugin.c
index f5aa589072..6dd84af775 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -428,8 +428,8 @@ static const struct plugin_api rockbox_api = {
428 cancel_cpu_boost, 428 cancel_cpu_boost,
429#endif 429#endif
430 430
431 cpucache_flush, 431 commit_dcache,
432 cpucache_invalidate, 432 commit_discard_dcache,
433 433
434 lc_open, 434 lc_open,
435 lc_open_from_mem, 435 lc_open_from_mem,
@@ -794,6 +794,8 @@ static const struct plugin_api rockbox_api = {
794 794
795 /* new stuff at the end, sort into place next time 795 /* new stuff at the end, sort into place next time
796 the API gets incompatible */ 796 the API gets incompatible */
797
798 commit_discard_idcache,
797}; 799};
798 800
799int plugin_load(const char* plugin, const void* parameter) 801int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index e2b7fe7e11..4a62697724 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -148,7 +148,7 @@ void* plugin_get_buffer(size_t *buffer_size);
148#define PLUGIN_MAGIC 0x526F634B /* RocK */ 148#define PLUGIN_MAGIC 0x526F634B /* RocK */
149 149
150/* increase this every time the api struct changes */ 150/* increase this every time the api struct changes */
151#define PLUGIN_API_VERSION 214 151#define PLUGIN_API_VERSION 215
152 152
153/* update this to latest version if a change to the api struct breaks 153/* update this to latest version if a change to the api struct breaks
154 backwards compatibility (and please take the opportunity to sort in any 154 backwards compatibility (and please take the opportunity to sort in any
@@ -513,8 +513,8 @@ struct plugin_api {
513 void (*cancel_cpu_boost)(void); 513 void (*cancel_cpu_boost)(void);
514#endif 514#endif
515 515
516 void (*cpucache_flush)(void); 516 void (*commit_dcache)(void);
517 void (*cpucache_invalidate)(void); 517 void (*commit_discard_dcache)(void);
518 518
519 /* load code api for overlay */ 519 /* load code api for overlay */
520 void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size); 520 void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size);
@@ -948,7 +948,8 @@ struct plugin_api {
948 948
949 /* new stuff at the end, sort into place next time 949 /* new stuff at the end, sort into place next time
950 the API gets incompatible */ 950 the API gets incompatible */
951 951
952 void (*commit_discard_idcache)(void);
952}; 953};
953 954
954/* plugin header */ 955/* plugin header */
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index 11bdfc8e74..89205503e7 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -1249,7 +1249,7 @@ static void fft_thread_entry(void)
1249 } 1249 }
1250 1250
1251 /* write back output for other processor and invalidate for next frame read */ 1251 /* write back output for other processor and invalidate for next frame read */
1252 rb->cpucache_invalidate(); 1252 rb->commit_discard_dcache();
1253 1253
1254 int new_tail = output_tail ^ 1; 1254 int new_tail = output_tail ^ 1;
1255 1255
@@ -1311,7 +1311,7 @@ static void fft_close_fft(void)
1311 /* Handle our FFT thread. */ 1311 /* Handle our FFT thread. */
1312 fft_thread_run = false; 1312 fft_thread_run = false;
1313 rb->thread_wait(fft_thread); 1313 rb->thread_wait(fft_thread);
1314 rb->cpucache_invalidate(); 1314 rb->commit_discard_dcache();
1315} 1315}
1316#else /* NUM_CORES == 1 */ 1316#else /* NUM_CORES == 1 */
1317/* everything serialize on single-core and FFT gets to use IRAM main stack if 1317/* everything serialize on single-core and FFT gets to use IRAM main stack if
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index c2165b2ea9..eb58c67f44 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(rb->cpucache_invalidate()); 152 IF_COP(rb->commit_discard_dcache());
153 return true; 153 return true;
154} 154}
155 155
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 5119712396..392cc6179f 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -550,7 +550,7 @@ static void video_thread_msg(struct video_thread_data *td)
550 } 550 }
551 else 551 else
552 { 552 {
553 IF_COP(rb->cpucache_invalidate()); 553 IF_COP(rb->commit_discard_dcache());
554 vo_lock(); 554 vo_lock();
555 rb->lcd_update(); 555 rb->lcd_update();
556 vo_unlock(); 556 vo_unlock();
@@ -1007,7 +1007,7 @@ bool video_thread_init(void)
1007{ 1007{
1008 intptr_t rep; 1008 intptr_t rep;
1009 1009
1010 IF_COP(rb->cpucache_flush()); 1010 IF_COP(rb->commit_dcache());
1011 1011
1012 video_str.hdr.q = &video_str_queue; 1012 video_str.hdr.q = &video_str_queue;
1013 rb->queue_init(video_str.hdr.q, false); 1013 rb->queue_init(video_str.hdr.q, false);
@@ -1025,7 +1025,7 @@ bool video_thread_init(void)
1025 1025
1026 /* Wait for thread to initialize */ 1026 /* Wait for thread to initialize */
1027 rep = str_send_msg(&video_str, STREAM_NULL, 0); 1027 rep = str_send_msg(&video_str, STREAM_NULL, 0);
1028 IF_COP(rb->cpucache_invalidate()); 1028 IF_COP(rb->commit_discard_dcache());
1029 1029
1030 return rep == 0; /* Normally STREAM_NULL should be ignored */ 1030 return rep == 0; /* Normally STREAM_NULL should be ignored */
1031} 1031}
@@ -1037,7 +1037,7 @@ void video_thread_exit(void)
1037 { 1037 {
1038 str_post_msg(&video_str, STREAM_QUIT, 0); 1038 str_post_msg(&video_str, STREAM_QUIT, 0);
1039 rb->thread_wait(video_str.thread); 1039 rb->thread_wait(video_str.thread);
1040 IF_COP(rb->cpucache_invalidate()); 1040 IF_COP(rb->commit_discard_dcache());
1041 video_str.thread = 0; 1041 video_str.thread = 0;
1042 } 1042 }
1043} 1043}
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c
index 917ccb11a9..680bb0723d 100644
--- a/apps/plugins/plugin_crt0.c
+++ b/apps/plugins/plugin_crt0.c
@@ -76,10 +76,8 @@ enum plugin_status plugin__start(const void *param)
76 rb->audio_stop(); 76 rb->audio_stop();
77 rb->memcpy(iramstart, iramcopy, iram_size); 77 rb->memcpy(iramstart, iramcopy, iram_size);
78 rb->memset(iedata, 0, ibss_size); 78 rb->memset(iedata, 0, ibss_size);
79#ifdef HAVE_CPUCACHE_INVALIDATE
80 /* make the icache (if it exists) up to date with the new code */ 79 /* make the icache (if it exists) up to date with the new code */
81 rb->cpucache_invalidate(); 80 rb->commit_discard_idcache();
82#endif /* HAVE_CPUCACHE_INVALIDATE */
83 81
84 /* barrier to prevent reordering iram copy and BSS clearing, 82 /* barrier to prevent reordering iram copy and BSS clearing,
85 * because the BSS segment alias the IRAM copy. 83 * because the BSS segment alias the IRAM copy.
@@ -91,12 +89,10 @@ enum plugin_status plugin__start(const void *param)
91 /* zero out the bss section */ 89 /* zero out the bss section */
92 rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); 90 rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
93 91
94#ifdef HAVE_CPUCACHE_INVALIDATE
95 /* Some parts of bss may be used via a no-cache alias (at least 92 /* Some parts of bss may be used via a no-cache alias (at least
96 * portalplayer has this). If we don't clear the cache, those aliases 93 * portalplayer has this). If we don't clear the cache, those aliases
97 * may read garbage */ 94 * may read garbage */
98 rb->cpucache_invalidate(); 95 rb->commit_dcache();
99#endif /* HAVE_CPUCACHE_INVALIDATE */
100#endif 96#endif
101 97
102 /* we come back here if exit() was called or the plugin returned normally */ 98 /* we come back here if exit() was called or the plugin returned normally */