Change lc_open_from_mem() return type to void*
[maemo-rb.git] / firmware / export / load_code.h
blob6f5e5d084241511c6107332db7b4119123ff2cfc
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 void *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 #ifdef WIN32
46 /* windows' LoadLibrary can only handle ucs2, no utf-8 */
47 #define _lc_open_char wchar_t
48 #else
49 #define _lc_open_char char
50 #endif
51 extern void *_lc_open(const _lc_open_char *filename, char *buf, size_t buf_size);
52 extern void *_lc_get_header(void *handle);
53 extern void _lc_close(void *handle);
55 extern void *lc_open(const char *filename, char *buf, size_t buf_size);
56 /* not possiible on hosted platforms */
57 extern void *lc_open_from_mem(void *addr, size_t blob_size);
58 extern void *lc_get_header(void *handle);
59 extern void lc_close(void *handle);
60 extern const char* lc_last_error(void);
61 #endif