RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
rtthread.h 文件参考
#include <rtconfig.h>
#include <rtdef.h>
#include <rtservice.h>
#include <rtm.h>
#include <rtatomic.h>
#include <rtklibc.h>
#include <finsh.h>
+ rtthread.h 的引用(Include)关系图:

浏览该文件的源代码.

结构体

struct  rt_mq_message
 

宏定义

#define RT_SCHEDULER_STACK_CHECK(thr)
 
#define RT_THREAD_RESUME_RES_THR_ERR   (-1)
 
#define RT_MQ_BUF_SIZE(msg_size, max_msgs)
 
#define rt_cpu_get_id()
 
#define rt_kprintf(...)
 
#define rt_kputs(str)
 
#define RT_ASSERT(EX)
 
#define RT_DEBUG_NOT_IN_INTERRUPT
 
#define RT_DEBUG_IN_THREAD_CONTEXT
 
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
 
#define rt_sched_thread_is_binding(thread)
 

类型定义

typedef void(* rt_thread_inited_hookproto_t) (rt_thread_t thread)
 

函数

struct rt_object_informationrt_object_get_information (enum rt_object_class_type type)
 
int rt_object_get_length (enum rt_object_class_type type)
 
int rt_object_get_pointers (enum rt_object_class_type type, rt_object_t *pointers, int maxlen)
 
void rt_object_init (struct rt_object *object, enum rt_object_class_type type, const char *name)
 
void rt_object_detach (rt_object_t object)
 
rt_object_t rt_object_allocate (enum rt_object_class_type type, const char *name)
 
void rt_object_delete (rt_object_t object)
 
rt_object_t rt_custom_object_create (const char *name, void *data, rt_err_t(*data_destroy)(void *))
 
rt_err_t rt_custom_object_destroy (rt_object_t obj)
 
rt_bool_t rt_object_is_systemobject (rt_object_t object)
 
rt_uint8_t rt_object_get_type (rt_object_t object)
 
rt_err_t rt_object_for_each (rt_uint8_t type, rt_object_iter_t iter, void *data)
 
rt_object_t rt_object_find (const char *name, rt_uint8_t type)
 
rt_err_t rt_object_get_name (rt_object_t object, char *name, rt_uint8_t name_size)
 
void rt_object_attach_sethook (void(*hook)(struct rt_object *object))
 
void rt_object_detach_sethook (void(*hook)(struct rt_object *object))
 
void rt_object_trytake_sethook (void(*hook)(struct rt_object *object))
 
void rt_object_take_sethook (void(*hook)(struct rt_object *object))
 
void rt_object_put_sethook (void(*hook)(struct rt_object *object))
 
rt_tick_t rt_tick_get (void)
 
void rt_tick_set (rt_tick_t tick)
 
void rt_tick_increase (void)
 
void rt_tick_increase_tick (rt_tick_t tick)
 
rt_tick_t rt_tick_from_millisecond (rt_int32_t ms)
 
rt_weak rt_tick_t rt_tick_get_millisecond (void)
 
void rt_tick_sethook (void(*hook)(void))
 
void rt_system_timer_init (void)
 
void rt_system_timer_thread_init (void)
 
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)
 
rt_err_t rt_timer_detach (rt_timer_t timer)
 
rt_timer_t rt_timer_create (const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
 
rt_err_t rt_timer_delete (rt_timer_t timer)
 
rt_err_t rt_timer_start (rt_timer_t timer)
 
rt_err_t rt_timer_stop (rt_timer_t timer)
 
rt_err_t rt_timer_control (rt_timer_t timer, int cmd, void *arg)
 
rt_tick_t rt_timer_next_timeout_tick (void)
 
void rt_timer_check (void)
 
void rt_timer_enter_sethook (void(*hook)(struct rt_timer *timer))
 
void rt_timer_exit_sethook (void(*hook)(struct rt_timer *timer))
 
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)
 
rt_err_t rt_thread_detach (rt_thread_t thread)
 
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)
 
rt_err_t rt_thread_delete (rt_thread_t thread)
 
rt_err_t rt_thread_close (rt_thread_t thread)
 
rt_thread_t rt_thread_self (void)
 
rt_thread_t rt_thread_find (char *name)
 
rt_err_t rt_thread_startup (rt_thread_t thread)
 
rt_err_t rt_thread_yield (void)
 
rt_err_t rt_thread_delay (rt_tick_t tick)
 
