diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 00:29:50 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 00:29:50 +0000 |
commit | 194174a371b16dfc24960d1e33371c0a7ef1c2c2 (patch) | |
tree | b924bf74a96bb7dedcaebb45319569c003d81e8b /firmware/export | |
parent | 97d2a6ec5ca8ace8daed29c8c69aab9595147b3a (diff) | |
download | rockbox-194174a371b16dfc24960d1e33371c0a7ef1c2c2.tar.gz rockbox-194174a371b16dfc24960d1e33371c0a7ef1c2c2.zip |
2nd try: Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.
Apparently sh needs linker symbols prefixed with _ even if they're referenced without from C code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27902 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/load_code.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/firmware/export/load_code.h b/firmware/export/load_code.h new file mode 100644 index 0000000000..f4fa8f9b46 --- /dev/null +++ b/firmware/export/load_code.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include "config.h" | ||
24 | |||
25 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
26 | #include "system.h" | ||
27 | |||
28 | extern void *lc_open(const char *filename, char *buf, size_t buf_size); | ||
29 | /* header is always at the beginning of the blob, and handle actually points | ||
30 | * to the start of the blob */ | ||
31 | static inline char *lc_open_from_mem(void* addr, size_t blob_size) | ||
32 | { | ||
33 | (void)blob_size; | ||
34 | cpucache_invalidate(); | ||
35 | return addr; | ||
36 | } | ||
37 | static inline void *lc_get_header(void *handle) { return handle; } | ||
38 | /* no need to do anything */ | ||
39 | static inline void lc_close(void *handle) { (void)handle; } | ||
40 | |||
41 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) | ||
42 | |||
43 | /* don't call these directly for loading code | ||
44 | * they're to be wrapped by platform specific functions */ | ||
45 | extern void *_lc_open(const char *filename, char *buf, size_t buf_size); | ||
46 | extern void *_lc_get_header(void *handle); | ||
47 | extern void _lc_close(void *handle); | ||
48 | |||
49 | extern void *lc_open(const char *filename, char *buf, size_t buf_size); | ||
50 | /* not possiible on hosted platforms */ | ||
51 | extern void *lc_open_from_mem(void *addr, size_t blob_size); | ||
52 | extern void *lc_get_header(void *handle); | ||
53 | extern void lc_close(void *handle); | ||
54 | extern const char* lc_last_error(void); | ||
55 | #endif | ||