Browse Source

add memory heap object in module

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2113 bbd45198-f89e-11dd-88c7-29a3b14d5316
dzzxzz@gmail.com 13 years ago
parent
commit
1641c9db4f
3 changed files with 19 additions and 0 deletions
  1. 2 0
      include/rtdef.h
  2. 7 0
      src/module.c
  3. 10 0
      src/rtm.c

+ 2 - 0
include/rtdef.h

@@ -224,9 +224,11 @@ typedef struct rt_object *rt_object_t;                  /* Type for kernel objec
  *  - Event
  *  - Event
  *  - MailBox
  *  - MailBox
  *  - MessageQueue
  *  - MessageQueue
+ *  - MemHeap
  *  - MemPool
  *  - MemPool
  *  - Device
  *  - Device
  *  - Timer
  *  - Timer
+ *  - Module
  *  - Unknown
  *  - Unknown
  *  - Static
  *  - Static
  */
  */

+ 7 - 0
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;
 	module->module_object[RT_Object_Class_MessageQueue].type = RT_Object_Class_MessageQueue;
 #endif
 #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
 #ifdef RT_USING_MEMPOOL
 	/* initialize object container - memory pool */
 	/* initialize object container - memory pool */
 	rt_list_init(&(module->module_object[RT_Object_Class_MemPool].object_list));
 	rt_list_init(&(module->module_object[RT_Object_Class_MemPool].object_list));

+ 10 - 0
src/rtm.c

@@ -110,6 +110,16 @@ RTM_EXPORT(rt_mq_recv);
 RTM_EXPORT(rt_mq_control);  
 RTM_EXPORT(rt_mq_control);  
 #endif
 #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
 #ifdef RT_USING_MEMPOOL
 /*
 /*
  * memory pool interface symbol
  * memory pool interface symbol