From 446799244a2b796dbcd83bf8e557aff4ebaadc7d Mon Sep 17 00:00:00 2001 From: qiuyiuestc Date: Sun, 19 Sep 2010 23:43:48 +0000 Subject: module clean up git-svn-id: https://rt-thread.googlecode.com/svn/trunk@915 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/module.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/module.c') diff --git a/src/module.c b/src/module.c index c76aafcbd3..44a0081d54 100644 --- a/src/module.c +++ b/src/module.c @@ -12,9 +12,9 @@ * 2010-01-09 Bernard first version * 2010-04-09 yi.qiu implement based on first version */ - -#include + #include +#include #include "string.h" #include "kservice.h" @@ -35,19 +35,33 @@ #define IS_AX(s) ((s.sh_flags & SHF_ALLOC) && (s.sh_flags & SHF_EXECINSTR)) #define IS_AW(s) ((s.sh_flags & SHF_ALLOC) && (s.sh_flags & SHF_WRITE)) -struct rt_module* rt_current_module; +static struct rt_module* rt_current_module; /** * This function will return self module object * - * @return the self thread object + * @return the self module object * */ rt_module_t rt_module_self (void) { + /* return current module */ return rt_current_module; } +/** + * This function will set current module object + * + * @return RT_EOK + */ +rt_err_t rt_module_set (rt_module_t module) +{ + /* set current module */ + rt_current_module = module; + + return RT_EOK; +} + static int rt_module_arm_relocate(struct rt_module* module, Elf32_Rel *rel, Elf32_Addr sym_val) { Elf32_Addr *where, tmp; @@ -289,6 +303,10 @@ rt_err_t rt_module_unload(rt_module_t module) struct rt_object* object; struct rt_list_node *list, *node; +#ifdef RT_MODULE_DEBUG + rt_kprintf("rt_module_unload %s\n", module->parent.name); +#endif + /* check parameter */ RT_ASSERT(module != RT_NULL); -- cgit v1.3.1