feature:支持queue地址外部部署共功能及queue名字设置
Signed-off-by: xuxinyu <xuxinyu6@huawei.com> Change-Id: I1984014956a92d61d65b68f79279b2aa593a72e1
This commit is contained in:
parent
df30bc4e0a
commit
c09b3a8774
|
@ -1226,14 +1226,40 @@ osMessageQueueId_t osMessageQueueNew(uint32_t msg_count, uint32_t msg_size, cons
|
|||
{
|
||||
UINT32 queueId;
|
||||
UINT32 ret;
|
||||
UNUSED(attr);
|
||||
osMessageQueueId_t handle;
|
||||
const char *queueName = NULL;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
UINT32 queueSize = 0;
|
||||
UINT8 *staticMem = NULL;
|
||||
#endif
|
||||
|
||||
if ((msg_count == 0) || (msg_size == 0) || OS_INT_ACTIVE) {
|
||||
return (osMessageQueueId_t)NULL;
|
||||
}
|
||||
|
||||
ret = LOS_QueueCreate((char *)NULL, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
if (attr != NULL) {
|
||||
queueName = attr->name;
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
queueSize = attr->mq_size;
|
||||
staticMem = attr->mq_mem;
|
||||
if ((queueSize == 0 || staticMem == NULL)) {
|
||||
return (osMessageQueueId_t)NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (staticMem != NULL) {
|
||||
ret = LOS_QueueCreateStatic((const CHAR *)queueName, (UINT16)msg_count, &queueId, \
|
||||
(UINT8 *)staticMem, 0, (UINT16)queueSize / msg_count);
|
||||
} else {
|
||||
ret = LOS_QueueCreate((const CHAR *)queueName, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
}
|
||||
#else
|
||||
ret = LOS_QueueCreate((const CHAR *)queueName, (UINT16)msg_count, &queueId, 0, (UINT16)msg_size);
|
||||
#endif
|
||||
|
||||
if (ret == LOS_OK) {
|
||||
handle = (osMessageQueueId_t)(GET_QUEUE_HANDLE(queueId));
|
||||
} else {
|
||||
|
@ -1361,8 +1387,13 @@ osStatus_t osMessageQueueDelete(osMessageQueueId_t mq_id)
|
|||
|
||||
const char *osMessageQueueGetName(osMessageQueueId_t mq_id)
|
||||
{
|
||||
UNUSED(mq_id);
|
||||
return NULL;
|
||||
if (mq_id == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LosQueueCB *pstQueue = (LosQueueCB *)mq_id;
|
||||
|
||||
return (const char *)pstQueue->queueName;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -350,6 +350,14 @@ extern "C" {
|
|||
#define LOSCFG_BASE_IPC_QUEUE_LIMIT 6
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Maximum supported number of static queues rather than the number of usable queues
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT
|
||||
#define LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT 3
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Software timer module configuration
|
||||
|
|
|
@ -380,7 +380,7 @@ typedef struct tagQueueInfo {
|
|||
* <ul>
|
||||
* <li>There are LOSCFG_BASE_IPC_QUEUE_LIMIT queues available, change it's value when necessary.</li>
|
||||
* </ul>
|
||||
* @param queueName [IN] Message queue name. Reserved parameter, not used for now.
|
||||
* @param queueName [IN] Message queue name.
|
||||
* @param len [IN] Queue length. The value range is [1,0xffff].
|
||||
* @param queueID [OUT] ID of the queue control structure that is successfully created.
|
||||
* @param flags [IN] Queue mode. Reserved parameter, not used for now.
|
||||
|
@ -403,6 +403,41 @@ extern UINT32 LOS_QueueCreate(const CHAR *queueName,
|
|||
UINT32 flags,
|
||||
UINT16 maxMsgSize);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Create a message queue.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to create a message queue.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>There are LOSCFG_BASE_IPC_QUEUE_LIMIT queues available, change it's value when necessary.</li>
|
||||
* </ul>
|
||||
* @param queueName [IN] Message queue name.
|
||||
* @param len [IN] Queue length. The value range is [1,0xffff].
|
||||
* @param queueID [OUT] ID of the queue control structure that is successfully created.
|
||||
* @param staticMem [IN] Pointer to a static memory for the message queue data.
|
||||
* @param flags [IN] Queue mode. Reserved parameter, not used for now.
|
||||
* @param maxMsgSize [IN] Node size. The value range is [1,0xffff-4].
|
||||
*
|
||||
* @retval #LOS_OK The message queue is successfully created.
|
||||
* @retval #LOS_ERRNO_QUEUE_CB_UNAVAILABLE The upper limit of the number of created queues is exceeded.
|
||||
* @retval #LOS_ERRNO_QUEUE_CREATE_NO_MEMORY Insufficient memory for queue creation.
|
||||
* @retval #LOS_ERRNO_QUEUE_CREAT_PTR_NULL Null pointer, queueID is NULL.
|
||||
* @retval #LOS_ERRNO_QUEUE_PARA_ISZERO The queue length or message node size passed in during queue
|
||||
* creation is 0.
|
||||
* @retval #LOS_ERRNO_QUEUE_SIZE_TOO_BIG The parameter maxMsgSize is larger than 0xffff - 4.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_queue.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueDelete
|
||||
*/
|
||||
extern UINT32 LOS_QueueCreateStatic(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Read a queue.
|
||||
|
@ -775,6 +810,7 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
UINT8 *queue; /**< Pointer to a queue handle */
|
||||
UINT8 *queueName; /**< Queue name */
|
||||
UINT16 queueState; /**< Queue state */
|
||||
UINT16 queueLen; /**< Queue length */
|
||||
UINT16 queueSize; /**< Node size */
|
||||
|
@ -787,6 +823,9 @@ typedef struct {
|
|||
LOS_DL_LIST memList; /**< Pointer to the memory linked list */
|
||||
} LosQueueCB;
|
||||
|
||||
|
||||
extern LosQueueCB *OsGetQueueHandle(UINT32 queueID);
|
||||
|
||||
/* queue state */
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
|
@ -822,14 +861,24 @@ extern LosQueueCB *g_allQueue;
|
|||
* @ingroup los_queue
|
||||
* Obtain a handle of the queue that has a specified ID.
|
||||
*/
|
||||
#define GET_QUEUE_HANDLE(QueueID) (((LosQueueCB *)g_allQueue) + (QueueID))
|
||||
#define GET_QUEUE_HANDLE(QueueID) OsGetQueueHandle(QueueID)
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* Obtain the head node in a queue doubly linked list.
|
||||
* Obtain the head node in a queue doubly linked list.
|
||||
*/
|
||||
#define GET_QUEUE_LIST(ptr) LOS_DL_LIST_ENTRY(ptr, LosQueueCB, readWriteList[OS_QUEUE_WRITE])
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* Maximum number of queues
|
||||
*/
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
#define OS_ALL_IPC_QUEUE_LIMIT LOSCFG_BASE_IPC_QUEUE_LIMIT + LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT
|
||||
#else
|
||||
#define OS_ALL_IPC_QUEUE_LIMIT LOSCFG_BASE_IPC_QUEUE_LIMIT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Alloc a stationary memory for a mail.
|
||||
|
|
|
@ -47,6 +47,11 @@
|
|||
LITE_OS_SEC_BSS LosQueueCB *g_allQueue = NULL ;
|
||||
LITE_OS_SEC_BSS LOS_DL_LIST g_freeQueueList;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LITE_OS_SEC_BSS LosQueueCB *g_staticQueue = NULL ;
|
||||
LITE_OS_SEC_BSS LOS_DL_LIST g_freeStaticQueueList;
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
Function : OsQueueInit
|
||||
Description : queue initial
|
||||
|
@ -59,7 +64,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsQueueInit(VOID)
|
|||
LosQueueCB *queueNode = NULL;
|
||||
UINT16 index;
|
||||
|
||||
if (LOSCFG_BASE_IPC_QUEUE_LIMIT == 0) {
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LosQueueCB *queueNodeStatic = NULL;
|
||||
#endif
|
||||
|
||||
if (OS_ALL_IPC_QUEUE_LIMIT == 0) {
|
||||
return LOS_ERRNO_QUEUE_MAXNUM_ZERO;
|
||||
}
|
||||
|
||||
|
@ -78,24 +87,33 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsQueueInit(VOID)
|
|||
LOS_ListTailInsert(&g_freeQueueList, &queueNode->readWriteList[OS_QUEUE_WRITE]);
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
g_staticQueue = (LosQueueCB *)LOS_MemAlloc(m_aucSysMem0, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB));
|
||||
if (g_staticQueue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_NO_MEMORY;
|
||||
}
|
||||
|
||||
(VOID)memset_s(g_staticQueue, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB),
|
||||
0, LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT * sizeof(LosQueueCB));
|
||||
|
||||
LOS_ListInit(&g_freeStaticQueueList);
|
||||
for (index = 0; index < LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT; index++) {
|
||||
queueNodeStatic = ((LosQueueCB *)g_staticQueue) + index;
|
||||
queueNodeStatic->queueID = index + LOSCFG_BASE_IPC_QUEUE_LIMIT;
|
||||
LOS_ListTailInsert(&g_freeStaticQueueList, &queueNodeStatic->readWriteList[OS_QUEUE_WRITE]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreate
|
||||
Description : Create a queue
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
|
||||
static UINT32 OsQueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
LosQueueCB *queueCB = NULL;
|
||||
UINT32 intSave;
|
||||
|
@ -103,7 +121,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
|||
UINT8 *queue = NULL;
|
||||
UINT16 msgSize;
|
||||
|
||||
(VOID)queueName;
|
||||
(VOID)flags;
|
||||
|
||||
if (queueID == NULL) {
|
||||
|
@ -124,6 +141,32 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
|||
if ((UINT32_MAX / msgSize) < len) {
|
||||
return LOS_ERRNO_QUEUE_SIZE_TOO_BIG;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (staticMem != NULL) {
|
||||
queue = staticMem;
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
if (LOS_ListEmpty(&g_freeStaticQueueList)) {
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeStaticQueueList));
|
||||
} else {
|
||||
queue = (UINT8 *)LOS_MemAlloc(m_aucSysMem0, (UINT32)len * msgSize);
|
||||
if (queue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_CREATE_NO_MEMORY;
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_ListEmpty(&g_freeQueueList)) {
|
||||
LOS_IntRestore(intSave);
|
||||
(VOID)LOS_MemFree(m_aucSysMem0, queue);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeQueueList));
|
||||
}
|
||||
#else
|
||||
queue = (UINT8 *)LOS_MemAlloc(m_aucSysMem0, (UINT32)len * msgSize);
|
||||
if (queue == NULL) {
|
||||
return LOS_ERRNO_QUEUE_CREATE_NO_MEMORY;
|
||||
|
@ -135,10 +178,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
|||
(VOID)LOS_MemFree(m_aucSysMem0, queue);
|
||||
return LOS_ERRNO_QUEUE_CB_UNAVAILABLE;
|
||||
}
|
||||
|
||||
unusedQueue = LOS_DL_LIST_FIRST(&(g_freeQueueList));
|
||||
#endif
|
||||
|
||||
LOS_ListDelete(unusedQueue);
|
||||
queueCB = (GET_QUEUE_LIST(unusedQueue));
|
||||
queueCB->queueName = (UINT8 *)queueName; // The name can be null
|
||||
queueCB->queueLen = len;
|
||||
queueCB->queueSize = msgSize;
|
||||
queueCB->queue = queue;
|
||||
|
@ -159,10 +204,62 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
|||
return LOS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreateStatic
|
||||
Description : Create a queue use static menory
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: queueMem --- Queue static memory for data storage
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreateStatic(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT8 *staticMem,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
(VOID)flags;
|
||||
|
||||
ret = OsQueueCreate(queueName, len, queueID, staticMem, 0, maxMsgSize);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_QueueCreate
|
||||
Description : Create a queue
|
||||
Input : queueName --- Queue name, less than 4 characters
|
||||
: len --- Queue length
|
||||
: flags --- Queue type, FIFO or PRIO
|
||||
: maxMsgSize --- Maximum message size in byte
|
||||
Output : queueID --- Queue ID
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueCreate(const CHAR *queueName,
|
||||
UINT16 len,
|
||||
UINT32 *queueID,
|
||||
UINT32 flags,
|
||||
UINT16 maxMsgSize)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
(VOID)flags;
|
||||
|
||||
ret = OsQueueCreate(queueName, len, queueID, NULL, 0, maxMsgSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueReadParameterCheck(UINT32 queueID, VOID *bufferAddr,
|
||||
UINT32 *bufferSize, UINT32 timeOut)
|
||||
{
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
if ((bufferAddr == NULL) || (bufferSize == NULL)) {
|
||||
|
@ -184,7 +281,7 @@ static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueReadParameterCheck(UINT32 queueID,
|
|||
static INLINE LITE_OS_SEC_TEXT UINT32 OsQueueWriteParameterCheck(UINT32 queueID, VOID *bufferAddr,
|
||||
UINT32 *bufferSize, UINT32 timeOut)
|
||||
{
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
|
||||
|
@ -459,7 +556,7 @@ LITE_OS_SEC_TEXT VOID *OsQueueMailAlloc(UINT32 queueID, VOID *mailPool, UINT32 t
|
|||
LosQueueCB *queueCB = (LosQueueCB *)NULL;
|
||||
LosTaskCB *runTsk = (LosTaskCB *)NULL;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -523,7 +620,7 @@ LITE_OS_SEC_TEXT UINT32 OsQueueMailFree(UINT32 queueID, VOID *mailPool, VOID *ma
|
|||
LosQueueCB *queueCB = (LosQueueCB *)NULL;
|
||||
LosTaskCB *resumedTask = (LosTaskCB *)NULL;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_MAIL_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
|
@ -573,7 +670,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueDelete(UINT32 queueID)
|
|||
UINT32 intSave;
|
||||
UINT32 ret;
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -608,6 +705,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_QueueDelete(UINT32 queueID)
|
|||
queue = queueCB->queue;
|
||||
queueCB->queue = (UINT8 *)NULL;
|
||||
queueCB->queueState = OS_QUEUE_UNUSED;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT && queueID < OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
LOS_ListAdd(&g_freeStaticQueueList, &queueCB->readWriteList[OS_QUEUE_WRITE]);
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
LOS_ListAdd(&g_freeQueueList, &queueCB->readWriteList[OS_QUEUE_WRITE]);
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
|
@ -632,7 +737,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_QueueInfoGet(UINT32 queueID, QUEUE_INFO_S *que
|
|||
return LOS_ERRNO_QUEUE_PTR_NULL;
|
||||
}
|
||||
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT) {
|
||||
if (queueID >= OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return LOS_ERRNO_QUEUE_INVALID;
|
||||
}
|
||||
|
||||
|
@ -673,5 +778,16 @@ QUEUE_END:
|
|||
return ret;
|
||||
}
|
||||
|
||||
LosQueueCB *OsGetQueueHandle(UINT32 queueID)
|
||||
{
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
if (queueID >= LOSCFG_BASE_IPC_QUEUE_LIMIT && queueID < OS_ALL_IPC_QUEUE_LIMIT) {
|
||||
return (((LosQueueCB *)g_staticQueue) + (queueID - LOSCFG_BASE_IPC_QUEUE_LIMIT));
|
||||
}
|
||||
#endif
|
||||
|
||||
return (((LosQueueCB *)g_allQueue) + (queueID));
|
||||
}
|
||||
|
||||
#endif /* (LOSCFG_BASE_IPC_QUEUE == 1) */
|
||||
|
||||
|
|
|
@ -49,10 +49,10 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT], 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CB_UNAVAILABLE, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWrite(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueWrite(OS_ALL_IPC_QUEUE_LIMIT + 1, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueRead(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueRead(OS_ALL_IPC_QUEUE_LIMIT + 1, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
|
|
|
@ -41,7 +41,7 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWrite(LOSCFG_BASE_IPC_QUEUE_LIMIT, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueWrite(OS_ALL_IPC_QUEUE_LIMIT, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
|
|
|
@ -69,7 +69,7 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1);
|
||||
ret = LOS_QueueDelete(OS_ALL_IPC_QUEUE_LIMIT + 1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_FOUND, ret, EXIT);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
|
|
|
@ -38,15 +38,15 @@ static UINT32 Testcase(VOID)
|
|||
UINT32 swTmrID;
|
||||
QUEUE_INFO_S queueInfo;
|
||||
|
||||
swTmrID = LOSCFG_BASE_IPC_QUEUE_LIMIT + 1;
|
||||
swTmrID = OS_ALL_IPC_QUEUE_LIMIT + 1;
|
||||
ret = LOS_QueueInfoGet(swTmrID, &queueInfo);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
swTmrID = LOSCFG_BASE_IPC_QUEUE_LIMIT;
|
||||
swTmrID = OS_ALL_IPC_QUEUE_LIMIT;
|
||||
ret = LOS_QueueInfoGet(swTmrID, &queueInfo);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
swTmrID = LOSCFG_BASE_IPC_QUEUE_LIMIT - 1;
|
||||
swTmrID = OS_ALL_IPC_QUEUE_LIMIT - 1;
|
||||
ret = LOS_QueueInfoGet(swTmrID, &queueInfo);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret, EXIT);
|
||||
|
||||
|
|
|
@ -49,10 +49,10 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[LOSCFG_BASE_IPC_QUEUE_LIMIT], 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_CB_UNAVAILABLE, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWriteHead(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueWriteHead(OS_ALL_IPC_QUEUE_LIMIT + 1, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueRead(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueRead(OS_ALL_IPC_QUEUE_LIMIT + 1, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
EXIT:
|
||||
|
|
|
@ -41,7 +41,7 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueWriteHead(LOSCFG_BASE_IPC_QUEUE_LIMIT, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ret = LOS_QueueWriteHead(OS_ALL_IPC_QUEUE_LIMIT, &buff1, QUEUE_BASE_MSGSIZE, 0);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_INVALID, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
|
||||
|
|
|
@ -70,7 +70,7 @@ static UINT32 Testcase(VOID)
|
|||
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||
|
||||
ret = LOS_QueueDelete(LOSCFG_BASE_IPC_QUEUE_LIMIT + 1);
|
||||
ret = LOS_QueueDelete(OS_ALL_IPC_QUEUE_LIMIT + 1);
|
||||
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_FOUND, ret, EXIT);
|
||||
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
|
|
|
@ -102,18 +102,34 @@ UINT32 SwtmrCountGetTest(VOID)
|
|||
}
|
||||
|
||||
extern LosQueueCB *g_allQueue;
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
extern LosQueueCB *g_staticQueue;
|
||||
#endif
|
||||
|
||||
UINT32 QueueUsedCountGet(VOID)
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 count = 0;
|
||||
UINT32 index;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
for (UINT32 index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT; index++) {
|
||||
for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT; index++) {
|
||||
LosQueueCB *queueNode = ((LosQueueCB *)g_allQueue) + index;
|
||||
if (queueNode->queueState == OS_QUEUE_INUSED) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
|
||||
for (index = 0; index < LOSCFG_BASE_IPC_STATIC_QUEUE_LIMIT; index++) {
|
||||
LosQueueCB *queueNode = ((LosQueueCB *)g_staticQueue) + index;
|
||||
if (queueNode->queueState == OS_QUEUE_INUSED) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
return count;
|
||||
|
|
Loading…
Reference in New Issue