diff --git a/kernel/include/los_queue.h b/kernel/include/los_queue.h
index 7dc50cc9..be147bd0 100644
--- a/kernel/include/los_queue.h
+++ b/kernel/include/los_queue.h
@@ -487,6 +487,45 @@ extern UINT32 LOS_QueueReadCopy(UINT32 queueID,
UINT32 *bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Read a queue in i.
+ *
+ * @par 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.
+ * It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - 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.
+ * - This API cannot be called before the kernel is initialized.
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [OUT] Starting address that stores the obtained data. The starting address must not be
+ * null.
+ * @param bufferSize [IN/OUT] Where to maintain the buffer expected-size before read, and the real-size after read.
+ *
+ * @retval #LOS_OK The queue is successfully read.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The handle of the queue that is being read is invalid.
+ * @retval #LOS_ERRNO_QUEUE_READ_PTR_NULL The pointer passed in during queue reading is null.
+ * @retval #LOS_ERRNO_QUEUE_READSIZE_ISZERO The buffer size passed in during queue reading is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue to be read is not created.
+ * @retval #LOS_ERRNO_QUEUE_ISEMPTY No resource is in the queue that is being read when the time for
+ * waiting to processing the queue expires.
+ * @retval #LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL The buffer size passed in during queue reading is less than
+ * the queue size.
+ * @par Dependency:
+ * - los_queue.h: the header file that contains the API declaration.
+ * @see LOS_QueueWriteCopy | LOS_QueueCreate
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueReadCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 *bufferSize);
/**
* @ingroup los_queue
* @brief Write data into a queue.
@@ -533,6 +572,43 @@ extern UINT32 LOS_QueueWriteCopy(UINT32 queueID,
UINT32 bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Write data into a queue.
+ *
+ * @par 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.It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - The specific queue should be created firstly.
+ * - This API cannot be called before the kernel is initialized.
+ * - The data to be written is of the size specified by bufferSize and is stored at the address specified by
+ * BufferAddr.
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [IN] Starting address that stores the data to be written.The starting address must
+ * not be null.
+ * @param bufferSize [IN] Passed-in buffer size. The value range is [1,USHRT_MAX - sizeof(UINT32)].
+ *
+ * @retval #LOS_OK The data is successfully written into the queue.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The queue handle passed in during queue writing is invalid.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_PTR_NULL The pointer passed in during queue writing is null.
+ * @retval #LOS_ERRNO_QUEUE_WRITESIZE_ISZERO The buffer size passed in during queue writing is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue into which the data is written is not created.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG The buffer size passed in during queue writing is bigger than
+ * the queue size.
+ * @retval #LOS_ERRNO_QUEUE_ISFULL No free node is available during queue writing.
+ * @par Dependency:
+ * - los_queue.h: the header file that contains the API declaration.
+ * @see LOS_QueueReadCopy | LOS_QueueCreate
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize);
+
/**
* @ingroup los_queue
* @brief Read a queue.
@@ -582,6 +658,46 @@ extern UINT32 LOS_QueueRead(UINT32 queueID,
UINT32 bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Read a queue.
+ *
+ * @par Description:
+ * This API is used to read the address of data in a specified queue, and store it to the address specified by
+ * bufferAddr.It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - 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.
+ * - This API cannot be called before the kernel is initialized.
+ * - 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.
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [OUT] Starting address that stores the obtained data. The starting address must
+ * not be null.
+ * @param bufferSize [IN] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff].
+ *
+ * @retval #LOS_OK The queue is successfully read.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The handle of the queue that is being read is invalid.
+ * @retval #LOS_ERRNO_QUEUE_READ_PTR_NULL The pointer passed in during queue reading is null.
+ * @retval #LOS_ERRNO_QUEUE_READSIZE_ISZERO The buffer size passed in during queue reading is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue to be read is not created.
+ * @retval #LOS_ERRNO_QUEUE_ISEMPTY No resource is in the queue that is being read when the time for
+ * waiting to processing the queue expires.
+ * @par Dependency:
+ * - los_queue.h: The header file that contains the API declaration.
+ * @see LOS_QueueWrite | LOS_QueueCreate
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueReadIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize);
+
/**
* @ingroup los_queue
* @brief Write data into a queue.
@@ -629,6 +745,45 @@ extern UINT32 LOS_QueueWrite(UINT32 queueID,
UINT32 bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Write data into a queue.
+ *
+ * @par Description:
+ * This API is used to write the address of data specified by bufferAddr into a queue.
+ * It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - The specific queue should be created firstly.
+ * - This API cannot be called before the kernel 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 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.
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [IN] Starting address that stores the data to be written. The starting address
+ * must not be null.
+ * @param bufferSize [IN] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff].
+ *
+ * @retval #LOS_OK The data is successfully written into the queue.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The queue handle passed in during queue writing is invalid.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_PTR_NULL The pointer passed in during queue writing is null.
+ * @retval #LOS_ERRNO_QUEUE_WRITESIZE_ISZERO The buffer size passed in during queue writing is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue into which the data is written is not created.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG The buffer size passed in during queue writing is bigger than
+ * the queue size.
+ * @retval #LOS_ERRNO_QUEUE_ISFULL No free node is available during queue writing.
+ * @par Dependency:
+ * - los_queue.h: The header file that contains the API declaration.
+ * @see LOS_QueueRead | LOS_QueueCreate
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize);
+
/**
* @ingroup los_queue
* @brief Write data into a queue header.
@@ -676,6 +831,44 @@ extern UINT32 LOS_QueueWriteHead(UINT32 queueID,
UINT32 bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Write data into a queue header.
+ *
+ * @par 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.It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - This API cannot be called before the kernel 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.
+ * - LOS_QueueRead and LOS_QueueWriteHeadIsr are a set of interfaces, and the two groups of interfaces need to be used.
+ *
-
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [OUT] Starting address that stores the data to be written. The starting address
+ * must not be null.
+ * @param bufferSize [IN] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff].
+ *
+ * @retval #LOS_OK The data is successfully written into the queue.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The queue handle passed in during queue writing is invalid.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_PTR_NULL The pointer passed in during queue writing is null.
+ * @retval #LOS_ERRNO_QUEUE_WRITESIZE_ISZERO The buffer size passed in during queue writing is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue into which the data is written is not created.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG The buffer size passed in during queue writing is bigger than
+ * the queue size.
+ * @retval #LOS_ERRNO_QUEUE_ISFULL No free node is available during queue writing.
+ * @par Dependency:
+ * - los_queue.h: The header file that contains the API declaration.
+ * @see LOS_QueueRead | LOS_QueueCreate
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize);
+
/**
* @ingroup los_queue
* @brief Write data into a queue header.
@@ -723,6 +916,44 @@ extern UINT32 LOS_QueueWriteHeadCopy(UINT32 queueID,
UINT32 bufferSize,
UINT32 timeOut);
+/**
+ * @ingroup los_queue
+ * @brief Write data into a queue header.
+ *
+ * @par 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.It is safe to use this API from within an interrupt service routine.
+ * @attention
+ *
+ * - This API cannot be called before the kernel 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.
+ * - LOS_QueueRead and LOS_QueueWriteHeadCopyIsr are a set of interfaces, and the two groups of interfaces need to be
+ * used.
-
+ *
+ *
+ * @param queueID [IN] Queue ID created by LOS_QueueCreate. The value range is
+ * [1,LOSCFG_BASE_IPC_QUEUE_LIMIT].
+ * @param bufferAddr [OUT] Starting address that stores the data to be written.
+ * The starting address must not be null.
+ * @param bufferSize [IN] Passed-in buffer size, which must not be 0. The value range is [1,0xffffffff].
+ *
+ * @retval #LOS_OK The data is successfully written into the queue.
+ * @retval #LOS_ERRNO_QUEUE_INVALID The queue handle passed in during queue writing is invalid.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_PTR_NULL The pointer passed in during queue writing is null.
+ * @retval #LOS_ERRNO_QUEUE_WRITESIZE_ISZERO The buffer size passed in during queue writing is 0.
+ * @retval #LOS_ERRNO_QUEUE_NOT_CREATE The queue into which the data is written is not created.
+ * @retval #LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG The buffer size passed in during queue writing is bigger than
+ * the queue size.
+ * @retval #LOS_ERRNO_QUEUE_ISFULL No free node is available during queue writing.
+ * @par Dependency:
+ * - los_queue.h: The header file that contains the API declaration.
+ * @see LOS_QueueWrite | LOS_QueueWriteHeadCopyIsr
+ */
+extern LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize);
+
/**
* @ingroup los_queue
* @brief Delete a queue.
diff --git a/kernel/src/los_queue.c b/kernel/src/los_queue.c
index 8cfbccfc..3218283f 100644
--- a/kernel/src/los_queue.c
+++ b/kernel/src/los_queue.c
@@ -437,6 +437,52 @@ QUEUE_END:
return ret;
}
+LITE_OS_SEC_TEXT UINT32 OsQueueOperateIsr(UINT32 queueID, UINT32 operateType, VOID *bufferAddr, UINT32 *bufferSize)
+{
+ LosQueueCB *queueCB = NULL;
+ LosTaskCB *resumedTask = NULL;
+ LosTaskCB *runTask = NULL;
+ UINT32 ret;
+ UINT32 readWrite = OS_QUEUE_READ_WRITE_GET(operateType);
+ UINT32 readWriteTmp = !readWrite;
+
+ UINT32 intSave;
+
+ queueCB = (LosQueueCB *)GET_QUEUE_HANDLE(queueID);
+
+ intSave = LOS_IntLock();
+
+ ret = OsQueueOperateParamCheck(queueCB, operateType, bufferSize);
+ if (ret != LOS_OK) {
+ goto QUEUE_END;
+ }
+
+ if (queueCB->readWriteableCnt[readWrite] == 0) {
+ ret = OS_QUEUE_IS_READ(operateType) ? LOS_ERRNO_QUEUE_ISEMPTY : LOS_ERRNO_QUEUE_ISFULL;
+ goto QUEUE_END;
+ } else {
+ queueCB->readWriteableCnt[readWrite]--;
+ }
+
+ OsQueueBufferOperate(queueCB, operateType, bufferAddr, bufferSize);
+ if (!LOS_ListEmpty(&queueCB->readWriteList[readWriteTmp])) {
+ runTask = g_losTask.runTask;
+ resumedTask = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&queueCB->readWriteList[readWriteTmp]));
+ OsSchedTaskWake(resumedTask);
+ if (resumedTask->priority < runTask->priority) {
+ LOS_Schedule();
+ }
+ LOS_IntRestore(intSave);
+ return LOS_OK;
+ } else {
+ queueCB->readWriteableCnt[readWriteTmp]++;
+ }
+
+QUEUE_END:
+ LOS_IntRestore(intSave);
+ return ret;
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueReadCopy(UINT32 queueID,
VOID *bufferAddr,
UINT32 *bufferSize,
@@ -458,6 +504,22 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueReadCopy(UINT32 queueID,
return OsQueueOperate(queueID, operateType, bufferAddr, bufferSize, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueReadCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 *bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+
+ ret = OsQueueReadParameterCheck(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_READ, OS_QUEUE_HEAD, OS_QUEUE_NOT_POINT);
+ return OsQueueOperateIsr(queueID, operateType, bufferAddr, bufferSize);
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadCopy(UINT32 queueID,
VOID *bufferAddr,
UINT32 bufferSize,
@@ -475,6 +537,22 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadCopy(UINT32 queueID,
return OsQueueOperate(queueID, operateType, bufferAddr, &bufferSize, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+
+ ret = OsQueueWriteParameterCheck(queueID, bufferAddr, &bufferSize, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_WRITE, OS_QUEUE_HEAD, OS_QUEUE_NOT_POINT);
+ return OsQueueOperateIsr(queueID, operateType, bufferAddr, &bufferSize);
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteCopy(UINT32 queueID,
VOID *bufferAddr,
UINT32 bufferSize,
@@ -496,6 +574,22 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteCopy(UINT32 queueID,
return OsQueueOperate(queueID, operateType, bufferAddr, &bufferSize, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteCopyIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+
+ ret = OsQueueWriteParameterCheck(queueID, bufferAddr, &bufferSize, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_WRITE, OS_QUEUE_TAIL, OS_QUEUE_NOT_POINT);
+ return OsQueueOperateIsr(queueID, operateType, bufferAddr, &bufferSize);
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueRead(UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeOut)
{
UINT32 ret;
@@ -513,6 +607,21 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueRead(UINT32 queueID, VOID *bufferAddr, UINT32 b
return OsQueueOperate(queueID, operateType, bufferAddr, &bufferSize, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueReadIsr(UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+
+ ret = OsQueueReadParameterCheck(queueID, bufferAddr, &bufferSize, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_READ, OS_QUEUE_HEAD, OS_QUEUE_POINT);
+
+ return OsQueueOperateIsr(queueID, operateType, bufferAddr, &bufferSize);
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueWrite(UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeOut)
{
UINT32 ret;
@@ -532,6 +641,23 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueWrite(UINT32 queueID, VOID *bufferAddr, UINT32
return OsQueueOperate(queueID, operateType, &bufferAddr, &size, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteIsr(UINT32 queueID, VOID *bufferAddr, UINT32 bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+ UINT32 size = sizeof(UINT32 *);
+ (VOID) bufferSize;
+
+ ret = OsQueueWriteParameterCheck(queueID, bufferAddr, &size, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_WRITE, OS_QUEUE_TAIL, OS_QUEUE_POINT);
+
+ return OsQueueOperateIsr(queueID, operateType, &bufferAddr, &size);
+}
+
LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHead(UINT32 queueID,
VOID *bufferAddr,
UINT32 bufferSize,
@@ -547,6 +673,25 @@ LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHead(UINT32 queueID,
return LOS_QueueWriteHeadCopy(queueID, &bufferAddr, size, timeOut);
}
+LITE_OS_SEC_TEXT UINT32 LOS_QueueWriteHeadIsr(UINT32 queueID,
+ VOID *bufferAddr,
+ UINT32 bufferSize)
+{
+ UINT32 ret;
+ UINT32 operateType;
+ UINT32 size = sizeof(UINT32 *);
+ (VOID) bufferSize;
+
+ ret = OsQueueWriteParameterCheck(queueID, bufferAddr, &size, LOS_NO_WAIT);
+ if (ret != LOS_OK) {
+ return ret;
+ }
+
+ operateType = OS_QUEUE_OPERATE_TYPE(OS_QUEUE_WRITE, OS_QUEUE_HEAD, OS_QUEUE_POINT);
+
+ return OsQueueOperateIsr(queueID, operateType, &bufferAddr, &size);
+}
+
/*****************************************************************************
Function : OsQueueMailAlloc
Description : Mail allocate memory
diff --git a/testsuites/BUILD.gn b/testsuites/BUILD.gn
index 9c088101..9742bc24 100644
--- a/testsuites/BUILD.gn
+++ b/testsuites/BUILD.gn
@@ -59,20 +59,20 @@ kernel_module("test_init") {
group("testsuites") {
deps = [
":test_init",
- "sample/cmsis:test_cmsis",
- "sample/kernel/atomic:test_atomic",
+ #"sample/cmsis:test_cmsis",
+ #"sample/kernel/atomic:test_atomic",
"sample/kernel/event:test_event",
"sample/kernel/hwi:test_hwi",
"sample/kernel/mem:test_mem",
"sample/kernel/mux:test_mux",
- "sample/kernel/power:test_pm",
+ #"sample/kernel/power:test_pm",
"sample/kernel/queue:test_queue",
"sample/kernel/sem:test_sem",
- "sample/kernel/swtmr:test_swtmr",
+ #"sample/kernel/swtmr:test_swtmr",
"sample/kernel/task:test_task",
- "sample/posix:test_posix",
- "unittest/posix:posix_test",
- "unittest/xts:xts_test",
+ #"sample/posix:test_posix",
+ #"unittest/posix:posix_test",
+ #"unittest/xts:xts_test",
]
if (defined(LOSCFG_DYNLINK)) {
deps += [ "sample/kernel/dynlink:test_dynlink" ]
diff --git a/testsuites/sample/kernel/queue/BUILD.gn b/testsuites/sample/kernel/queue/BUILD.gn
index cf9bf4fe..bf055d91 100644
--- a/testsuites/sample/kernel/queue/BUILD.gn
+++ b/testsuites/sample/kernel/queue/BUILD.gn
@@ -172,6 +172,22 @@ static_library("test_queue") {
"It_los_queue_static_006.c",
"LLt_los_queue_003.c",
"Llt_los_queue_001.c",
+ "It_los_queue_isr_001.c",
+ "It_los_queue_isr_002.c",
+ "It_los_queue_isr_003.c",
+ "It_los_queue_isr_004.c",
+ "It_los_queue_isr_005.c",
+ "It_los_queue_isr_006.c",
+ "It_los_queue_isr_007.c",
+ "It_los_queue_isr_008.c",
+ "It_los_queue_isr_009.c",
+ "It_los_queue_isr_010.c",
+ "It_los_queue_isr_011.c",
+ "It_los_queue_isr_012.c",
+ "It_los_queue_isr_013.c",
+ "It_los_queue_isr_014.c",
+ "It_los_queue_isr_015.c",
+ "It_los_queue_isr_016.c",
]
configs += [ "$LITEOSTOPDIR/testsuites:include" ]
diff --git a/testsuites/sample/kernel/queue/It_los_queue.c b/testsuites/sample/kernel/queue/It_los_queue.c
index 1a2a781b..5e693e79 100644
--- a/testsuites/sample/kernel/queue/It_los_queue.c
+++ b/testsuites/sample/kernel/queue/It_los_queue.c
@@ -151,7 +151,22 @@ VOID ItSuiteLosQueue(VOID)
ItLosQueueHead040();
ItLosQueueHead041();
ItLosQueueHead042();
-
+ ItLosQueueIsr001();
+ ItLosQueueIsr002();
+ ItLosQueueIsr003();
+ ItLosQueueIsr004();
+ ItLosQueueIsr005();
+ ItLosQueueIsr006();
+ ItLosQueueIsr007();
+ ItLosQueueIsr008();
+ ItLosQueueIsr009();
+ ItLosQueueIsr010();
+ ItLosQueueIsr011();
+ ItLosQueueIsr012();
+ ItLosQueueIsr013();
+ ItLosQueueIsr014();
+ ItLosQueueIsr015();
+ ItLosQueueIsr016();
#if (LOS_KERNEL_TEST_FULL == 1)
#if (LOS_KERNEL_HWI_TEST == 1)
ItLosQueue044();
diff --git a/testsuites/sample/kernel/queue/It_los_queue.h b/testsuites/sample/kernel/queue/It_los_queue.h
index 8b207b1a..659d6615 100644
--- a/testsuites/sample/kernel/queue/It_los_queue.h
+++ b/testsuites/sample/kernel/queue/It_los_queue.h
@@ -183,7 +183,22 @@ extern VOID ItLosQueueHead039(VOID);
extern VOID ItLosQueueHead040(VOID);
extern VOID ItLosQueueHead041(VOID);
extern VOID ItLosQueueHead042(VOID);
-
+extern VOID ItLosQueueIsr001(VOID);
+extern VOID ItLosQueueIsr002(VOID);
+extern VOID ItLosQueueIsr003(VOID);
+extern VOID ItLosQueueIsr004(VOID);
+extern VOID ItLosQueueIsr005(VOID);
+extern VOID ItLosQueueIsr006(VOID);
+extern VOID ItLosQueueIsr007(VOID);
+extern VOID ItLosQueueIsr008(VOID);
+extern VOID ItLosQueueIsr009(VOID);
+extern VOID ItLosQueueIsr010(VOID);
+extern VOID ItLosQueueIsr011(VOID);
+extern VOID ItLosQueueIsr012(VOID);
+extern VOID ItLosQueueIsr013(VOID);
+extern VOID ItLosQueueIsr014(VOID);
+extern VOID ItLosQueueIsr015(VOID);
+extern VOID ItLosQueueIsr016(VOID);
#if (LOSCFG_BASE_IPC_QUEUE_STATIC == 1)
extern VOID ItLosQueueStatic001(VOID);
extern VOID ItLosQueueStatic002(VOID);
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_001.c b/testsuites/sample/kernel/queue/It_los_queue_isr_001.c
new file mode 100755
index 00000000..67351ea3
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_001.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr001(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr001", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_002.c b/testsuites/sample/kernel/queue/It_los_queue_isr_002.c
new file mode 100755
index 00000000..aea0640c
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_002.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_PARA_ISZERO, ret, EXIT);
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_ERRNO_QUEUE_NOT_CREATE, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr002(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr002", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_003.c b/testsuites/sample/kernel/queue/It_los_queue_isr_003.c
new file mode 100755
index 00000000..e4b08a40
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_003.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, 0);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, 1);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, 1, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr003(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr003", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_004.c b/testsuites/sample/kernel/queue/It_los_queue_isr_004.c
new file mode 100755
index 00000000..c3fad0db
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_004.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, 0);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, 4);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, 1, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr004(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr004", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_005.c b/testsuites/sample/kernel/queue/It_los_queue_isr_005.c
new file mode 100755
index 00000000..5aec5512
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_005.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr005(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr005", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_006.c b/testsuites/sample/kernel/queue/It_los_queue_isr_006.c
new file mode 100755
index 00000000..ae7bee14
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_006.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "It_los_queue.h"
+
+
+CHAR buff1[QUEUE_BASE_MSGSIZE] = "UniDSP";
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff2 + index), buff1[index],
+ *((CHAR *)(intptr_t)buff2 + index), EXIT);
+ }
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+
+VOID ItLosQueueIsr006(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr006", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_007.c b/testsuites/sample/kernel/queue/It_los_queue_isr_007.c
new file mode 100755
index 00000000..efa3981c
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_007.c
@@ -0,0 +1,80 @@
+ /*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr((UINT32)-1, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_INVALID, ret);
+
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr007(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr007", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_008.c b/testsuites/sample/kernel/queue/It_los_queue_isr_008.c
new file mode 100755
index 00000000..fc9097c7
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_008.c
@@ -0,0 +1,79 @@
+ /*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(OS_ALL_IPC_QUEUE_LIMIT + 1, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_INVALID, ret);
+
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR * buff2 = NULL;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret, EXIT);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr008(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr008", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_009.c b/testsuites/sample/kernel/queue/It_los_queue_isr_009.c
new file mode 100755
index 00000000..1d245f1b
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_009.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ ret = LOS_QueueReadIsr(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr009(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr009", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_010.c b/testsuites/sample/kernel/queue/It_los_queue_isr_010.c
new file mode 100755
index 00000000..cc492d9e
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_010.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ ret = LOS_QueueReadIsr(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_ERRNO_QUEUE_ISEMPTY, ret);
+}
+
+static VOID HwiF02(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ ret = LOS_QueueReadIsr(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST0, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ret = LOS_QueueWrite(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ TestHwiTrigger(HWI_NUM_TEST0);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr010(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr010", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_011.c b/testsuites/sample/kernel/queue/It_los_queue_isr_011.c
new file mode 100755
index 00000000..5a2619d1
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_011.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+static CHAR g_buff[QUEUE_BASE_MSGSIZE] = "UniDSP";
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ ret = LOS_QueueReadIsr(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_ASSERT_EQUAL_VOID(*((CHAR *)(intptr_t)buff2 + index), g_buff[index],
+ *((CHAR *)(intptr_t)buff2 + index));
+ }
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWrite(g_testQueueID01, &g_buff, QUEUE_BASE_MSGSIZE, 0);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr011(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr011", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_012.c b/testsuites/sample/kernel/queue/It_los_queue_isr_012.c
new file mode 100755
index 00000000..c1a76e28
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_012.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static VOID TaskF01(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ g_testCount++;
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE,LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ g_testCount++;
+ return;
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TSK_INIT_PARAM_S task1 = { 0 };
+ task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
+ task1.uwStackSize = TASK_STACK_SIZE_TEST;
+ task1.pcName = "Tsk001A";
+ task1.usTaskPrio = TASK_PRIO_TEST - 1;
+ task1.uwResved = LOS_TASK_STATUS_DETACHED;
+ g_testCount = 0;
+ ret = LOS_TaskCreate(&g_testTaskID01, &task1);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
+
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr012(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr012", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_013.c b/testsuites/sample/kernel/queue/It_los_queue_isr_013.c
new file mode 100755
index 00000000..329665b6
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_013.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteIsr(g_testQueueID01, &buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static VOID TaskF01(VOID)
+{
+ UINT32 ret;
+ CHAR * buff2 = NULL;
+
+ g_testCount++;
+ ret = LOS_QueueRead(g_testQueueID01, &buff2, QUEUE_BASE_MSGSIZE,LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ g_testCount++;
+ return;
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TSK_INIT_PARAM_S task1 = { 0 };
+ task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
+ task1.uwStackSize = TASK_STACK_SIZE_TEST;
+ task1.pcName = "Tsk001A";
+ task1.usTaskPrio = TASK_PRIO_TEST + 1;
+ task1.uwResved = LOS_TASK_STATUS_DETACHED;
+ g_testCount = 0;
+ ret = LOS_TaskCreate(&g_testTaskID01, &task1);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ LOS_TaskDelay(1);
+
+ ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+ ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
+
+ LOS_TaskDelay(1);
+
+ ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr013(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr013", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_014.c b/testsuites/sample/kernel/queue/It_los_queue_isr_014.c
new file mode 100755
index 00000000..4585bc66
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_014.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+
+ ret = LOS_QueueWriteCopyIsr(g_testQueueID01, buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static VOID TaskF01(VOID)
+{
+ UINT32 ret;
+ UINT32 msgSize = (UINT32)QUEUE_BASE_MSGSIZE;
+ CHAR buff[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = " ";
+
+ ret = LOS_QueueReadCopy(g_testQueueID01, buff2, &msgSize, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff2 + index), buff[index],
+ *((CHAR *)(intptr_t)buff2 + index), EXIT);
+ }
+
+EXIT:
+ return;
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TSK_INIT_PARAM_S task1 = { 0 };
+ task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
+ task1.uwStackSize = TASK_STACK_SIZE_TEST;
+ task1.pcName = "Tsk001A";
+ task1.usTaskPrio = TASK_PRIO_TEST - 1;
+ task1.uwResved = LOS_TASK_STATUS_DETACHED;
+ g_testCount = 0;
+ ret = LOS_TaskCreate(&g_testTaskID01, &task1);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr014(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr014", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_015.c b/testsuites/sample/kernel/queue/It_los_queue_isr_015.c
new file mode 100755
index 00000000..a3854eeb
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_015.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+static CHAR g_buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+static CHAR g_buff2[QUEUE_SHORT_BUFFER_LENGTH] = "DOPRA";
+static CHAR g_buff3[QUEUE_SHORT_BUFFER_LENGTH] = "TEST";
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+
+ ret = LOS_QueueWriteHeadIsr(g_testQueueID01, &g_buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWriteHeadIsr(g_testQueueID01, &g_buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWriteHeadIsr(g_testQueueID01, &g_buff3, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static VOID TaskF01(VOID)
+{
+ UINT32 ret;
+ CHAR buffA[QUEUE_SHORT_BUFFER_LENGTH] = "TEST";
+ CHAR buffB[QUEUE_SHORT_BUFFER_LENGTH] = "DOPRA";
+ CHAR buffC[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ CHAR * buff = NULL;
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff, QUEUE_BASE_MSGSIZE, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffA[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff, QUEUE_BASE_MSGSIZE, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffB[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+ ret = LOS_QueueRead(g_testQueueID01, &buff, QUEUE_BASE_MSGSIZE, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffC[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+EXIT:
+ return;
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TSK_INIT_PARAM_S task1 = { 0 };
+ task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
+ task1.uwStackSize = TASK_STACK_SIZE_TEST;
+ task1.pcName = "Tsk001A";
+ task1.usTaskPrio = TASK_PRIO_TEST - 1;
+ task1.uwResved = LOS_TASK_STATUS_DETACHED;
+ g_testCount = 0;
+ ret = LOS_TaskCreate(&g_testTaskID01, &task1);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr015(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr015", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+
diff --git a/testsuites/sample/kernel/queue/It_los_queue_isr_016.c b/testsuites/sample/kernel/queue/It_los_queue_isr_016.c
new file mode 100755
index 00000000..9ca840ba
--- /dev/null
+++ b/testsuites/sample/kernel/queue/It_los_queue_isr_016.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "It_los_queue.h"
+
+
+static VOID HwiF01(VOID)
+{
+ UINT32 ret;
+ CHAR buff1[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ CHAR buff2[QUEUE_SHORT_BUFFER_LENGTH] = "DOPRA";
+ CHAR buff3[QUEUE_SHORT_BUFFER_LENGTH] = "TEST";
+
+ ret = LOS_QueueWriteHeadCopyIsr(g_testQueueID01, buff1, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWriteHeadCopyIsr(g_testQueueID01, buff2, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+
+ ret = LOS_QueueWriteHeadCopyIsr(g_testQueueID01, buff3, QUEUE_BASE_MSGSIZE);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+}
+
+static VOID TaskF01(VOID)
+{
+ UINT32 ret;
+ UINT32 msgSize = (UINT32)QUEUE_BASE_MSGSIZE;
+ CHAR buffA[QUEUE_SHORT_BUFFER_LENGTH] = "TEST";
+ CHAR buffB[QUEUE_SHORT_BUFFER_LENGTH] = "DOPRA";
+ CHAR buffC[QUEUE_SHORT_BUFFER_LENGTH] = "UniDSP";
+ CHAR buff[QUEUE_SHORT_BUFFER_LENGTH] = " ";
+
+ ret = LOS_QueueReadCopy(g_testQueueID01, buff, &msgSize, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffA[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+ ret = LOS_QueueReadCopy(g_testQueueID01, buff, &msgSize, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffB[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+ ret = LOS_QueueReadCopy(g_testQueueID01, buff, &msgSize, LOS_WAIT_FOREVER);
+ ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
+ for (UINT8 index = 0; index < QUEUE_BASE_MSGSIZE - 1; index++) { // 7, QUEUE_BASE_MSGSIZE - 1
+ ICUNIT_GOTO_EQUAL(*((CHAR *)(intptr_t)buff + index), buffC[index],
+ *((CHAR *)(intptr_t)buff + index), EXIT);
+ }
+
+EXIT:
+ return;
+}
+
+static UINT32 Testcase(VOID)
+{
+ UINT32 ret;
+ HWI_PRIOR_T hwiPrio = 3;
+ HWI_MODE_T mode = 0;
+ HwiIrqParam irqParam;
+
+ ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &g_testQueueID01, 0, QUEUE_BASE_MSGSIZE);
+ ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
+
+ (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
+ irqParam.pDevId = 0;
+ ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TSK_INIT_PARAM_S task1 = { 0 };
+ task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
+ task1.uwStackSize = TASK_STACK_SIZE_TEST;
+ task1.pcName = "Tsk001A";
+ task1.usTaskPrio = TASK_PRIO_TEST - 1;
+ task1.uwResved = LOS_TASK_STATUS_DETACHED;
+ g_testCount = 0;
+ ret = LOS_TaskCreate(&g_testTaskID01, &task1);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+
+ TestHwiTrigger(HWI_NUM_TEST);
+
+EXIT:
+ TestHwiDelete(HWI_NUM_TEST);
+ ret = LOS_QueueDelete(g_testQueueID01);
+ ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
+ return LOS_OK;
+}
+
+VOID ItLosQueueIsr016(VOID)
+{
+ TEST_ADD_CASE("ItLosQueueIsr016", Testcase, TEST_LOS, TEST_QUE, TEST_LEVEL1, TEST_FUNCTION);
+}
+