RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
|
结构体 | |
struct | rt_messagequeue |
struct | rt_mq_message |
宏定义 | |
#define | RT_MQ_BUF_SIZE(msg_size, max_msgs) |
类型定义 | |
typedef struct rt_messagequeue * | rt_mq_t |
#define RT_MQ_BUF_SIZE | ( | msg_size, | |
max_msgs ) |
在文件 rtthread.h 第 574 行定义.
typedef struct rt_messagequeue* rt_mq_t |
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.
mq | is a pointer to the messagequeue to initialize. It is assumed that storage for the messagequeue will be allocated in your application. |
name | is a pointer to the name that given to the messagequeue. |
msgpool | is a pointer to the starting address of the memory space you allocated for the messagequeue in advance. In other words, msgpool is a pointer to the messagequeue buffer of the starting address. |
msg_size | is the maximum length of a message in the messagequeue (Unit: Byte). |
pool_size | is the size of the memory space allocated for the messagequeue in advance. |
flag | is the messagequeue flag, which determines the queuing way of how multiple threads wait when the messagequeue is not available. The messagequeue flag can be ONE of the following values: RT_IPC_FLAG_PRIO The pending threads will queue in order of priority. RT_IPC_FLAG_FIFO The pending threads will queue in the first-in-first-out method (also known as first-come-first-served (FCFS) scheduling strategy). NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about the first-in-first-out principle, and you clearly understand that all threads involved in this messagequeue will become non-real-time threads. |
引用了 _ipc_object_init(), rt_messagequeue::entry, rt_object::flag, rt_messagequeue::max_msgs, rt_messagequeue::msg_pool, rt_messagequeue::msg_queue_free, rt_messagequeue::msg_queue_head, rt_messagequeue::msg_queue_tail, rt_messagequeue::msg_size, rt_mq_message::next, rt_ipc_object::parent, rt_messagequeue::parent, RT_ALIGN, RT_ASSERT, RT_IPC_FLAG_FIFO, RT_IPC_FLAG_PRIO, rt_list_init(), RT_NULL, RT_Object_Class_MessageQueue, rt_object_init(), rt_spin_lock_init(), rt_messagequeue::spinlock , 以及 rt_messagequeue::suspend_sender_thread.
RTM_EXPORT | ( | rt_mq_init | ) |
This function will detach a static messagequeue object.
mq | is a pointer to a messagequeue object to be detached. |
引用了 rt_ipc_object::parent, rt_messagequeue::parent, RT_ASSERT, RT_NULL, RT_Object_Class_MessageQueue, rt_object_detach(), rt_object_get_type(), rt_object_is_systemobject(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_resume_all(), rt_messagequeue::spinlock, rt_messagequeue::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.
RTM_EXPORT | ( | rt_mq_detach | ) |
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.
name | is a pointer that given to the messagequeue. |
msg_size | is the maximum length of a message in the messagequeue (Unit: Byte). |
max_msgs | is the maximum number of messages in the messagequeue. |
flag | is the messagequeue flag, which determines the queuing way of how multiple threads wait when the messagequeue is not available. The messagequeue flag can be ONE of the following values: RT_IPC_FLAG_PRIO The pending threads will queue in order of priority. RT_IPC_FLAG_FIFO The pending threads will queue in the first-in-first-out method (also known as first-come-first-served (FCFS) scheduling strategy). NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about the first-in-first-out principle, and you clearly understand that all threads involved in this messagequeue will become non-real-time threads. |
引用了 _ipc_object_init(), rt_messagequeue::entry, rt_object::flag, rt_messagequeue::max_msgs, rt_messagequeue::msg_pool, rt_messagequeue::msg_queue_free, rt_messagequeue::msg_queue_head, rt_messagequeue::msg_queue_tail, rt_messagequeue::msg_size, rt_mq_message::next, rt_ipc_object::parent, rt_messagequeue::parent, RT_ALIGN, RT_ASSERT, RT_DEBUG_NOT_IN_INTERRUPT, RT_IPC_FLAG_FIFO, RT_IPC_FLAG_PRIO, RT_KERNEL_MALLOC, rt_list_init(), RT_NULL, rt_object_allocate(), RT_Object_Class_MessageQueue, rt_object_delete(), rt_spin_lock_init(), rt_messagequeue::spinlock , 以及 rt_messagequeue::suspend_sender_thread.
RTM_EXPORT | ( | rt_mq_create | ) |
This function will delete a messagequeue object and release the memory.
mq | is a pointer to a messagequeue object to be deleted. |
引用了 rt_messagequeue::msg_pool, rt_ipc_object::parent, rt_messagequeue::parent, RT_ASSERT, RT_DEBUG_NOT_IN_INTERRUPT, RT_FALSE, RT_KERNEL_FREE, RT_NULL, RT_Object_Class_MessageQueue, rt_object_delete(), rt_object_get_type(), rt_object_is_systemobject(), rt_spin_lock(), rt_spin_unlock(), rt_susp_list_resume_all(), rt_messagequeue::spinlock, rt_messagequeue::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.
RTM_EXPORT | ( | rt_mq_delete | ) |
rt_err_t rt_mq_send_wait | ( | rt_mq_t | mq, |
const void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_send_wait | ) |
rt_err_t rt_mq_send_wait_interruptible | ( | rt_mq_t | mq, |
const void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_send_wait_interruptible | ) |
rt_err_t rt_mq_send_wait_killable | ( | rt_mq_t | mq, |
const void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_send_wait_killable | ) |
This function will send a message to the messagequeue object. If there is a thread suspended on the messagequeue, the thread will be resumed.
mq | is a pointer to the messagequeue object to be sent. |
buffer | is the content of the message. |
size | is the length of the message(Unit: Byte). |
引用了 rt_mq_send_wait().
RTM_EXPORT | ( | rt_mq_send | ) |
引用了 rt_mq_send_wait_interruptible().
RTM_EXPORT | ( | rt_mq_send_interruptible | ) |
引用了 rt_mq_send_wait_killable().
RTM_EXPORT | ( | rt_mq_send_killable | ) |
This function will send an urgent message to the messagequeue object.
mq | is a pointer to the messagequeue object to be sent. |
buffer | is the content of the message. |
size | is the length of the message(Unit: Byte). |
引用了 rt_messagequeue::entry, GET_MESSAGEBYTE_ADDR, rt_mq_message::length, rt_messagequeue::msg_queue_free, rt_messagequeue::msg_queue_head, rt_messagequeue::msg_queue_tail, rt_messagequeue::msg_size, rt_mq_message::next, rt_ipc_object::parent, rt_messagequeue::parent, RT_ASSERT, rt_list_isempty(), RT_MQ_ENTRY_MAX, RT_NULL, RT_Object_Class_MessageQueue, rt_object_get_type(), RT_OBJECT_HOOK_CALL, rt_schedule(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_dequeue(), rt_messagequeue::spinlock , 以及 rt_ipc_object::suspend_thread.
RTM_EXPORT | ( | rt_mq_urgent | ) |
rt_ssize_t rt_mq_recv | ( | rt_mq_t | mq, |
void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_recv | ) |
rt_ssize_t rt_mq_recv_interruptible | ( | rt_mq_t | mq, |
void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_recv_interruptible | ) |
rt_ssize_t rt_mq_recv_killable | ( | rt_mq_t | mq, |
void * | buffer, | ||
rt_size_t | size, | ||
rt_int32_t | timeout ) |
RTM_EXPORT | ( | rt_mq_recv_killable | ) |
This function will set some extra attributions of a messagequeue object.
mq | is a pointer to a messagequeue object. |
cmd | is a command used to configure some attributions of the messagequeue. |
arg | is the argument of the function to execute the command. |
引用了 rt_messagequeue::entry, rt_messagequeue::msg_queue_free, rt_messagequeue::msg_queue_head, rt_messagequeue::msg_queue_tail, rt_mq_message::next, rt_ipc_object::parent, rt_messagequeue::parent, RT_ASSERT, RT_IPC_CMD_RESET, RT_NULL, RT_Object_Class_MessageQueue, rt_object_get_type(), rt_schedule(), rt_spin_lock_irqsave(), rt_spin_unlock_irqrestore(), rt_susp_list_resume_all(), RT_UNUSED, rt_messagequeue::spinlock, rt_messagequeue::suspend_sender_thread , 以及 rt_ipc_object::suspend_thread.
RTM_EXPORT | ( | rt_mq_control | ) |