rt_err_t rt_thread_delay_until (rt_tick_t *tick, rt_tick_t inc_tick)
 
rt_err_t rt_thread_mdelay (rt_int32_t ms)
 
rt_err_t rt_thread_control (rt_thread_t thread, int cmd, void *arg)
 
rt_err_t rt_thread_suspend (rt_thread_t thread)
 
rt_err_t rt_thread_suspend_with_flag (rt_thread_t thread, int suspend_flag)
 
rt_err_t rt_thread_resume (rt_thread_t thread)
 
rt_err_t rt_thread_get_name (rt_thread_t thread, char *name, rt_uint8_t name_size)
 
void rt_thread_suspend_sethook (void(*hook)(rt_thread_t thread))
 
void rt_thread_resume_sethook (void(*hook)(rt_thread_t thread))
 
 RT_OBJECT_HOOKLIST_DECLARE (rt_thread_inited_hookproto_t, rt_thread_inited)
 
void rt_thread_idle_init (void)
 
rt_err_t rt_thread_idle_sethook (void(*hook)(void))
 
rt_err_t rt_thread_idle_delhook (void(*hook)(void))
 
rt_thread_t rt_thread_idle_gethandler (void)
 
void rt_system_scheduler_init (void)
 
void rt_system_scheduler_start (void)
 
void rt_schedule (void)
 
void rt_scheduler_do_irq_switch (void *context)
 
rt_base_t rt_enter_critical (void)
 
void rt_exit_critical (void)
 
void rt_exit_critical_safe (rt_base_t critical_level)
 
rt_uint16_t rt_critical_level (void)
 
void rt_scheduler_sethook (void(*hook)(rt_thread_t from, rt_thread_t to))
 
void rt_scheduler_switch_sethook (void(*hook)(struct rt_thread *tid))
 
rt_err_t rt_mp_init (struct rt_mempool *mp, const char *name, void *start, rt_size_t size, rt_size_t block_size)
 
rt_err_t rt_mp_detach (struct rt_mempool *mp)
 
rt_mp_t rt_mp_create (const char *name, rt_size_t block_count, rt_size_t block_size)
 
rt_err_t rt_mp_delete (rt_mp_t mp)
 
void * rt_mp_alloc (rt_mp_t mp, rt_int32_t time)
 
void rt_mp_free (void *block)
 
void rt_mp_alloc_sethook (void(*hook)(struct rt_mempool *mp, void *block))
 
void rt_mp_free_sethook (void(*hook)(struct rt_mempool *mp, void *block))
 
void rt_system_heap_init (void *begin_addr, void *end_addr)
 
void rt_system_heap_init_generic (void *begin_addr, void *end_addr)
 
void * rt_malloc (rt_size_t size)
 
void rt_free (void *ptr)
 
void * rt_realloc (void *ptr, rt_size_t newsize)
 
void * rt_calloc (rt_size_t count, rt_size_t size)
 
void * rt_malloc_align (rt_size_t size, rt_size_t align)
 
void rt_free_align (void *ptr)
 
void rt_memory_info (rt_size_t *total, rt_size_t *used, rt_size_t *max_used)
 
rt_smem_t rt_smem_init (const char *name, void *begin_addr, rt_size_t size)
 
rt_err_t rt_smem_detach (rt_smem_t m)
 
void * rt_smem_alloc (rt_smem_t m, rt_size_t size)
 
void * rt_smem_realloc (rt_smem_t m, void *rmem, rt_size_t newsize)
 
void rt_smem_free (void *rmem)
 
void rt_susp_list_print (rt_list_t *list)
 
struct rt_threadrt_susp_list_dequeue (rt_list_t *susp_list, rt_err_t thread_error)
 
rt_err_t rt_susp_list_resume_all (rt_list_t *susp_list, rt_err_t thread_error)
 
rt_err_t rt_susp_list_resume_all_irq (rt_list_t *susp_list, rt_err_t thread_error, struct rt_spinlock *lock)
 
rt_err_t rt_thread_suspend_to_list (rt_thread_t thread, rt_list_t *susp_list, int ipc_flags, int suspend_flag)
 
rt_err_t rt_susp_list_enqueue (rt_list_t *susp_list, rt_thread_t thread, int ipc_flags)
 
rt_err_t rt_sem_init (rt_sem_t sem, const char *name, rt_uint32_t value, rt_uint8_t flag)
 
rt_err_t rt_sem_detach (rt_sem_t sem)
 
rt_sem_t rt_sem_create (const char *name, rt_uint32_t value, rt_uint8_t flag)
 
