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

结构体

struct  tagQueueInfo
 

宏定义

#define LOS_ERRNO_QUEUE_MAXNUM_ZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x00)
 
#define LOS_ERRNO_QUEUE_NO_MEMORY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x01)
 
#define LOS_ERRNO_QUEUE_CREATE_NO_MEMORY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x02)
 
#define LOS_ERRNO_QUEUE_SIZE_TOO_BIG   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x03)
 
#define LOS_ERRNO_QUEUE_CB_UNAVAILABLE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x04)
 
#define LOS_ERRNO_QUEUE_NOT_FOUND   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x05)
 
#define LOS_ERRNO_QUEUE_PEND_IN_LOCK   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x06)
 
#define LOS_ERRNO_QUEUE_TIMEOUT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x07)
 
#define LOS_ERRNO_QUEUE_IN_TSKUSE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x08)
 
#define LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x09)
 
#define LOS_ERRNO_QUEUE_NOT_CREATE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0a)
 
#define LOS_ERRNO_QUEUE_IN_TSKWRITE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0b)
 
#define LOS_ERRNO_QUEUE_CREAT_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0c)
 
#define LOS_ERRNO_QUEUE_PARA_ISZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0d)
 
#define LOS_ERRNO_QUEUE_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0e)
 
#define LOS_ERRNO_QUEUE_READ_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0f)
 
#define LOS_ERRNO_QUEUE_READSIZE_IS_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x10)
 
#define LOS_ERRNO_QUEUE_WRITE_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x12)
 
#define LOS_ERRNO_QUEUE_WRITESIZE_ISZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x13)
 
#define LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x15)
 
#define LOS_ERRNO_QUEUE_ISFULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x16)
 
#define LOS_ERRNO_QUEUE_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x17)
 
#define LOS_ERRNO_QUEUE_READ_IN_INTERRUPT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x18)
 
#define LOS_ERRNO_QUEUE_MAIL_HANDLE_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x19)
 
#define LOS_ERRNO_QUEUE_MAIL_PTR_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1a)
 
#define LOS_ERRNO_QUEUE_MAIL_FREE_ERROR   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1b)
 
#define LOS_ERRNO_QUEUE_ISEMPTY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1d)
 
#define LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1f)
 

类型定义

typedef struct tagQueueInfo QUEUE_INFO_S
 

函数

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.
 

详细描述

宏定义说明

◆ LOS_ERRNO_QUEUE_CB_UNAVAILABLE

#define LOS_ERRNO_QUEUE_CB_UNAVAILABLE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x04)

Queue error code: The upper limit of the number of created queues is exceeded.

Value: 0x02000604.

Solution: Increase the configured number of resources for queues.

◆ LOS_ERRNO_QUEUE_CREAT_PTR_NULL

#define LOS_ERRNO_QUEUE_CREAT_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0c)

Queue error code: Parameters passed in during queue creation are null pointers.

Value: 0x0200060c.

Solution: Ensure the passed-in parameters are not null pointers.

◆ LOS_ERRNO_QUEUE_CREATE_NO_MEMORY

#define LOS_ERRNO_QUEUE_CREATE_NO_MEMORY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x02)

Queue error code: The memory for queue creation fails to be requested.

Value: 0x02000602.

Solution: Allocate more memory for queue creation, or decrease the queue length and the number of nodes in the queue to be created.

◆ LOS_ERRNO_QUEUE_IN_TSKUSE

#define LOS_ERRNO_QUEUE_IN_TSKUSE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x08)

Queue error code: The queue that blocks a task cannot be deleted.

Value: 0x02000608.

Solution: Enable the task to obtain resources rather than be blocked on the queue.

◆ LOS_ERRNO_QUEUE_IN_TSKWRITE

#define LOS_ERRNO_QUEUE_IN_TSKWRITE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0b)

Queue error code: Queue reading and writing are not synchronous.

Value: 0x0200060b.

Solution: Synchronize queue reading with queue writing.

◆ LOS_ERRNO_QUEUE_INVALID

#define LOS_ERRNO_QUEUE_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0e)

Queue error code: The handle of the queue is invalid.

Value: 0x0200060e.

