Fix advanced EQ menu
[maemo-rb.git] / firmware / export / load_code.h
blobcca577044edae3053e20c4782b169cdebbc181f5
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 #ifndef __LOAD_CODE_H__
24 #define __LOAD_CODE_H__
26 #include "config.h"
28 extern void *lc_open(const char *filename, unsigned char *buf, size_t buf_size);
30 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
31 #include "system.h"
33 /* header is always at the beginning of the blob, and handle actually points
34 * to the start of the blob (the header is there) */
35 static inline void *lc_open_from_mem(void* addr, size_t blob_size)
37 (void)blob_size;
38 /* commit dcache and discard icache */
39 commit_discard_idcache();
40 return addr;
42 static inline void *lc_get_header(void *handle) { return handle; }
43 /* no need to do anything */
44 static inline void lc_close(void *handle) { (void)handle; }
46 #elif (CONFIG_PLATFORM & PLATFORM_HOSTED)
48 extern void *lc_open_from_mem(void* addr, size_t blob_size);
49 extern void *lc_get_header(void *handle);
50 extern void lc_close(void *handle);
52 #endif
54 /* this struct needs to be the first part of other headers
55 * (lc_open() casts the other header to this one to load to the correct
56 * address)
58 struct lc_header {
59 unsigned long magic;
60 unsigned short target_id;
61 unsigned short api_version;
62 unsigned char *load_addr;
63 unsigned char *end_addr;
66 #endif /* __LOAD_CODE_H__ */