Introduce a small api for loading code (codecs,plugins) from disk/memory.
[maemo-rb.git] / firmware / export / load_code.h
blobf4fa8f9b469c50090b87ec22407e3505b9e0899f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 by Thomas Martitz
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include "config.h"
25 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
26 #include "system.h"
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)
33 (void)blob_size;
34 cpucache_invalidate();
35 return addr;
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; }
41 #elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
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);
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