Solution: Check whether the passed-in queue handle value is valid.

◆ LOS_ERRNO_QUEUE_ISEMPTY

#define LOS_ERRNO_QUEUE_ISEMPTY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1d)

Queue error code: No resource is in the queue that is being read when the time for waiting to processing the queue expires.

Value: 0x0200061d.

Solution: Ensure that the queue contains messages when it is being read.

◆ LOS_ERRNO_QUEUE_ISFULL

#define LOS_ERRNO_QUEUE_ISFULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x16)

Queue error code: No free node is available during queue writing.

Value: 0x02000616.

Solution: Ensure that free nodes are available before queue writing.

◆ LOS_ERRNO_QUEUE_MAIL_FREE_ERROR

#define LOS_ERRNO_QUEUE_MAIL_FREE_ERROR   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1b)

Queue error code: The memory for the queue fails to be freed.

Value: 0x0200061b.

Solution: Pass in correct input parameters.

◆ LOS_ERRNO_QUEUE_MAIL_HANDLE_INVALID

#define LOS_ERRNO_QUEUE_MAIL_HANDLE_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x19)

Queue error code: The handle of the queue passed-in when the memory for the queue is being freed is invalid.

Value: 0x02000619.

Solution: Check whether the passed-in queue handle value is valid.

◆ LOS_ERRNO_QUEUE_MAIL_PTR_INVALID

#define LOS_ERRNO_QUEUE_MAIL_PTR_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1a)

Queue error code: The pointer to the memory to be freed is null.

Value: 0x0200061a.

Solution: Check whether the passed-in pointer is null.

◆ LOS_ERRNO_QUEUE_MAXNUM_ZERO

#define LOS_ERRNO_QUEUE_MAXNUM_ZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x00)

Queue error code: The maximum number of queue resources is configured to 0.

Value: 0x02000600.

Solution: Configure the maximum number of queue resources to be greater than 0. If queue modules are not used, set the configuration item for the tailoring of the maximum number of queue resources to NO.

弃用:
This error code is obsolete since LiteOS 5.0.0.

◆ LOS_ERRNO_QUEUE_NO_MEMORY

#define LOS_ERRNO_QUEUE_NO_MEMORY   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x01)

Queue error code: The queue block memory fails to be initialized.

Value: 0x02000601.

Solution: Allocate the queue block bigger memory partition, or decrease the maximum number of queue resources.

◆ LOS_ERRNO_QUEUE_NOT_CREATE

#define LOS_ERRNO_QUEUE_NOT_CREATE   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0a)

Queue error code: The queue is not created.

Value: 0x0200060a.

Solution: Check whether the passed-in queue handle value is valid.

◆ LOS_ERRNO_QUEUE_NOT_FOUND

#define LOS_ERRNO_QUEUE_NOT_FOUND   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x05)

Queue error code: Invalid queue.

Value: 0x02000605.

Solution: Ensure that the passed-in queue ID is valid.

◆ LOS_ERRNO_QUEUE_PARA_ISZERO

#define LOS_ERRNO_QUEUE_PARA_ISZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0d)

Queue error code: The queue length or message node size passed in during queue creation is 0.

Value: 0x0200060d.

Solution: Pass in correct queue length and message node size.

◆ LOS_ERRNO_QUEUE_PEND_IN_LOCK

#define LOS_ERRNO_QUEUE_PEND_IN_LOCK   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x06)

Queue error code: The task is forbidden to be blocked on a queue when the task is locked.

Value: 0x02000606.

Solution: Unlock the task before using a queue.

◆ LOS_ERRNO_QUEUE_PTR_NULL

#define LOS_ERRNO_QUEUE_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x17)

Queue error code: The pointer passed in when the queue information is being obtained is null.

Value: 0x02000617.

Solution: Check whether the passed-in pointer is null.

◆ LOS_ERRNO_QUEUE_READ_IN_INTERRUPT

#define LOS_ERRNO_QUEUE_READ_IN_INTERRUPT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x18)

Queue error code: The queue cannot be read during an interrupt when the time for waiting to processing the queue expires.

Value: 0x02000618.

Solution: Set the expiry time to the never-waiting mode, or use asynchronous queues.

