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.h | |
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.h')
-rw-r--r-- | apps/codecs.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/codecs.h b/apps/codecs.h index f94c81ab20..1c0b9da6ba 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #include "settings.h" | 51 | #include "settings.h" |
52 | 52 | ||
53 | #include "gcc_extensions.h" | 53 | #include "gcc_extensions.h" |
54 | #include "load_code.h" | ||
54 | 55 | ||
55 | #ifdef CODEC | 56 | #ifdef CODEC |
56 | #if defined(DEBUG) || defined(SIMULATOR) | 57 | #if defined(DEBUG) || defined(SIMULATOR) |
@@ -240,11 +241,7 @@ struct codec_api { | |||
240 | 241 | ||
241 | /* codec header */ | 242 | /* codec header */ |
242 | struct codec_header { | 243 | struct codec_header { |
243 | unsigned long magic; /* RCOD or RENC */ | 244 | struct lc_header lc_hdr; /* must be first */ |
244 | unsigned short target_id; | ||
245 | unsigned short api_version; | ||
246 | unsigned char *load_addr; | ||
247 | unsigned char *end_addr; | ||
248 | enum codec_status(*entry_point)(void); | 245 | enum codec_status(*entry_point)(void); |
249 | struct codec_api **api; | 246 | struct codec_api **api; |
250 | }; | 247 | }; |
@@ -261,27 +258,27 @@ extern unsigned char plugin_end_addr[]; | |||
261 | #define CODEC_HEADER \ | 258 | #define CODEC_HEADER \ |
262 | const struct codec_header __header \ | 259 | const struct codec_header __header \ |
263 | __attribute__ ((section (".header")))= { \ | 260 | __attribute__ ((section (".header")))= { \ |
264 | CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ | 261 | { CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ |
265 | plugin_start_addr, plugin_end_addr, codec_start, &ci }; | 262 | plugin_start_addr, plugin_end_addr }, codec_start, &ci }; |
266 | /* encoders */ | 263 | /* encoders */ |
267 | #define CODEC_ENC_HEADER \ | 264 | #define CODEC_ENC_HEADER \ |
268 | const struct codec_header __header \ | 265 | const struct codec_header __header \ |
269 | __attribute__ ((section (".header")))= { \ | 266 | __attribute__ ((section (".header")))= { \ |
270 | CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ | 267 | { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ |
271 | plugin_start_addr, plugin_end_addr, codec_start, &ci }; | 268 | plugin_start_addr, plugin_end_addr }, codec_start, &ci }; |
272 | 269 | ||
273 | #else /* def SIMULATOR */ | 270 | #else /* def SIMULATOR */ |
274 | /* decoders */ | 271 | /* decoders */ |
275 | #define CODEC_HEADER \ | 272 | #define CODEC_HEADER \ |
276 | const struct codec_header __header \ | 273 | const struct codec_header __header \ |
277 | __attribute__((visibility("default"))) = { \ | 274 | __attribute__((visibility("default"))) = { \ |
278 | CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ | 275 | { CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \ |
279 | NULL, NULL, codec_start, &ci }; | 276 | codec_start, &ci }; |
280 | /* encoders */ | 277 | /* encoders */ |
281 | #define CODEC_ENC_HEADER \ | 278 | #define CODEC_ENC_HEADER \ |
282 | const struct codec_header __header = { \ | 279 | const struct codec_header __header = { \ |
283 | CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ | 280 | { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \ |
284 | NULL, NULL, codec_start, &ci }; | 281 | codec_start, &ci }; |
285 | #endif /* SIMULATOR */ | 282 | #endif /* SIMULATOR */ |
286 | #endif /* CODEC */ | 283 | #endif /* CODEC */ |
287 | 284 | ||