diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2011-04-27 03:08:23 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2011-04-27 03:08:23 +0000 |
| commit | c537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch) | |
| tree | 7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/codecs/codec_crt0.c | |
| parent | dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff) | |
| download | rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.zip rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.gz rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.bz2 rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.xz | |
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.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c index cf14e46..3387627 100644 --- a/apps/codecs/codec_crt0.c +++ b/apps/codecs/codec_crt0.c @@ -27,39 +27,45 @@ struct codec_api *ci DATA_ATTR; extern unsigned char plugin_bss_start[]; extern unsigned char plugin_end_addr[]; -extern enum codec_status codec_main(void); +extern enum codec_status codec_main(enum codec_entry_call_reason reason); /* stub, the entry point is called via its reference in __header to * avoid warning with certain compilers */ int _start(void) {return 0;} -enum codec_status codec_start(void) +enum codec_status codec_start(enum codec_entry_call_reason reason) { #if (CONFIG_PLATFORM & PLATFORM_NATIVE) -#ifdef USE_IRAM - extern char iramcopy[], iramstart[], iramend[], iedata[], iend[]; - size_t iram_size = iramend - iramstart; - size_t ibss_size = iend - iedata; - if (iram_size > 0 || ibss_size > 0) + if (reason == CODEC_LOAD) { - ci->memcpy(iramstart, iramcopy, iram_size); - ci->memset(iedata, 0, ibss_size); - /* make the icache (if it exists) up to date with the new code */ +#ifdef USE_IRAM + extern char iramcopy[], iramstart[], iramend[], iedata[], iend[]; + size_t iram_size = iramend - iramstart; + size_t ibss_size = iend - iedata; + if (iram_size > 0 || ibss_size > 0) + { + ci->memcpy(iramstart, iramcopy, iram_size); + ci->memset(iedata, 0, ibss_size); + /* make the icache (if it exists) up to date with the new code */ + ci->cpucache_invalidate(); + /* barrier to prevent reordering iram copy and BSS clearing, + * because the BSS segment alias the IRAM copy. + */ + asm volatile ("" ::: "memory"); + } +#endif /* PLUGIN_USE_IRAM */ + ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); + /* Some parts of bss may be used via a no-cache alias (at least + * portalplayer has this). If we don't clear the cache, those aliases + * may read garbage */ ci->cpucache_invalidate(); - /* barrier to prevent reordering iram copy and BSS clearing, - * because the BSS segment alias the IRAM copy. - */ - asm volatile ("" ::: "memory"); } -#endif /* PLUGIN_USE_IRAM */ - ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); - /* Some parts of bss may be used via a no-cache alias (at least - * portalplayer has this). If we don't clear the cache, those aliases - * may read garbage */ - ci->cpucache_invalidate(); -#endif +#endif /* CONFIG_PLATFORM */ - return codec_main(); + /* Note: If for any reason codec_main would not be called with CODEC_LOAD + * because the above code failed then it must not be ever be called with + * any other value and some strategy to avoid doing so must be conceived */ + return codec_main(reason); } #if defined(CPU_ARM) && (CONFIG_PLATFORM & PLATFORM_NATIVE) |