Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
465 theseven 1
#include "syscallwrappers.h"
2
 
3
 
468 theseven 4
#define EMCORE_LIB_HEADER(lib_identifier, lib_version, lib_min_version, init_func, shutdown_func, \
5
                          api_pointer)                                                            \
465 theseven 6
    struct emcore_syscall_table* __emcore_syscall;                                                \
7
    int __emcore_lib_init()                                                                       \
8
    {                                                                                             \
9
        asm volatile("swi\t2\n\tldr\tr1, =__emcore_syscall\n\tstr\tr0, [r1]\n\t"                  \
10
                 ::: "r0", "r1", "r2", "r3", "r12", "lr", "cc", "memory");                        \
466 theseven 11
        if (__emcore_syscall->table_version < EMCORE_API_VERSION                                  \
12
         || __emcore_syscall->table_minversion > EMCORE_API_VERSION)                              \
465 theseven 13
             return 0x80000000;                                                                   \
14
    }                                                                                             \
466 theseven 15
    struct emcorelib_header __emcore_lib_header __attribute__((section(".emcoreentrypoint"))) =   \
465 theseven 16
    {                                                                                             \
17
        .headerversion = EMCORELIB_HEADER_VERSION,                                                \
466 theseven 18
        .identifier = lib_identifier,                                                             \
19
        .version = lib_version,                                                                   \
468 theseven 20
        .minversion = lib_min_version,                                                            \
21
        .setupfunc = __emcore_lib_init,                                                           \
22
        .initfunc = init_func,                                                                    \
466 theseven 23
        .shutdownfunc = shutdown_func,                                                            \
24
        .api = &api_pointer                                                                       \
465 theseven 25
    };
489 theseven 26
 
27
 
28
extern struct emcore_syscall_table* __emcore_syscall;