◆ LOS_ERRNO_QUEUE_READ_PTR_NULL

#define LOS_ERRNO_QUEUE_READ_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x0f)

Queue error code: The pointer passed in during queue reading is null.

Value: 0x0200060f.

Solution: Check whether the passed-in pointer is null.

◆ LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL

#define LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x1f)

Queue error code: The buffer size passed in during queue reading is smaller than the queue size.

Value: 0x0200061f.

Solution: Increase the buffer size, or use a queue in which nodes are smaller.

◆ LOS_ERRNO_QUEUE_READSIZE_IS_INVALID

#define LOS_ERRNO_QUEUE_READSIZE_IS_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x10)

Queue error code: The buffer size passed in during queue reading is too small or too big.

Value: 0x02000610.

Solution: Pass in a correct buffer size between [sizeof(CHAR*), OS_NULL_SHORT].

◆ LOS_ERRNO_QUEUE_SIZE_TOO_BIG

#define LOS_ERRNO_QUEUE_SIZE_TOO_BIG   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x03)

Queue error code: The size of the biggest message in the created queue is too big.

Value: 0x02000603.

Solution: Change the size of the biggest message in the created queue.

◆ LOS_ERRNO_QUEUE_TIMEOUT

#define LOS_ERRNO_QUEUE_TIMEOUT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x07)

Queue error code: The time set for waiting to processing the queue expires.

Value: 0x02000607.

Solution: Check whether the expiry time setting is appropriate.

◆ LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT

#define LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPT   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x09)

Queue error code: The queue cannot be written during an interrupt when the time for waiting to processing the queue expires.

Value: 0x02000609.

Solution: Set the expiry time to the never-waiting mode, or use asynchronous queues.

◆ LOS_ERRNO_QUEUE_WRITE_PTR_NULL

#define LOS_ERRNO_QUEUE_WRITE_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x12)

Queue error code: The pointer passed in during queue writing is null.

Value: 0x02000612.

Solution: Check whether the passed-in pointer is null.

◆ LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG

#define LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x15)

Queue error code: The buffer size passed in during queue writing is bigger than the queue size.

Value: 0x02000615.

Solution: Decrease the buffer size, or use a queue in which nodes are bigger.

◆ LOS_ERRNO_QUEUE_WRITESIZE_ISZERO

#define LOS_ERRNO_QUEUE_WRITESIZE_ISZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x13)

Queue error code: The buffer size passed in during queue writing is 0.

Value: 0x02000613.

Solution: Pass in a correct buffer size.

类型定义说明

◆ QUEUE_INFO_S

typedef struct tagQueueInfo QUEUE_INFO_S

Structure of the block for queue information query

函数说明

◆ LOS_QueueDelete()

UINT32 LOS_QueueDelete ( UINT32  queueId)
extern

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.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
返回值
LOS_OKThe queue is successfully deleted.
LOS_NOKFailed to release the queue memory.
LOS_ERRNO_QUEUE_NOT_FOUNDThe queue cannot be found.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue handle passed in when the queue is being deleted is incorrect.
LOS_ERRNO_QUEUE_IN_TSKUSEThe queue that blocks a task cannot be deleted.
LOS_ERRNO_QUEUE_IN_TSKWRITEQueue reading and writing are not synchronous.
Dependency:
  • los_queue.h: the header file that contains the API declaration.
参见
LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueInfoGet()

UINT32 LOS_QueueInfoGet ( UINT32  queueId,
QUEUE_INFO_S queueInfo 
)
extern

Obtain queue information.

Description:
This API is used to obtain queue information.
注意
The specific queue should be created firstly before getting the queue information.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
queueInfo[OUT] The queue information to be read must not be null.
返回值
LOS_OKThe queue information is successfully obtained.
LOS_ERRNO_QUEUE_PTR_NULLThe pointer to the queue information to be obtained is null.
LOS_ERRNO_QUEUE_INVALIDThe handle of the queue that is being read is invalid.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue in which the information to be obtained is stored is not created.
Dependency:
  • los_queue.h: the header file that contains the API declaration.
参见
LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueRead()

