summaryrefslogtreecommitdiff
path: root/apps/codecs/codec_crt0.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
commitc537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch)
tree7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/codecs/codec_crt0.c
parentdcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff)
downloadrockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.gz
rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.zip
Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/codec_crt0.c')
-rw-r--r--apps/codecs/codec_crt0.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c
index cf14e460ec..33876272c6 100644
--- a/apps/codecs/codec_crt0.c
+++ b/apps/codecs/codec_crt0.c
@@ -27,39 +27,45 @@ struct codec_api *ci DATA_ATTR;
27extern unsigned char plugin_bss_start[]; 27extern unsigned char plugin_bss_start[];
28extern unsigned char plugin_end_addr[]; 28extern unsigned char plugin_end_addr[];
29 29
30extern enum codec_status codec_main(void); 30extern enum codec_status codec_main(enum codec_entry_call_reason reason);
31 31
32/* stub, the entry point is called via its reference in __header to 32/* stub, the entry point is called via its reference in __header to
33 * avoid warning with certain compilers */ 33 * avoid warning with certain compilers */
34int _start(void) {return 0;} 34int _start(void) {return 0;}
35 35
36enum codec_status codec_start(void) 36enum codec_status codec_start(enum codec_entry_call_reason reason)
37{ 37{
38#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 38#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
39#ifdef USE_IRAM 39 if (reason == CODEC_LOAD)
40 extern char iramcopy[], iramstart[], iramend[], iedata[], iend[];
41 size_t iram_size = iramend - iramstart;
42 size_t ibss_size = iend - iedata;
43 if (iram_size > 0 || ibss_size > 0)
44 { 40 {
45 ci->memcpy(iramstart, iramcopy, iram_size); 41#ifdef USE_IRAM
46 ci->memset(iedata, 0, ibss_size); 42 extern char iramcopy[], iramstart[], iramend[], iedata[], iend[];
47 /* make the icache (if it exists) up to date with the new code */ 43 size_t iram_size = iramend - iramstart;
44 size_t ibss_size = iend - iedata;
45 if (iram_size > 0 || ibss_size > 0)
46 {
47 ci->memcpy(iramstart, iramcopy, iram_size);
48 ci->memset(iedata, 0, ibss_size);
49 /* make the icache (if it exists) up to date with the new code */
50 ci->cpucache_invalidate();
51 /* barrier to prevent reordering iram copy and BSS clearing,
52 * because the BSS segment alias the IRAM copy.
53 */
54 asm volatile ("" ::: "memory");
55 }
56#endif /* PLUGIN_USE_IRAM */
57 ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
58 /* Some parts of bss may be used via a no-cache alias (at least
59 * portalplayer has this). If we don't clear the cache, those aliases
60 * may read garbage */
48 ci->cpucache_invalidate(); 61 ci->cpucache_invalidate();
49 /* barrier to prevent reordering iram copy and BSS clearing,
50 * because the BSS segment alias the IRAM copy.
51 */
52 asm volatile ("" ::: "memory");
53 } 62 }
54#endif /* PLUGIN_USE_IRAM */ 63#endif /* CONFIG_PLATFORM */
55 ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
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
58 * may read garbage */
59 ci->cpucache_invalidate();
60#endif
61 64
62 return codec_main(); 65 /* Note: If for any reason codec_main would not be called with CODEC_LOAD
66 * because the above code failed then it must not be ever be called with
67 * any other value and some strategy to avoid doing so must be conceived */
68 return codec_main(reason);
63} 69}
64 70
65#if defined(CPU_ARM) && (CONFIG_PLATFORM & PLATFORM_NATIVE) 71#if defined(CPU_ARM) && (CONFIG_PLATFORM & PLATFORM_NATIVE)