rt_err_t rt_sem_delete (rt_sem_t sem)
 
rt_err_t rt_sem_take (rt_sem_t sem, rt_int32_t time)
 
rt_err_t rt_sem_take_interruptible (rt_sem_t sem, rt_int32_t time)
 
rt_err_t rt_sem_take_killable (rt_sem_t sem, rt_int32_t time)
 
rt_err_t rt_sem_trytake (rt_sem_t sem)
 
rt_err_t rt_sem_release (rt_sem_t sem)
 
rt_err_t rt_sem_control (rt_sem_t sem, int cmd, void *arg)
 
rt_err_t rt_mutex_init (rt_mutex_t mutex, const char *name, rt_uint8_t flag)
 
rt_err_t rt_mutex_detach (rt_mutex_t mutex)
 
rt_mutex_t rt_mutex_create (const char *name, rt_uint8_t flag)
 
rt_err_t rt_mutex_delete (rt_mutex_t mutex)
 
void rt_mutex_drop_thread (rt_mutex_t mutex, rt_thread_t thread)
 
rt_uint8_t rt_mutex_setprioceiling (rt_mutex_t mutex, rt_uint8_t priority)
 
rt_uint8_t rt_mutex_getprioceiling (rt_mutex_t mutex)
 
rt_err_t rt_mutex_take (rt_mutex_t mutex, rt_int32_t time)
 
rt_err_t rt_mutex_trytake (rt_mutex_t mutex)
 
rt_err_t rt_mutex_take_interruptible (rt_mutex_t mutex, rt_int32_t time)
 
rt_err_t rt_mutex_take_killable (rt_mutex_t mutex, rt_int32_t time)
 
rt_err_t rt_mutex_release (rt_mutex_t mutex)
 
rt_err_t rt_mutex_control (rt_mutex_t mutex, int cmd, void *arg)
 
rt_inline rt_thread_t rt_mutex_get_owner (rt_mutex_t mutex)
 
rt_inline rt_ubase_t rt_mutex_get_hold (rt_mutex_t mutex)
 
rt_err_t rt_event_init (rt_event_t event, const char *name, rt_uint8_t flag)
 
rt_err_t rt_event_detach (rt_event_t event)
 
rt_event_t rt_event_create (const char *name, rt_uint8_t flag)
 
rt_err_t rt_event_delete (rt_event_t event)
 
rt_err_t rt_event_send (rt_event_t event, rt_uint32_t set)
 
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_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_recv_killable (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)
 
rt_err_t rt_mb_init (rt_mailbox_t mb, const char *name, void *msgpool, rt_size_t size, rt_uint8_t flag)
 
rt_err_t rt_mb_detach (rt_mailbox_t mb)
 
rt_mailbox_t rt_mb_create (const char *name, rt_size_t size, rt_uint8_t flag)
 
rt_err_t rt_mb_delete (rt_mailbox_t mb)
 
rt_err_t rt_mb_send (rt_mailbox_t mb, rt_ubase_t value)
 
rt_err_t rt_mb_send_interruptible (rt_mailbox_t mb, rt_ubase_t value)
 
rt_err_t rt_mb_send_killable (rt_mailbox_t mb, rt_ubase_t value)
 
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_mb_send_wait_killable (rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout)
 
rt_err_t rt_mb_urgent (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_recv_interruptible (rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
 
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)
 
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)
 
rt_err_t rt_mq_detach (rt_mq_t mq)
 
rt_mq_t rt_mq_create (const char *name, rt_size_t msg_size, rt_size_t max_msgs, rt_uint8_t flag)
 
rt_err_t rt_mq_delete (rt_mq_t mq)
 
