summaryrefslogtreecommitdiff
path: root/firmware/export/load_code.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/load_code.h')
-rw-r--r--firmware/export/load_code.h55
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
28extern 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 */
31static inline char *lc_open_from_mem(void* addr, size_t blob_size)
32{
33 (void)blob_size;
34 cpucache_invalidate();
35 return addr;
36}
37static inline void *lc_get_header(void *handle) { return handle; }
38/* no need to do anything */
39static 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 */
45extern void *_lc_open(const char *filename, char *buf, size_t buf_size);
46extern void *_lc_get_header(void *handle);
47extern void _lc_close(void *handle);
48
49extern void *lc_open(const char *filename, char *buf, size_t buf_size);
50/* not possiible on hosted platforms */
51extern void *lc_open_from_mem(void *addr, size_t blob_size);
52extern void *lc_get_header(void *handle);
53extern void lc_close(void *handle);
54extern const char* lc_last_error(void);
55#endif