freemyipod r468 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r467‎ | r468 | r469 >
Date:00:57, 22 January 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Allow libraries to not have an initialization function
Modified paths:
  • /emcore/trunk/export/emcorelib.h (modified) (history)
  • /emcore/trunk/library.c (modified) (history)
  • /emcore/trunk/library.h (modified) (history)

Diff [purge]

Index: emcore/trunk/export/emcorelib.h
@@ -1,7 +1,8 @@
22 #include "syscallwrappers.h"
33
44
5 -#define EMCORE_LIB_HEADER(lib_identifier, lib_version, init_func, shutdown_func, api_pointer) \
 5+#define EMCORE_LIB_HEADER(lib_identifier, lib_version, lib_min_version, init_func, shutdown_func, \
 6+ api_pointer) \
67 struct emcore_syscall_table* __emcore_syscall; \
78 int __emcore_lib_init() \
89 { \
@@ -10,7 +11,6 @@
1112 if (__emcore_syscall->table_version < EMCORE_API_VERSION \
1213 || __emcore_syscall->table_minversion > EMCORE_API_VERSION) \
1314 return 0x80000000; \
14 - if (init_func) return init_func(); \
1515 } \
1616 struct emcorelib_header __emcore_lib_header __attribute__((section(".emcoreentrypoint"))) = \
1717 { \
@@ -17,7 +17,9 @@
1818 .headerversion = EMCORELIB_HEADER_VERSION, \
1919 .identifier = lib_identifier, \
2020 .version = lib_version, \
21 - .initfunc = __emcore_lib_init, \
 21+ .minversion = lib_min_version, \
 22+ .setupfunc = __emcore_lib_init, \
 23+ .initfunc = init_func, \
2224 .shutdownfunc = shutdown_func, \
2325 .api = &api_pointer \
2426 };
Index: emcore/trunk/library.c
@@ -52,7 +52,8 @@
5353 mutex_unlock(&library_mutex);
5454 return NULL;
5555 }
56 - if (header->initfunc && header->initfunc() < 0)
 56+ if ((header->setupfunc && header->setupfunc() < 0)
 57+ || (header->initfunc && header->initfunc() < 0))
5758 {
5859 mutex_unlock(&library_mutex);
5960 return NULL;
Index: emcore/trunk/library.h
@@ -40,6 +40,7 @@
4141 uint32_t identifier;
4242 uint32_t version;
4343 uint32_t minversion;
 44+ int (*setupfunc)();
4445 int (*initfunc)();
4546 int (*shutdownfunc)();
4647 void* api;