28#ifndef __RT_THREAD_H__
29#define __RT_THREAD_H__
115 void (*timeout)(
void *parameter),
122 void (*timeout)(
void *parameter),
150 void (*entry)(
void *parameter),
159 void (*entry)(
void *parameter),
180void rt_thread_wakeup_set(
struct rt_thread *thread, rt_wakeup_func_t func,
void* user_data);
183#ifdef RT_USING_SIGNALS
206#if defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK)
221#ifdef RT_USING_OVERFLOW_CHECK
222void rt_scheduler_stack_check(
struct rt_thread *thread);
224#define RT_SCHEDULER_STACK_CHECK(thr) rt_scheduler_stack_check(thr)
228#define RT_SCHEDULER_STACK_CHECK(thr)
243void rt_secondary_cpu_entry(
void);
253#ifdef RT_USING_SIGNALS
254void rt_signal_mask(
int signo);
255void rt_signal_unmask(
int signo);
256rt_sighandler_t rt_signal_install(
int signo, rt_sighandler_t handler);
257int rt_signal_wait(
const rt_sigset_t *set, rt_siginfo_t *si,
rt_int32_t timeout);
258int rt_system_signal_init(
void);
270#ifdef RT_USING_MEMPOOL
313#if defined(RT_USING_SLAB) && defined(RT_USING_SLAB_AS_HEAP)
315void rt_page_free(
void *addr,
rt_size_t npages);
333#ifdef RT_USING_SMALL_MEM
346#ifdef RT_USING_MEMHEAP
350rt_err_t rt_memheap_init(
struct rt_memheap *memheap,
354rt_err_t rt_memheap_detach(
struct rt_memheap *heap);
355void *rt_memheap_alloc(
struct rt_memheap *heap,
rt_size_t size);
356void *rt_memheap_realloc(
struct rt_memheap *heap,
void *ptr,
rt_size_t newsize);
357void rt_memheap_free(
void *ptr);
358void rt_memheap_info(
struct rt_memheap *heap,
364#ifdef RT_USING_MEMHEAP_AS_HEAP
368void *_memheap_alloc(
struct rt_memheap *heap,
rt_size_t size);
369void _memheap_free(
void *rmem);
370void *_memheap_realloc(
struct rt_memheap *heap,
void *rmem,
rt_size_t newsize);
377rt_slab_t rt_slab_init(
const char *name,
void *begin_addr,
rt_size_t size);
378rt_err_t rt_slab_detach(rt_slab_t m);
379void *rt_slab_page_alloc(rt_slab_t m,
rt_size_t npages);
380void rt_slab_page_free(rt_slab_t m,
void *addr,
rt_size_t npages);
381void *rt_slab_alloc(rt_slab_t m,
rt_size_t size);
382void *rt_slab_realloc(rt_slab_t m,
void *ptr,
rt_size_t size);
383void rt_slab_free(rt_slab_t m,
void *ptr);
401#define RT_THREAD_RESUME_RES_THR_ERR (-1)
418#ifdef RT_USING_SEMAPHORE
523#ifdef RT_USING_MAILBOX
563#ifdef RT_USING_MESSAGEQUEUE
569#ifdef RT_USING_MESSAGEQUEUE_PRIORITY
574#define RT_MQ_BUF_SIZE(msg_size, max_msgs) \
575((RT_ALIGN((msg_size), RT_ALIGN_SIZE) + sizeof(struct rt_mq_message)) * (max_msgs))
625#ifdef RT_USING_MESSAGEQUEUE_PRIORITY
662#ifdef RT_USING_DEVICE
739 #define rt_cpu_get_id rt_hw_cpu_id
743#define rt_cpu_get_id() (0)
757#ifdef RT_USING_COMPONENTS_INIT
758void rt_components_init(
void);
759void rt_components_board_init(
void);
770#ifndef RT_USING_CONSOLE
771#define rt_kprintf(...)
785#if defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE)
786rt_device_t rt_console_set_device(
const char *name);
788#ifdef RT_USING_THREADSAFE_PRINTF
791 rt_inline
void *rt_console_current_user(
void) {
return RT_NULL; }
801#ifdef RT_DEBUGING_ASSERT
802extern void (*rt_assert_hook)(
const char *ex,
const char *func,
rt_size_t line);
803void rt_assert_set_hook(
void (*hook)(
const char *ex,
const char *func,
rt_size_t line));
804void rt_assert_handler(
const char *ex,
const char *func,
rt_size_t line);
806#define RT_ASSERT(EX) \
809 rt_assert_handler(#EX, __FUNCTION__, __LINE__); \
812#define RT_ASSERT(EX) {RT_UNUSED(EX);}
815#ifdef RT_DEBUGING_CONTEXT
817#define RT_DEBUG_NOT_IN_INTERRUPT \
820 if (rt_interrupt_get_nest() != 0) \
822 rt_kprintf("Function[%s] shall not be used in ISR\n", __FUNCTION__); \
832#define RT_DEBUG_IN_THREAD_CONTEXT \
835 if (rt_thread_self() == RT_NULL) \
837 rt_kprintf("Function[%s] shall not be used before scheduler start\n", \
841 RT_DEBUG_NOT_IN_INTERRUPT; \
850#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check) \
855 if (rt_critical_level() != 0) \
857 rt_kprintf("Function[%s]: scheduler is not available\n", \
861 RT_DEBUG_IN_THREAD_CONTEXT; \
866#define RT_DEBUG_NOT_IN_INTERRUPT
867#define RT_DEBUG_IN_THREAD_CONTEXT
868#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
890 return !thread ||
RT_SCHED_CTX(thread).bind_cpu != RT_CPUS_NR;
894#define rt_sched_thread_is_binding(thread) (RT_TRUE)
rt_base_t rt_cpus_lock(void)
This function will lock all cpus's scheduler and disable local irq.
void rt_cpus_unlock(rt_base_t level)
This function will restore all cpus's scheduler and restore local irq.
void rt_cpus_lock_status_restore(struct rt_thread *thread)
rt_err_t rt_timer_detach(rt_timer_t timer)
This function will detach a timer from timer management.
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
void rt_timer_exit_sethook(void(*hook)(struct rt_timer *timer))
void rt_tick_increase(void)
This function will notify kernel there is one tick passed. Normally, this function is invoked by cloc...
struct rt_timer * rt_timer_t
void rt_timer_check(void)
This function will check timer list, if a timeout event happens, the corresponding timeout function w...
rt_err_t rt_timer_start(rt_timer_t timer)
This function will start the timer
rt_tick_t rt_timer_next_timeout_tick(void)
This function will return the next timeout tick in the system.
void rt_timer_enter_sethook(void(*hook)(struct rt_timer *timer))
void rt_tick_increase_tick(rt_tick_t tick)
This function will notify kernel there is n tick passed. Normally, this function is invoked by clock ...
void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
This function will initialize a timer normally this function is used to initialize a static timer obj...
rt_tick_t rt_tick_get(void)
This function will return current tick from operating system startup.
rt_weak rt_tick_t rt_tick_get_millisecond(void)
This function will return the passed millisecond from boot.
void rt_tick_set(rt_tick_t tick)
This function will set current tick.
rt_timer_t rt_timer_create(const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
This function will create a timer
void rt_system_timer_init(void)
This function will initialize system timer
rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
This function will calculate the tick from millisecond.
rt_err_t rt_timer_stop(rt_timer_t timer)
This function will stop the timer
void rt_tick_sethook(void(*hook)(void))
void rt_system_timer_thread_init(void)
This function will initialize system timer thread
rt_err_t rt_timer_delete(rt_timer_t timer)
This function will delete a timer and release timer memory
rt_err_t rt_device_init(rt_device_t dev)
rt_err_t rt_device_set_rx_indicate(rt_device_t dev, rt_err_t(*rx_ind)(rt_device_t dev, rt_size_t size))
rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg)
rt_ssize_t rt_device_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
rt_ssize_t rt_device_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
rt_device_t rt_device_create(int type, int attach_size)
void rt_device_destroy(rt_device_t device)
rt_err_t rt_device_unregister(rt_device_t dev)
rt_device_t rt_device_find(const char *name)
struct rt_device * rt_device_t
rt_err_t rt_device_close(rt_device_t dev)
rt_err_t rt_device_register(rt_device_t dev, const char *name, rt_uint16_t flags)
rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
rt_err_t rt_device_set_tx_complete(rt_device_t dev, rt_err_t(*tx_done)(rt_device_t dev, void *buffer))
void rt_realloc_set_exit_hook(void(*hook)(void **ptr, rt_size_t size))
This function will set a hook function, which will be invoked when a memory block is allocated from h...
void rt_free_sethook(void(*hook)(void **ptr))
This function will set a hook function, which will be invoked when a memory block is released to heap...
void rt_realloc_set_entry_hook(void(*hook)(void **ptr, rt_size_t size))
This function will set a hook function, which will be invoked when a memory block is allocated from h...
void rt_malloc_sethook(void(*hook)(void **ptr, rt_size_t size))
This function will set a hook function, which will be invoked when a memory block is allocated from h...
void rt_thread_defunct_enqueue(rt_thread_t thread)
Enqueue a thread to defunct queue.
void rt_defunct_execute(void)
This function will perform system background job when system idle.
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_thread_t rt_thread_defunct_dequeue(void)
Dequeue a thread from defunct queue.
rt_err_t rt_susp_list_resume_all_irq(rt_list_t *susp_list, rt_err_t thread_error, struct rt_spinlock *lock)
This function will resume all suspended threads in the IPC object list, including the suspended list ...
void rt_thread_defunct_init(void)
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_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_susp_list_print(rt_list_t *list)
Print thread on suspend list to system console
void rt_spin_lock(struct rt_spinlock *lock)
This function will lock the spinlock, will lock the thread scheduler.
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
void rt_spin_unlock(struct rt_spinlock *lock)
This function will unlock the spinlock, will unlock the thread scheduler.
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,...
rt_err_t rt_susp_list_enqueue(rt_list_t *susp_list, rt_thread_t thread, int ipc_flags)
Add a thread to the suspend list
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_interrupt_enter(void)
This function will be invoked by BSP, when enter interrupt service routine
rt_uint8_t rt_interrupt_get_nest(void)
This function will return the nest of interrupt.
void rt_interrupt_leave(void)
This function will be invoked by BSP, when leave interrupt service routine
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.
void rt_object_detach_sethook(void(*hook)(struct rt_object *object))
rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size)
This function will return the name of the specified object container
rt_err_t rt_custom_object_destroy(rt_object_t obj)
rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
This function will allocate an object from object system.
void rt_object_take_sethook(void(*hook)(struct rt_object *object))
rt_object_t rt_object_find(const char *name, rt_uint8_t type)
This function will find specified name object from object container.
rt_object_t rt_custom_object_create(const char *name, void *data, rt_err_t(*data_destroy)(void *))
void rt_object_attach_sethook(void(*hook)(struct rt_object *object))
struct rt_object_information * rt_object_get_information(enum rt_object_class_type type)
This function will return the specified type of object information.
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.
struct rt_object * rt_object_t
int rt_object_get_length(enum rt_object_class_type type)
This function will return the length of object list in object container.
rt_err_t rt_object_for_each(rt_uint8_t type, rt_object_iter_t iter, void *data)
This function will iterate through each object from object container.
int rt_object_get_pointers(enum rt_object_class_type type, rt_object_t *pointers, int maxlen)
This function will copy the object pointer of the specified type, with the maximum size specified by ...
void rt_object_trytake_sethook(void(*hook)(struct rt_object *object))
rt_err_t(* rt_object_iter_t)(rt_object_t object, void *data)
void rt_object_put_sethook(void(*hook)(struct rt_object *object))
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 ...
#define RT_OBJECT_HOOKLIST_DECLARE(handler_type, name)
void rt_show_version(void)
This function will show the version of rt-thread rtos
rt_inline rt_bool_t rt_scheduler_is_available(void)
rt_inline rt_bool_t rt_in_thread_context(void)
rt_weak rt_err_t rt_backtrace_to_buffer(rt_thread_t thread, struct rt_hw_backtrace_frame *frame, long skip, rt_ubase_t *buffer, long buflen)
Print backtrace from frame to the given buffer
unsigned long __rt_ffsl(unsigned long value)
unsigned long __rt_clz(unsigned long value)
rt_weak rt_err_t rt_backtrace_formatted_print(rt_ubase_t *buffer, long buflen)
Print backtrace from buffer to system console
rt_weak rt_err_t rt_backtrace_frame(rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
Print backtrace from frame to system console device
#define rt_sched_thread_is_binding(thread)
int __rt_ffs(int value)
This function finds the first bit set (beginning with the least significant bit) in value and return ...
rt_weak rt_err_t rt_backtrace(void)
Print backtrace of current thread to system console device
rt_err_t rt_backtrace_thread(rt_thread_t thread)
Print backtrace of a thread to system console device
void rt_smem_free(void *rmem)
This function will release the previously allocated memory block by rt_mem_alloc. The released memory...
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_malloc_align(rt_size_t size, rt_size_t align)
This function allocates a memory block, which address is aligned to the specified alignment size.
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.
void rt_memory_info(rt_size_t *total, rt_size_t *used, rt_size_t *max_used)
This function will caculate the total memory, the used memory, and the max used memory.
void rt_free(void *ptr)
This function will release the previously allocated memory block by rt_malloc. The released memory bl...
void * rt_malloc(rt_size_t size)
Allocate a block of memory with a minimum of 'size' bytes.
void * rt_smem_alloc(rt_smem_t m, rt_size_t size)
Allocate a block of memory with a minimum of 'size' bytes.
void * rt_calloc(rt_size_t count, rt_size_t size)
This function will contiguously allocate enough space for count objects that are size bytes of memory...
void * rt_realloc(void *ptr, rt_size_t newsize)
This function will change the size of previously allocated memory block.
void * rt_smem_realloc(rt_smem_t m, void *rmem, rt_size_t newsize)
This function will change the size of previously allocated memory block.
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.
void rt_free_align(void *ptr)
This function release the memory block, which is allocated by rt_malloc_align function and address is...
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.
rt_smem_t rt_smem_init(const char *name, void *begin_addr, rt_size_t size)
This function will initialize small memory management algorithm.
rt_err_t rt_smem_detach(rt_smem_t m)
This function will remove a small mem from the system.
void rt_system_heap_init_generic(void *begin_addr, void *end_addr)
This function will do the generic system heap initialization.
void rt_system_heap_init(void *begin_addr, void *end_addr)
This function will init system heap. User can override this API to complete other works,...
void rt_mp_free_sethook(void(*hook)(struct rt_mempool *mp, void *block))
rt_err_t rt_thread_startup(rt_thread_t thread)
This function will start a thread and put it to system ready queue.
rt_err_t rt_thread_close(rt_thread_t thread)
This function will close a thread. The thread object will be removed from thread queue and detached/d...
rt_err_t rt_thread_get_name(rt_thread_t thread, char *name, rt_uint8_t name_size)
This function will return the name of the specified thread
void rt_scheduler_sethook(void(*hook)(rt_thread_t from, rt_thread_t to))
void rt_scheduler_ipi_handler(int vector, void *param)
This function will handle IPI interrupt and do a scheduling in system.
void rt_exit_critical_safe(rt_base_t critical_level)
rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick)
This function will let current thread delay until (*tick + inc_tick).
rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
This function will control thread behaviors according to control command.
void rt_exit_critical(void)
This function will unlock the thread scheduler.
void rt_scheduler_switch_sethook(void(*hook)(struct rt_thread *tid))
rt_err_t rt_thread_mdelay(rt_int32_t ms)
This function will let current thread delay for some milliseconds.
rt_err_t rt_thread_detach(rt_thread_t thread)
This function will detach a thread. The thread object will be removed from thread queue and detached/...
rt_err_t rt_thread_suspend_with_flag(rt_thread_t thread, int suspend_flag)
This function will suspend the specified thread and change it to suspend state.
rt_err_t rt_thread_yield(void)
This function will let current thread yield processor, and scheduler will choose the highest thread t...
void rt_system_scheduler_init(void)
This function will initialize the system scheduler.
rt_thread_t rt_thread_self(void)
This function will return self thread object.
rt_err_t rt_thread_delay(rt_tick_t tick)
This function will let current thread delay for some ticks.
rt_err_t rt_thread_delete(rt_thread_t thread)
This function will delete a thread. The thread object will be removed from thread queue and deleted f...
void(* rt_thread_inited_hookproto_t)(rt_thread_t thread)
Sets a hook function when a thread is initialized.
rt_thread_t rt_thread_find(char *name)
This function will find the specified thread.
void rt_thread_suspend_sethook(void(*hook)(rt_thread_t thread))
void rt_system_scheduler_start(void)
This function will startup the scheduler. It will select one thread with the highest priority level,...
rt_err_t rt_thread_resume(rt_thread_t thread)
This function will resume a thread and put it to system ready queue.
rt_err_t rt_thread_suspend(rt_thread_t thread)
rt_err_t rt_thread_idle_sethook(void(*hook)(void))
void rt_scheduler_do_irq_switch(void *context)
This function checks whether a scheduling is needed after an IRQ context switching....
rt_base_t rt_enter_critical(void)
This function will lock the thread scheduler.
rt_thread_t rt_thread_create(const char *name, void(*entry)(void *parameter), void *parameter, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
This function will create a thread object and allocate thread object memory. and stack.
rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
This function will initialize a thread. It's used to initialize a static thread object.
struct rt_thread * rt_thread_t
rt_thread_t rt_thread_idle_gethandler(void)
This function will get the handler of the idle thread.
void rt_thread_resume_sethook(void(*hook)(rt_thread_t thread))
void rt_thread_idle_init(void)
This function will initialize idle thread, then start it.
struct rt_interrupt_context * rt_interrupt_context_t
void rt_schedule(void)
This function will perform one scheduling. It will select one thread with the highest priority level ...
rt_uint16_t rt_critical_level(void)
Get the scheduler lock level.
rt_err_t rt_thread_idle_delhook(void(*hook)(void))
delete the idle hook on hook list.
rt_err_t rt_event_recv_interruptible(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t *recved)
rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
This function will set some extra attributions of an event object.
rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
Creating an event object.
rt_err_t rt_event_detach(rt_event_t event)
This function will detach a static event object.
rt_err_t rt_event_recv(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t *recved)
rt_err_t rt_event_delete(rt_event_t event)
This function will delete an event object and release the memory space.
rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
This function will send an event to the event object. If there is a thread suspended on the event,...
rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
The function will initialize a static event object.
rt_err_t rt_event_recv_killable(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t *recved)
struct rt_event * rt_event_t
rt_err_t rt_mb_recv_killable(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg)
This function will set some extra attributions of a mailbox object.
rt_err_t rt_mb_send_wait_killable(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
rt_err_t rt_mb_detach(rt_mailbox_t mb)
This function will detach a static mailbox object.
rt_err_t rt_mb_send_killable(rt_mailbox_t mb, rt_ubase_t value)
rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
rt_err_t rt_mb_delete(rt_mailbox_t mb)
This function will delete a mailbox object and release the memory space.
rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
Creating a mailbox object.
rt_err_t rt_mb_recv_interruptible(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
struct rt_mailbox * rt_mailbox_t
rt_err_t rt_mb_send_interruptible(rt_mailbox_t mb, rt_ubase_t value)
rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
This function will send an urgent mail to the mailbox object.
rt_err_t rt_mb_init(rt_mailbox_t mb, const char *name, void *msgpool, rt_size_t size, rt_uint8_t flag)
Initialize a static mailbox object.
rt_err_t rt_mb_send(rt_mailbox_t mb, rt_ubase_t value)
This function will send an mail to the mailbox object. If there is a thread suspended on the mailbox,...
rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
rt_err_t rt_mb_send_wait_interruptible(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
rt_err_t rt_mq_send_wait(rt_mq_t mq, const void *buffer, rt_size_t size, rt_int32_t timeout)
rt_err_t rt_mq_detach(rt_mq_t mq)
This function will detach a static messagequeue object.
rt_mq_t rt_mq_create(const char *name, rt_size_t msg_size, rt_size_t max_msgs, rt_uint8_t flag)
Creating a messagequeue object.
rt_err_t rt_mq_control(rt_mq_t mq, int cmd, void *arg)
This function will set some extra attributions of a messagequeue object.
rt_err_t rt_mq_send_wait_killable(rt_mq_t mq, const void *buffer, rt_size_t size, rt_int32_t timeout)
struct rt_messagequeue * rt_mq_t
rt_ssize_t rt_mq_recv_killable(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout)
rt_err_t rt_mq_send_killable(rt_mq_t mq, const void *buffer, rt_size_t size)
rt_err_t rt_mq_send_interruptible(rt_mq_t mq, const void *buffer, rt_size_t size)
rt_ssize_t rt_mq_recv_interruptible(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout)
rt_err_t rt_mq_init(rt_mq_t mq, const char *name, void *msgpool, rt_size_t msg_size, rt_size_t pool_size, rt_uint8_t flag)
Initialize a static messagequeue object.
rt_err_t rt_mq_send(rt_mq_t mq, const void *buffer, rt_size_t size)
This function will send a message to the messagequeue object. If there is a thread suspended on the m...
rt_err_t rt_mq_send_wait_interruptible(rt_mq_t mq, const void *buffer, rt_size_t size, rt_int32_t timeout)
rt_err_t rt_mq_delete(rt_mq_t mq)
This function will delete a messagequeue object and release the memory.
rt_ssize_t rt_mq_recv(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout)
rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
This function will send an urgent message to the messagequeue object.
rt_err_t rt_mutex_control(rt_mutex_t mutex, int cmd, void *arg)
This function will set some extra attributions of a mutex object.
rt_err_t rt_mutex_take_interruptible(rt_mutex_t mutex, rt_int32_t time)
rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag)
This function will create a mutex object.
rt_inline rt_ubase_t rt_mutex_get_hold(rt_mutex_t mutex)
rt_err_t rt_mutex_take_killable(rt_mutex_t mutex, rt_int32_t time)
rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time)
rt_err_t rt_mutex_detach(rt_mutex_t mutex)
This function will detach a static mutex object.
rt_uint8_t rt_mutex_setprioceiling(rt_mutex_t mutex, rt_uint8_t priority)
set the prioceiling attribute of the mutex.
rt_err_t rt_mutex_delete(rt_mutex_t mutex)
This function will delete a mutex object and release this memory space.
void rt_mutex_drop_thread(rt_mutex_t mutex, rt_thread_t thread)
drop a thread from the suspend list of mutex
rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
Initialize a static mutex object.
rt_inline rt_thread_t rt_mutex_get_owner(rt_mutex_t mutex)
rt_err_t rt_mutex_release(rt_mutex_t mutex)
This function will release a mutex. If there is thread suspended on the mutex, the thread will be res...
struct rt_mutex * rt_mutex_t
rt_err_t rt_mutex_trytake(rt_mutex_t mutex)
This function will try to take a mutex, if the mutex is unavailable, the thread returns immediately.
rt_uint8_t rt_mutex_getprioceiling(rt_mutex_t mutex)
set the prioceiling attribute of the mutex.
rt_err_t rt_sem_init(rt_sem_t sem, const char *name, rt_uint32_t value, rt_uint8_t flag)
This function will initialize a static semaphore object.
rt_err_t rt_sem_delete(rt_sem_t sem)
This function will delete a semaphore object and release the memory space.
rt_err_t rt_sem_take_killable(rt_sem_t sem, rt_int32_t time)
rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg)
This function will set some extra attributions of a semaphore object.
rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
Creating a semaphore object.
rt_err_t rt_sem_take_interruptible(rt_sem_t sem, rt_int32_t time)
rt_err_t rt_sem_detach(rt_sem_t sem)
This function will detach a static semaphore object.
rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time)
struct rt_semaphore * rt_sem_t
rt_err_t rt_sem_release(rt_sem_t sem)
This function will release a semaphore. If there is thread suspended on the semaphore,...
rt_err_t rt_sem_trytake(rt_sem_t sem)
This function will try to take a semaphore, if the semaphore is unavailable, the thread returns immed...
#define RT_SCHED_CTX(thread)
void rt_interrupt_context_push(rt_interrupt_context_t this_ctx)
void rt_interrupt_enter_sethook(void(*hook)(void))
void rt_interrupt_leave_sethook(void(*hook)(void))
struct rt_cpu * rt_cpu_index(int index)
This fucntion will return the cpu object corresponding to index.
struct rt_cpu * rt_cpu_self(void)
This fucntion will return current cpu object.
void rt_interrupt_context_pop(void)
void * rt_interrupt_context_get(void)
unsigned short rt_uint16_t
struct rt_list_node rt_list_t
struct rt_mq_message * next