结构体 | |
struct | LosQueueCB |
struct | tagQueueInfo |
类型定义 | |
typedef struct tagQueueInfo | QUEUE_INFO_S |
函数 | |
VOID * | OsQueueMailAlloc (UINT32 queueID, VOID *mailPool, UINT32 timeout) |
Alloc a stationary memory for a mail. 更多... | |
UINT32 | OsQueueMailFree (UINT32 queueID, VOID *mailPool, VOID *mailMem) |
Free a stationary memory of a mail. 更多... | |
UINT32 | LOS_QueueCreate (CHAR *queueName, UINT16 len, UINT32 *queueID, UINT32 flags, UINT16 maxMsgSize) |
Create a message queue. 更多... | |
UINT32 | LOS_QueueReadCopy (UINT32 queueID, VOID *bufferAddr, UINT32 *bufferSize, UINT32 timeout) |
Read a queue. 更多... | |
UINT32 | LOS_QueueWriteCopy (UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout) |
Write data into a queue. 更多... | |
UINT32 | LOS_QueueRead (UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout) |
Read a queue. 更多... | |
UINT32 | LOS_QueueWrite (UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout) |
Write data into a queue. 更多... | |
UINT32 | LOS_QueueWriteHead (UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout) |
Write data into a queue header. 更多... | |
UINT32 | LOS_QueueWriteHeadCopy (UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout) |
Write data into a queue header. 更多... | |
UINT32 | LOS_QueueDelete (UINT32 queueID) |
Delete a queue. 更多... | |
UINT32 | LOS_QueueInfoGet (UINT32 queueID, QUEUE_INFO_S *queueInfo) |
Obtain queue information. 更多... | |
变量 | |
LosQueueCB * | g_allQueue |
消息队列池 更多... | |
typedef struct tagQueueInfo QUEUE_INFO_S |
Structure of the block for queue information query
UINT32 LOS_QueueCreate | ( | CHAR * | queueName, |
UINT16 | len, | ||
UINT32 * | queueID, | ||
UINT32 | flags, | ||
UINT16 | maxMsgSize | ||
) |
Create a message queue.
queueName | [IN] Message queue name. Reserved parameter, not used for now. |
len | [IN] Queue length. The value range is [1,0xffff]. |
queueID | [OUT] ID of the queue control structure that is successfully created. |
flags | [IN] Queue mode. Reserved parameter, not used for now. |
maxMsgSize | [IN] Node size. The value range is [1,0xffff-4]. |
#LOS_OK | The message queue is successfully created. |
#LOS_ERRNO_QUEUE_CB_UNAVAILABLE | The upper limit of the number of created queues is exceeded. |
#LOS_ERRNO_QUEUE_CREATE_NO_MEMORY | Insufficient memory for queue creation. |
#LOS_ERRNO_QUEUE_CREAT_PTR_NULL | Null pointer, queueID is NULL. |
#LOS_ERRNO_QUEUE_PARA_ISZERO | The queue length or message node size passed in during queue creation is 0. |
#LOS_ERRNO_QUEUE_SIZE_TOO_BIG | The parameter usMaxMsgSize is larger than 0xffff - 4. |
Create a message queue.
在文件 los_queue.c 第 131 行定义.
Delete a queue.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
#LOS_OK | The queue is successfully deleted. |
#LOS_ERRNO_QUEUE_NOT_FOUND | The queue cannot be found. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue handle passed in when the queue is being deleted is incorrect. |
#LOS_ERRNO_QUEUE_IN_TSKUSE | The queue that blocks a task cannot be deleted. |
#LOS_ERRNO_QUEUE_IN_TSKWRITE | Queue reading and writing are not synchronous. |
外部接口 删除队列,还有任务要读/写消息时不能删除 删除队列时,根据传入的队列ID寻找到对应的队列,把队列状态置为未使用, 释放原队列所占的空间,对应的队列控制头置为初始状态。 *
在文件 los_queue.c 第 486 行定义.
UINT32 LOS_QueueInfoGet | ( | UINT32 | queueID, |
QUEUE_INFO_S * | queueInfo | ||
) |
Obtain queue information.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
queueInfo | [OUT] The queue information to be read must not be null. |
#LOS_OK | The queue information is successfully obtained. |
#LOS_ERRNO_QUEUE_PTR_NULL | The pointer to the queue information to be obtained is null. |
#LOS_ERRNO_QUEUE_INVALID | The handle of the queue that is being read is invalid. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue in which the information to be obtained is stored is not created. |
Obtain queue information.
在文件 los_queue.c 第 542 行定义.
Read a queue.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [OUT] Starting address that stores the obtained data. The starting address must not be null. |
bufferSize | [IN] Passed-in buffer size,The value range is [sizeof(CHAR*),OS_NULL_SHORT - sizeof(UINT32)]. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The queue is successfully read. |
#LOS_ERRNO_QUEUE_INVALID | The handle of the queue that is being read is invalid. |
#LOS_ERRNO_QUEUE_READ_PTR_NULL | The pointer passed in during queue reading is null. |
#LOS_ERRNO_QUEUE_READSIZE_IS_INVALID | The buffer size passed in during queue reading is invalid. |
#LOS_ERRNO_QUEUE_READ_IN_INTERRUPT | The queue cannot be read during an interrupt when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue to be read is not created. |
#LOS_ERRNO_QUEUE_ISEMPTY | No resource is in the queue that is being read when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
外部接口 读一个队列数据 读队列时,根据Head找到最先写入队列中的消息节点进行读取。如果Head已经指向队列尾则采用回卷方式。 根据usReadableCnt判断队列是否有消息读取,对全部空闲(usReadableCnt为0)队列进行读队列操作会引起任务挂起。 *
在文件 los_queue.c 第 436 行定义.
Read a queue.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [OUT] Starting address that stores the obtained data. The starting address must not be null. |
bufferSize | [IN/OUT] Where to maintain the buffer wanted-size before read, and the real-size after read. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The queue is successfully read. |
#LOS_ERRNO_QUEUE_INVALID | The handle of the queue that is being read is invalid. |
#LOS_ERRNO_QUEUE_READ_PTR_NULL | The pointer passed in during queue reading is null. |
#LOS_ERRNO_QUEUE_READSIZE_IS_INVALID | The buffer size passed in during queue reading is invalid. |
#LOS_ERRNO_QUEUE_READ_IN_INTERRUPT | The queue cannot be read during an interrupt when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue to be read is not created. |
#LOS_ERRNO_QUEUE_ISEMPTY | No resource is in the queue that is being read when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL | The buffer size passed in during queue reading is less than the queue size. |
Read a queue.
在文件 los_queue.c 第 377 行定义.
Write data into a queue.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [IN] Starting address that stores the data to be written. The starting address must not be null. |
bufferSize | [IN] This parameter is not in use temporarily. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The data is successfully written into the queue. |
#LOS_ERRNO_QUEUE_INVALID | The queue handle passed in during queue writing is invalid. |
#LOS_ERRNO_QUEUE_WRITE_PTR_NULL | The pointer passed in during queue writing is null. |
#LOS_ERRNO_QUEUE_WRITESIZE_ISZERO | The buffer size passed in during queue writing is 0. |
#LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT | The queue cannot be written during an interrupt when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue into which the data is written is not created. |
#LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG | The buffer size passed in during queue writing is bigger than the queue size. |
#LOS_ERRNO_QUEUE_ISFULL | No free node is available during queue writing. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
外部接口 写一个队列数据 根据Tail找到被占用消息节点末尾的空闲节点作为数据写入对象。如果Tail已经指向队列尾则采用回卷方式。 根据usWritableCnt判断队列是否可以写入,不能对已满(usWritableCnt为0)队列进行写队列操作 *
在文件 los_queue.c 第 449 行定义.
Write data into a queue.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [IN] Starting address that stores the data to be written.The starting address must not be null. |
bufferSize | [IN] Passed-in buffer size. The value range is [1,USHRT_MAX - sizeof(UINT32)]. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The data is successfully written into the queue. |
#LOS_ERRNO_QUEUE_INVALID | The queue handle passed in during queue writing is invalid. |
#LOS_ERRNO_QUEUE_WRITE_PTR_NULL | The pointer passed in during queue writing is null. |
#LOS_ERRNO_QUEUE_WRITESIZE_ISZERO | The buffer size passed in during queue writing is 0. |
#LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT | The queue cannot be written during an interrupt when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue into which the data is written is not created. |
#LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG | The buffer size passed in during queue writing is bigger than the queue size. |
#LOS_ERRNO_QUEUE_ISFULL | No free node is available during queue writing. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
Write data into a queue.
在文件 los_queue.c 第 411 行定义.
Write data into a queue header.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [OUT] Starting address that stores the data to be written. The starting address must not be null. |
bufferSize | [IN] This parameter is not in use temporarily. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The data is successfully written into the queue. |
#LOS_ERRNO_QUEUE_INVALID | The queue handle passed in during queue writing is invalid. |
#LOS_ERRNO_QUEUE_WRITE_PTR_NULL | The pointer passed in during queue writing is null. |
#LOS_ERRNO_QUEUE_WRITESIZE_ISZERO | The buffer size passed in during queue writing is 0. |
#LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT | The queue cannot be written during an interrupt when the time for waiting to processing the queue expires. waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue into which the data is written is not created. |
#LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG | The buffer size passed in during queue writing is bigger than the queue size. |
#LOS_ERRNO_QUEUE_ISFULL | No free node is available during queue writing. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
外部接口 从头部写入 写队列时,根据Tail找到被占用消息节点末尾的空闲节点作为数据写入对象。如果Tail已经指向队列尾则采用回卷方式。 根据usWritableCnt判断队列是否可以写入,不能对已满(usWritableCnt为0)队列进行写队列操作 *
在文件 los_queue.c 第 466 行定义.
UINT32 LOS_QueueWriteHeadCopy | ( | UINT32 | queueID, |
VOID * | bufferAddr, | ||
UINT32 | bufferSize, | ||
UINT32 | timeout | ||
) |
Write data into a queue header.
queueID | [IN] Queue ID created by LOS_QueueCreate. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
bufferAddr | [OUT] Starting address that stores the data to be written. The starting address must not be null. |
bufferSize | [IN] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff]. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick). |
#LOS_OK | The data is successfully written into the queue. |
#LOS_ERRNO_QUEUE_INVALID | The queue handle passed in during queue writing is invalid. |
#LOS_ERRNO_QUEUE_WRITE_PTR_NULL | The pointer passed in during queue writing is null. |
#LOS_ERRNO_QUEUE_WRITESIZE_ISZERO | The buffer size passed in during queue writing is 0. |
#LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT | The queue cannot be written during an interrupt when the time for waiting to processing the queue expires. |
#LOS_ERRNO_QUEUE_NOT_CREATE | The queue into which the data is written is not created. |
#LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG | The buffer size passed in during queue writing is bigger than the queue size. |
#LOS_ERRNO_QUEUE_ISFULL | No free node is available during queue writing. |
#LOS_ERRNO_QUEUE_PEND_IN_LOCK | The task is forbidden to be blocked on a queue when the task is locked. |
#LOS_ERRNO_QUEUE_TIMEOUT | The time set for waiting to processing the queue expires. |
Write data into a queue header.
在文件 los_queue.c 第 394 行定义.
Alloc a stationary memory for a mail.
queueID | [IN] Queue ID. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
mailPool | [IN] The memory poll that stores the mail. |
timeout | [IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER]. |
#NULL | The memory allocation is failed. |
#pMem | The address of alloc memory. |
Free a stationary memory of a mail.
queueID | [IN] Queue ID. The value range is [1,LOSCFG_BASE_IPC_QUEUE_LIMIT]. |
mailPool | [IN] The mail memory poll address. |
mailMem | [IN] The mail memory block address. |
#LOS_OK | 0x00000000: The memory free successfully. |
#OS_ERRNO_QUEUE_MAIL_HANDLE_INVALID | 0x02000619: The handle of the queue passed-in when the memory for the queue is being freed is invalid. |
#OS_ERRNO_QUEUE_MAIL_PTR_INVALID | 0x0200061a: The pointer to the memory to be freed is null. |
#OS_ERRNO_QUEUE_MAIL_FREE_ERROR | 0x0200061b: The memory for the queue fails to be freed. |
|
extern |