add RT_KERNEL_MALLOC/FREE
This commit is contained in:
parent
608bf2cb3d
commit
4afdf44da2
|
@ -155,6 +155,15 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
|||
#define RT_MM_PAGE_MASK (RT_MM_PAGE_SIZE - 1)
|
||||
#define RT_MM_PAGE_BITS 12
|
||||
|
||||
/* kernel malloc definitions */
|
||||
#ifndef RT_KERNEL_MALLOC
|
||||
#define RT_KERNEL_MALLOC(sz) rt_malloc(sz)
|
||||
#endif
|
||||
|
||||
#ifndef RT_KERNEL_FREE
|
||||
#define RT_KERNEL_FREE(ptr) rt_free(ptr)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup Error
|
||||
*/
|
||||
|
|
|
@ -128,7 +128,7 @@ void rt_thread_idle_excute(void)
|
|||
else
|
||||
#endif
|
||||
/* release thread's stack */
|
||||
rt_free(thread->stack_addr);
|
||||
RT_KERNEL_FREE(thread->stack_addr);
|
||||
/* delete thread object */
|
||||
rt_object_delete((rt_object_t)thread);
|
||||
#endif
|
||||
|
|
|
@ -1314,7 +1314,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
|
|||
|
||||
/* init mailbox */
|
||||
mb->size = size;
|
||||
mb->msg_pool = rt_malloc(mb->size * sizeof(rt_uint32_t));
|
||||
mb->msg_pool = RT_KERNEL_MALLOC(mb->size * sizeof(rt_uint32_t));
|
||||
if (mb->msg_pool == RT_NULL)
|
||||
{
|
||||
/* delete mailbox object */
|
||||
|
@ -1361,7 +1361,7 @@ rt_err_t rt_mb_delete(rt_mailbox_t mb)
|
|||
#endif
|
||||
|
||||
/* free mailbox pool */
|
||||
rt_free(mb->msg_pool);
|
||||
RT_KERNEL_FREE(mb->msg_pool);
|
||||
|
||||
/* delete mailbox object */
|
||||
rt_object_delete(&(mb->parent.parent));
|
||||
|
@ -1827,7 +1827,7 @@ rt_mq_t rt_mq_create(const char *name,
|
|||
mq->max_msgs = max_msgs;
|
||||
|
||||
/* allocate message pool */
|
||||
mq->msg_pool = rt_malloc((mq->msg_size + sizeof(struct rt_mq_message))* mq->max_msgs);
|
||||
mq->msg_pool = RT_KERNEL_MALLOC((mq->msg_size + sizeof(struct rt_mq_message))* mq->max_msgs);
|
||||
if (mq->msg_pool == RT_NULL)
|
||||
{
|
||||
rt_mq_delete(mq);
|
||||
|
@ -1881,7 +1881,7 @@ rt_err_t rt_mq_delete(rt_mq_t mq)
|
|||
#endif
|
||||
|
||||
/* free message queue pool */
|
||||
rt_free(mq->msg_pool);
|
||||
RT_KERNEL_FREE(mq->msg_pool);
|
||||
|
||||
/* delete message queue object */
|
||||
rt_object_delete(&(mq->parent.parent));
|
||||
|
|
|
@ -281,7 +281,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
|
|||
information = &rt_object_container[type];
|
||||
#endif
|
||||
|
||||
object = (struct rt_object *)rt_malloc(information->object_size);
|
||||
object = (struct rt_object *)RT_KERNEL_MALLOC(information->object_size);
|
||||
if (object == RT_NULL)
|
||||
{
|
||||
/* no memory can be allocated */
|
||||
|
@ -353,7 +353,7 @@ void rt_object_delete(rt_object_t object)
|
|||
#endif
|
||||
|
||||
/* free the memory of object */
|
||||
rt_free(object);
|
||||
RT_KERNEL_FREE(object);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ rt_thread_t rt_thread_create(const char *name,
|
|||
if (thread == RT_NULL)
|
||||
return RT_NULL;
|
||||
|
||||
stack_start = (void *)rt_malloc(stack_size);
|
||||
stack_start = (void *)RT_KERNEL_MALLOC(stack_size);
|
||||
if (stack_start == RT_NULL)
|
||||
{
|
||||
/* allocate stack failure */
|
||||
|
|
Loading…
Reference in New Issue