WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_msgqueue

函数

int osal_msg_queue_create (const char *name, unsigned short queue_len, unsigned long *queue_id, unsigned int flags, unsigned short max_msgsize)
 Create a message queue.
 
int osal_msg_queue_write_copy (unsigned long queue_id, void *buffer_addr, unsigned int buffer_size, unsigned int timeout)
 Write data into a queue.
 
int osal_msg_queue_read_copy (unsigned long queue_id, void *buffer_addr, unsigned int *buffer_size, unsigned int timeout)
 Read a queue.
 
int osal_msg_queue_write_head_copy (unsigned long queue_id, void *buffer_addr, unsigned int buffer_size, unsigned int timeout)
 Write data into a queue header.
 
void osal_msg_queue_delete (unsigned long queue_id)
 Delete a queue.
 
int osal_msg_queue_is_full (unsigned long queue_id)
 Check whether the message queue is full.
 
unsigned int osal_msg_queue_get_msg_num (unsigned long queue_id)
 Obtains the number of messages in the current message queue.
 

详细描述

函数说明

◆ osal_msg_queue_create()

int osal_msg_queue_create ( const char *  name,
unsigned short  queue_len,
unsigned long *  queue_id,
unsigned int  flags,
unsigned short  max_msgsize 
)

Create a message queue.

Description:
This API is used to create a message queue.
注意
There are LOSCFG_BASE_IPC_QUEUE_LIMIT queues available, change it's value when necessary. This function is defined only when LOSCFG_QUEUE_DYNAMIC_ALLOCATION is defined. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
name[in] Message queue name. Reserved parameter, not used for now.
queue_len[in] Queue length. The value range is [1,0xffff].
queue_id[out] ID of the queue control structure that is successfully created.
flags[in] Queue mode. Reserved parameter, not used for now.
max_msgsize[in] Node size. The value range is [1,0xffff].
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
liteos freertos.

◆ osal_msg_queue_delete()

void osal_msg_queue_delete ( unsigned long  queue_id)

Delete a queue.

Description:
This API is used to delete a queue.
注意
This API cannot be used to delete a queue that is not created. A synchronous queue fails to be deleted if any tasks are blocked on it, or some queues are being read or written. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create..
Support System:
liteos freertos

◆ osal_msg_queue_get_msg_num()

unsigned int osal_msg_queue_get_msg_num ( unsigned long  queue_id)

Obtains the number of messages in the current message queue.

Description:
This API is used to obtains the number of messages in the current message queue.
注意
The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create
返回
The number of messages in the current message queue. or OSAL_INVALID_MSG_NUM when get number failed.
Support System:
liteos freertos

◆ osal_msg_queue_is_full()

int osal_msg_queue_is_full ( unsigned long  queue_id)

Check whether the message queue is full.

Description:
This API is used to check whether the message queue is full.
注意
The specific queue should be created firstly. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create.
返回
true/false
Support System:
liteos freertos

◆ osal_msg_queue_read_copy()

int osal_msg_queue_read_copy ( unsigned long  queue_id,
void *  buffer_addr,
unsigned int *  buffer_size,
unsigned int  timeout 
)

Read a queue.

Description:
This API is used to read data in a specified queue, and store the obtained data to the address specified by buffer_addr. The address and the size of the data to be read are defined by users.
注意
The specific queue should be created firstly. Queue reading adopts the fist in first out (FIFO) mode. The data that is first stored in the queue is read first. buffer_addr stores the obtained data. Do not read or write a queue in unblocking modes such as an interrupt. This API cannot be called before the LiteOS is initialized. The argument timeout is a relative time. Do not call this API in software timer callback. The buffer_size parameter is not used in the freertos system and buffer length depends on the size transferred during creation. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create.
buffer_addr[out] Starting address that stores the data to be written. The starting address must not be null.
buffer_size[in/out] Where to maintain the buffer wanted-size before read, and the real-size after read.
timeout[in] Expiry time. (unit: Tick).
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
liteos freertos
System Differ: The bufferSize of freertos does not support read/write of a specified size,
only supports full storage and rounding.

◆ osal_msg_queue_write_copy()

int osal_msg_queue_write_copy ( unsigned long  queue_id,
void *  buffer_addr,
unsigned int  buffer_size,
unsigned int  timeout 
)

Write data into a queue.

Description:
This API is used to write the data of the size specified by buffer_size and stored at the address specified by buffer_addr into a queue.
注意
The specific queue should be created firstly. Do not read or write a queue in unblocking modes such as interrupt. This API cannot be called before the LiteOS is initialized. The data to be written is of the size specified by buffer_size and is stored at the address specified by buffer_addr. The argument timeout is a relative time. Do not call this API in software timer callback. The buffer_size parameter is not used in the freertos system and buffer length depends on the size transferred during creation. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create.
buffer_addr[in] Starting address that stores the data to be written. The starting address must not be null.
buffer_size[in] Passed-in buffer size.
timeout[in] Expiry time. (unit: Tick).
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
liteos freertos
System Differ: The bufferSize of freertos does not support read/write of a specified size,
only supports full storage and rounding.

◆ osal_msg_queue_write_head_copy()

int osal_msg_queue_write_head_copy ( unsigned long  queue_id,
void *  buffer_addr,
unsigned int  buffer_size,
unsigned int  timeout 
)

Write data into a queue header.

Description:
This API is used to write the data of the size specified by bufferSize and stored at the address specified by buffer_addr into a queue header.
注意
Do not read or write a queue in unblocking modes such as an interrupt. This API cannot be called before the LiteOS is initialized. The address of the data of the size specified by bufferSize and stored at the address specified by bufferAddr is to be written. The argument timeout is a relative time. Do not call this API in software timer callback. The buffer_size parameter is not used in the freertos system and buffer length depends on the size transferred during creation. The input parameter queue_id is used as an address in the FreeRtos system, and the input parameter queue_id is used as an integer in the LiteOS system. parameter queue_id is created by osal_msg_queue_create.
参数
queue_id[in] Queue ID created by osal_msg_queue_create.
buffer_addr[out] Starting address that stores the data to be written. The starting address must not be null.
buffer_size[in] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff].
timeout[in] Expiry time. (unit: Tick).
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
liteos freertos
System Differ: The bufferSize of freertos does not support read/write of a specified size,
only supports full storage and rounding.