rt_err_t rt_mq_send (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_err_t rt_mq_send_killable (rt_mq_t mq, const void *buffer, rt_size_t size)
 
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_send_wait_interruptible (rt_mq_t mq, const void *buffer, rt_size_t size, rt_int32_t timeout)
 
rt_err_t rt_mq_send_wait_killable (rt_mq_t mq, const 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)
 
rt_ssize_t rt_mq_recv (rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout)
 
rt_ssize_t rt_mq_recv_interruptible (rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout)
 
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_control (rt_mq_t mq, int cmd, void *arg)
 
void rt_thread_defunct_init (void)
 
void rt_thread_defunct_enqueue (rt_thread_t thread)
 
rt_thread_t rt_thread_defunct_dequeue (void)
 
void rt_defunct_execute (void)
 
void rt_spin_lock_init (struct rt_spinlock *lock)
 
void rt_spin_lock (struct rt_spinlock *lock)
 
void rt_spin_unlock (struct rt_spinlock *lock)
 
rt_base_t rt_spin_lock_irqsave (struct rt_spinlock *lock)
 
void rt_spin_unlock_irqrestore (struct rt_spinlock *lock, rt_base_t level)
 
rt_device_t rt_device_find (const char *name)
 
rt_err_t rt_device_register (rt_device_t dev, const char *name, rt_uint16_t flags)
 
rt_err_t rt_device_unregister (rt_device_t dev)
 
rt_device_t rt_device_create (int type, int attach_size)
 
void rt_device_destroy (rt_device_t device)
 
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_set_tx_complete (rt_device_t dev, rt_err_t(*tx_done)(rt_device_t dev, void *buffer))
 
rt_err_t rt_device_init (rt_device_t dev)
 
rt_err_t rt_device_open (rt_device_t dev, rt_uint16_t oflag)
 
rt_err_t rt_device_close (rt_device_t dev)
 
rt_ssize_t rt_device_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
 
rt_ssize_t rt_device_write (rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
 
rt_err_t rt_device_control (rt_device_t dev, int cmd, void *arg)
 
void rt_interrupt_enter (void)
 
void rt_interrupt_leave (void)
 
void rt_interrupt_context_push (rt_interrupt_context_t this_ctx)
 
void rt_interrupt_context_pop (void)
 
void * rt_interrupt_context_get (void)
 
struct rt_cpurt_cpu_self (void)
 
struct rt_cpurt_cpu_index (int index)
 
rt_uint8_t rt_interrupt_get_nest (void)
 
void rt_interrupt_enter_sethook (void(*hook)(void))
 
void rt_interrupt_leave_sethook (void(*hook)(void))
 
rt_weak rt_err_t rt_backtrace (void)
 
rt_err_t rt_backtrace_thread (rt_thread_t thread)
 
rt_weak rt_err_t rt_backtrace_frame (rt_thread_t thread, struct rt_hw_backtrace_frame *frame)
 
rt_weak rt_err_t rt_backtrace_formatted_print (rt_ubase_t *buffer, long buflen)
 
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)
 
int __rt_ffs (int value)
 
unsigned long __rt_ffsl (unsigned long value)
 
unsigned long __rt_clz (unsigned long value)
 
void rt_show_version (void)
 
rt_inline rt_bool_t rt_in_thread_context (void)
 
rt_inline rt_bool_t rt_scheduler_is_available (void)
 
void rt_malloc_sethook (void(*hook)(void **ptr, rt_size_t size))
 
void rt_realloc_set_entry_hook (void(*hook)(void **ptr, rt_size_t size))
 
void rt_realloc_set_exit_hook (void(*hook)(void **ptr, rt_size_t size))
 
void rt_free_sethook (void(*hook)(void **ptr))
 

宏定义说明

◆ rt_cpu_get_id

#define rt_cpu_get_id ( void)
值:
(0)

在文件 rtthread.h743 行定义.

函数说明

◆ rt_interrupt_context_push()

void rt_interrupt_context_push ( rt_interrupt_context_t this_ctx)

◆ rt_interrupt_context_pop()

void rt_interrupt_context_pop ( void )

◆ rt_interrupt_context_get()

void * rt_interrupt_context_get ( void )

◆ rt_cpu_self()

struct rt_cpu * rt_cpu_self ( void )

This fucntion will return current cpu object.

CPU object

返回
Return a pointer to the current cpu object.

在文件 cpu_mp.c118 行定义.

119{
120 return &_cpus[rt_hw_cpu_id()];
121}
int rt_hw_cpu_id(void)

引用了 rt_cpu_self() , 以及 rt_hw_cpu_id().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_cpu_index()

struct rt_cpu * rt_cpu_index ( int index)

This fucntion will return the cpu object corresponding to index.

参数
indexis the index of target cpu object.
返回
Return a pointer to the cpu object corresponding to index.

在文件 cpu_mp.c130 行定义.

131{
132 return &_cpus[index];
133}

引用了 RT_NULL.

+ 这是这个函数的调用关系图:

◆ rt_interrupt_enter_sethook()

void rt_interrupt_enter_sethook ( void(* hook )(void))

◆ rt_interrupt_leave_sethook()

void rt_interrupt_leave_sethook ( void(* hook )(void))