UINT32 LOS_QueueRead ( UINT32  queueId,
void *  bufferAddr,
UINT32  bufferSize,
UINT32  timeout 
)
extern

Read a queue.

Description:
This API is used to read the address of data in a specified queue, and store it to the address specified by bufferAddr.
注意
  • 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.
  • bufferAddr stores the obtained data address.
  • Do not read or write a queue in unblocking modes such as an interrupt.
  • This API cannot be called before the Huawei LiteOS is initialized.
  • The argument timeout is a relative time.
  • The bufferSize is not really used in LOS_QueueRead, because the interface is only used to obtain the address of data.
  • The buffer which the bufferAddr pointing to must be greater than or equal to 4 bytes.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
bufferAddr[OUT] Starting address that stores the obtained data. The starting address must not be null.
bufferSize[IN] Passed-in buffer size,The value must be greater than sizeof(CHAR*).
timeout[IN] Expiry time. The value range is [0,LOS_WAIT_FOREVER](unit: Tick).
返回值
LOS_OKThe queue is successfully read.
LOS_ERRNO_QUEUE_INVALIDThe handle of the queue that is being read is invalid.
LOS_ERRNO_QUEUE_READ_PTR_NULLThe pointer passed in during queue reading is null.
LOS_ERRNO_QUEUE_READ_IN_INTERRUPTThe queue cannot be read during an interrupt when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue to be read is not created.
LOS_ERRNO_QUEUE_ISEMPTYNo resource is in the queue that is being read when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
Dependency:
  • los_queue.h: The header file that contains the API declaration.
参见
LOS_QueueWrite | LOS_QueueWriteHead | LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueReadCopy()

UINT32 LOS_QueueReadCopy ( UINT32  queueId,
void *  bufferAddr,
UINT32 bufferSize,
UINT32  timeout 
)
extern

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 bufferAddr. 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.
  • bufferAddr 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 Huawei LiteOS is initialized.
  • The argument timeout is a relative time.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
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_OKThe queue is successfully read.
LOS_ERRNO_QUEUE_INVALIDThe handle of the queue that is being read is invalid.
LOS_ERRNO_QUEUE_READ_PTR_NULLThe pointer passed in during queue reading is null.
LOS_ERRNO_QUEUE_READ_IN_INTERRUPTThe queue cannot be read during an interrupt when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue to be read is not created.
LOS_ERRNO_QUEUE_ISEMPTYNo resource is in the queue that is being read when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALLThe buffer size passed in during queue reading is less than the queue size.
Dependency:
  • los_queue.h: the header file that contains the API declaration.
参见
LOS_QueueWriteCopy | LOS_QueueWriteHeadCopy | LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueWrite()

UINT32 LOS_QueueWrite ( UINT32  queueId,
void *  bufferAddr,
UINT32  bufferSize,
UINT32  timeout 
)
extern

Write data into a queue.

Description:
This API is used to write the address of data specified by bufferAddr into a queue.
注意
  • The specific queue should be created firstly.
  • Do not read or write a queue in unblocking modes such as an interrupt.
  • This API cannot be called before the Huawei 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.
  • The bufferSize is not really used in LOS_QueueWrite, because the interface is only used to write the address of data specified by bufferAddr into a queue.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
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_OKThe data is successfully written into the queue.
LOS_ERRNO_QUEUE_INVALIDThe queue handle passed in during queue writing is invalid.
LOS_ERRNO_QUEUE_WRITE_PTR_NULLThe pointer passed in during queue writing is null.
LOS_ERRNO_QUEUE_WRITESIZE_ISZEROThe buffer size passed in during queue writing is 0.
LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPTThe queue cannot be written during an interrupt when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue into which the data is written is not created.
LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIGThe buffer size passed in during queue writing is bigger than the queue size.
LOS_ERRNO_QUEUE_ISFULLNo free node is available during queue writing.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
Dependency:
  • los_queue.h: The header file that contains the API declaration.
参见
LOS_QueueRead | LOS_QueueWriteHead | LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueWriteCopy()

UINT32 LOS_QueueWriteCopy ( UINT32  queueId,
void *  bufferAddr,
UINT32  bufferSize,
UINT32  timeout 
)
extern

Write data into a queue.

