25#ifdef RT_USING_MEMPOOL
27#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
28static void (*rt_mp_alloc_hook)(
struct rt_mempool *mp,
void *block);
29static void (*rt_mp_free_hook)(
struct rt_mempool *mp,
void *block);
45 rt_mp_alloc_hook = hook;
56 rt_mp_free_hook = hook;
303 rt_set_errno(-RT_ETIMEOUT);
310 thread->
error = RT_EOK;
333 if (thread->
error != RT_EOK)
#define RT_ALIGN(size, align)
#define RT_ALIGN_DOWN(size, align)
rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg)
This function will get or set some options of the timer
rt_err_t rt_timer_start(rt_timer_t timer)
This function will start the timer
rt_tick_t rt_tick_get(void)
This function will return current tick from operating system startup.
#define RT_TIMER_CTRL_SET_TIME
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
This function will disable the local interrupt and then lock the spinlock, will lock the thread sched...
rt_err_t rt_susp_list_resume_all(rt_list_t *susp_list, rt_err_t thread_error)
This function will resume all suspended threads in the IPC object list, including the suspended list ...
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
struct rt_thread * rt_susp_list_dequeue(rt_list_t *susp_list, rt_err_t thread_error)
Dequeue a thread from suspended list and set it to ready. The 2 are taken as an atomic operation,...
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
This function will unlock the spinlock and then restore current cpu interrupt status,...
void rt_object_delete(rt_object_t object)
This function will delete an object and release object memory.
void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name)
This function will initialize an object and add it to object system management.
rt_bool_t rt_object_is_systemobject(rt_object_t object)
This function will judge the object is system object or not.
#define RT_OBJECT_HOOK_CALL(func, argv)
rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
This function will allocate an object from object system.
rt_uint8_t rt_object_get_type(rt_object_t object)
This function will return the type of object without RT_Object_Class_Static flag.
void rt_object_detach(rt_object_t object)
This function will detach a static object from object system, and the memory of static object is not ...
@ RT_Object_Class_MemPool
#define RT_DEBUG_NOT_IN_INTERRUPT
rt_inline void rt_list_init(rt_list_t *l)
initialize a list
rt_weak void rt_free(void *ptr)
This function will release the previously allocated memory block by rt_malloc. The released memory bl...
rt_weak void * rt_malloc(rt_size_t size)
Allocate a block of memory with a minimum of 'size' bytes.
rt_err_t rt_mp_init(struct rt_mempool *mp, const char *name, void *start, rt_size_t size, rt_size_t block_size)
This function will initialize a memory pool object, normally which is used for static object.
void rt_mp_alloc_sethook(void(*hook)(struct rt_mempool *mp, void *block))
void * rt_mp_alloc(rt_mp_t mp, rt_int32_t time)
This function will allocate a block from memory pool.
void rt_mp_free(void *block)
This function will release a memory block.
rt_err_t rt_mp_detach(struct rt_mempool *mp)
This function will detach a memory pool from system object management.
rt_mp_t rt_mp_create(const char *name, rt_size_t block_count, rt_size_t block_size)
This function will create a mempool object and allocate the memory pool from heap.
struct rt_mempool * rt_mp_t
rt_err_t rt_mp_delete(rt_mp_t mp)
This function will delete a memory pool and release the object memory.
void rt_mp_free_sethook(void(*hook)(struct rt_mempool *mp, void *block))
rt_err_t rt_thread_suspend_to_list(rt_thread_t thread, rt_list_t *susp_list, int ipc_flags, int suspend_flag)
This function will suspend the specified thread and change it to suspend state.
rt_thread_t rt_thread_self(void)
This function will return self thread object.
void rt_schedule(void)
This function will perform one scheduling. It will select one thread with the highest priority level ...
#define RTM_EXPORT(symbol)
struct rt_spinlock spinlock
rt_size_t block_total_count
rt_size_t block_free_count
RT_SCHED_THREAD_CTX struct rt_timer thread_timer