diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
commit | 0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch) | |
tree | 70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/codecs | |
parent | cec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff) | |
download | rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip |
Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know
it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/codec_crt0.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c index fdb79092f4..c845f79a40 100644 --- a/apps/codecs/codec_crt0.c +++ b/apps/codecs/codec_crt0.c | |||
@@ -20,15 +20,10 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "codeclib.h" | 23 | #include "codecs.h" |
24 | 24 | ||
25 | struct codec_api *ci DATA_ATTR; | 25 | struct codec_api *ci DATA_ATTR; |
26 | 26 | ||
27 | extern unsigned char iramcopy[]; | ||
28 | extern unsigned char iramstart[]; | ||
29 | extern unsigned char iramend[]; | ||
30 | extern unsigned char iedata[]; | ||
31 | extern unsigned char iend[]; | ||
32 | extern unsigned char plugin_bss_start[]; | 27 | extern unsigned char plugin_bss_start[]; |
33 | extern unsigned char plugin_end_addr[]; | 28 | extern unsigned char plugin_end_addr[]; |
34 | 29 | ||
@@ -42,14 +37,23 @@ enum codec_status codec_start(void) | |||
42 | { | 37 | { |
43 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 38 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
44 | #ifdef USE_IRAM | 39 | #ifdef USE_IRAM |
45 | ci->memcpy(iramstart, iramcopy, iramend - iramstart); | 40 | extern char iramcopy[], iramstart[], iramend[], iedata[], iend[]; |
46 | ci->memset(iedata, 0, iend - iedata); | 41 | size_t iram_size = iramend - iramstart; |
47 | #endif | 42 | size_t ibss_size = iend - iedata; |
43 | if (iram_size > 0 || ibss_size > 0) | ||
44 | { | ||
45 | ci->memcpy(iramstart, iramcopy, iram_size); | ||
46 | ci->memset(iedata, 0, ibss_size); | ||
47 | /* make the icache (if it exists) up to date with the new code */ | ||
48 | 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 | } | ||
54 | #endif /* PLUGIN_USE_IRAM */ | ||
48 | ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); | 55 | ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); |
49 | #endif | 56 | #endif |
50 | /* writeback cleared iedata and bss areas, invalidate icache for | ||
51 | * copied code */ | ||
52 | ci->cpucache_invalidate(); | ||
53 | 57 | ||
54 | return codec_main(); | 58 | return codec_main(); |
55 | } | 59 | } |