Description:
This API is used to write the data of the size specified by bufferSize and stored at the address specified by bufferAddr 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 Huawei LiteOS is initialized.
  • The data to be written is of the size specified by bufferSize and is stored at the address specified by bufferAddr.
  • The argument timeout is a relative time.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
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_OKThe data is successfully written into the queue.
LOS_ERRNO_QUEUE_INVALIDThe queue handle passed in during queue writing is invalid.
LOS_ERRNO_QUEUE_WRITE_PTR_NULLThe pointer passed in during queue writing is null.
LOS_ERRNO_QUEUE_WRITESIZE_ISZEROThe buffer size passed in during queue writing is 0.
LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPTThe queue cannot be written during an interrupt when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue into which the data is written is not created.
LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIGThe buffer size passed in during queue writing is bigger than the queue size.
LOS_ERRNO_QUEUE_ISFULLNo free node is available during queue writing.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
Dependency:
  • los_queue.h: the header file that contains the API declaration.
参见
LOS_QueueReadCopy | LOS_QueueWriteHeadCopy | LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueWriteHead()

UINT32 LOS_QueueWriteHead ( UINT32  queueId,
void *  bufferAddr,
UINT32  bufferSize,
UINT32  timeout 
)
extern

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 bufferAddr 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 Huawei 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.
  • LOS_QueueRead and LOS_QueueWriteHead are a set of interfaces, and the two groups of interfaces need to be used.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
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_OKThe data is successfully written into the queue.
LOS_ERRNO_QUEUE_INVALIDThe queue handle passed in during queue writing is invalid.
LOS_ERRNO_QUEUE_WRITE_PTR_NULLThe pointer passed in during queue writing is null.
LOS_ERRNO_QUEUE_WRITESIZE_ISZEROThe buffer size passed in during queue writing is 0.
LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPTThe 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_CREATEThe queue into which the data is written is not created.
LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIGThe buffer size passed in during queue writing is bigger than the queue size.
LOS_ERRNO_QUEUE_ISFULLNo free node is available during queue writing.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
Dependency:
  • los_queue.h: The header file that contains the API declaration.
参见
LOS_QueueWrite | LOS_QueueRead | LOS_QueueCreate | LOS_QueueCreateStatic
自从
Huawei LiteOS V100R001C00

◆ LOS_QueueWriteHeadCopy()

UINT32 LOS_QueueWriteHeadCopy ( UINT32  queueId,
void *  bufferAddr,
UINT32  bufferSize,
UINT32  timeout 
)
extern

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 bufferAddr 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 Huawei 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.
  • LOS_QueueRead and LOS_QueueWriteHead are a set of interfaces, and the two groups of interfaces need to be used.
  • Do not call this API in software timer callback.
参数
queueId[IN] Queue ID created by LOS_QueueCreate or LOS_QueueCreateStatic. The value range is [0, LOSCFG_BASE_IPC_QUEUE_LIMIT - 1].
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_OKThe data is successfully written into the queue.
LOS_ERRNO_QUEUE_INVALIDThe queue handle passed in during queue writing is invalid.
LOS_ERRNO_QUEUE_WRITE_PTR_NULLThe pointer passed in during queue writing is null.
LOS_ERRNO_QUEUE_WRITESIZE_ISZEROThe buffer size passed in during queue writing is 0.
LOS_ERRNO_QUEUE_WRITE_IN_INTERRUPTThe queue cannot be written during an interrupt when the time for waiting to processing the queue expires.
LOS_ERRNO_QUEUE_NOT_CREATEThe queue into which the data is written is not created.
LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIGThe buffer size passed in during queue writing is bigger than the queue size.
LOS_ERRNO_QUEUE_ISFULLNo free node is available during queue writing.
LOS_ERRNO_QUEUE_PEND_IN_LOCKThe task is forbidden to be blocked on a queue when the task is locked.
LOS_ERRNO_QUEUE_TIMEOUTThe time set for waiting to processing the queue expires.
Dependency:
  • los_queue.h: The header file that contains the API declaration.
参见
LOS_QueueWriteCopy | LOS_QueueReadCopy
自从
Huawei LiteOS V100R001C00