| 19 | #include <rtdbg.h> |
| 20 | |
| 21 | void rt_module_init_object_container(struct rt_module *module) |
| 22 | { |
| 23 | RT_ASSERT(module != RT_NULL); |
| 24 | |
| 25 | /* initialize object container - thread */ |
| 26 | rt_list_init(&(module->module_object[RT_Object_Class_Thread].object_list)); |
| 27 | module->module_object[RT_Object_Class_Thread].object_size = sizeof(struct rt_thread); |
| 28 | module->module_object[RT_Object_Class_Thread].type = RT_Object_Class_Thread; |
| 29 | |
| 30 | #ifdef RT_USING_SEMAPHORE |
| 31 | /* initialize object container - semaphore */ |
| 32 | rt_list_init(&(module->module_object[RT_Object_Class_Semaphore].object_list)); |
| 33 | module->module_object[RT_Object_Class_Semaphore].object_size = sizeof(struct rt_semaphore); |
| 34 | module->module_object[RT_Object_Class_Semaphore].type = RT_Object_Class_Semaphore; |
| 35 | #endif |
| 36 | |
| 37 | #ifdef RT_USING_MUTEX |
| 38 | /* initialize object container - mutex */ |
| 39 | rt_list_init(&(module->module_object[RT_Object_Class_Mutex].object_list)); |
| 40 | module->module_object[RT_Object_Class_Mutex].object_size = sizeof(struct rt_mutex); |
| 41 | module->module_object[RT_Object_Class_Mutex].type = RT_Object_Class_Mutex; |
| 42 | #endif |
| 43 | |
| 44 | #ifdef RT_USING_EVENT |
| 45 | /* initialize object container - event */ |
| 46 | rt_list_init(&(module->module_object[RT_Object_Class_Event].object_list)); |
| 47 | module->module_object[RT_Object_Class_Event].object_size = sizeof(struct rt_event); |
| 48 | module->module_object[RT_Object_Class_Event].type = RT_Object_Class_Event; |
| 49 | #endif |
| 50 | |
| 51 | #ifdef RT_USING_MAILBOX |
| 52 | /* initialize object container - mailbox */ |
| 53 | rt_list_init(&(module->module_object[RT_Object_Class_MailBox].object_list)); |
| 54 | module->module_object[RT_Object_Class_MailBox].object_size = sizeof(struct rt_mailbox); |
| 55 | module->module_object[RT_Object_Class_MailBox].type = RT_Object_Class_MailBox; |
| 56 | #endif |
| 57 | |
| 58 | #ifdef RT_USING_MESSAGEQUEUE |
| 59 | /* initialize object container - message queue */ |
| 60 | rt_list_init(&(module->module_object[RT_Object_Class_MessageQueue].object_list)); |
| 61 | module->module_object[RT_Object_Class_MessageQueue].object_size = sizeof(struct rt_messagequeue); |
| 62 | module->module_object[RT_Object_Class_MessageQueue].type = RT_Object_Class_MessageQueue; |
| 63 | #endif |
| 64 | |
| 65 | #ifdef RT_USING_MEMHEAP |
| 66 | /* initialize object container - memory heap */ |
| 67 | rt_list_init(&(module->module_object[RT_Object_Class_MemHeap].object_list)); |
| 68 | module->module_object[RT_Object_Class_MemHeap].object_size = sizeof(struct rt_memheap); |
| 69 | module->module_object[RT_Object_Class_MemHeap].type = RT_Object_Class_MemHeap; |
| 70 | #endif |
| 71 | |
| 72 | #ifdef RT_USING_MEMPOOL |
| 73 | /* initialize object container - memory pool */ |
| 74 | rt_list_init(&(module->module_object[RT_Object_Class_MemPool].object_list)); |
| 75 | module->module_object[RT_Object_Class_MemPool].object_size = sizeof(struct rt_mempool); |
| 76 | module->module_object[RT_Object_Class_MemPool].type = RT_Object_Class_MemPool; |
| 77 | #endif |
| 78 |
no test coverage detected