Compare commits
25 Commits
OpenHarmon
...
master
Author | SHA1 | Date |
---|---|---|
|
3d8536b450 | |
|
413b08295d | |
|
10e00b3047 | |
|
88fd668b8f | |
|
ddaad05097 | |
|
c739d4a164 | |
|
92fbcaf074 | |
|
441d552355 | |
|
e151e8369b | |
|
e539a6c951 | |
|
e19155f49f | |
|
76562c376c | |
|
954c855528 | |
|
80f3e0f6b2 | |
|
36c0634ff5 | |
|
e22e8525e9 | |
|
1b778c4267 | |
|
c70295cc30 | |
|
c19dc1bc94 | |
|
d2bf535696 | |
|
bda25829af | |
|
a1e215f16a | |
|
5e36b8b599 | |
|
954aa6fb70 | |
|
64a73724b3 |
7
BUILD.gn
7
BUILD.gn
|
@ -44,6 +44,10 @@ if (defined(LOSCFG_COMPILER_ICCARM)) {
|
|||
}
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
liteos_build_asm = true
|
||||
}
|
||||
|
||||
config("arch_config") {
|
||||
cflags = arch_config_cflags
|
||||
asmflags = arch_config_asmflags
|
||||
|
@ -215,4 +219,7 @@ build_ext_component("build_kernel_image") {
|
|||
exec_path = rebase_path(root_out_dir)
|
||||
|
||||
command = toochain_config_command
|
||||
if (liteos_build_asm) {
|
||||
command += toochain_asm_command
|
||||
}
|
||||
}
|
||||
|
|
4
OAT.xml
4
OAT.xml
|
@ -23,6 +23,7 @@
|
|||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="copyright" name="Hunan OpenValley Digital Industry Development Co., Ltd." path=".*" desc="Developed By OpenValley Digital Co., Ltd."/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
|
@ -66,6 +67,9 @@
|
|||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath"
|
||||
name="figures/architecture-of-openharmony-the-liteos-cortex-m-kernel.png" desc="architecture-of-openharmony-the-liteos-cortex-m-kernel"/>
|
||||
<filteritem type="filepath" name="figures/OpenHarmony-LiteOS-M核内核架构图.png" desc="内核驱动架构"/>
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
|
|
|
@ -105,10 +105,6 @@ BOOL OsHwiIsCreated(UINT32 index)
|
|||
#endif
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
|
|
|
@ -63,6 +63,11 @@ extern UINT32 g_intCount;
|
|||
#endif
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_arch_interrupt
|
||||
* Set interrupt vector table.
|
||||
|
|
|
@ -86,7 +86,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
|
||||
return nextResponseTime;
|
||||
|
|
|
@ -85,7 +85,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2024 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.
|
||||
|
||||
import("//kernel/liteos_m/liteos.gni")
|
||||
|
||||
module_name = "arch"
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"los_context.c",
|
||||
"los_dispatch.S",
|
||||
"los_exc.S",
|
||||
"los_interrupt.c",
|
||||
"los_mpu.c",
|
||||
"los_timer.c",
|
||||
]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
|
@ -84,7 +84,7 @@ STATIC UINT64 SysTickReload(UINT64 nextResponseTime)
|
|||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
SysTick->LOAD = (UINT32)(nextResponseTime - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
return nextResponseTime;
|
||||
}
|
||||
|
|
|
@ -155,10 +155,6 @@ UINT32 ArchIntCurIrqNum(VOID)
|
|||
}
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
|
|
|
@ -63,6 +63,11 @@ extern volatile UINT32 g_intCount;
|
|||
#endif
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_arch_interrupt
|
||||
* Set interrupt vector table.
|
||||
|
|
|
@ -110,6 +110,12 @@ typedef struct {
|
|||
*/
|
||||
#define OS_RISCV_VECTOR_CNT (OS_RISCV_SYS_VECTOR_CNT + OS_RISCV_CUSTOM_IRQ_VECTOR_CNT)
|
||||
|
||||
/**
|
||||
* @ingroup los_arch_interrupt
|
||||
* Count of risc-v system interrupt vector.
|
||||
*/
|
||||
#define OS_SYS_VECTOR_CNT 0
|
||||
|
||||
/**
|
||||
* Maximum number of supported hardware devices that generate hardware interrupts.
|
||||
* The maximum number of hardware devices that generate hardware interrupts supported by hi3518ev200 is 32.
|
||||
|
|
|
@ -137,10 +137,6 @@ UINT32 ArchIntCurIrqNum(VOID)
|
|||
}
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
|
|
|
@ -63,6 +63,11 @@ extern UINT32 g_intCount;
|
|||
#endif
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_HANDLER_FUNC;
|
||||
|
||||
/* *
|
||||
* @ingroup los_arch_interrupt
|
||||
* Set interrupt vector table.
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
"component": {
|
||||
"name": "liteos_m",
|
||||
"subsystem": "kernel",
|
||||
"syscap": [
|
||||
"SystemCapability.Kernel.Liteos-M"
|
||||
],
|
||||
"features": [],
|
||||
"adapted_system_type": [
|
||||
"mini"
|
||||
|
|
|
@ -616,11 +616,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E
|
|||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqStart(UINT32 intNum)
|
||||
{
|
||||
if (g_irqCpupInitFlg == 0) {
|
||||
if ((g_irqCpupInitFlg == 0) || (intNum < OS_SYS_VECTOR_CNT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_irqCpup[intNum].startTime = CpupTimeUsGet();
|
||||
UINT32 cpupIntNum = intNum - OS_SYS_VECTOR_CNT;
|
||||
g_irqCpup[cpupIntNum].startTime = CpupTimeUsGet();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -629,33 +629,34 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
|
|||
UINT64 cpuTime;
|
||||
UINT64 usedTime;
|
||||
|
||||
if (g_irqCpupInitFlg == 0) {
|
||||
if ((g_irqCpupInitFlg == 0) || (intNum < OS_SYS_VECTOR_CNT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_irqCpup[intNum].startTime == 0) {
|
||||
UINT32 cpupIntNum = intNum - OS_SYS_VECTOR_CNT;
|
||||
if (g_irqCpup[cpupIntNum].startTime == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
cpuTime = CpupTimeUsGet();
|
||||
if (cpuTime < g_irqCpup[intNum].startTime) {
|
||||
if (cpuTime < g_irqCpup[cpupIntNum].startTime) {
|
||||
cpuTime += OS_US_PER_TICK;
|
||||
}
|
||||
|
||||
g_irqCpup[intNum].cpupID = intNum;
|
||||
g_irqCpup[intNum].status = OS_CPUP_USED;
|
||||
usedTime = cpuTime - g_irqCpup[intNum].startTime;
|
||||
g_irqCpup[cpupIntNum].cpupID = intNum;
|
||||
g_irqCpup[cpupIntNum].status = OS_CPUP_USED;
|
||||
usedTime = cpuTime - g_irqCpup[cpupIntNum].startTime;
|
||||
|
||||
if (g_irqCpup[intNum].count <= 1000) { /* 1000, Take 1000 samples */
|
||||
g_irqCpup[intNum].allTime += usedTime;
|
||||
g_irqCpup[intNum].count++;
|
||||
if (g_irqCpup[cpupIntNum].count <= 1000) { /* 1000, Take 1000 samples */
|
||||
g_irqCpup[cpupIntNum].allTime += usedTime;
|
||||
g_irqCpup[cpupIntNum].count++;
|
||||
} else {
|
||||
g_irqCpup[intNum].allTime = 0;
|
||||
g_irqCpup[intNum].count = 0;
|
||||
g_irqCpup[cpupIntNum].allTime = 0;
|
||||
g_irqCpup[cpupIntNum].count = 0;
|
||||
}
|
||||
g_irqCpup[intNum].startTime = 0;
|
||||
if (usedTime > g_irqCpup[intNum].timeMax) {
|
||||
g_irqCpup[intNum].timeMax = usedTime;
|
||||
g_irqCpup[cpupIntNum].startTime = 0;
|
||||
if (usedTime > g_irqCpup[cpupIntNum].timeMax) {
|
||||
g_irqCpup[cpupIntNum].timeMax = usedTime;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -206,5 +206,6 @@ toochain_config_objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
|||
toochain_config_command =
|
||||
"$toochain_config_objcopy -O binary $liteos_name $liteos_name.bin"
|
||||
toochain_config_command += " && sh -c '$toochain_config_objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||
toochain_config_command +=
|
||||
|
||||
toochain_asm_command =
|
||||
" && sh -c '$toochain_config_objdump -d $liteos_name >$liteos_name.asm'"
|
||||
|
|
|
@ -149,4 +149,5 @@ toochain_config_objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
|
|||
|
||||
toochain_config_command =
|
||||
"$toochain_config_objcopy --bin --verbose $liteos_name $liteos_name.bin"
|
||||
toochain_config_command += " && sh -c '$toochain_config_objdump --source --all $liteos_name -o $liteos_name.asm'"
|
||||
|
||||
toochain_asm_command = " && sh -c '$toochain_config_objdump --source --all $liteos_name -o $liteos_name.asm'"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "los_list.h"
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
@ -487,6 +488,50 @@ extern UINT32 LOS_QueueReadCopy(UINT32 queueID,
|
|||
UINT32 *bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Read a queue in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>Queue reading adopts the fist in first out (FIFO) mode. The data that is first stored in the queue is read
|
||||
* first.</li>
|
||||
* <li>This API read a queue in unblocking modes.</li>
|
||||
* <li>bufferAddr stores the obtained data.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueWriteCopy | LOS_QueueCreate
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueReadCopyIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 *bufferSize)
|
||||
{
|
||||
return LOS_QueueReadCopy(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue.
|
||||
|
@ -533,6 +578,47 @@ extern UINT32 LOS_QueueWriteCopy(UINT32 queueID,
|
|||
UINT32 bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>This API write data into a queue in unblocking modes.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The data to be written is of the size specified by bufferSize and is stored at the address specified by
|
||||
* BufferAddr.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueReadCopy | LOS_QueueCreate
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueWriteCopyIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 bufferSize)
|
||||
{
|
||||
return LOS_QueueWriteCopy(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Read a queue.
|
||||
|
@ -582,6 +668,50 @@ extern UINT32 LOS_QueueRead(UINT32 queueID,
|
|||
UINT32 bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Read a queue in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>Queue reading adopts the fist in first out (FIFO) mode. The data that is first stored in the queue is
|
||||
* read first.</li>
|
||||
* <li>This API read a queue in unblocking modes.</li>
|
||||
* <li>bufferAddr stores the obtained data address.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The bufferSize is not really used in LOS_QueueRead, because the interface is only used to
|
||||
* obtain the address of data.</li>
|
||||
* <li>The buffer which the bufferAddr pointing to must be greater than or equal to 4 bytes.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: The header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueWrite | LOS_QueueCreate
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueReadIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 bufferSize)
|
||||
{
|
||||
return LOS_QueueRead(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue.
|
||||
|
@ -629,6 +759,49 @@ extern UINT32 LOS_QueueWrite(UINT32 queueID,
|
|||
UINT32 bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>The specific queue should be created firstly.</li>
|
||||
* <li>This API write data into a queue in unblocking modes.</li>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>The bufferSize is not really used in LOS_QueueWriteIsr, because the interface is only used to write the address
|
||||
* of data specified by bufferAddr into a queue.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: The header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueRead | LOS_QueueCreate
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueWriteIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 bufferSize)
|
||||
{
|
||||
return LOS_QueueWrite(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue header.
|
||||
|
@ -676,6 +849,48 @@ extern UINT32 LOS_QueueWriteHead(UINT32 queueID,
|
|||
UINT32 bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue header in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>This API write data into a queue header in unblocking modes.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>LOS_QueueRead and LOS_QueueWriteHeadIsr are a set of interfaces, and the two groups of interfaces need to be used.
|
||||
* <li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: The header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueRead | LOS_QueueCreate
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueWriteHeadIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 bufferSize)
|
||||
{
|
||||
return LOS_QueueWriteHead(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue header.
|
||||
|
@ -723,6 +938,48 @@ extern UINT32 LOS_QueueWriteHeadCopy(UINT32 queueID,
|
|||
UINT32 bufferSize,
|
||||
UINT32 timeOut);
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Write data into a queue header in interrupt service routine.
|
||||
*
|
||||
* @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
|
||||
* <ul>
|
||||
* <li>This API cannot be called before the kernel is initialized.</li>
|
||||
* <li>This API write data into a queue header in unblocking modes.</li>
|
||||
* <li>The address of the data of the size specified by bufferSize and stored at the address specified by
|
||||
* BufferAddr is to be written.</li>
|
||||
* <li>LOS_QueueReadCopy and LOS_QueueWriteHeadCopyIsr are a set of interfaces, and the two groups of interfaces need to be
|
||||
* used.<li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul><li>los_queue.h: The header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_QueueWrite | LOS_QueueWriteHeadIsr
|
||||
*/
|
||||
STATIC INLINE UINT32 LOS_QueueWriteHeadCopyIsr(UINT32 queueID,
|
||||
VOID *bufferAddr,
|
||||
UINT32 bufferSize)
|
||||
{
|
||||
return LOS_QueueWriteHeadCopy(queueID, bufferAddr, bufferSize, LOS_NO_WAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_queue
|
||||
* @brief Delete a queue.
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "los_interrupt.h"
|
||||
#include "los_membox.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_task.h"
|
||||
#include "los_sched.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -164,6 +164,22 @@ static_library("test_queue") {
|
|||
"It_los_queue_head_040.c",
|
||||
"It_los_queue_head_041.c",
|
||||
"It_los_queue_head_042.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",
|
||||
"It_los_queue_static_001.c",
|
||||
"It_los_queue_static_002.c",
|
||||
"It_los_queue_static_003.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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
TestHwiDelete(HWI_NUM_TEST0);
|
||||
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);
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -34,6 +34,8 @@ static_library("cmsis_test") {
|
|||
"cmsis_msg_func_test.c",
|
||||
"cmsis_mutex_func_test.c",
|
||||
"cmsis_sem_func_test.c",
|
||||
"cmsis_task_func_test.c",
|
||||
"cmsis_task_pri_func_test.c",
|
||||
"cmsis_timer_func_test.c",
|
||||
"xts_cmsis.c",
|
||||
]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -36,5 +36,7 @@ void CmsisFuncTest(void)
|
|||
CmsisMsgFuncTest();
|
||||
CmsisMutexFuncTest();
|
||||
CmsisSemFuncTest();
|
||||
CmsisTaskFuncTest();
|
||||
CmsisTaskPriFuncTest();
|
||||
CmsisTimerFuncTest();
|
||||
}
|
|
@ -78,4 +78,12 @@
|
|||
#define DELAY_TICKS_5 5
|
||||
#define DELAY_TICKS_10 10
|
||||
|
||||
#define PRIORITY_COUNT_NOT_MIN 3
|
||||
#define PRIORITY_COUNT_MIN_1 4
|
||||
#define PRIORITY_COUNT_MIN_2 5
|
||||
#define PRIORITY_COUNT_MIN_3 6
|
||||
#define PRIORITY_COUNT_MIN_4 7
|
||||
#define MAX_UINT32 0xFFFFFFFF
|
||||
#define ALIVE_INFO_DIS 10000
|
||||
|
||||
#endif
|
|
@ -647,6 +647,200 @@ LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqSetAttrEBADFEINVAL, Function |
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_OPEN_0100
|
||||
* @tc.name mq_open function errno for EEXIST test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqOpenEEXIST, Function | MediumTest | Level2)
|
||||
{
|
||||
int ret;
|
||||
char qName[MQ_NAME_LEN];
|
||||
mqd_t queue, queueOther;
|
||||
|
||||
ret = sprintf_s(qName, sizeof(qName), "testMqOpenEEXIST_%d", GetRandom(10000)); /* 10000, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(ret, strlen(qName), ret);
|
||||
queue = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
|
||||
ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue); /* 1, common data for test, no special meaning */
|
||||
|
||||
queueOther = mq_open(qName, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(queueOther, (mqd_t)-1, queueOther); /* 1, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(errno, EEXIST, errno);
|
||||
ret = mq_close(queue);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = mq_unlink(qName);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_OPEN_0200
|
||||
* @tc.name mq_open function errno for EINVAL test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqOpenEINVAL, Function | MediumTest | Level2)
|
||||
{
|
||||
int i, ret;
|
||||
mqd_t queue;
|
||||
struct mq_attr attr = { 0 };
|
||||
char qName[MQ_NAME_LEN];
|
||||
const int max = 65535; /* 65535, common data for test, no special meaning */
|
||||
|
||||
ret = sprintf_s(qName, sizeof(qName), "testMqOpenEINVAL_%d", GetRandom(10000)); /* 10000, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(ret, strlen(qName), ret);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
attr.mq_msgsize = -1; /* -1, common data for test, no special meaning */
|
||||
attr.mq_maxmsg = max;
|
||||
break;
|
||||
case 1:
|
||||
attr.mq_msgsize = max;
|
||||
attr.mq_maxmsg = max;
|
||||
break;
|
||||
case 2:
|
||||
attr.mq_msgsize = 10; /* 10, common data for test, no special meaning */
|
||||
attr.mq_maxmsg = -1; /* -1, common data for test, no special meaning */
|
||||
break;
|
||||
case 3:
|
||||
attr.mq_msgsize = 10; /* 10, common data for test, no special meaning */
|
||||
attr.mq_maxmsg = max + 1;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
attr.mq_msgsize = 0; /* 0, common data for test, no special meaning */
|
||||
attr.mq_maxmsg = 16; /* 16, common data for test, no special meaning */
|
||||
break;
|
||||
|
||||
case 5:
|
||||
attr.mq_msgsize = 64; /* 64, common data for test, no special meaning */
|
||||
attr.mq_maxmsg = 0; /* 0, common data for test, no special meaning */
|
||||
break;
|
||||
}
|
||||
|
||||
queue = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
|
||||
ICUNIT_ASSERT_EQUAL(queue, (mqd_t)-1, queue); /* 1, common data for test, no special meaning */
|
||||
|
||||
if (queue != (mqd_t)-1) { /* 1, common data for test, no special meaning */
|
||||
ret = mq_close(queue);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = mq_unlink(qName);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
}
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
|
||||
}
|
||||
|
||||
for (i = 0; i < MQ_NAME_LEN; i++) {
|
||||
qName[i] = 0;
|
||||
}
|
||||
attr.mq_msgsize = MQ_MSG_SIZE;
|
||||
attr.mq_maxmsg = MQ_MAX_MSG;
|
||||
queue = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
|
||||
ICUNIT_ASSERT_EQUAL(queue, (mqd_t)-1, queue); /* 1, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_OPEN_0300
|
||||
* @tc.name mq_open function errno for ENAMETOOLONG test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqOpenENAMETOOLONG, Function | MediumTest | Level2)
|
||||
{
|
||||
char qName[MAX_MQ_NAME_LEN + 10]; /* 10, common data for test, no special meaning */
|
||||
mqd_t queue;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < MAX_MQ_NAME_LEN + 5; i++) { /* 5, common data for test, no special meaning */
|
||||
qName[i] = '8';
|
||||
}
|
||||
qName[i] = '\0';
|
||||
|
||||
queue = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(queue, (mqd_t)-1, queue); /* -1, common data for test, no special meaning */
|
||||
|
||||
if (queue != (mqd_t)-1) { /* -1, common data for test, no special meaning */
|
||||
ret = mq_close(queue);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = mq_unlink(qName);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
}
|
||||
|
||||
ICUNIT_ASSERT_EQUAL(errno, ENAMETOOLONG, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_OPEN_0400
|
||||
* @tc.name mq_open function errno for ENOENT test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqOpenENOENT, Function | MediumTest | Level3)
|
||||
{
|
||||
int ret;
|
||||
mqd_t queue;
|
||||
char qName[MQ_NAME_LEN];
|
||||
|
||||
ret = sprintf_s(qName, MQ_NAME_LEN, "testMqOpenENOENT_%d", GetRandom(10000)); /* 10000, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(ret, strlen(qName), ret);
|
||||
queue = mq_open(qName, O_RDWR, S_IRUSR | S_IWUSR, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(queue, (mqd_t)-1, queue); /* -1, common data for test, no special meaning */
|
||||
|
||||
if (queue != (mqd_t)-1) { /* -1, common data for test, no special meaning */
|
||||
ret = mq_close(queue);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = mq_unlink(qName);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
}
|
||||
ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_OPEN_0600
|
||||
* @tc.name mq_open function errno for ENOSPC test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqOpenENOSPC, Function | MediumTest | Level3)
|
||||
{
|
||||
int ret;
|
||||
mqd_t queue;
|
||||
struct mq_attr setAttr = { 0 };
|
||||
char qName[MQ_NAME_LEN];
|
||||
|
||||
ret = sprintf_s(qName, MQ_NAME_LEN, "testMqOpenENOSPC_%d", GetRandom(10000)); /* 10000, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(ret, strlen(qName), ret);
|
||||
setAttr.mq_msgsize = MAX_MQ_MSG_SIZE + 1; /* 1, common data for test, no special meaning */
|
||||
setAttr.mq_maxmsg = MAX_MQ_NAME_LEN;
|
||||
queue = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &setAttr);
|
||||
ICUNIT_ASSERT_EQUAL(queue, (mqd_t)-1, queue); /* -1, common data for test, no special meaning */
|
||||
|
||||
if (queue != (mqd_t)-1) { /* -1, common data for test, no special meaning */
|
||||
ret = mq_close(queue);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = mq_unlink(qName);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
}
|
||||
ICUNIT_ASSERT_EQUAL(errno, ENOSPC, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* *
|
||||
* @tc.number SUB_KERNEL_IPC_MQ_CLOSE_0100
|
||||
* @tc.name mq_close function errno for EBADF test
|
||||
* @tc.desc [C- SOFTWARE -0200]
|
||||
*/
|
||||
LITE_TEST_CASE(IpcMqExceptionApiTestSuite, testMqCloseEBADF, Function | MediumTest | Level2)
|
||||
{
|
||||
int ret = mq_close(NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, -1, ret); /* -1, common data for test, no special meaning */
|
||||
ICUNIT_ASSERT_EQUAL(errno, EBADF, errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RUN_TEST_SUITE(IpcMqExceptionApiTestSuite);
|
||||
|
||||
void IpcMqExceptionFuncTest(void)
|
||||
|
@ -667,4 +861,10 @@ void IpcMqExceptionFuncTest(void)
|
|||
RUN_ONE_TESTCASE(testMqUnlinkEINVAL);
|
||||
RUN_ONE_TESTCASE(testMqGetAttrEBADFEINVAL);
|
||||
RUN_ONE_TESTCASE(testMqSetAttrEBADFEINVAL);
|
||||
RUN_ONE_TESTCASE(testMqOpenEEXIST);
|
||||
RUN_ONE_TESTCASE(testMqOpenEINVAL);
|
||||
RUN_ONE_TESTCASE(testMqOpenENAMETOOLONG);
|
||||
RUN_ONE_TESTCASE(testMqOpenENOENT);
|
||||
RUN_ONE_TESTCASE(testMqOpenENOSPC);
|
||||
RUN_ONE_TESTCASE(testMqCloseEBADF);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue