From 1641c9db4fd628e50e57febaf59e8e0cefb58a61 Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Mon, 7 May 2012 06:23:30 +0000 Subject: [PATCH] add memory heap object in module git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2113 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- include/rtdef.h | 2 ++ src/module.c | 7 +++++++ src/rtm.c | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/include/rtdef.h b/include/rtdef.h index dbc0db3b17..67fda14610 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -224,9 +224,11 @@ typedef struct rt_object *rt_object_t; /* Type for kernel objec * - Event * - MailBox * - MessageQueue + * - MemHeap * - MemPool * - Device * - Timer + * - Module * - Unknown * - Static */ diff --git a/src/module.c b/src/module.c index 19771137a5..71929b4462 100644 --- a/src/module.c +++ b/src/module.c @@ -293,6 +293,13 @@ static void rt_module_init_object_container(struct rt_module *module) module->module_object[RT_Object_Class_MessageQueue].type = RT_Object_Class_MessageQueue; #endif +#ifdef RT_USING_MEMHEAP + /* initialize object container - memory heap */ + rt_list_init(&(module->module_object[RT_Object_Class_MemHeap].object_list)); + module->module_object[RT_Object_Class_MemHeap].object_size = sizeof(struct rt_memheap); + module->module_object[RT_Object_Class_MemHeap].type = RT_Object_Class_MemHeap; +#endif + #ifdef RT_USING_MEMPOOL /* initialize object container - memory pool */ rt_list_init(&(module->module_object[RT_Object_Class_MemPool].object_list)); diff --git a/src/rtm.c b/src/rtm.c index d94c0e30ec..38d6df3d30 100644 --- a/src/rtm.c +++ b/src/rtm.c @@ -110,6 +110,16 @@ RTM_EXPORT(rt_mq_recv); RTM_EXPORT(rt_mq_control); #endif +#ifdef RT_USING_MEMHEAP +/* + * memory heap interface symbol + */ +RTM_EXPORT(rt_memheap_init); +RTM_EXPORT(rt_memheap_detach); +RTM_EXPORT(rt_memheap_alloc); +RTM_EXPORT(rt_memheap_free); +#endif + #ifdef RT_USING_MEMPOOL /* * memory pool interface symbol -- GitLab