fix: Solution of conflict
Change-Id: If6304999f1dfbcdfbc1670b73ace61b8024336bd
This commit is contained in:
commit
f6c4f6f5da
1
BUILD.gn
1
BUILD.gn
|
|
@ -67,6 +67,7 @@ lite_subsystem("kernel") {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deps = [ ":make" ]
|
deps = [ ":make" ]
|
||||||
|
deps += [ "//kernel/liteos_a/testsuites/unittest:unittest" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
Kconfig
1
Kconfig
|
|
@ -303,6 +303,7 @@ source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
|
||||||
source "../../drivers/adapter/khdf/liteos/Kconfig"
|
source "../../drivers/adapter/khdf/liteos/Kconfig"
|
||||||
|
|
||||||
source "drivers/char/mem/Kconfig"
|
source "drivers/char/mem/Kconfig"
|
||||||
|
source "drivers/char/quickstart/Kconfig"
|
||||||
source "drivers/char/random/Kconfig"
|
source "drivers/char/random/Kconfig"
|
||||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||||
source "drivers/char/video/Kconfig"
|
source "drivers/char/video/Kconfig"
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
|
||||||
return intSave;
|
return intSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC INLINE VOID ArchIrqDisable(VOID)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"cpsid i "
|
||||||
|
:
|
||||||
|
:
|
||||||
|
: "memory", "cc");
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC INLINE VOID ArchIrqEnable(VOID)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"cpsie i "
|
||||||
|
:
|
||||||
|
:
|
||||||
|
: "memory", "cc");
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
STATIC INLINE UINT32 ArchIntLock(VOID)
|
STATIC INLINE UINT32 ArchIntLock(VOID)
|
||||||
|
|
|
||||||
|
|
@ -893,7 +893,7 @@ STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached)
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
kernelMap = &mmuKernelMappings[i];
|
kernelMap = &mmuKernelMappings[i];
|
||||||
if (uncached) {
|
if (uncached) {
|
||||||
flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
kernelMap->flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||||
}
|
}
|
||||||
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
|
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
|
||||||
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
|
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
|
||||||
|
|
|
||||||
|
|
@ -181,18 +181,29 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
|
||||||
#ifdef LOSCFG_KERNEL_VM
|
#ifdef LOSCFG_KERNEL_VM
|
||||||
UINT32 OsArmSharedPageFault(UINT32 excType, PageFaultContext *frame, UINT32 far, UINT32 fsr)
|
UINT32 OsArmSharedPageFault(UINT32 excType, PageFaultContext *frame, UINT32 far, UINT32 fsr)
|
||||||
{
|
{
|
||||||
PRINT_INFO("page fault entry!!!\n");
|
BOOL instructionFault = FALSE;
|
||||||
BOOL instruction_fault = FALSE;
|
|
||||||
UINT32 pfFlags = 0;
|
UINT32 pfFlags = 0;
|
||||||
UINT32 fsrFlag;
|
UINT32 fsrFlag;
|
||||||
BOOL write = FALSE;
|
BOOL write = FALSE;
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
PRINT_INFO("page fault entry!!!\n");
|
||||||
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
|
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
|
||||||
return LOS_ERRNO_VM_NOT_FOUND;
|
return LOS_ERRNO_VM_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
|
||||||
|
BOOL irqEnable = !(LOS_SpinHeld(&g_taskSpin) && (OsPercpuGet()->taskLockCnt != 0));
|
||||||
|
if (irqEnable) {
|
||||||
|
ArchIrqEnable();
|
||||||
|
} else {
|
||||||
|
PrintExcInfo("[ERR][%s] may be held scheduler lock when entering [%s]\n",
|
||||||
|
OsCurrTaskGet()->taskName, __FUNCTION__);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ArchIrqEnable();
|
||||||
|
#endif
|
||||||
if (excType == OS_EXCEPT_PREFETCH_ABORT) {
|
if (excType == OS_EXCEPT_PREFETCH_ABORT) {
|
||||||
instruction_fault = TRUE;
|
instructionFault = TRUE;
|
||||||
} else {
|
} else {
|
||||||
write = !!BIT_GET(fsr, WNR_BIT);
|
write = !!BIT_GET(fsr, WNR_BIT);
|
||||||
}
|
}
|
||||||
|
|
@ -210,13 +221,23 @@ UINT32 OsArmSharedPageFault(UINT32 excType, PageFaultContext *frame, UINT32 far,
|
||||||
BOOL user = (frame->CPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
|
BOOL user = (frame->CPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
|
||||||
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
|
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
|
||||||
pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
|
pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
|
||||||
pfFlags |= instruction_fault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
|
pfFlags |= instructionFault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
|
||||||
pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
|
pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
|
||||||
return OsVmPageFaultHandler(far, pfFlags, frame);
|
ret = OsVmPageFaultHandler(far, pfFlags, frame);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return LOS_ERRNO_VM_NOT_FOUND;
|
ret = LOS_ERRNO_VM_NOT_FOUND;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
|
||||||
|
if (irqEnable) {
|
||||||
|
ArchIrqDisable();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ArchIrqDisable();
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -365,9 +365,6 @@ _osExceptFiqHdl:
|
||||||
MOV R3, #0
|
MOV R3, #0
|
||||||
STMFD SP!, {R2-R3}
|
STMFD SP!, {R2-R3}
|
||||||
|
|
||||||
MOV R0, #OS_EXCEPT_FIQ @ Set exception ID to OS_EXCEPT_FIQ.
|
|
||||||
B _osExceptDispatch @ Branch to global exception handler.
|
|
||||||
|
|
||||||
@ Description: Exception handler
|
@ Description: Exception handler
|
||||||
@ Parameter : R0 Exception Type
|
@ Parameter : R0 Exception Type
|
||||||
@ Regs Hold : R3 Exception`s CPSR
|
@ Regs Hold : R3 Exception`s CPSR
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,9 @@ __exception_handlers:
|
||||||
.global reset_vector
|
.global reset_vector
|
||||||
.type reset_vector,function
|
.type reset_vector,function
|
||||||
|
|
||||||
#ifdef LOSCFG_QUICK_START
|
#ifdef LOSCFG_BOOTENV_RAM
|
||||||
__quickstart_args_start:
|
__quickstart_args_start:
|
||||||
.fill 512,1,0
|
.fill LOSCFG_BOOTENV_RAMSIZE,1,0
|
||||||
__quickstart_args_end:
|
__quickstart_args_end:
|
||||||
|
|
||||||
.global OsGetArgsAddr
|
.global OsGetArgsAddr
|
||||||
|
|
|
||||||
|
|
@ -739,11 +739,8 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
|
||||||
|
|
||||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||||
if (privateMqPersonal == NULL) {
|
|
||||||
goto ERROUT_UNLOCK;
|
|
||||||
}
|
|
||||||
|
|
||||||
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
|
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
|
||||||
|
|
||||||
mqueueCB = privateMqPersonal->mq_posixdes;
|
mqueueCB = privateMqPersonal->mq_posixdes;
|
||||||
OS_MQ_GOTO_ERROUT_UNLOCK_IF(msgLen > (size_t)(mqueueCB->mqcb->queueSize - sizeof(UINT32)), EMSGSIZE);
|
OS_MQ_GOTO_ERROUT_UNLOCK_IF(msgLen > (size_t)(mqueueCB->mqcb->queueSize - sizeof(UINT32)), EMSGSIZE);
|
||||||
|
|
@ -786,10 +783,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
|
||||||
|
|
||||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||||
if (privateMqPersonal == NULL) {
|
if (privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC) {
|
||||||
goto ERROUT_UNLOCK;
|
|
||||||
}
|
|
||||||
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
|
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
goto ERROUT_UNLOCK;
|
goto ERROUT_UNLOCK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
config DRIVERS_QUICKSTART
|
||||||
|
bool "Enable QUICKSTART"
|
||||||
|
default y
|
||||||
|
depends on DRIVERS && FS_VFS
|
||||||
|
help
|
||||||
|
Answer Y to enable LiteOS support quickstart frame dev.
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LOS_DEV_QUICKSTART_H__
|
||||||
|
#define __LOS_DEV_QUICKSTART_H__
|
||||||
|
|
||||||
|
#include "los_typedef.h"
|
||||||
|
#include "sys/ioctl.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
QS_STAGE1 = 1, /* 1: start from stage1, 0 is already called in kernel process */
|
||||||
|
QS_STAGE2, /* system init stage No 2 */
|
||||||
|
QS_STAGE3, /* system init stage No 3 */
|
||||||
|
QS_STAGE_LIMIT
|
||||||
|
} QuickstartStage;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
QS_UNREGISTER = QS_STAGE_LIMIT, /* quickstart dev unregister */
|
||||||
|
QS_NOTIFY, /* quickstart notify */
|
||||||
|
QS_LISTEN, /* quickstart listen */
|
||||||
|
QS_CTL_LIMIT
|
||||||
|
} QuickstartConctrl;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int pid;
|
||||||
|
unsigned int events;
|
||||||
|
} QuickstartMask;
|
||||||
|
|
||||||
|
#define QUICKSTART_IOC_MAGIC 'T'
|
||||||
|
#define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, QS_UNREGISTER)
|
||||||
|
#define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY)
|
||||||
|
#define QUICKSTART_LISTEN _IOR(QUICKSTART_IOC_MAGIC, QS_LISTEN, QuickstartMask)
|
||||||
|
#define QUICKSTART_STAGE(x) _IO(QUICKSTART_IOC_MAGIC, (x))
|
||||||
|
|
||||||
|
#define QUICKSTART_NODE "/dev/quickstart"
|
||||||
|
|
||||||
|
#define QS_STAGE_CNT (QS_STAGE_LIMIT - QS_STAGE1)
|
||||||
|
|
||||||
|
typedef void (*SysteminitHook)(void);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SysteminitHook func[QS_STAGE_CNT];
|
||||||
|
} LosSysteminitHook;
|
||||||
|
|
||||||
|
extern void QuickstartHookRegister(LosSysteminitHook hooks);
|
||||||
|
|
||||||
|
extern int QuickstartDevRegister(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -29,16 +29,15 @@
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "los_quick_start_pri.h"
|
#include "los_dev_quickstart.h"
|
||||||
#include "bits/ioctl.h"
|
|
||||||
#include "fcntl.h"
|
#include "fcntl.h"
|
||||||
#include "linux/kernel.h"
|
#include "linux/kernel.h"
|
||||||
|
#include "los_process_pri.h"
|
||||||
|
|
||||||
#define QUICKSTART_IOC_MAGIC 'T'
|
|
||||||
#define QUICKSTART_INITSTEP2 _IO(QUICKSTART_IOC_MAGIC, 0)
|
|
||||||
#define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, 1)
|
|
||||||
#define QUICKSTART_NODE "/dev/quickstart"
|
|
||||||
|
|
||||||
|
EVENT_CB_S g_qsEvent;
|
||||||
|
static SysteminitHook g_systemInitFunc[QS_STAGE_CNT] = {0};
|
||||||
|
static char g_callOnce[QS_STAGE_CNT] = {0};
|
||||||
|
|
||||||
static int QuickstartOpen(struct file *filep)
|
static int QuickstartOpen(struct file *filep)
|
||||||
{
|
{
|
||||||
|
|
@ -50,19 +49,52 @@ static int QuickstartClose(struct file *filep)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SystemInitStep2(void)
|
static int QuickstartNotify(unsigned int events)
|
||||||
{
|
{
|
||||||
static int once = 0;
|
unsigned int pid = LOS_GetCurrProcessID();
|
||||||
/* Only one call is allowed */
|
/* 16:low 16 bits for eventMask, high 16 bits for pid */
|
||||||
if (once != 0) {
|
unsigned int notifyEvent = (pid << 16) | events;
|
||||||
return;
|
int ret = LOS_EventWrite((PEVENT_CB_S)&g_qsEvent, notifyEvent);
|
||||||
|
if (ret != 0) {
|
||||||
|
PRINT_ERR("%s,%d:0x%x\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
ret = -EINVAL;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
once = 1;
|
|
||||||
|
|
||||||
unsigned int ret = OsSystemInitStep2();
|
static int QuickstartListen(unsigned long arg)
|
||||||
if (ret != LOS_OK) {
|
{
|
||||||
PRINT_ERR("systemInitStep2 failed\n");
|
QuickstartMask listenMask;
|
||||||
|
if (copy_from_user(&listenMask, (struct QuickstartMask __user *)arg, sizeof(QuickstartMask)) != LOS_OK) {
|
||||||
|
PRINT_ERR("%s,%d\n", __FUNCTION__, __LINE__);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
/* 16:low 16 bits for eventMask, high 16 bits for pid */
|
||||||
|
unsigned int mask = (listenMask.pid << 16) | listenMask.events;
|
||||||
|
int ret = LOS_EventRead((PEVENT_CB_S)&g_qsEvent, mask, LOS_WAITMODE_AND | LOS_WAITMODE_CLR, LOS_WAIT_FOREVER);
|
||||||
|
if (ret != mask) {
|
||||||
|
PRINT_ERR("%s,%d:0x%x\n", __FUNCTION__, __LINE__, ret);
|
||||||
|
ret = -EINVAL;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickstartHookRegister(LosSysteminitHook hooks)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < QS_STAGE_CNT; i++) {
|
||||||
|
g_systemInitFunc[i] = hooks.func[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int QuickstartStageWorking(unsigned int level)
|
||||||
|
{
|
||||||
|
if ((level < QS_STAGE_CNT) && (g_callOnce[level] == 0) && (g_systemInitFunc[level] != NULL)) {
|
||||||
|
g_callOnce[level] = 1; /* 1: Already called */
|
||||||
|
g_systemInitFunc[level]();
|
||||||
|
} else {
|
||||||
|
PRINT_WARN("Trigger quickstart,but doing nothing!!\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int QuickstartDevUnregister(void)
|
static int QuickstartDevUnregister(void)
|
||||||
|
|
@ -72,18 +104,27 @@ static int QuickstartDevUnregister(void)
|
||||||
|
|
||||||
static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg)
|
static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
ssize_t ret;
|
||||||
case QUICKSTART_INITSTEP2:
|
if (cmd == QUICKSTART_NOTIFY) {
|
||||||
SystemInitStep2();
|
return QuickstartNotify(arg);
|
||||||
break;
|
}
|
||||||
case QUICKSTART_UNREGISTER:
|
|
||||||
QuickstartDevUnregister();
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
if (OsGetUserInitProcessID() != LOS_GetCurrProcessID()) {
|
||||||
|
PRINT_ERR("Permission denios!\n");
|
||||||
|
return -EACCES;
|
||||||
|
}
|
||||||
|
switch (cmd) {
|
||||||
|
case QUICKSTART_UNREGISTER:
|
||||||
|
ret = QuickstartDevUnregister();
|
||||||
|
break;
|
||||||
|
case QUICKSTART_LISTEN:
|
||||||
|
ret = QuickstartListen(arg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
ret = QuickstartStageWorking(cmd - QUICKSTART_STAGE(QS_STAGE1)); /* ioctl cmd converted to stage level */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations_vfs g_quickstartDevOps = {
|
static const struct file_operations_vfs g_quickstartDevOps = {
|
||||||
|
|
@ -100,8 +141,9 @@ static const struct file_operations_vfs g_quickstartDevOps = {
|
||||||
NULL, /* unlink */
|
NULL, /* unlink */
|
||||||
};
|
};
|
||||||
|
|
||||||
int DevQuickStartRegister(void)
|
int QuickstartDevRegister(void)
|
||||||
{
|
{
|
||||||
return register_driver(QUICKSTART_NODE, &g_quickstartDevOps, 0666, 0); /* 0666: file mode */
|
LOS_EventInit(&g_qsEvent);
|
||||||
|
return register_driver(QUICKSTART_NODE, &g_quickstartDevOps, 0644, 0); /* 0644: file mode */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,13 @@ int fatfs_2_vfs(int result)
|
||||||
|
|
||||||
case FR_NO_FILE:
|
case FR_NO_FILE:
|
||||||
case FR_NO_PATH:
|
case FR_NO_PATH:
|
||||||
case FR_NO_FILESYSTEM:
|
|
||||||
status = ENOENT;
|
status = ENOENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FR_NO_FILESYSTEM:
|
||||||
|
status = ENOTSUP;
|
||||||
|
break;
|
||||||
|
|
||||||
case FR_INVALID_NAME:
|
case FR_INVALID_NAME:
|
||||||
status = EINVAL;
|
status = EINVAL;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ int format(const char *dev, int sectors, int option)
|
||||||
}
|
}
|
||||||
err = fatfs_mkfs(device, sectors, option);
|
err = fatfs_mkfs(device, sectors, option);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
VnodeDrop();
|
||||||
set_errno(-err);
|
set_errno(-err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,30 +163,6 @@ void clear_fd(int fd);
|
||||||
|
|
||||||
extern char *rindex(const char *s, int c);
|
extern char *rindex(const char *s, int c);
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup fs
|
|
||||||
* @brief list directory contents.
|
|
||||||
*
|
|
||||||
* @par Description:
|
|
||||||
* Get the volume label of the FAT partition.
|
|
||||||
*
|
|
||||||
* @attention
|
|
||||||
* <ul>
|
|
||||||
* <li>The function support FAT filesystem only.</li>
|
|
||||||
* <li>The label must allocated more than 11 charactors space first</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param target [IN] Type #const char* The file pathname.
|
|
||||||
* @param label [OUT] Type #const char* The string pointer transform the label massge back.
|
|
||||||
*
|
|
||||||
* @retval #int Point the status which is successed or failed.
|
|
||||||
*
|
|
||||||
* @par Dependency:
|
|
||||||
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
|
|
||||||
*/
|
|
||||||
|
|
||||||
int getlabel(const char *target, char *label);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup fs
|
* @ingroup fs
|
||||||
*
|
*
|
||||||
|
|
@ -349,40 +325,6 @@ int fscheck(const char *path);
|
||||||
|
|
||||||
extern int virstatfs(const char *path, struct statfs *buf);
|
extern int virstatfs(const char *path, struct statfs *buf);
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup fs
|
|
||||||
* @set the virtual partition information.
|
|
||||||
*
|
|
||||||
* @par Description:
|
|
||||||
* The los_set_virpartparam() function use for set virtual partition parameter.
|
|
||||||
* The parameter include virtual partition number, virtual partition percent, virtual partition name
|
|
||||||
* and the partition path which need mount virtual partition.
|
|
||||||
*
|
|
||||||
* @attention
|
|
||||||
* <ul>
|
|
||||||
* <li>This function only support for FAT32.</li>
|
|
||||||
* <li>This function only support for the virtual partition feature.</li>
|
|
||||||
* <li>This function only can be used before mount function.</li>
|
|
||||||
* <li>The function can be invoked once before umount partition.</li>
|
|
||||||
* <li>Now support set single partition,the partition information will be replaced
|
|
||||||
* if it used for set another partition name.</li>
|
|
||||||
* <li>The function has no effert if virtual partition information is already in the partition.</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param virtualinfo [IN] Type #virpartinfo The struct which include virtual partition information.
|
|
||||||
*
|
|
||||||
* @retval #0 los_set_virpartparam success.
|
|
||||||
* @retval #-1 los_set_virpartparam failed.
|
|
||||||
*
|
|
||||||
* @par Dependency:
|
|
||||||
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
|
|
||||||
* @see
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef VFS_IMPL_LATER
|
|
||||||
int los_set_virpartparam(virpartinfo virtualinfo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -111,16 +111,16 @@ int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
|
||||||
int VnodeHold(void);
|
int VnodeHold(void);
|
||||||
int VnodeDrop(void);
|
int VnodeDrop(void);
|
||||||
void VnodeRefDec(struct Vnode *vnode);
|
void VnodeRefDec(struct Vnode *vnode);
|
||||||
int VnodeFreeIter(struct Vnode *vnode);
|
int VnodeFreeAll(const struct Mount *mnt);
|
||||||
int VnodeFreeAll(struct Mount *mnt);
|
|
||||||
int VnodeHashInit(void);
|
int VnodeHashInit(void);
|
||||||
uint32_t VfsHashIndex(struct Vnode *vnode);
|
uint32_t VfsHashIndex(struct Vnode *vnode);
|
||||||
int VfsHashGet(const struct Mount *mount, uint32_t hash, struct Vnode **vnode, VfsHashCmp *fun, void *arg);
|
int VfsHashGet(const struct Mount *mount, uint32_t hash, struct Vnode **vnode, VfsHashCmp *fun, void *arg);
|
||||||
void VfsHashRemove(struct Vnode *vnode);
|
void VfsHashRemove(struct Vnode *vnode);
|
||||||
int VfsHashInsert(struct Vnode *vnode, uint32_t hash);
|
int VfsHashInsert(struct Vnode *vnode, uint32_t hash);
|
||||||
void ChangeRoot(struct Vnode *newRoot);
|
void ChangeRoot(struct Vnode *newRoot);
|
||||||
BOOL VnodeInUseIter(struct Vnode *vnode);
|
BOOL VnodeInUseIter(const struct Mount *mount);
|
||||||
struct Vnode *VnodeGetRoot(void);
|
struct Vnode *VnodeGetRoot(void);
|
||||||
void VnodeMemoryDump(void);
|
void VnodeMemoryDump(void);
|
||||||
|
int VnodeDestory(struct Vnode *vnode);
|
||||||
|
|
||||||
#endif /* !_VNODE_H_ */
|
#endif /* !_VNODE_H_ */
|
||||||
|
|
|
||||||
|
|
@ -1148,15 +1148,16 @@ ERROR_HANDLE:
|
||||||
INT32 los_disk_cache_clear(INT32 drvID)
|
INT32 los_disk_cache_clear(INT32 drvID)
|
||||||
{
|
{
|
||||||
INT32 result;
|
INT32 result;
|
||||||
|
los_part *part = get_part(drvID);
|
||||||
los_disk *disk = NULL;
|
los_disk *disk = NULL;
|
||||||
|
|
||||||
result = OsSdSync(drvID);
|
result = OsSdSync(part->disk_id);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
PRINTK("[ERROR]disk_cache_clear SD sync failed!\n");
|
PRINTK("[ERROR]disk_cache_clear SD sync failed!\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
disk = get_disk(drvID);
|
disk = get_disk(part->disk_id);
|
||||||
if (disk == NULL) {
|
if (disk == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,162 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "vfs_config.h"
|
|
||||||
|
|
||||||
#include "sys/mount.h"
|
|
||||||
#include "errno.h"
|
|
||||||
#include "fs/fs.h"
|
|
||||||
|
|
||||||
#include "stdlib.h"
|
|
||||||
|
|
||||||
#include "string.h"
|
|
||||||
#include "disk.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Types
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: getlabel()
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* getlabel() get the volume label of partition(disk) from FAT filesystem by
|
|
||||||
* the 'target' path
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* target : the path which is the mount point of FAT filesystem device.
|
|
||||||
* label : the string var pointer, by which passed out label string.
|
|
||||||
*
|
|
||||||
* Return:
|
|
||||||
* Zero is returned on success; -1 is returned on an error and errno is
|
|
||||||
* set appropriately:
|
|
||||||
*
|
|
||||||
* ENOMEM There is no memory for allocated space for var.
|
|
||||||
* EFAULT The pointer 'target' does not pass in corretly.
|
|
||||||
* ENOENT The pointer 'target' pointed to a wrong location.
|
|
||||||
* EPERM The pointer 'target' does not point to a mount inode.
|
|
||||||
* EINVAL The pointer 'label' does not pass in correctly.
|
|
||||||
* EACCES The filesystem which 'target' point to is not supported.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int getlabel(const char *target, char *label)
|
|
||||||
{
|
|
||||||
#ifdef VFS_IMPL_LATER
|
|
||||||
struct inode *mountpt_inode = NULL;
|
|
||||||
int errcode = OK;
|
|
||||||
int status;
|
|
||||||
char *fullpath = NULL;
|
|
||||||
struct inode_search_s desc;
|
|
||||||
int ret;
|
|
||||||
/* Verify required pointer arguments */
|
|
||||||
|
|
||||||
if (target == NULL || label == NULL) {
|
|
||||||
errcode = EFAULT;
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get a absolute path */
|
|
||||||
|
|
||||||
errcode = vfs_normalize_path((const char *)NULL, target, &fullpath);
|
|
||||||
if (errcode < 0) {
|
|
||||||
errcode = -errcode;
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the mountpt */
|
|
||||||
SETUP_SEARCH(&desc, fullpath, false);
|
|
||||||
ret = inode_find(&desc);
|
|
||||||
if (ret < 0) {
|
|
||||||
errcode = EACCES;
|
|
||||||
goto errout_with_fullpath;
|
|
||||||
}
|
|
||||||
mountpt_inode = desc.node;
|
|
||||||
|
|
||||||
/* Verfy the path is a mountpoint path or file path */
|
|
||||||
|
|
||||||
if (!INODE_IS_MOUNTPT(mountpt_inode) && !INODE_IS_BLOCK(mountpt_inode)) {
|
|
||||||
errcode = EPERM;
|
|
||||||
goto errout_with_release;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mountpt_inode->u.i_mops) {
|
|
||||||
status = LOS_OK;
|
|
||||||
if (status < 0) {
|
|
||||||
/* The inode is unhappy with the blkdrvr for some reason */
|
|
||||||
|
|
||||||
errcode = -status;
|
|
||||||
goto errout_with_release;
|
|
||||||
}
|
|
||||||
inode_release(mountpt_inode);
|
|
||||||
free(fullpath);
|
|
||||||
return OK;
|
|
||||||
} else {
|
|
||||||
errcode = EACCES;
|
|
||||||
goto errout_with_release;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A lot of goto's! But they make the error handling much simpler */
|
|
||||||
|
|
||||||
errout_with_release:
|
|
||||||
inode_release(mountpt_inode);
|
|
||||||
errout_with_fullpath:
|
|
||||||
free(fullpath);
|
|
||||||
errout:
|
|
||||||
set_errno(errcode);
|
|
||||||
return VFS_ERROR;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -53,101 +53,7 @@
|
||||||
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
|
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
|
||||||
int virstatfs(const char *path, struct statfs *buf)
|
int virstatfs(const char *path, struct statfs *buf)
|
||||||
{
|
{
|
||||||
#ifdef VFS_IMPL_LATER
|
//currently not implemented
|
||||||
struct inode *inode = NULL;
|
return LOS_OK;
|
||||||
int ret = OK;
|
|
||||||
char *fullpath = NULL;
|
|
||||||
struct inode_search_s desc;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
|
|
||||||
if (!path || !buf)
|
|
||||||
{
|
|
||||||
ret = EFAULT;
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path[0])
|
|
||||||
{
|
|
||||||
ret = ENOENT;
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = vfs_normalize_path((const char *)NULL, path, &fullpath);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ret = -ret;
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get an inode for this file */
|
|
||||||
SETUP_SEARCH(&desc, fullpath, false);
|
|
||||||
ret = inode_find(&desc);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
/* This name does not refer to a psudeo-inode and there is no
|
|
||||||
* mountpoint that includes in this path.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ret = EACCES;
|
|
||||||
free(fullpath);
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
inode = desc.node;
|
|
||||||
|
|
||||||
/* The way we handle the statfs depends on the type of inode that we
|
|
||||||
* are dealing with.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
|
||||||
if (INODE_IS_MOUNTPT(inode))
|
|
||||||
{
|
|
||||||
/* The node is a file system mointpoint. Verify that the mountpoint
|
|
||||||
* supports the statfs() method
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (inode->u.i_mops)
|
|
||||||
{
|
|
||||||
/* Perform the statfs() operation */
|
|
||||||
|
|
||||||
ret = LOS_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = EINVAL;
|
|
||||||
goto errout_with_inode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
ret = EINVAL;
|
|
||||||
goto errout_with_inode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the statfs operation was successful */
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ret = -ret;
|
|
||||||
goto errout_with_inode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Successfully statfs'ed the file */
|
|
||||||
|
|
||||||
inode_release(inode);
|
|
||||||
free(fullpath);
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
/* Failure conditions always set the errno appropriately */
|
|
||||||
|
|
||||||
errout_with_inode:
|
|
||||||
inode_release(inode);
|
|
||||||
free(fullpath);
|
|
||||||
errout:
|
|
||||||
set_errno(ret);
|
|
||||||
return VFS_ERROR;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -64,16 +64,18 @@ void PathCacheDump(void)
|
||||||
void PathCacheMemoryDump(void)
|
void PathCacheMemoryDump(void)
|
||||||
{
|
{
|
||||||
int pathCacheNum = 0;
|
int pathCacheNum = 0;
|
||||||
|
int nameSum = 0;
|
||||||
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
|
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
|
||||||
LIST_HEAD *dhead = &g_pathCacheHashEntrys[i];
|
LIST_HEAD *dhead = &g_pathCacheHashEntrys[i];
|
||||||
struct PathCache *dent = NULL;
|
struct PathCache *dent = NULL;
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) {
|
||||||
pathCacheNum++;
|
pathCacheNum++;
|
||||||
|
nameSum += dent->nameLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRINTK("pathCache number = %d\n", pathCacheNum);
|
PRINTK("pathCache number = %d\n", pathCacheNum);
|
||||||
PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache));
|
PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache) + nameSum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t NameHash(const char *name, int len, struct Vnode *dvp)
|
static uint32_t NameHash(const char *name, int len, struct Vnode *dvp)
|
||||||
|
|
|
||||||
|
|
@ -837,6 +837,10 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
|
||||||
return remove(pathname);
|
return remove(pathname);
|
||||||
}
|
}
|
||||||
d = opendir(pathname);
|
d = opendir(pathname);
|
||||||
|
if (d == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
dirent = readdir(d);
|
dirent = readdir(d);
|
||||||
|
|
|
||||||
129
fs/vfs/vnode.c
129
fs/vfs/vnode.c
|
|
@ -47,7 +47,6 @@ static struct VnodeOps g_devfsOps;
|
||||||
#define ENTRY_TO_VNODE(ptr) LOS_DL_LIST_ENTRY(ptr, struct Vnode, actFreeEntry)
|
#define ENTRY_TO_VNODE(ptr) LOS_DL_LIST_ENTRY(ptr, struct Vnode, actFreeEntry)
|
||||||
#define VNODE_LRU_COUNT 10
|
#define VNODE_LRU_COUNT 10
|
||||||
#define DEV_VNODE_MODE 0755
|
#define DEV_VNODE_MODE 0755
|
||||||
#define MAX_ITER_TIMES 10
|
|
||||||
|
|
||||||
int VnodesInit(void)
|
int VnodesInit(void)
|
||||||
{
|
{
|
||||||
|
|
@ -98,8 +97,8 @@ struct Vnode *VnodeReclaimLru(void)
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
||||||
if ((item->useCount > 0) ||
|
if ((item->useCount > 0) ||
|
||||||
(item->flag & VNODE_FLAG_MOUNT_NEW) ||
|
(item->flag & VNODE_FLAG_MOUNT_ORIGIN) ||
|
||||||
(item->flag & VNODE_FLAG_MOUNT_ORIGIN)) {
|
(item->flag & VNODE_FLAG_MOUNT_NEW)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,29 +168,21 @@ int VnodeFree(struct Vnode *vnode)
|
||||||
if (vnode == NULL) {
|
if (vnode == NULL) {
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
struct PathCache *item = NULL;
|
|
||||||
struct PathCache *nextItem = NULL;
|
|
||||||
|
|
||||||
VnodeHold();
|
VnodeHold();
|
||||||
if (vnode->useCount > 0) {
|
if (vnode->useCount > 0) {
|
||||||
VnodeDrop();
|
VnodeDrop();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
|
|
||||||
PathCacheFree(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->parentPathCaches, struct PathCache, parentEntry) {
|
|
||||||
PathCacheFree(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
VnodePathCacheFree(vnode);
|
||||||
LOS_ListDelete(&(vnode->hashEntry));
|
LOS_ListDelete(&(vnode->hashEntry));
|
||||||
|
LOS_ListDelete(&vnode->actFreeEntry);
|
||||||
|
|
||||||
if (vnode->vop->Reclaim) {
|
if (vnode->vop->Reclaim) {
|
||||||
vnode->vop->Reclaim(vnode);
|
vnode->vop->Reclaim(vnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOS_ListDelete(&vnode->actFreeEntry);
|
|
||||||
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
|
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
|
||||||
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);
|
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);
|
||||||
|
|
||||||
|
|
@ -201,83 +192,35 @@ int VnodeFree(struct Vnode *vnode)
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VnodeFreeIter(struct Vnode *vnode)
|
int VnodeFreeAll(const struct Mount *mount)
|
||||||
{
|
{
|
||||||
struct Vnode *vp = NULL;
|
struct Vnode *vnode = NULL;
|
||||||
struct PathCache *item = NULL;
|
struct Vnode *nextVnode = NULL;
|
||||||
struct PathCache *nextItem = NULL;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(vnode, nextVnode, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
||||||
vp = item->childVnode;
|
if ((vnode->originMount == mount) && !(vnode->flag & VNODE_FLAG_MOUNT_NEW)) {
|
||||||
if (vp == NULL) {
|
ret = VnodeFree(vnode);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ret = VnodeFreeIter(vp);
|
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return VnodeFree(vnode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int VnodeFreeAll(struct Mount *mnt)
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL VnodeInUseIter(const struct Mount *mount)
|
||||||
{
|
{
|
||||||
struct Vnode *vp = NULL;
|
struct Vnode *vnode = NULL;
|
||||||
struct Vnode *mountptVnode = mnt->vnodeCovered;
|
|
||||||
struct PathCache *item = NULL;
|
|
||||||
struct PathCache *nextItem = NULL;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &mountptVnode->childPathCaches, struct PathCache, childEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY(vnode, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
||||||
vp = item->childVnode;
|
if (vnode->originMount == mount) {
|
||||||
if (vp == NULL) {
|
if ((vnode->useCount > 0) || (vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ret = VnodeFreeIter(vp);
|
|
||||||
if (ret != LOS_OK) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VOID VnodeIterDump(struct Vnode *vnode, int increase)
|
|
||||||
{
|
|
||||||
static int count = 0;
|
|
||||||
LIST_ENTRY *list = &vnode->parentPathCaches;
|
|
||||||
struct PathCache *pathCache = LOS_DL_LIST_ENTRY(list->pstNext, struct PathCache, parentEntry);
|
|
||||||
count += increase;
|
|
||||||
if (count >= MAX_ITER_TIMES) {
|
|
||||||
PRINTK("########## Vnode In Use Iteration ##########\n");
|
|
||||||
PRINTK("Iteration times: %d\n", count);
|
|
||||||
PRINTK("%p -- %s --> %p\n", vnode->parent, pathCache->name, vnode);
|
|
||||||
PathCacheDump();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL VnodeInUseIter(struct Vnode *vnode)
|
|
||||||
{
|
|
||||||
struct Vnode *vp = NULL;
|
|
||||||
struct PathCache *item = NULL;
|
|
||||||
struct PathCache *nextItem = NULL;
|
|
||||||
|
|
||||||
VnodeIterDump(vnode, 1);
|
|
||||||
if (vnode->useCount > 0) {
|
|
||||||
VnodeIterDump(vnode, -1);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &vnode->childPathCaches, struct PathCache, childEntry) {
|
|
||||||
vp = item->childVnode;
|
|
||||||
if (vp == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (VnodeInUseIter(vp) == TRUE) {
|
|
||||||
VnodeIterDump(vnode, -1);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VnodeIterDump(vnode, -1);
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -335,7 +278,7 @@ static int PreProcess(const char *originPath, struct Vnode **startVnode, char **
|
||||||
|
|
||||||
static struct Vnode *ConvertVnodeIfMounted(struct Vnode *vnode)
|
static struct Vnode *ConvertVnodeIfMounted(struct Vnode *vnode)
|
||||||
{
|
{
|
||||||
if ((vnode == NULL) || !(vnode->flag & VNODE_FLAG_MOUNT_NEW)) {
|
if ((vnode == NULL) || !(vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) {
|
||||||
return vnode;
|
return vnode;
|
||||||
}
|
}
|
||||||
return vnode->newMount->vnodeCovered;
|
return vnode->newMount->vnodeCovered;
|
||||||
|
|
@ -487,7 +430,7 @@ static void ChangeRootInternal(struct Vnode *rootOld, char *dirname)
|
||||||
mnt->vnodeBeCovered = nodeInFs;
|
mnt->vnodeBeCovered = nodeInFs;
|
||||||
|
|
||||||
nodeInFs->newMount = mnt;
|
nodeInFs->newMount = mnt;
|
||||||
nodeInFs->flag |= VNODE_FLAG_MOUNT_NEW;
|
nodeInFs->flag |= VNODE_FLAG_MOUNT_ORIGIN;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -600,7 +543,7 @@ int VnodeDevInit()
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
devMount->vnodeCovered = devNode;
|
devMount->vnodeCovered = devNode;
|
||||||
devMount->vnodeBeCovered->flag |= VNODE_FLAG_MOUNT_NEW;
|
devMount->vnodeBeCovered->flag |= VNODE_FLAG_MOUNT_ORIGIN;
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -668,8 +611,8 @@ void VnodeMemoryDump(void)
|
||||||
|
|
||||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
|
||||||
if ((item->useCount > 0) ||
|
if ((item->useCount > 0) ||
|
||||||
(item->flag & VNODE_FLAG_MOUNT_NEW) ||
|
(item->flag & VNODE_FLAG_MOUNT_ORIGIN) ||
|
||||||
(item->flag & VNODE_FLAG_MOUNT_ORIGIN)) {
|
(item->flag & VNODE_FLAG_MOUNT_NEW)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,3 +622,27 @@ void VnodeMemoryDump(void)
|
||||||
PRINTK("Vnode number = %d\n", vnodeCount);
|
PRINTK("Vnode number = %d\n", vnodeCount);
|
||||||
PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode));
|
PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VnodeDestory(struct Vnode *vnode)
|
||||||
|
{
|
||||||
|
if (vnode == NULL || vnode->vop != &g_devfsOps) {
|
||||||
|
/* destory only support dev vnode */
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
VnodeHold();
|
||||||
|
if (vnode->useCount > 0) {
|
||||||
|
VnodeDrop();
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
VnodePathCacheFree(vnode);
|
||||||
|
LOS_ListDelete(&(vnode->hashEntry));
|
||||||
|
LOS_ListDelete(&vnode->actFreeEntry);
|
||||||
|
|
||||||
|
free(vnode->data);
|
||||||
|
free(vnode);
|
||||||
|
VnodeDrop();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,14 @@ STATIC INLINE VOID OsAddNode2SortLink(SortLinkAttribute *sortLinkHeader, SortLin
|
||||||
}
|
}
|
||||||
|
|
||||||
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(head->pstNext, SortLinkList, sortLinkNode);
|
SortLinkList *listSorted = LOS_DL_LIST_ENTRY(head->pstNext, SortLinkList, sortLinkNode);
|
||||||
if (listSorted->responseTime >= sortList->responseTime) {
|
if (listSorted->responseTime > sortList->responseTime) {
|
||||||
LOS_ListAdd(head, &sortList->sortLinkNode);
|
LOS_ListAdd(head, &sortList->sortLinkNode);
|
||||||
sortLinkHeader->nodeNum++;
|
sortLinkHeader->nodeNum++;
|
||||||
return;
|
return;
|
||||||
|
} else if (listSorted->responseTime == sortList->responseTime) {
|
||||||
|
LOS_ListAdd(head->pstNext, &sortList->sortLinkNode);
|
||||||
|
sortLinkHeader->nodeNum++;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOS_DL_LIST *prevNode = head->pstPrev;
|
LOS_DL_LIST *prevNode = head->pstPrev;
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,8 @@ struct VmMapRegion {
|
||||||
|
|
||||||
typedef struct VmSpace {
|
typedef struct VmSpace {
|
||||||
LOS_DL_LIST node; /**< vm space dl list */
|
LOS_DL_LIST node; /**< vm space dl list */
|
||||||
LOS_DL_LIST regions; /**< region dl list */
|
|
||||||
LosRbTree regionRbTree; /**< region red-black tree root */
|
LosRbTree regionRbTree; /**< region red-black tree root */
|
||||||
LosMux regionMux; /**< region list mutex lock */
|
LosMux regionMux; /**< region red-black tree mutex lock */
|
||||||
VADDR_T base; /**< vm space base addr */
|
VADDR_T base; /**< vm space base addr */
|
||||||
UINT32 size; /**< vm space size */
|
UINT32 size; /**< vm space size */
|
||||||
VADDR_T heapBase; /**< vm space heap base address */
|
VADDR_T heapBase; /**< vm space heap base address */
|
||||||
|
|
|
||||||
|
|
@ -123,149 +123,6 @@ VOID OsDeletePageCacheLru(LosFilePage *page)
|
||||||
OsPageCacheDel(page);
|
OsPageCacheDel(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VFS_IMPL_LATER
|
|
||||||
STATIC LosFilePage *OsPagecacheGetPageAndFill(struct file *filp, VM_OFFSET_T pgOff, size_t *readSize, VADDR_T *kvaddr)
|
|
||||||
{
|
|
||||||
LosFilePage *page = NULL;
|
|
||||||
struct page_mapping *mapping = filp->f_mapping;
|
|
||||||
|
|
||||||
page = OsFindGetEntry(mapping, pgOff);
|
|
||||||
if (page != NULL) {
|
|
||||||
OsSetPageLocked(page->vmPage);
|
|
||||||
OsPageRefIncLocked(page);
|
|
||||||
*kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
|
|
||||||
*readSize = PAGE_SIZE;
|
|
||||||
} else {
|
|
||||||
page = OsPageCacheAlloc(mapping, pgOff);
|
|
||||||
if (page == NULL) {
|
|
||||||
VM_ERR("Failed to alloc a page frame");
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
OsSetPageLocked(page->vmPage);
|
|
||||||
*kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
|
|
||||||
|
|
||||||
file_seek(filp, pgOff << PAGE_SHIFT, SEEK_SET);
|
|
||||||
/* "ReadPage" func exists definitely in this procedure */
|
|
||||||
*readSize = filp->f_vnode->u.i_mops->readpage(filp, (char *)(UINTPTR)*kvaddr, PAGE_SIZE);
|
|
||||||
if (*readSize == 0) {
|
|
||||||
VM_ERR("read 0 bytes");
|
|
||||||
OsCleanPageLocked(page->vmPage);
|
|
||||||
}
|
|
||||||
OsAddToPageacheLru(page, mapping, pgOff);
|
|
||||||
}
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t OsMappingRead(struct file *filp, char *buf, size_t size)
|
|
||||||
{
|
|
||||||
INT32 ret;
|
|
||||||
vaddr_t kvaddr = 0;
|
|
||||||
UINT32 intSave;
|
|
||||||
struct stat bufStat;
|
|
||||||
size_t readSize = 0;
|
|
||||||
size_t readTotal = 0;
|
|
||||||
size_t readLeft = size;
|
|
||||||
LosFilePage *page = NULL;
|
|
||||||
VM_OFFSET_T pos = file_seek(filp, 0, SEEK_CUR);
|
|
||||||
VM_OFFSET_T pgOff = pos >> PAGE_SHIFT;
|
|
||||||
INT32 offInPage = pos % PAGE_SIZE;
|
|
||||||
struct page_mapping *mapping = filp->f_mapping;
|
|
||||||
INT32 nPages = (ROUNDUP(pos + size, PAGE_SIZE) - ROUNDDOWN(pos, PAGE_SIZE)) >> PAGE_SHIFT;
|
|
||||||
|
|
||||||
ret = stat(filp->f_path, &bufStat);
|
|
||||||
if (ret != OK) {
|
|
||||||
VM_ERR("Get file size failed. (filepath=%s)", filp->f_path);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pos >= bufStat.st_size) {
|
|
||||||
PRINT_INFO("%s filp->f_pos >= bufStat.st_size (pos=%ld, fileSize=%ld)\n", filp->f_path, pos, bufStat.st_size);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOS_SpinLockSave(&mapping->list_lock, &intSave);
|
|
||||||
|
|
||||||
for (INT32 i = 0; (i < nPages) && readLeft; i++, pgOff++) {
|
|
||||||
page = OsPagecacheGetPageAndFill(filp, pgOff, &readSize, &kvaddr);
|
|
||||||
if ((page == NULL) || (readSize == 0)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (readSize < PAGE_SIZE) {
|
|
||||||
readLeft = readSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
readSize = MIN2((PAGE_SIZE - offInPage), readLeft);
|
|
||||||
|
|
||||||
(VOID)memcpy_s((VOID *)buf, readLeft, (char *)(UINTPTR)kvaddr + offInPage, readSize);
|
|
||||||
buf += readSize;
|
|
||||||
readLeft -= readSize;
|
|
||||||
readTotal += readSize;
|
|
||||||
|
|
||||||
offInPage = 0;
|
|
||||||
|
|
||||||
OsCleanPageLocked(page->vmPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOS_SpinUnlockRestore(&mapping->list_lock, intSave);
|
|
||||||
file_seek(filp, pos + readTotal, SEEK_SET);
|
|
||||||
|
|
||||||
return readTotal;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ssize_t OsMappingWrite(struct file *filp, const char *buf, size_t size)
|
|
||||||
{
|
|
||||||
VADDR_T kvaddr;
|
|
||||||
UINT32 intSave;
|
|
||||||
INT32 writeSize = 0;
|
|
||||||
size_t writeLeft = size;
|
|
||||||
VM_OFFSET_T pos = file_seek(filp, 0, SEEK_CUR);
|
|
||||||
VM_OFFSET_T pgOff = pos >> PAGE_SHIFT;
|
|
||||||
INT32 offInPage = pos % PAGE_SIZE;
|
|
||||||
LosFilePage *page = NULL;
|
|
||||||
struct page_mapping *mapping = filp->f_mapping;
|
|
||||||
INT32 nPages = (ROUNDUP(pos + size, PAGE_SIZE) - ROUNDDOWN(pos, PAGE_SIZE)) >> PAGE_SHIFT;
|
|
||||||
|
|
||||||
LOS_SpinLockSave(&mapping->list_lock, &intSave);
|
|
||||||
|
|
||||||
for (INT32 i = 0; i < nPages; i++, pgOff++) {
|
|
||||||
page = OsFindGetEntry(mapping, pgOff);
|
|
||||||
if (page) {
|
|
||||||
kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
|
|
||||||
OsSetPageLocked(page->vmPage);
|
|
||||||
OsPageRefIncLocked(page);
|
|
||||||
} else {
|
|
||||||
page = OsPageCacheAlloc(mapping, pgOff);
|
|
||||||
if (page == NULL) {
|
|
||||||
VM_ERR("Failed to alloc a page frame");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
|
|
||||||
OsAddToPageacheLru(page, mapping, pgOff);
|
|
||||||
OsSetPageLocked(page->vmPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeSize = MIN2((PAGE_SIZE - offInPage), writeLeft);
|
|
||||||
|
|
||||||
(VOID)memcpy_s((char *)(UINTPTR)kvaddr + offInPage, writeLeft, buf, writeSize);
|
|
||||||
buf += writeSize;
|
|
||||||
writeLeft -= writeSize;
|
|
||||||
|
|
||||||
OsMarkPageDirty(page, NULL, offInPage, writeSize);
|
|
||||||
|
|
||||||
offInPage = 0;
|
|
||||||
|
|
||||||
OsCleanPageLocked(page->vmPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOS_SpinUnlockRestore(&mapping->list_lock, intSave);
|
|
||||||
|
|
||||||
file_seek(filp, pos + size - writeLeft, SEEK_SET);
|
|
||||||
return (size - writeLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC VOID OsPageCacheUnmap(LosFilePage *fpage, LosArchMmu *archMmu, VADDR_T vaddr)
|
STATIC VOID OsPageCacheUnmap(LosFilePage *fpage, LosArchMmu *archMmu, VADDR_T vaddr)
|
||||||
{
|
{
|
||||||
UINT32 intSave;
|
UINT32 intSave;
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,6 @@ STATIC BOOL OsVmSpaceInitCommon(LosVmSpace *vmSpace, VADDR_T *virtTtb)
|
||||||
{
|
{
|
||||||
LOS_RbInitTree(&vmSpace->regionRbTree, OsRegionRbCmpKeyFn, OsRegionRbFreeFn, OsRegionRbGetKeyFn);
|
LOS_RbInitTree(&vmSpace->regionRbTree, OsRegionRbCmpKeyFn, OsRegionRbFreeFn, OsRegionRbGetKeyFn);
|
||||||
|
|
||||||
LOS_ListInit(&vmSpace->regions);
|
|
||||||
status_t retval = LOS_MuxInit(&vmSpace->regionMux, NULL);
|
status_t retval = LOS_MuxInit(&vmSpace->regionMux, NULL);
|
||||||
if (retval != LOS_OK) {
|
if (retval != LOS_OK) {
|
||||||
VM_ERR("Create mutex for vm space failed, status: %d", retval);
|
VM_ERR("Create mutex for vm space failed, status: %d", retval);
|
||||||
|
|
@ -239,34 +238,6 @@ STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LosVmMapRegion *OsShareRegionClone(LosVmMapRegion *oldRegion)
|
|
||||||
{
|
|
||||||
/* no need to create vm object */
|
|
||||||
LosVmMapRegion *newRegion = LOS_MemAlloc(m_aucSysMem0, sizeof(LosVmMapRegion));
|
|
||||||
if (newRegion == NULL) {
|
|
||||||
VM_ERR("malloc new region struct failed.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* todo: */
|
|
||||||
*newRegion = *oldRegion;
|
|
||||||
return newRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
LosVmMapRegion *OsPrivateRegionClone(LosVmMapRegion *oldRegion)
|
|
||||||
{
|
|
||||||
/* need to create vm object */
|
|
||||||
LosVmMapRegion *newRegion = LOS_MemAlloc(m_aucSysMem0, sizeof(LosVmMapRegion));
|
|
||||||
if (newRegion == NULL) {
|
|
||||||
VM_ERR("malloc new region struct failed.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* todo: */
|
|
||||||
*newRegion = *oldRegion;
|
|
||||||
return newRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
STATUS_T LOS_VmSpaceClone(LosVmSpace *oldVmSpace, LosVmSpace *newVmSpace)
|
STATUS_T LOS_VmSpaceClone(LosVmSpace *oldVmSpace, LosVmSpace *newVmSpace)
|
||||||
{
|
{
|
||||||
LosVmMapRegion *oldRegion = NULL;
|
LosVmMapRegion *oldRegion = NULL;
|
||||||
|
|
@ -841,11 +812,6 @@ STATUS_T OsIsRegionCanExpand(LosVmSpace *space, LosVmMapRegion *region, size_t s
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if next node is head, then we can expand */
|
|
||||||
if (OsIsVmRegionEmpty(space) == TRUE) {
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextRegion = (LosVmMapRegion *)LOS_RbSuccessorNode(&space->regionRbTree, ®ion->rbNode);
|
nextRegion = (LosVmMapRegion *)LOS_RbSuccessorNode(&space->regionRbTree, ®ion->rbNode);
|
||||||
/* if the gap is larger than size, then we can expand */
|
/* if the gap is larger than size, then we can expand */
|
||||||
if ((nextRegion != NULL) && ((nextRegion->range.base - region->range.base) >= size)) {
|
if ((nextRegion != NULL) && ((nextRegion->range.base - region->range.base) >= size)) {
|
||||||
|
|
|
||||||
|
|
@ -435,11 +435,6 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
|
||||||
INT32 shmid;
|
INT32 shmid;
|
||||||
|
|
||||||
SYSV_SHM_LOCK();
|
SYSV_SHM_LOCK();
|
||||||
if (!((UINT32)shmflg & IPC_CREAT) &&
|
|
||||||
((UINT32)shmflg & IPC_EXCL)) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == IPC_PRIVATE) {
|
if (key == IPC_PRIVATE) {
|
||||||
ret = ShmAllocSeg(key, size, shmflg);
|
ret = ShmAllocSeg(key, size, shmflg);
|
||||||
|
|
@ -454,6 +449,11 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shmid = ret;
|
shmid = ret;
|
||||||
|
if (((UINT32)shmflg & IPC_CREAT) &&
|
||||||
|
((UINT32)shmflg & IPC_EXCL)) {
|
||||||
|
ret = -EEXIST;
|
||||||
|
goto ERROR;
|
||||||
|
}
|
||||||
ret = ShmPermCheck(ShmFindSeg(shmid), (UINT32)shmflg & ACCESSPERMS);
|
ret = ShmPermCheck(ShmFindSeg(shmid), (UINT32)shmflg & ACCESSPERMS);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = -ret;
|
ret = -ret;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,23 @@ endchoice
|
||||||
|
|
||||||
config BOOTENV_ADDR
|
config BOOTENV_ADDR
|
||||||
int "Address of boot command line (KB)"
|
int "Address of boot command line (KB)"
|
||||||
depends on PLATFORM_ROOTFS
|
depends on PLATFORM_ROOTFS && (STORAGE_SPINOR || STORAGE_SPINAND || STORAGE_EMMC)
|
||||||
range 0 1024
|
range 0 1024
|
||||||
default 512
|
default 512
|
||||||
help
|
help
|
||||||
Boot command line addr, range from 0 to 1MB.
|
Boot command line addr, range from 0 to 1MB.
|
||||||
|
|
||||||
|
config BOOTENV_RAM
|
||||||
|
bool "Read bootenv from RAM"
|
||||||
|
default n
|
||||||
|
depends on PLATFORM_ROOTFS
|
||||||
|
help
|
||||||
|
Answer Y to read bootenv from ram. Need boot copy to RAM.
|
||||||
|
|
||||||
|
config BOOTENV_RAMSIZE
|
||||||
|
int "Size of boot environment in RAM (Byte)"
|
||||||
|
depends on PLATFORM_ROOTFS && BOOTENV_RAM
|
||||||
|
range 128 1024
|
||||||
|
default 512
|
||||||
|
help
|
||||||
|
Boot environment in Ram space size, range from 128 to 1024 byte.
|
||||||
|
|
|
||||||
|
|
@ -117,10 +117,6 @@
|
||||||
#include "los_hilog.h"
|
#include "los_hilog.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LOSCFG_QUICK_START
|
|
||||||
#include "los_quick_start_pri.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
STATIC SystemRebootFunc g_rebootHook = NULL;
|
STATIC SystemRebootFunc g_rebootHook = NULL;
|
||||||
|
|
||||||
|
|
@ -388,13 +384,6 @@ STATIC UINT32 OsSystemInitTaskCreate(VOID)
|
||||||
return LOS_TaskCreate(&taskID, &sysTask);
|
return LOS_TaskCreate(&taskID, &sysTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOSCFG_QUICK_START
|
|
||||||
UINT32 OsSystemInitStep2(VOID)
|
|
||||||
{
|
|
||||||
SystemInit2();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UINT32 OsSystemInit(VOID)
|
UINT32 OsSystemInit(VOID)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi
|
||||||
#ifndef LOSCFG_SECURITY_BOOT
|
#ifndef LOSCFG_SECURITY_BOOT
|
||||||
STATIC INT32 GetArgs(CHAR **args)
|
STATIC INT32 GetArgs(CHAR **args)
|
||||||
{
|
{
|
||||||
#ifdef LOSCFG_QUICK_START
|
#ifdef LOSCFG_BOOTENV_RAM
|
||||||
*args = OsGetArgsAddr();
|
*args = OsGetArgsAddr();
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
||||||
|
|
@ -387,7 +387,7 @@ STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32
|
||||||
PRINT_ERR("Cannot get bootargs!\n");
|
PRINT_ERR("Cannot get bootargs!\n");
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
}
|
}
|
||||||
#ifndef LOSCFG_QUICK_START
|
#ifndef LOSCFG_BOOTENV_RAM
|
||||||
CHAR *argsBak = NULL;
|
CHAR *argsBak = NULL;
|
||||||
argsBak = args;
|
argsBak = args;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -399,7 +399,7 @@ STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32
|
||||||
p = strsep(&args, " ");
|
p = strsep(&args, " ");
|
||||||
}
|
}
|
||||||
if ((*fsType != NULL) && (*rootType != NULL)) {
|
if ((*fsType != NULL) && (*rootType != NULL)) {
|
||||||
#ifndef LOSCFG_QUICK_START
|
#ifndef LOSCFG_BOOTENV_RAM
|
||||||
free(argsBak);
|
free(argsBak);
|
||||||
#endif
|
#endif
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
|
|
@ -415,7 +415,7 @@ ERROUT:
|
||||||
free(*fsType);
|
free(*fsType);
|
||||||
*fsType = NULL;
|
*fsType = NULL;
|
||||||
}
|
}
|
||||||
#ifndef LOSCFG_QUICK_START
|
#ifndef LOSCFG_BOOTENV_RAM
|
||||||
free(argsBak);
|
free(argsBak);
|
||||||
#endif
|
#endif
|
||||||
return LOS_NOK;
|
return LOS_NOK;
|
||||||
|
|
@ -444,7 +444,7 @@ STATIC VOID OsMountUserdata(const CHAR *fsType)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
err = get_errno();
|
err = get_errno();
|
||||||
if (err == ENOENT) {
|
if (err == ENOTSUP) {
|
||||||
#ifdef LOSCFG_FS_FAT
|
#ifdef LOSCFG_FS_FAT
|
||||||
ret = format(emmcUserdataDev, 0, FM_FAT32);
|
ret = format(emmcUserdataDev, 0, FM_FAT32);
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ INT32 OsMountRootfs(VOID);
|
||||||
VOID OsSetCmdLineAddr(UINT64 addr);
|
VOID OsSetCmdLineAddr(UINT64 addr);
|
||||||
UINT64 OsGetCmdLineAddr(VOID);
|
UINT64 OsGetCmdLineAddr(VOID);
|
||||||
|
|
||||||
#ifdef LOSCFG_QUICK_START
|
#ifdef LOSCFG_BOOTENV_RAM
|
||||||
CHAR *OsGetArgsAddr(VOID);
|
CHAR *OsGetArgsAddr(VOID);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _LOS_ROOTFS_H */
|
#endif /* _LOS_ROOTFS_H */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see extra/config/Kconfig-language.txt
|
||||||
|
#
|
||||||
|
mainmenu "Huawei LiteOS Configuration"
|
||||||
|
|
||||||
|
menu "Enable Kernel TestSuit"
|
||||||
|
|
||||||
|
config KERNEL_TEST
|
||||||
|
bool "Enable Kernel Testsuit"
|
||||||
|
|
||||||
|
config TEST
|
||||||
|
bool "Enable Auto TestSuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST
|
||||||
|
|
||||||
|
source "./kernel/Kconfig"
|
||||||
|
source "./kernel/Kconfig_case"
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
LITEOSTESTTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||||
|
export OS=$(shell uname -s)
|
||||||
|
ifneq ($(OS), Linux)
|
||||||
|
LITEOSTESTTOPDIR := $(shell dirname $(subst \,/,$(LITEOSTESTTOPDIR))/./)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LITEOSTOPDIR := $(LITEOSTESTTOPDIR)/..
|
||||||
|
export LITEOSTOPDIR
|
||||||
|
export LITEOSTESTTOPDIR
|
||||||
|
|
||||||
|
-include $(LITEOSTESTTOPDIR)/config.mk
|
||||||
|
|
||||||
|
RM = -rm -rf
|
||||||
|
MAKE = make
|
||||||
|
__LIBS = libs
|
||||||
|
APPS = apps
|
||||||
|
KERNEL = kernel
|
||||||
|
TEST = test
|
||||||
|
TEST_KERNEL = test_kernel
|
||||||
|
TEST_APPS = test_apps
|
||||||
|
ROOTFSDIR = rootfsdir
|
||||||
|
ROOTFS = rootfs
|
||||||
|
HIDE := @
|
||||||
|
|
||||||
|
LITEOS_TEST_TARGET = liteos_ktest
|
||||||
|
LITEOS_TEST_LIBC = test_libs
|
||||||
|
LITEOS_LIBS_TARGET = libs_target
|
||||||
|
|
||||||
|
LITEOS_TEST_AUTOCONFIG_H = $(LITEOSTESTTOPDIR)/include/generated/autoconf.h
|
||||||
|
LITEOS_TEST_KERNEL_MENUCONFIG_H = $(LITEOSTESTTOPDIR)/kernel/include
|
||||||
|
#######LITEOS_TEST_USER_MENUCONFIG_H = $(LITEOSTESTTOPDIR)/apps/include
|
||||||
|
ifeq ($(LOSCFG_KERNEL_TEST), y)
|
||||||
|
LITEOS_TEST_MENUCONFIG_H = $(LITEOS_TEST_KERNEL_MENUCONFIG_H)/test_menuconfig.h
|
||||||
|
#######else
|
||||||
|
#######LITEOS_TEST_MENUCONFIG_H = $(LITEOS_TEST_USER_MENUCONFIG_H)/test_menuconfig.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_STORAGE_SPINOR), y)
|
||||||
|
FSTYPE = jffs2
|
||||||
|
endif
|
||||||
|
ifeq ($(LOSCFG_STORAGE_EMMC), y)
|
||||||
|
FSTYPE = vfat
|
||||||
|
endif
|
||||||
|
ROOTFS_DIR = $(OUT)/rootfs
|
||||||
|
ROOTFS_ZIP = $(OUT)/rootfs.zip
|
||||||
|
VERSION =
|
||||||
|
|
||||||
|
LITEOS_LIBDEP := $(LITEOS_BASELIB)
|
||||||
|
|
||||||
|
$(TEST_KERNEL): $(LITEOS_TEST_TARGET)
|
||||||
|
|
||||||
|
$(LITEOS_TEST_TARGET): $(LITEOS_TEST_LIBC)
|
||||||
|
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/$@.map -o $(OUT)/$@ --start-group $(LITEOS_LIBDEP) --end-group
|
||||||
|
$(OBJCOPY) -O binary $(OUT)/$@ $(LITEOS_TARGET_DIR)/$@.bin
|
||||||
|
$(OBJDUMP) -t $(OUT)/$@ |sort >$(OUT)/$@.sym.sorted
|
||||||
|
$(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm
|
||||||
|
|
||||||
|
$(LITEOS_TEST_LIBC): $(KERNEL)
|
||||||
|
$(HIDE)for dir in $(TESTLIB_SUBDIRS); \
|
||||||
|
do $(MAKE) -C $$dir all || exit 1; \
|
||||||
|
done
|
||||||
|
$(HIDE)echo "=============== make lib done ==============="
|
||||||
|
|
||||||
|
$(KERNEL): $(LITEOS_TEST_AUTOCONFIG_H)
|
||||||
|
$(HIDE)$(MAKE) -C ../ lib || exit 1
|
||||||
|
#echo "LITEOS_CFLAGS : $(LITEOS_CFLAGS)"
|
||||||
|
|
||||||
|
##### make test menuconfig #####
|
||||||
|
export CONFIG_=LOSCFG_
|
||||||
|
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig
|
||||||
|
TEST_KCONFIG_FILE_PATH = $(LITEOSTESTTOPDIR)/Kconfig
|
||||||
|
|
||||||
|
menuconfig:$(MENUCONFIG_PATH)/mconf
|
||||||
|
$< $(TEST_KCONFIG_FILE_PATH)
|
||||||
|
|
||||||
|
genconfig:$(MENUCONFIG_PATH)/conf
|
||||||
|
$(HIDE)mkdir -p include/config include/generated
|
||||||
|
$< --silentoldconfig $(TEST_KCONFIG_FILE_PATH)
|
||||||
|
mv -f $(LITEOS_TEST_AUTOCONFIG_H) $(LITEOS_TEST_MENUCONFIG_H)
|
||||||
|
|
||||||
|
##### menuconfig end #######
|
||||||
|
|
||||||
|
genconfig:$(MENUCONFIG_PATH)/conf
|
||||||
|
|
||||||
|
$(LITEOS_TEST_AUTOCONFIG_H):
|
||||||
|
ifneq ($(LITEOS_TEST_MENUCONFIG_H), $(wildcard $(LITEOS_TEST_MENUCONFIG_H)))
|
||||||
|
$(HIDE)$(MAKE) genconfig
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(HIDE)$(MAKE) -C ../ clean || exit 1
|
||||||
|
$(HIDE)for dir in $(TESTLIB_SUBDIRS); \
|
||||||
|
do $(MAKE) -C $$dir clean || exit 1; \
|
||||||
|
done
|
||||||
|
$(HIDE)$(RM) include
|
||||||
|
$(HIDE)$(RM) $(LITEOS_TEST_MENUCONFIG_H)
|
||||||
|
$(HIDE)$(RM) $(OUT)
|
||||||
|
.PHONY: test_apps test_kernel clean
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
TESTLIB_SUBDIRS :=
|
||||||
|
|
||||||
|
-include $(LITEOSTESTTOPDIR)/.config
|
||||||
|
ifeq ($(LOSCFG_KERNEL_TEST), y)
|
||||||
|
-include $(LITEOSTESTTOPDIR)/kernel/test.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_LLTREPORT) ,y)
|
||||||
|
# -fprofile-arcs may introduce false alarm on 'maybe-uninitialized'
|
||||||
|
LITEOS_GCOV_OPTS := -fprofile-arcs -ftest-coverage -Wno-maybe-uninitialized
|
||||||
|
LITEOS_BASELIB += -lgcov
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
# 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 $(LITEOSTOPDIR)/tools/build/config.mk
|
||||||
|
-include $(LITEOSTESTTOPDIR)/build/los_test_config.mk
|
||||||
|
LITEOS_CFLAGS += -I $(LITEOSTOPDIR)/lib/libc/musl/include \
|
||||||
|
-I $(LITEOSTOPDIR)/lib/libc/musl/obj/include \
|
||||||
|
-I $(LITEOSTOPDIR)/lib/libc/musl/arch/arm \
|
||||||
|
-I $(LITEOSTOPDIR)/lib/libc/musl/arch/generic \
|
||||||
|
-I $(LITEOSTHIRDPARTY)/bounds_checking_function/include \
|
||||||
|
-I $(LITEOSTOPDIR)/security/cap/ \
|
||||||
|
-I $(LITEOSTOPDIR)/security/vid/ \
|
||||||
|
-I $(LITEOSTOPDIR)/platform/include \
|
||||||
|
-I $(LITEOSTOPDIR)/kernel/base/include\
|
||||||
|
-I $(LITEOSTOPDIR)/kernel/include \
|
||||||
|
-I $(LITEOSTOPDIR)/kernel/extended/include \
|
||||||
|
-I $(LITEOSTOPDIR)/fs/vfs \
|
||||||
|
-I $(LITEOSTHIRDPARTY)/FatFs/source \
|
||||||
|
-I $(LITEOSTOPDIR)/fs/proc/include \
|
||||||
|
-I $(LITEOSTOPDIR)/fs/jffs2/os_adapt \
|
||||||
|
-I $(LITEOSTHIRDPARTY)/NuttX/fs/nfs/ \
|
||||||
|
-I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
import("//build/lite/config/component/lite_component.gni")
|
||||||
|
|
||||||
|
static_library("test_base") {
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"src/ChipTest.c",
|
||||||
|
"src/iCunit.c",
|
||||||
|
"src/osTest.c",
|
||||||
|
"src/testrun_shellcmd.c",
|
||||||
|
"src/testusb_shellcmd.c",
|
||||||
|
]
|
||||||
|
|
||||||
|
include_dirs = [
|
||||||
|
"../kernel/base/includ",
|
||||||
|
"../kernel/include",
|
||||||
|
"../kernel/extended/include",
|
||||||
|
"include",
|
||||||
|
"../fs/vfs",
|
||||||
|
"../fs/proc/include",
|
||||||
|
"../fs/jffs2/include",
|
||||||
|
"../fs/nfs/include",
|
||||||
|
"../bsd/compat/linuxkpi/include",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
lite_component("test") {
|
||||||
|
features = [ ":test_base" ]
|
||||||
|
|
||||||
|
# KERNEL BASE TEST
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_IPC) {
|
||||||
|
features += [ "sample/kernel_base/ipc:test_ipc" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_CORE) {
|
||||||
|
features += [ "sample/kernel_base/core:test_core" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_MP) {
|
||||||
|
features += [ "sample/kernel_base/mp:test_mp" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_MEM) {
|
||||||
|
features += [ "sample/kernel_base/mem:test_mem" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_MISC) {
|
||||||
|
features += [ "sample/kernel_base/misc:test_misc" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_OM) {
|
||||||
|
features += [ "sample/kernel_base/om:test_om" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_BASE_ATOMIC) {
|
||||||
|
features += [ "sample/kernel_base/atomic:test_atomic" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# KERNEL EXTEND TEST
|
||||||
|
if (LOSCFG_TEST_KERNEL_EXTEND_CPP) {
|
||||||
|
features += [ "sample/kernel_extend/cpp:test_cpp" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) {
|
||||||
|
features += [ "sample/kernel_extend/cpup:test_cpup" ]
|
||||||
|
}
|
||||||
|
if (LOSCFG_TEST_KERNEL_EXTEND_MMU) {
|
||||||
|
features += [ "sample/kernel_extend/mmu:test_mmu" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# COMPAT TEST
|
||||||
|
if (LOSCFG_TEST_POSIX) {
|
||||||
|
features += [
|
||||||
|
"sample/posix:test_posix",
|
||||||
|
# "sample/posix/smp:test_posix_smp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# if (LOSCFG_TEST_POSIX_MEM) {
|
||||||
|
# features += [ "sample/posix/mem:test_posix_mem" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_MQUEUE) {
|
||||||
|
# features += [ "sample/posix/mqueue:test_posix_mqueue" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_MUTEX) {
|
||||||
|
# features += [ "sample/posix/mutex:test_posix_mutex" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_PTHREAD) {
|
||||||
|
# features += [ "sample/posix/pthread:test_posix_pthread" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_SCHED) {
|
||||||
|
# features += [ "sample/posix/sched:test_posix_sched" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_SEM) {
|
||||||
|
# features += [ "sample/posix/sem:test_posix_sem" ]
|
||||||
|
# }
|
||||||
|
# if (LOSCFG_TEST_POSIX_SWTMR) {
|
||||||
|
# features += [ "sample/posix/swtmr:test_posix_swtmr" ]
|
||||||
|
# }
|
||||||
|
if (LOSCFG_TEST_LINUX) {
|
||||||
|
features += [ "sample/linux:test_linux" ]
|
||||||
|
}
|
||||||
|
#if (LOSCFG_TEST_LINUX_HRTIMER) {
|
||||||
|
# features += [ "sample/linux/hrtimer:test_linux_hrtimer" ]
|
||||||
|
#}
|
||||||
|
|
||||||
|
# LIBC TEST
|
||||||
|
if (LOSCFG_TEST_LIBC) {
|
||||||
|
features += [ "sample/libc:test_libc" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# LIBM TEST
|
||||||
|
if (LOSCFG_TEST_LIBM) {
|
||||||
|
features += [ "sample/libm:test_libm" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# SHELL TEST
|
||||||
|
if (LOSCFG_TEST_SHELL) {
|
||||||
|
features += [ "sample/shell:test_shell" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,426 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
config TEST_LEVEL
|
||||||
|
bool "Enable Test Level"
|
||||||
|
default y
|
||||||
|
depends on TEST
|
||||||
|
|
||||||
|
config TEST_SMOKE
|
||||||
|
bool "Enable Test smoke"
|
||||||
|
default y
|
||||||
|
depends on TEST && TEST_LEVEL
|
||||||
|
|
||||||
|
config TEST_FULL
|
||||||
|
bool "Enable Test full"
|
||||||
|
default y
|
||||||
|
depends on TEST && TEST_LEVEL
|
||||||
|
|
||||||
|
config TEST_PRESSURE
|
||||||
|
bool "Enable Test Pressure"
|
||||||
|
default n
|
||||||
|
depends on TEST && TEST_LEVEL
|
||||||
|
|
||||||
|
config TEST_LLT
|
||||||
|
bool "Enable Test LLT"
|
||||||
|
default n
|
||||||
|
depends on TEST && TEST_LEVEL
|
||||||
|
|
||||||
|
config TEST_MUTIL
|
||||||
|
bool "Enable Multi Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_KERNEL_BASE
|
||||||
|
bool "Enable Kernel Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_KERNEL_BASE_IPC
|
||||||
|
bool "Enable IPC Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_CORE
|
||||||
|
bool "Enable CORE Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_MP
|
||||||
|
bool "Enable MP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST && KERNEL_SMP
|
||||||
|
config TEST_KERNEL_BASE_MEM
|
||||||
|
bool "Enable MEM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_VM
|
||||||
|
bool "Enable VM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_MISC
|
||||||
|
bool "Enable MISC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_OM
|
||||||
|
bool "Enable OM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_BASE_ATOMIC
|
||||||
|
bool "Enable ATOMIC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_BASE && TEST
|
||||||
|
config TEST_KERNEL_EXTEND
|
||||||
|
bool "Enable Extended Kernel Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_CPP
|
||||||
|
bool "Enable CPP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_CPUP
|
||||||
|
bool "Enable CPUP Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_EXC
|
||||||
|
bool "Enable EXC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_UNALIGNACCESS
|
||||||
|
bool "Enable UNALIGNACCESS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && DO_ALIGN && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_MMU
|
||||||
|
bool "Enable MMU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_DYNLOAD
|
||||||
|
bool "Enable DYNLOAD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_MPU
|
||||||
|
bool "Enable MPU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_RUNSTOP
|
||||||
|
bool "Enable RUNSTOP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_RUNSTOP && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_SCATTER
|
||||||
|
bool "Enable SCATTER Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && KERNEL_SCATTER && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_TICKLESS
|
||||||
|
bool "Enable TICKLESS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_KERNEL_EXTEND_TRACE
|
||||||
|
bool "Enable TRACE Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_KERNEL_EXTEND && TEST
|
||||||
|
config TEST_POSIX
|
||||||
|
bool "Enable Posix Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_POSIX_MEM
|
||||||
|
bool "Enable Mem Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_MQUEUE
|
||||||
|
bool "Enable Mqueue Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_MUTEX
|
||||||
|
bool "Enable Mutex Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_PTHREAD
|
||||||
|
bool "Enable Pthread Testsuit"
|
||||||
|
default y
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_SCHED
|
||||||
|
bool "Enable Sched Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_SEM
|
||||||
|
bool "Enable Sem Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_POSIX_SWTMR
|
||||||
|
bool "Enable Swtmr Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_POSIX && TEST
|
||||||
|
config TEST_LINUX
|
||||||
|
bool "Enable Linux Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_LINUX_HRTIMER
|
||||||
|
bool "Enable Hrtimer Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_LINUX && TEST
|
||||||
|
config TEST_FS
|
||||||
|
bool "Enable FS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
|
||||||
|
config TEST_FS_VFS
|
||||||
|
bool "Enable VFS Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
config TEST_FS_JFFS
|
||||||
|
bool "Enable JFFS Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
config TEST_FS_RAMFS
|
||||||
|
bool "Enable RAMFS Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
|
||||||
|
config TEST_FS_FAT
|
||||||
|
bool "Enable FAT Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
config TEST_FS_FAT_FAT32
|
||||||
|
bool "Enable FAT32 Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS_FAT && TEST
|
||||||
|
config TEST_FAT32_FSCK
|
||||||
|
bool "Enable FAT32 Fsck Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS_FAT && TEST
|
||||||
|
|
||||||
|
config TEST_FS_VIRPART
|
||||||
|
bool "Enable FAT virtual partition test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && FS_FAT_VIRTUAL_PARTITION && TEST_FS && TEST
|
||||||
|
config TEST_FS_PROC
|
||||||
|
bool "Enable PROC Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
config TEST_FS_NFS
|
||||||
|
bool "Enable NFS Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_FS && TEST
|
||||||
|
config TEST_MTD
|
||||||
|
bool "Enable MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
|
||||||
|
config TEST_MTD_JFFS
|
||||||
|
bool "Enable JFFS MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_MTD && TEST
|
||||||
|
|
||||||
|
config TEST_MTD_FAT
|
||||||
|
bool "Enable FAT MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
|
||||||
|
|
||||||
|
config TEST_MTD_DISK
|
||||||
|
bool "Enable FAT MTD DISK Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_MTD && !FS_FAT_VIRTUAL_PARTITION && TEST
|
||||||
|
|
||||||
|
config TEST_MTD_FAT_VIRPART
|
||||||
|
bool "Enable FAT virtual partition MTD test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_MTD && FS_FAT_VIRTUAL_PARTITION && TEST
|
||||||
|
|
||||||
|
config TEST_DRIVERBASE
|
||||||
|
bool "Enable DriverBase Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_LIBC
|
||||||
|
bool "Enable LIBC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_LIBM
|
||||||
|
bool "Enable LIBM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
|
||||||
|
config TEST_SHELL
|
||||||
|
bool "Enable Shell Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_USB
|
||||||
|
bool "Enable Usb Manual Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST && DRIVERS_USB
|
||||||
|
help
|
||||||
|
|
||||||
|
config TEST_HOST_MASS_DEVICE
|
||||||
|
bool "Enable Host Mass Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE && TEST
|
||||||
|
config TEST_HOST_UVC
|
||||||
|
bool "Enable Host UVC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HOST_UVC && TEST
|
||||||
|
|
||||||
|
config TEST_DEVICE_MASS_GADGET
|
||||||
|
bool "Enable Device Mass Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_MASS_STORAGE_GADGET && TEST
|
||||||
|
config TEST_UVC_GADGET
|
||||||
|
bool "Enable UVC Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UVC_GADGET && TEST
|
||||||
|
config TEST_UAC_GADGET
|
||||||
|
bool "Enable UAC Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_UAC_GADGET && TEST
|
||||||
|
|
||||||
|
config TEST_CAMERA_GADGET
|
||||||
|
bool "Enable Camera Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_CAMERA_GADGET && TEST
|
||||||
|
config TEST_HUB_GADGET
|
||||||
|
bool "Enable HUB Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && TEST
|
||||||
|
config TEST_SERIAL_GADGET
|
||||||
|
bool "Enable Serial Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_SERIAL_GADGET && TEST
|
||||||
|
config TEST_HID_GADGET
|
||||||
|
bool "Enable HID Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_HID_GADGET && TEST
|
||||||
|
config TEST_ETHERNET_GADGET
|
||||||
|
bool "Enable Ethernet Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETHERNET_GADGET && TEST
|
||||||
|
config TEST_MULTI_GADGET
|
||||||
|
bool "Enable Ethernet & Serial Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_ETH_SER_GADGET && TEST
|
||||||
|
config TEST_DFU_GADGET
|
||||||
|
bool "Enable Drivers DFU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && DRIVERS_USB_DFU_GADGET && TEST
|
||||||
|
config TEST_MUTILDEVICE_GADGET
|
||||||
|
bool "Enable Drivers Multidevices Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && TEST
|
||||||
|
config TEST_SMP_USB
|
||||||
|
bool "Enable Usb SMP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && TEST && KERNEL_SMP
|
||||||
|
config TEST_HOST_ETH
|
||||||
|
bool "Enable Host Eth Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_USB && TEST
|
||||||
|
|
||||||
|
config TEST_AUTO_USB
|
||||||
|
bool "Enable Usb Auto Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST && DRIVERS_USB
|
||||||
|
|
||||||
|
config TEST_MMC
|
||||||
|
bool "Enable MMC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST
|
||||||
|
|
||||||
|
config TEST_SD
|
||||||
|
bool "Enable SD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
|
||||||
|
|
||||||
|
config TEST_SDIO
|
||||||
|
bool "Enable SDIO Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST
|
||||||
|
|
||||||
|
comment "Only one platform can be selected"
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
|
||||||
|
config TEST_SDIO_1131S
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
|
||||||
|
bool "1131s"
|
||||||
|
config TEST_SDIO_RTL8189
|
||||||
|
depends on KERNEL_TEST && DRIVERS_MMC && TEST_MMC && TEST && TEST_SDIO
|
||||||
|
bool "RTL8189"
|
||||||
|
|
||||||
|
config TEST_PERFORMANCE
|
||||||
|
bool "Enable Performance Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config TEST_PERFORMANCE_CORE
|
||||||
|
bool "Enable Performance CORE Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
|
||||||
|
config TEST_PERFORMANCE_MEM
|
||||||
|
bool "Enable Performance MEM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
|
||||||
|
config TEST_PERFORMANCE_FS
|
||||||
|
bool "Enable Performance FS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
|
||||||
|
config TEST_PERFORMANCE_USB
|
||||||
|
bool "Enable Performance USB Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
|
||||||
|
config TEST_PERFORMANCE_NET
|
||||||
|
bool "Enable Performance NET Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_PERFORMANCE && TEST
|
||||||
|
|
||||||
|
config TEST_NET
|
||||||
|
bool "Enable NET Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
config TEST_LWIP
|
||||||
|
bool "Enable LWIP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST_NET && TEST
|
||||||
|
config AR6K3_WIFI_TEST
|
||||||
|
bool "Enable AR6K3_WIFI Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_QRD
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
config BCM_WIFI_TEST
|
||||||
|
bool "Enable BCM_WIFI Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST && DRIVERS_WIFI_BCM
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
|
||||||
|
config TEST_PLATFORM
|
||||||
|
bool "Enable Platform Testsuit"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST
|
||||||
|
config 3RDPARTY_TEST
|
||||||
|
bool "Enable 3rdParty Test"
|
||||||
|
default n
|
||||||
|
depends on KERNEL_TEST && TEST && 3RDPARTY
|
||||||
|
help
|
||||||
|
Attention: 3rdParty tools and libs test
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,387 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
config LOSCFG_TEST_LEVEL
|
||||||
|
int "Test Level"
|
||||||
|
default 2
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
help
|
||||||
|
Attention:
|
||||||
|
0:smoke test
|
||||||
|
1:llt test
|
||||||
|
2:full test
|
||||||
|
3:presssure test
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE
|
||||||
|
bool "Enable Kernel Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_IPC
|
||||||
|
bool "Enable IPC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_CORE
|
||||||
|
bool "Enable CORE Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_MEM
|
||||||
|
bool "Enable MEM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_VM
|
||||||
|
bool "Enable VM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_MISC
|
||||||
|
bool "Enable MISC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_OM
|
||||||
|
bool "Enable OM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_BASE_ATOMIC
|
||||||
|
bool "Enable ATOMIC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_BASE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND
|
||||||
|
bool "Enable Extended Kernel Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_CPP
|
||||||
|
bool "Enable CPP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_CPUP
|
||||||
|
bool "Enable CPUP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_EXC
|
||||||
|
bool "Enable EXC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_UNALIGNACCESS
|
||||||
|
bool "Enable UNALIGNACCESS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_DO_ALIGN && LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_MMU
|
||||||
|
bool "Enable MMU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_DYNLOAD
|
||||||
|
bool "Enable DYNLOAD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_MPU
|
||||||
|
bool "Enable MPU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_TICKLESS
|
||||||
|
bool "Enable TICKLESS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_KERNEL_EXTEND_TRACE
|
||||||
|
bool "Enable TRACE Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_KERNEL_EXTEND && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_POSIX
|
||||||
|
bool "Enable Posix Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_MEM
|
||||||
|
bool "Enable Mem Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_MQUEUE
|
||||||
|
bool "Enable Mqueue Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_MUTEX
|
||||||
|
bool "Enable Mutex Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_PTHREAD
|
||||||
|
bool "Enable Pthread Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_SCHED
|
||||||
|
bool "Enable Sched Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_SEM
|
||||||
|
bool "Enable Sem Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_POSIX_SWTMR
|
||||||
|
bool "Enable Swtmr Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_POSIX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_LINUX
|
||||||
|
bool "Enable Linux Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_LINUX_HRTIMER
|
||||||
|
bool "Enable Hrtimer Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_LINUX && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS
|
||||||
|
bool "Enable FS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_FS_VFS
|
||||||
|
bool "Enable VFS Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_JFFS
|
||||||
|
bool "Enable JFFS Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_RAMFS
|
||||||
|
bool "Enable RAMFS Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_FS_FAT
|
||||||
|
bool "Enable FAT Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_FAT_FAT32
|
||||||
|
bool "Enable FAT32 Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_FAT_EXFAT
|
||||||
|
bool "Enable exFAT Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FAT32_FSCK
|
||||||
|
bool "Enable FAT32 Fsck Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS_FAT && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_FS_VIRPART
|
||||||
|
bool "Enable FAT virtual partition test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_PROC
|
||||||
|
bool "Enable PROC Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_FS_NFS
|
||||||
|
bool "Enable NFS Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_FS && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_MTD
|
||||||
|
bool "Enable MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_MTD_JFFS
|
||||||
|
bool "Enable JFFS MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_MTD && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_MTD_FAT
|
||||||
|
bool "Enable FAT MTD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_MTD && !LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_MTD_FAT_VIRPART
|
||||||
|
bool "Enable FAT virtual partition MTD test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_MTD && LOSCFG_FS_FAT_VIRTUAL_PARTITION && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_DRIVERBASE
|
||||||
|
bool "Enable DriverBase Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_LIBC
|
||||||
|
bool "Enable LIBC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_LIBM
|
||||||
|
bool "Enable LIBM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_SHELL
|
||||||
|
bool "Enable Shell Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_USB
|
||||||
|
bool "Enable Usb Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_USB
|
||||||
|
help
|
||||||
|
|
||||||
|
config LOSCFG_TEST_HOST_MASS_DEVICE
|
||||||
|
bool "Enable Host Mass Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_DEVICE_MASS_GADGET
|
||||||
|
bool "Enable Device Mass Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_UVC_GADGET
|
||||||
|
bool "Enable UVC Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UVC_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_UAC_GADGET
|
||||||
|
bool "Enable UAC Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_UAC_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_CAMERA_GADGET
|
||||||
|
bool "Enable Camera Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_CAMERA_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_HUB_GADGET
|
||||||
|
bool "Enable HUB Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_MASS_STORAGE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_SERIAL_GADGET
|
||||||
|
bool "Enable Serial Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_SERIAL_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_ETHERNET_GADGET
|
||||||
|
bool "Enable Ethernet Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETHERNET_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_MULTI_GADGET
|
||||||
|
bool "Enable Ethernet & Serial Gadget Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_DRIVERS_USB_ETH_SER_GADGET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_DFU_GADGET
|
||||||
|
bool "Enable Drivers DFU Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_MUTILDEVICE_GADGET
|
||||||
|
bool "Enable Drivers Multidevices Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_HOST_ETH
|
||||||
|
bool "Enable Host Eth Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_AUTO_USB
|
||||||
|
bool "Enable Usb auto Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_USB && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_MMC
|
||||||
|
bool "Enable MMC Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_MMC
|
||||||
|
|
||||||
|
config LOSCFG_TEST_SD
|
||||||
|
bool "Enable SD Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_SDIO
|
||||||
|
bool "Enable SDIO Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
comment "Only one platform can be selected"
|
||||||
|
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_SDIO_1131S
|
||||||
|
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
|
||||||
|
bool "1131s"
|
||||||
|
config LOSCFG_TEST_SDIO_RTL8189
|
||||||
|
depends on LOSCFG_TEST_SDIO && LOSCFG_TEST_MMC && LOSCFG_DRIVERS_MMC && LOSCFG_TESTSUIT_SHELL
|
||||||
|
bool "RTL8189"
|
||||||
|
|
||||||
|
config LOSCFG_TEST_PERFORMANCE
|
||||||
|
bool "Enable Performance Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_PERFORMANCE_CORE
|
||||||
|
bool "Enable Performance CORE Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_PERFORMANCE_MEM
|
||||||
|
bool "Enable Performance MEM Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_PERFORMANCE_FS
|
||||||
|
bool "Enable Performance FS Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_PERFORMANCE_USB
|
||||||
|
bool "Enable Performance USB Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config LOSCFG_TEST_PERFORMANCE_NET
|
||||||
|
bool "Enable Performance NET Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_PERFORMANCE && LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_PLATFORM
|
||||||
|
bool "Enable Platform Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
config LOSCFG_TEST_NET
|
||||||
|
bool "Enable NET Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
|
||||||
|
config LOSCFG_TEST_LWIP
|
||||||
|
bool "Enable LWIP Testsuit"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TEST_NET && LOSCFG_TESTSUIT_SHELL
|
||||||
|
config AR6K3_WIFI_TEST
|
||||||
|
bool "Enable AR6K3_WIFI Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_QRD
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
config BCM_WIFI_TEST
|
||||||
|
bool "Enable BCM_WIFI Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_DRIVERS_WIFI_BCM
|
||||||
|
help
|
||||||
|
Attention: if this option turns on, other test suits will be ignored.
|
||||||
|
|
||||||
|
config LOSCFG_3RDPARTY_TEST
|
||||||
|
bool "Enable 3rdParty Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL && LOSCFG_3RDPARTY
|
||||||
|
help
|
||||||
|
Attention: 3rdParty tools and libs test
|
||||||
|
config LOSCFG_TEST_MANUAL_SHELL
|
||||||
|
bool "Enable Manual Test"
|
||||||
|
default n
|
||||||
|
depends on LOSCFG_TESTSUIT_SHELL
|
||||||
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
# 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 $(LITEOSTESTTOPDIR)/config.mk
|
||||||
|
|
||||||
|
MODULE_NAME := ktest
|
||||||
|
|
||||||
|
LOCAL_INCLUDE := -I $(LITEOSTESTTOPDIR)/kernel/include
|
||||||
|
|
||||||
|
LOCAL_SRCS := $(wildcard src/osTest.c) \
|
||||||
|
$(wildcard src/runstop_osTest.c) \
|
||||||
|
$(wildcard src/scatter_osTest.c) \
|
||||||
|
$(wildcard src/iCunit.c) \
|
||||||
|
$(wildcard src/ChipTest.c) \
|
||||||
|
$(wildcard src/testusb_shellcmd.c) \
|
||||||
|
$(wildcard src/testrun_shellcmd.c)
|
||||||
|
|
||||||
|
LOCAL_FLAGS := $(LOCAL_INCLUDE) -Wno-error -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include \
|
||||||
|
-I $(LITEOSTOPDIR)/fs/fat/os_adapt
|
||||||
|
|
||||||
|
include $(MODULE)
|
||||||
|
|
@ -0,0 +1,574 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNI_ICUNIT_H
|
||||||
|
#define _UNI_ICUNIT_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "los_typedef.h"
|
||||||
|
#include "los_spinlock.h"
|
||||||
|
|
||||||
|
#ifdef TST_DRVPRINT
|
||||||
|
#include "VOS_typdef.h"
|
||||||
|
#include "uartdriver.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
typedef unsigned short iUINT16;
|
||||||
|
typedef unsigned int iUINT32;
|
||||||
|
typedef signed short iINT16;
|
||||||
|
typedef signed long iINT32;
|
||||||
|
typedef char iCHAR;
|
||||||
|
typedef void iVOID;
|
||||||
|
|
||||||
|
typedef unsigned long iiUINT32;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FUNCTION_TEST (1 << 0)
|
||||||
|
|
||||||
|
#define PRESSURE_TEST (1 << 1)
|
||||||
|
|
||||||
|
#define PERFORMANCE_TEST (1 << 2)
|
||||||
|
|
||||||
|
#define TEST_MODE (FUNCTION_TEST)
|
||||||
|
|
||||||
|
#define TEST_LESSER_MEM NO
|
||||||
|
|
||||||
|
|
||||||
|
typedef iUINT32 (*CASE_FUNCTION)(void);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const iCHAR *pcCaseID;
|
||||||
|
CASE_FUNCTION pstCaseFunc;
|
||||||
|
iUINT16 testcase_layer;
|
||||||
|
iUINT16 testcase_module;
|
||||||
|
iUINT16 testcase_level;
|
||||||
|
iUINT16 testcase_type;
|
||||||
|
iiUINT32 retCode;
|
||||||
|
iUINT16 errLine;
|
||||||
|
} ICUNIT_CASE_S;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
iUINT16 uwCaseCnt;
|
||||||
|
iCHAR *pcSuitID;
|
||||||
|
iCHAR *pucFilename;
|
||||||
|
ICUNIT_CASE_S *pstCaseList;
|
||||||
|
iUINT16 passCnt;
|
||||||
|
iUINT16 failCnt;
|
||||||
|
} ICUNIT_SUIT_S;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEST_TASK = 0,
|
||||||
|
TEST_MEM,
|
||||||
|
TEST_VM,
|
||||||
|
TEST_SEM,
|
||||||
|
TEST_MUX,
|
||||||
|
TEST_RWLOCK,
|
||||||
|
TEST_EVENT,
|
||||||
|
TEST_QUE,
|
||||||
|
TEST_SWTMR,
|
||||||
|
TEST_HWI,
|
||||||
|
TEST_MP,
|
||||||
|
TEST_ATO,
|
||||||
|
TEST_CPUP,
|
||||||
|
TEST_SCATTER,
|
||||||
|
TEST_RUNSTOP,
|
||||||
|
TEST_TIMER,
|
||||||
|
TEST_MMU,
|
||||||
|
TEST_ROBIN,
|
||||||
|
TEST_LIBC,
|
||||||
|
TEST_WAIT,
|
||||||
|
TEST_VFAT,
|
||||||
|
TEST_JFFS,
|
||||||
|
TEST_RAMFS,
|
||||||
|
TEST_NFS,
|
||||||
|
TEST_PROC,
|
||||||
|
TEST_FS,
|
||||||
|
TEST_UART,
|
||||||
|
TEST_PTHREAD,
|
||||||
|
TEST_COMP,
|
||||||
|
TEST_HWI_HALFBOTTOM,
|
||||||
|
TEST_WORKQ,
|
||||||
|
TEST_WAKELOCK,
|
||||||
|
TEST_TIMES,
|
||||||
|
TEST_LIBM,
|
||||||
|
TEST_SUPPORT,
|
||||||
|
TEST_STL,
|
||||||
|
TEST_MAIL,
|
||||||
|
TEST_MSG,
|
||||||
|
TEST_CP,
|
||||||
|
TEST_SIGNAL,
|
||||||
|
TEST_SCHED,
|
||||||
|
TEST_MTDCHAR,
|
||||||
|
TEST_TIME,
|
||||||
|
TEST_WRITE,
|
||||||
|
TEST_READ,
|
||||||
|
TEST_DYNLOAD,
|
||||||
|
TEST_REGISTER,
|
||||||
|
TEST_UNAME,
|
||||||
|
TEST_ERR,
|
||||||
|
TEST_CMD,
|
||||||
|
TEST_TICKLESS,
|
||||||
|
TEST_TRACE,
|
||||||
|
TEST_UNALIGNACCESS,
|
||||||
|
TEST_EXC,
|
||||||
|
TEST_REQULATOR,
|
||||||
|
TEST_DEVFREQ,
|
||||||
|
TEST_CPUFREQ,
|
||||||
|
TEST_MISC,
|
||||||
|
#if defined(LOSCFG_3RDPARTY_TEST)
|
||||||
|
TEST_THTTPD,
|
||||||
|
TEST_BIDIREFC,
|
||||||
|
TEST_CJSON,
|
||||||
|
TEST_CURL,
|
||||||
|
TEST_FFMPEG,
|
||||||
|
TEST_FREETYPE,
|
||||||
|
TEST_INIPARSER,
|
||||||
|
TEST_JSONCPP,
|
||||||
|
TEST_LIBICONV,
|
||||||
|
TEST_LIBJPEG,
|
||||||
|
TEST_LIBPNG,
|
||||||
|
TEST_OPENEXIF,
|
||||||
|
TEST_OPENSSL,
|
||||||
|
TEST_OPUS,
|
||||||
|
TEST_SQLITE,
|
||||||
|
TEST_TINYXML,
|
||||||
|
TEST_XML2,
|
||||||
|
TEST_ZBAR,
|
||||||
|
TEST_HARFBUZZ,
|
||||||
|
#endif
|
||||||
|
TEST_DRIVERBASE,
|
||||||
|
TEST_UDP,
|
||||||
|
TEST_TCP,
|
||||||
|
TEST_MODULE_ALL,
|
||||||
|
} LiteOS_test_module;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEST_LOS = 0,
|
||||||
|
TEST_POSIX,
|
||||||
|
TEST_LIB,
|
||||||
|
TEST_VFS,
|
||||||
|
TEST_EXTEND,
|
||||||
|
TEST_PARTITION,
|
||||||
|
TEST_CPP,
|
||||||
|
TEST_SHELL,
|
||||||
|
TEST_LINUX,
|
||||||
|
TEST_USB,
|
||||||
|
#if defined(LOSCFG_3RDPARTY_TEST)
|
||||||
|
TEST_3RDPARTY,
|
||||||
|
#endif
|
||||||
|
TEST_DRIVERFRAME,
|
||||||
|
TEST_NET_LWIP,
|
||||||
|
TEST_LAYER_ALL,
|
||||||
|
} LiteOS_test_layer;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEST_LEVEL0 = 0,
|
||||||
|
TEST_LEVEL1,
|
||||||
|
TEST_LEVEL2,
|
||||||
|
TEST_LEVEL3,
|
||||||
|
TEST_LEVEL4,
|
||||||
|
TEST_LEVEL_ALL,
|
||||||
|
} LiteOS_test_level;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEST_FUNCTION = 0,
|
||||||
|
TEST_PRESSURE,
|
||||||
|
TEST_PERFORMANCE,
|
||||||
|
TEST_TYPE_ALL,
|
||||||
|
} LiteOS_test_type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEST_SEQUENCE = 0,
|
||||||
|
TEST_RANDOM
|
||||||
|
} LiteOS_test_sequence;
|
||||||
|
|
||||||
|
extern iUINT16 g_iCunitErrLineNo;
|
||||||
|
extern iiUINT32 g_iCunitErrCode;
|
||||||
|
extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
|
||||||
|
|
||||||
|
#define ICUNIT_UNINIT 0x0EF00000
|
||||||
|
#define ICUNIT_OPENFILE_FAILED 0x0EF00001
|
||||||
|
#define ICUNIT_ALLOC_FAIL 0x0EF00002
|
||||||
|
#define ICUNIT_SUIT_FULL 0x0EF00002
|
||||||
|
#define ICUNIT_CASE_FULL 0x0EF00003
|
||||||
|
#define ICUNIT_SUIT_ALL 0x0EF0FFFF
|
||||||
|
|
||||||
|
#define ICUNIT_SUCCESS 0x00000000
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#define ICUNIT_TRACK_NOT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_NOT_EQUAL_NULL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return NULL; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_EQUAL_NULL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return NULL; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_EQUAL_VOID(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_NOT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_WITHIN_EQUAL(param, value1, value2, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) < (value1) || (param) > (value2)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_WITHIN_EQUAL_VOID(param, value1, value2, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) < (value1) || (param) > (value2)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_WITHIN_EQUAL_NULL(param, value1, value2, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) < (value1) || (param) > (value2)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_SIZE_STRING_EQUAL(str1, str2, strsize, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strncmp((str1), (str2), (strsize)) != 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_EQUAL_TIME(param, g_value, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) < (g_value - 1) || (param) > (g_value + 1)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) != 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_STRING_EQUAL_VOID(str1, str2, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) != 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) == 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_EQUAL(param, g_value, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_EQUAL_IN(param, value1, value2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if (((param) != (value1)) && ((param) != (value2))) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_NOT_EQUAL(param, g_value, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_WITHIN_EQUAL(param, value1, value2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) < (value1) || (param) > (value2)) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) != 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) == 0) { \
|
||||||
|
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define ICUNIT_TRACK_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_TRACK_NOT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_EQUAL_VOID(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#define ICUNIT_ASSERT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_NOT_EQUAL(param, g_value, retcode) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) != 0) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) == 0) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_EQUAL(param, g_value, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) != (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_NOT_EQUAL(param, g_value, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if ((param) == (g_value)) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) != 0) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \
|
||||||
|
do { \
|
||||||
|
if (strcmp(str1, str2) == 0) { \
|
||||||
|
g_iCunitErrLineNo = (g_iCunitErrLineNo == 0) ? __LINE__ : g_iCunitErrLineNo; \
|
||||||
|
g_iCunitErrCode = (g_iCunitErrCode == 0) ? (iiUINT32)retcode : g_iCunitErrCode; \
|
||||||
|
goto label; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
extern SPIN_LOCK_S g_testSuitSpin;
|
||||||
|
#define TESTSUIT_LOCK(state) LOS_SpinLockSave(&g_testSuitSpin, &(state))
|
||||||
|
#define TESTSUIT_UNLOCK(state) LOS_SpinUnlockRestore(&g_testSuitSpin, state)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern iUINT32 iCunitAddSuit_F(iCHAR *suitName, iCHAR *pfileName);
|
||||||
|
#define iCunitAddSuit(suitName) iCunitAddSuit_F(suitName, __FILE__)
|
||||||
|
extern iUINT32 ICunitAddCase(const iCHAR *caseName, CASE_FUNCTION caseFunc, iUINT16 testcaseLayer,
|
||||||
|
iUINT16 testcaseModule, iUINT16 testcaseLevel, iUINT16 testcaseType);
|
||||||
|
|
||||||
|
extern iUINT32 ICunitRunTestOne(const char *tcId);
|
||||||
|
extern INT32 ICunitRunTestArray(const char *tcSequence, const char *tcNum, const char *tcLayer, const char *tcModule,
|
||||||
|
const char *tcLevel, const char *tcType);
|
||||||
|
extern iUINT32 ICunitRunTestArraySequence(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUINT32 testcaseModule,
|
||||||
|
iUINT32 testcaseLevel, iUINT32 testcaseType);
|
||||||
|
extern iUINT32 ICunitRunTestArrayRandom(iUINT32 testcaseNum, iUINT32 testcaseLayer, iUINT32 testcaseModule,
|
||||||
|
iUINT32 testcaseLevel, iUINT32 testcaseType);
|
||||||
|
extern iUINT32 ICunitRunTestcaseSatisfied(ICUNIT_CASE_S *testCase, iUINT32 testcaseLayer, iUINT32 testcaseModule,
|
||||||
|
iUINT32 testcaseLevel, iUINT32 testcaseType);
|
||||||
|
|
||||||
|
extern iUINT32 ICunitInit(void);
|
||||||
|
extern iUINT32 ICunitRunSingle(ICUNIT_CASE_S *psubCase);
|
||||||
|
extern iUINT32 ICunitRunF(ICUNIT_CASE_S *psubCase);
|
||||||
|
|
||||||
|
extern iUINT32 iCunitPrintReport(void);
|
||||||
|
|
||||||
|
|
||||||
|
#define TEST_ADD_CASE(name, casefunc, testcase_layer, testcase_module, testcase_level, testcase_type) \
|
||||||
|
do { \
|
||||||
|
iUINT32 uwRet = 1; \
|
||||||
|
uwRet = ICunitAddCase(name, (CASE_FUNCTION)casefunc, testcase_layer, testcase_module, testcase_level, \
|
||||||
|
testcase_type); \
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(uwRet, ICUNIT_SUCCESS, uwRet); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define TEST_RUN_SUITE() \
|
||||||
|
do { \
|
||||||
|
UINT32 uiRet; \
|
||||||
|
uiRet = iCunitRun(); \
|
||||||
|
ICUNIT_ASSERT_NOT_EQUAL_VOID(uiRet, ICUNIT_UNINIT, ICUNIT_UNINIT); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#endif /* _UNI_ICUNIT_H */
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ICUNIT_ICUNIT_INC
|
||||||
|
#define _ICUNIT_ICUNIT_INC
|
||||||
|
|
||||||
|
#include "iCunit_config.h"
|
||||||
|
#include "los_builddef.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
ICUNIT_CASE_S g_iCunitRandArray[1];
|
||||||
|
ICUNIT_CASE_S g_iCunitCaseArray[ICUNIT_CASE_SIZE];
|
||||||
|
|
||||||
|
iUINT32 g_iCunitInitSuccess = 0x0000FFFF;
|
||||||
|
iUINT32 g_iCunitCaseCnt = 0xFFFF;
|
||||||
|
iUINT32 g_iCunitCaseFailedCnt = 0;
|
||||||
|
iUINT32 g_iCunitErrLogAddCase = 0;
|
||||||
|
|
||||||
|
iUINT16 g_iCunitErrLineNo;
|
||||||
|
iiUINT32 g_iCunitErrCode;
|
||||||
|
|
||||||
|
iUINT32 g_iCunitCaseRun = 0;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _UNI_ICUNIT_INC */
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* 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 "los_builddef.h"
|
||||||
|
#ifndef _ICUNIT_CONFIG_H
|
||||||
|
#define _ICUNIT_CONFIG_H
|
||||||
|
|
||||||
|
#include "los_builddef.h"
|
||||||
|
#include "los_config.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#if defined(LITEOS_TEST_AUTO) && !defined(LOSCFG_TEST_MUTIL)
|
||||||
|
#define ICUNIT_CASE_SIZE LOSCFG_BASE_CORE_TSK_LIMIT
|
||||||
|
#else
|
||||||
|
#define ICUNIT_CASE_SIZE 20000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ICUNIT_SUIT_SIZE 1
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LOS_TEST_PRI_H
|
||||||
|
#define _LOS_TEST_PRI_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
extern UINT32 OsTestInit(VOID);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _LOS_TEST_PRI_H */
|
||||||
|
|
@ -0,0 +1,374 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OSTEST_H
|
||||||
|
#define _OSTEST_H
|
||||||
|
|
||||||
|
#ifndef SWTMR_TEST
|
||||||
|
#define SWTMR_TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "test_menuconfig.h"
|
||||||
|
#include "stdarg.h"
|
||||||
|
#include "los_config.h"
|
||||||
|
#include "iCunit.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "limits.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "los_base.h"
|
||||||
|
#include "los_config.h"
|
||||||
|
#include "los_typedef.h"
|
||||||
|
#include "los_hwi.h"
|
||||||
|
#include "los_vm_map.h"
|
||||||
|
#include "los_task.h"
|
||||||
|
#include "los_sched_pri.h"
|
||||||
|
#include "los_task_pri.h"
|
||||||
|
#include "los_sys_pri.h"
|
||||||
|
#include "los_sem_pri.h"
|
||||||
|
#include "los_event.h"
|
||||||
|
#include "los_memory.h"
|
||||||
|
#include "los_queue.h"
|
||||||
|
#include "los_swtmr.h"
|
||||||
|
#include "los_mux.h"
|
||||||
|
#include "los_queue_pri.h"
|
||||||
|
#include "los_atomic.h"
|
||||||
|
#if !defined(TEST1980) && !defined(TESTISP)
|
||||||
|
#include "console.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LOSCFG_AARCH64
|
||||||
|
#ifdef LOSCFG_LIB_LIBC
|
||||||
|
#include "time.h"
|
||||||
|
#endif
|
||||||
|
#include "target_config.h"
|
||||||
|
#endif
|
||||||
|
#include "los_process_pri.h"
|
||||||
|
#include "pthread.h"
|
||||||
|
|
||||||
|
#ifdef LOSCFG_PLATFORM_HI3516DV300
|
||||||
|
#define TEST3516DV300
|
||||||
|
#elif LOSCFG_PLATFORM_HI3518EV300
|
||||||
|
#define TEST3518EV300
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
|
||||||
|
do { \
|
||||||
|
memset(&testTask, 0, sizeof(TSK_INIT_PARAM_S)); \
|
||||||
|
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
|
||||||
|
testTask.uwStackSize = LOS_TASK_MIN_STACK_SIZE; \
|
||||||
|
testTask.pcName = task_name; \
|
||||||
|
testTask.usTaskPrio = prio; \
|
||||||
|
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
#define TEST_TASK_PARAM_INIT_AFFI(testTask, task_name, entry, prio, affi) \
|
||||||
|
TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
|
||||||
|
testTask.usCpuAffiMask = affi;
|
||||||
|
#else
|
||||||
|
#define TEST_TASK_PARAM_INIT_AFFI(stTestTask, task_name, entry, prio, affi) \
|
||||||
|
TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio)
|
||||||
|
#endif
|
||||||
|
#define JFFS_BASE_MTD_ADDR 0x100000
|
||||||
|
#define JFFS_BASE_MTD_LEN 0x600000
|
||||||
|
|
||||||
|
|
||||||
|
#define TASK_PRIO_TEST 25
|
||||||
|
#define TASK_PRIO_TEST_TASK 4
|
||||||
|
#define TASK_PRIO_TEST_SWTMR 4
|
||||||
|
#ifdef LOSCFG_AARCH64
|
||||||
|
#define TASK_STACK_SIZE_TEST (LOS_TASK_MIN_STACK_SIZE * 3)
|
||||||
|
#else
|
||||||
|
#define TASK_STACK_SIZE_TEST LOS_TASK_MIN_STACK_SIZE
|
||||||
|
#endif
|
||||||
|
#define LOS_MS_PER_TICK (OS_SYS_MS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND)
|
||||||
|
|
||||||
|
#define HWI_NUM_INTVALID OS_HWI_MAX_NUM
|
||||||
|
#define writel(g_value, address) WRITE_UINT32(g_value, address)
|
||||||
|
#ifdef TESTPBXA9
|
||||||
|
extern int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_POSIX)
|
||||||
|
extern UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri);
|
||||||
|
extern UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern UINT32 TaskCountGetTest(VOID);
|
||||||
|
extern UINT32 SemCountGetTest(VOID);
|
||||||
|
extern UINT32 QueueCountGetTest(VOID);
|
||||||
|
extern UINT32 SwtmrCountGetTest(VOID);
|
||||||
|
extern void hal_interrupt_set_affinity(uint32_t irq, uint32_t cpuMask);
|
||||||
|
|
||||||
|
#define TASK_EXISTED_NUM (TaskCountGetTest())
|
||||||
|
#define QUEUE_EXISTED_NUM (QueueCountGetTest())
|
||||||
|
#define SWTMR_EXISTED_NUM (SwtmrCountGetTest())
|
||||||
|
#define SEM_EXISTED_NUM (SemCountGetTest())
|
||||||
|
|
||||||
|
extern void TestTestHwiDelete(unsigned int irq, void *devId);
|
||||||
|
extern void TestHwiTrigger(unsigned int irq);
|
||||||
|
extern void TestExtraTaskDelay(UINT32 tick);
|
||||||
|
extern UINT64 TestTickCountGet(void);
|
||||||
|
extern UINT64 TestTickCountByCurrCpuid(void);
|
||||||
|
extern void TestBusyTaskDelay(UINT32 tick);
|
||||||
|
extern void *malloc(size_t size);
|
||||||
|
extern void TestDumpCpuid(void);
|
||||||
|
extern u_long TRandom(void);
|
||||||
|
|
||||||
|
#define TEST_HwiDelete(ID) TestTestHwiDelete(ID, NULL)
|
||||||
|
#define TEST_HwiClear(ID) HalIrqMask(ID)
|
||||||
|
#define TEST_HwiTriggerDelay LOS_TaskDelay(200 * LOSCFG_BASE_CORE_TICK_PER_SECOND / 1000)
|
||||||
|
#define TEST_HwiCreate(ID, prio, mode, Func, arg) LOS_HwiCreate(ID, prio, mode, Func, arg)
|
||||||
|
|
||||||
|
|
||||||
|
#define HWI_NUM_INT0 0
|
||||||
|
#define HWI_NUM_INT1 1
|
||||||
|
#define HWI_NUM_INT2 2
|
||||||
|
#define HWI_NUM_INT3 3
|
||||||
|
#define HWI_NUM_INT4 4
|
||||||
|
#define HWI_NUM_INT5 5
|
||||||
|
#define HWI_NUM_INT6 6
|
||||||
|
#define HWI_NUM_INT7 7
|
||||||
|
#define HWI_NUM_INT11 11
|
||||||
|
#define HWI_NUM_INT12 12
|
||||||
|
#define HWI_NUM_INT13 13
|
||||||
|
#define HWI_NUM_INT14 14
|
||||||
|
#define HWI_NUM_INT15 15
|
||||||
|
#define HWI_NUM_INT16 16
|
||||||
|
#define HWI_NUM_INT17 17
|
||||||
|
#define HWI_NUM_INT18 18
|
||||||
|
#define HWI_NUM_INT19 19
|
||||||
|
#define HWI_NUM_INT21 21
|
||||||
|
#define HWI_NUM_INT22 22
|
||||||
|
#define HWI_NUM_INT23 23
|
||||||
|
#define HWI_NUM_INT24 24
|
||||||
|
#define HWI_NUM_INT25 25
|
||||||
|
#define HWI_NUM_INT26 26
|
||||||
|
#define HWI_NUM_INT27 27
|
||||||
|
#define HWI_NUM_INT28 28
|
||||||
|
#define HWI_NUM_INT30 30
|
||||||
|
#define HWI_NUM_INT31 31
|
||||||
|
#define HWI_NUM_INT32 32
|
||||||
|
#define HWI_NUM_INT33 33
|
||||||
|
#define HWI_NUM_INT34 34
|
||||||
|
#define HWI_NUM_INT35 35
|
||||||
|
#define HWI_NUM_INT42 42
|
||||||
|
#define HWI_NUM_INT45 45
|
||||||
|
#define HWI_NUM_INT46 46
|
||||||
|
#define HWI_NUM_INT50 50
|
||||||
|
#define HWI_NUM_INT55 55
|
||||||
|
#define HWI_NUM_INT56 56
|
||||||
|
#define HWI_NUM_INT57 57
|
||||||
|
#define HWI_NUM_INT58 58
|
||||||
|
#define HWI_NUM_INT59 59
|
||||||
|
#define HWI_NUM_INT60 60
|
||||||
|
#define HWI_NUM_INT61 61
|
||||||
|
#define HWI_NUM_INT63 63
|
||||||
|
#define HWI_NUM_INT62 62
|
||||||
|
#define HWI_NUM_INT68 68
|
||||||
|
#define HWI_NUM_INT69 69
|
||||||
|
|
||||||
|
#define HWI_NUM_INT95 95
|
||||||
|
#define HWI_NUM_INT114 114
|
||||||
|
#define HWI_NUM_INT169 169
|
||||||
|
|
||||||
|
#if defined TESTPBXA9
|
||||||
|
#define HWI_NUM_TEST HWI_NUM_INT56
|
||||||
|
#define HWI_NUM_TEST1 HWI_NUM_INT57
|
||||||
|
#define HWI_NUM_TEST0 HWI_NUM_INT58
|
||||||
|
#define HWI_NUM_TEST2 HWI_NUM_INT59
|
||||||
|
#define HWI_NUM_TEST3 HWI_NUM_INT60
|
||||||
|
#elif defined TEST3518EV300
|
||||||
|
#define HWI_NUM_TEST0 HWI_NUM_INT58
|
||||||
|
#define HWI_NUM_TEST HWI_NUM_INT59
|
||||||
|
#define HWI_NUM_TEST1 HWI_NUM_INT60
|
||||||
|
#define HWI_NUM_TEST2 HWI_NUM_INT61
|
||||||
|
#define HWI_NUM_TEST3 HWI_NUM_INT68
|
||||||
|
#elif defined TEST3516DV300
|
||||||
|
#define HWI_NUM_TEST HWI_NUM_INT56
|
||||||
|
#define HWI_NUM_TEST1 HWI_NUM_INT57
|
||||||
|
#define HWI_NUM_TEST0 HWI_NUM_INT58
|
||||||
|
#define HWI_NUM_TEST2 HWI_NUM_INT59
|
||||||
|
#define HWI_NUM_TEST3 HWI_NUM_INT60
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TEST_TASKDELAY_1TICK 1
|
||||||
|
#define TEST_TASKDELAY_2TICK 2
|
||||||
|
#define TEST_TASKDELAY_4TICK 4
|
||||||
|
#define TEST_TASKDELAY_10TICK 10
|
||||||
|
#define TEST_TASKDELAY_20TICK 20
|
||||||
|
#define TEST_TASKDELAY_50TICK 50
|
||||||
|
|
||||||
|
#ifdef TEST3731
|
||||||
|
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER1_REG_BASE + TIMER_VALUE)
|
||||||
|
#elif defined TEST3559
|
||||||
|
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER3_REG_BASE + TIMER_VALUE)
|
||||||
|
#else
|
||||||
|
#define TestTimer2ValueGet(temp) READ_UINT32(temp, TIMER2_REG_BASE + TIMER_VALUE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define REALTIME(time) (UINT32)((UINT64)(0xffffffff - time) * 1000 / OS_SYS_CLOCK) /* accuracy:ms */
|
||||||
|
#define HW_TMI(time) (UINT32)((UINT64)(0xffffffff - time) * 1000 / (OS_SYS_CLOCK / 1000000)) /* accuracy:ns */
|
||||||
|
|
||||||
|
#define uart_printf_func dprintf
|
||||||
|
|
||||||
|
#ifndef VFS_STAT_PRINTF
|
||||||
|
#define VFS_STAT_PRINTF 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef VFS_STATFS_PRINTF
|
||||||
|
#define VFS_STATFS_PRINTF 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPEN_FILE_MAX 20
|
||||||
|
|
||||||
|
#define HUAWEI_ENV_NFS 0
|
||||||
|
|
||||||
|
#ifndef TEST_RESOURCELEAK_CHECK
|
||||||
|
#define TEST_RESOURCELEAK_CHECK YES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TEST_MODULE_CHECK
|
||||||
|
#define TEST_MODULE_CHECK YES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OS_PROCESS_STATUS_PEND OS_PROCESS_STATUS_PENDING
|
||||||
|
#define OS_TASK_STATUS_SUSPEND OS_TASK_STATUS_SUSPENDED
|
||||||
|
#define OS_TASK_STATUS_PEND OS_TASK_STATUS_PENDING
|
||||||
|
|
||||||
|
extern UINT32 volatile g_testCount;
|
||||||
|
extern UINT32 g_testCount1;
|
||||||
|
extern UINT32 g_testCount2;
|
||||||
|
extern UINT32 g_testCount3;
|
||||||
|
extern UINT32 g_flowcheck;
|
||||||
|
extern UINT32 g_failResult;
|
||||||
|
extern UINT32 g_passResult;
|
||||||
|
extern UINT32 g_testTskHandle;
|
||||||
|
extern UINT32 g_testTaskID01;
|
||||||
|
extern UINT32 g_testTaskID02;
|
||||||
|
extern UINT32 g_testTaskID03;
|
||||||
|
extern UINT32 g_testTaskID04;
|
||||||
|
extern UINT32 g_hwiNum1;
|
||||||
|
extern UINT32 g_hwiNum2;
|
||||||
|
extern UINT32 g_semID;
|
||||||
|
extern UINT32 g_semID2;
|
||||||
|
extern LosMux g_mutexkernelTest;
|
||||||
|
extern UINT32 g_cpupTestCount;
|
||||||
|
extern UINT16 g_swTmrID;
|
||||||
|
extern UINT32 g_semID;
|
||||||
|
extern UINT32 g_testQueueID01;
|
||||||
|
extern UINT32 g_testQueueID02;
|
||||||
|
extern UINT32 g_testQueueID03;
|
||||||
|
extern UINT32 g_testTskHandle;
|
||||||
|
extern UINT32 g_leavingTaskNum;
|
||||||
|
extern UINT32 g_semID3[];
|
||||||
|
extern EVENT_CB_S g_eventCB;
|
||||||
|
extern EVENT_CB_S g_event;
|
||||||
|
extern UINT32 g_testPeriod;
|
||||||
|
extern BOOL g_isAddArray;
|
||||||
|
extern BOOL g_isSdInit;
|
||||||
|
extern BOOL g_isSpinorInit;
|
||||||
|
extern UINT32 g_getTickConsume;
|
||||||
|
extern UINT32 g_waitTestCount;
|
||||||
|
extern INT32 g_libFileSystem;
|
||||||
|
extern UINT32 LosMuxCreate(LosMux *mutex);
|
||||||
|
extern INT32 g_performanceStart;
|
||||||
|
|
||||||
|
extern void msleep(unsigned int msecs);
|
||||||
|
extern unsigned int sleep(unsigned int seconds);
|
||||||
|
extern int usleep(unsigned useconds);
|
||||||
|
|
||||||
|
#define OS_TASK_STATUS_DETACHED OS_TASK_FLAG_DETACHED
|
||||||
|
extern UINT32 LOS_MemTotalUsedGet(VOID *pool);
|
||||||
|
extern VOID ptestTickConsume(VOID);
|
||||||
|
extern UINT32 TEST_TskDelete(UINT32 taskID);
|
||||||
|
extern UINT32 TEST_SemDelete(UINT32 semHandle);
|
||||||
|
|
||||||
|
extern VOID ItSuiteLosQueue(VOID);
|
||||||
|
extern VOID ItSuiteLosSwtmr(VOID);
|
||||||
|
extern VOID ItSuiteLosTask(VOID);
|
||||||
|
extern VOID ItSuiteLosEvent(VOID);
|
||||||
|
|
||||||
|
extern VOID ItSuiteLosMux(VOID);
|
||||||
|
extern VOID ItSuiteLosRwlock(VOID);
|
||||||
|
extern VOID ItSuiteLosSem(VOID);
|
||||||
|
extern VOID ItSuiteSmpHwi(VOID);
|
||||||
|
extern VOID ItSuiteHwiNesting(VOID);
|
||||||
|
|
||||||
|
extern VOID ItSuiteExtendCpup(VOID);
|
||||||
|
|
||||||
|
extern VOID ItSuitePosixMutex(VOID);
|
||||||
|
extern VOID ItSuitePosixPthread(VOID);
|
||||||
|
|
||||||
|
extern VOID TestRunShell(VOID);
|
||||||
|
|
||||||
|
extern UINT32 OsTestInit(VOID);
|
||||||
|
|
||||||
|
extern void TEST_DT_COMMON(void);
|
||||||
|
extern VOID dprintf(const char *fmt, ...);
|
||||||
|
|
||||||
|
#define BIG_FD 512
|
||||||
|
typedef struct testrunParam {
|
||||||
|
CHAR testcase_sequence[16];
|
||||||
|
CHAR testcase_num[16];
|
||||||
|
CHAR testcase_layer[32];
|
||||||
|
CHAR testcase_module[32];
|
||||||
|
CHAR testcase_level[16];
|
||||||
|
CHAR testcase_type[16];
|
||||||
|
CHAR testcase_id[128];
|
||||||
|
} TEST_RUN_PARAM;
|
||||||
|
|
||||||
|
#define LOSCFG_BASE_CORE_TSK_CONFIG LOSCFG_BASE_CORE_TSK_LIMIT
|
||||||
|
#define LOSCFG_BASE_IPC_SEM_CONFIG LOSCFG_BASE_IPC_SEM_LIMIT
|
||||||
|
#define LOSCFG_BASE_IPC_QUEUE_CONFIG LOSCFG_BASE_IPC_QUEUE_LIMIT
|
||||||
|
#define LOSCFG_BASE_CORE_SWTMR_CONFIG LOSCFG_BASE_CORE_SWTMR_LIMIT
|
||||||
|
|
||||||
|
#define HAL_READ_UINT8(addr, data) READ_UINT8(data, addr)
|
||||||
|
#define HAL_WRITE_UINT8(addr, data) WRITE_UINT8(data, addr)
|
||||||
|
#define HAL_READ_UINT32(addr, data) READ_UINT32(data, addr)
|
||||||
|
#define HAL_WRITE_UINT32(addr, data) WRITE_UINT32(data, addr)
|
||||||
|
|
||||||
|
extern void InitRebootHook(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#endif /* _OSTEST_H */
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
static_library("test_core") {
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"task/It_los_task.c",
|
||||||
|
"swtmr/It_los_swtmr.c",
|
||||||
|
"hwi/It_smp_hwi.c",
|
||||||
|
"hwi_nesting/It_hwi_nesting.c",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (LOSCFG_TEST_SMOKE) {
|
||||||
|
sources += [
|
||||||
|
"task/smoke/It_los_task_045.c",
|
||||||
|
"task/smoke/It_los_task_046.c",
|
||||||
|
"task/smoke/It_los_task_049.c",
|
||||||
|
"task/smoke/It_los_task_081.c",
|
||||||
|
"task/smoke/It_los_task_089.c",
|
||||||
|
"task/smoke/It_los_task_097.c",
|
||||||
|
"task/smoke/It_los_task_099.c",
|
||||||
|
"task/smoke/It_los_task_101.c",
|
||||||
|
"task/smoke/It_los_task_105.c",
|
||||||
|
"task/smoke/It_los_task_timeslice_001.c",
|
||||||
|
"swtmr/smoke/It_los_swtmr_053.c",
|
||||||
|
"swtmr/smoke/It_los_swtmr_058.c",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
include_dirs = [
|
||||||
|
"../../../include/",
|
||||||
|
"task",
|
||||||
|
"swtmr",
|
||||||
|
"hwi",
|
||||||
|
"hwi_nesting",
|
||||||
|
]
|
||||||
|
|
||||||
|
cflags = [ "-Wno-error" ]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
include $(LITEOSTESTTOPDIR)/config.mk
|
||||||
|
|
||||||
|
MODULE_NAME := coretest
|
||||||
|
|
||||||
|
LOCAL_INCLUDE := \
|
||||||
|
-I $(LITEOSTESTTOPDIR)/kernel/include \
|
||||||
|
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/task \
|
||||||
|
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/swtmr \
|
||||||
|
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/hwi \
|
||||||
|
-I $(LITEOSTESTTOPDIR)/kernel/sample/kernel_base/core/hwi_nesting
|
||||||
|
|
||||||
|
SRC_MODULES := task swtmr hwi hwi_nesting
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_KERNEL_SMP), y)
|
||||||
|
SMP_MODULES := task/smp swtmr/smp hwi/smp task/float
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_TEST_LLT), y)
|
||||||
|
LLT_MODULES := task/llt swtmr/llt
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_TEST_PRESSURE), y)
|
||||||
|
PRESSURE_MODULES := task/pressure swtmr/pressure
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_TEST_SMOKE), y)
|
||||||
|
SMOKE_MODULES := task/smoke swtmr/smoke
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_TEST_FULL), y)
|
||||||
|
FULL_MODULES := task/full swtmr/full hwi_nesting/full
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LOSCFG_TEST_MANUAL_SHELL), y)
|
||||||
|
MANUAL_MODULES :=task/manual
|
||||||
|
endif
|
||||||
|
|
||||||
|
LOCAL_MODULES := $(SRC_MODULES) $(LLT_MODULES) $(PRESSURE_MODULES) $(SMOKE_MODULES) $(FULL_MODULES) $(SMP_MODULES) $(MANUAL_MODULES)
|
||||||
|
|
||||||
|
LOCAL_SRCS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.c))
|
||||||
|
LOCAL_CHS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.h))
|
||||||
|
|
||||||
|
LOCAL_FLAGS := $(LOCAL_INCLUDE) -Wno-error
|
||||||
|
|
||||||
|
include $(MODULE)
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
VOID ItSuiteSmpHwi(VOID)
|
||||||
|
{
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
ItSmpLosHwi001();
|
||||||
|
ItSmpLosHwi002();
|
||||||
|
ItSmpLosHwi003();
|
||||||
|
ItSmpLosHwi004();
|
||||||
|
ItSmpLosHwi005();
|
||||||
|
ItSmpLosHwi006();
|
||||||
|
ItSmpLosHwi007();
|
||||||
|
ItSmpLosHwi008();
|
||||||
|
ItSmpLosHwi009();
|
||||||
|
ItSmpLosHwi010();
|
||||||
|
ItSmpLosHwi011();
|
||||||
|
ItSmpLosHwi012();
|
||||||
|
ItSmpLosHwi013();
|
||||||
|
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
ItSmpLosHwiShare001();
|
||||||
|
ItSmpLosHwiShare002();
|
||||||
|
ItSmpLosHwiShare003();
|
||||||
|
ItSmpLosHwiShare004();
|
||||||
|
ItSmpLosHwiShare005();
|
||||||
|
ItSmpLosHwiShare006();
|
||||||
|
ItSmpLosHwiShare007();
|
||||||
|
ItSmpLosHwiShare008();
|
||||||
|
ItSmpLosHwiShare009();
|
||||||
|
ItSmpLosHwiShare010();
|
||||||
|
#endif
|
||||||
|
ItSmpLosHwiIpi001();
|
||||||
|
ItSmpLosHwiIpi002();
|
||||||
|
ItSmpLosHwiIpi003();
|
||||||
|
ItSmpLosHwiIpi004();
|
||||||
|
ItSmpLosHwiIpi005();
|
||||||
|
|
||||||
|
ItSmpLosHwiIpi006();
|
||||||
|
ItSmpLosHwiIpi007();
|
||||||
|
ItSmpLosHwiIpi008();
|
||||||
|
|
||||||
|
ItSmpLosHwiNest001();
|
||||||
|
ItSmpLosHwiNest002();
|
||||||
|
ItSmpLosHwiNest003();
|
||||||
|
ItSmpLosHwiNest004();
|
||||||
|
ItSmpLosHwiNest005();
|
||||||
|
ItSmpLosHwiNest006();
|
||||||
|
ItSmpLosHwiNest007();
|
||||||
|
ItSmpLosHwiNest008();
|
||||||
|
#endif
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, 1);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, 1);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST2, 1);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST3, 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LOS_SMP_HWI_H
|
||||||
|
#define LOS_SMP_HWI_H
|
||||||
|
|
||||||
|
#include "los_hwi.h"
|
||||||
|
#include "osTest.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#define LOOP 100
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_SMP)
|
||||||
|
VOID ItSmpLosHwi001(VOID);
|
||||||
|
VOID ItSmpLosHwi002(VOID);
|
||||||
|
VOID ItSmpLosHwi003(VOID);
|
||||||
|
VOID ItSmpLosHwi004(VOID);
|
||||||
|
VOID ItSmpLosHwi005(VOID);
|
||||||
|
VOID ItSmpLosHwi006(VOID);
|
||||||
|
VOID ItSmpLosHwi007(VOID);
|
||||||
|
VOID ItSmpLosHwi008(VOID);
|
||||||
|
VOID ItSmpLosHwi009(VOID);
|
||||||
|
VOID ItSmpLosHwi010(VOID);
|
||||||
|
VOID ItSmpLosHwi011(VOID);
|
||||||
|
VOID ItSmpLosHwi012(VOID);
|
||||||
|
VOID ItSmpLosHwi013(VOID);
|
||||||
|
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
VOID ItSmpLosHwiShare001(VOID);
|
||||||
|
VOID ItSmpLosHwiShare002(VOID);
|
||||||
|
VOID ItSmpLosHwiShare003(VOID);
|
||||||
|
VOID ItSmpLosHwiShare004(VOID);
|
||||||
|
VOID ItSmpLosHwiShare005(VOID);
|
||||||
|
VOID ItSmpLosHwiShare006(VOID);
|
||||||
|
VOID ItSmpLosHwiShare007(VOID);
|
||||||
|
VOID ItSmpLosHwiShare008(VOID);
|
||||||
|
VOID ItSmpLosHwiShare009(VOID);
|
||||||
|
VOID ItSmpLosHwiShare010(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi001(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi002(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi003(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi004(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi005(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi006(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi007(VOID);
|
||||||
|
VOID ItSmpLosHwiIpi008(VOID);
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest001(VOID);
|
||||||
|
VOID ItSmpLosHwiNest002(VOID);
|
||||||
|
VOID ItSmpLosHwiNest003(VOID);
|
||||||
|
VOID ItSmpLosHwiNest004(VOID);
|
||||||
|
VOID ItSmpLosHwiNest005(VOID);
|
||||||
|
VOID ItSmpLosHwiNest006(VOID);
|
||||||
|
VOID ItSmpLosHwiNest007(VOID);
|
||||||
|
VOID ItSmpLosHwiNest008(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* LOS_SMP_HWI_H */
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_testTimes;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi001(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(0));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
do {
|
||||||
|
__asm__ volatile("nop");
|
||||||
|
} while (g_testCount != 1);
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi002(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_testTimes;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_SHARED_ERROR, ret);
|
||||||
|
#else
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi003(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_testTimes;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_SHARED_ERROR, ret);
|
||||||
|
#else
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi004(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi005(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestAssertBusyTaskDelay(100, 1); // 100, Set the timeout of runtime;
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
TestAssertBusyTaskDelay(100, 2); // 100, Set the timeout of runtime; 2, test runing count
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi006(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF02(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret;
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1);
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT(testTask, "it_hwi_007_task02", TaskF02, TASK_PRIO_TEST + 1);
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID02, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi007(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static UINT32 g_ret = 0;
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
g_ret |= ret;
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, i, j;
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
g_testCount = 0;
|
||||||
|
g_ret = 0;
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1,
|
||||||
|
CPUID_TO_AFFI_MASK(i));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_TaskDelete(g_testTaskID01);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi008(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static UINT32 g_ret = 0;
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
g_ret |= ret;
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, i, j;
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
g_testCount = 0;
|
||||||
|
g_ret = 0;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_007_task01", TaskF01, TASK_PRIO_TEST + 1,
|
||||||
|
CPUID_TO_AFFI_MASK(i));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(2); // 2, set delay time
|
||||||
|
|
||||||
|
#ifdef TEST1980
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
#endif
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
}
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi009(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi010(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi010", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,190 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST);
|
||||||
|
ret = LOS_SwtmrStart(g_szId[0]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
|
||||||
|
LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST1);
|
||||||
|
ret = LOS_SwtmrStart(g_szId[1]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
|
||||||
|
LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF03(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST2);
|
||||||
|
ret = LOS_SwtmrStop(g_szId[1]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
|
||||||
|
LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF04(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST3);
|
||||||
|
ret = LOS_SwtmrStop(g_szId[0]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST2, NULL);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST3, NULL);
|
||||||
|
LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST2, 1, 0, (HWI_PROC_FUNC)HwiF03, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST2, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST3, 1, 0, (HWI_PROC_FUNC)HwiF04, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST3, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1); // start swtmrs
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
|
||||||
|
#endif
|
||||||
|
LOS_TaskDelay(g_testPeriod + 1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2 * (i + 1), g_testCount, EXIT); // 2 * (i + 1),Compared to the expected value.
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST3); // stop swtmrs
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST2);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST3);
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST2);
|
||||||
|
#endif
|
||||||
|
LOS_TaskDelay(g_testPeriod + 1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2 * (i + 1), g_testCount, EXIT); // 2 * (i + 1),Compared to the expected value.
|
||||||
|
}
|
||||||
|
EXIT:
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST2, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST3, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi011(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi011", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[0], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[1], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_SwtmrStart(g_szId[0]);
|
||||||
|
LOS_SwtmrStart(g_szId[1]);
|
||||||
|
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
|
||||||
|
#endif
|
||||||
|
LOS_TaskDelay(g_testPeriod + 1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST1, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[0]);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[1]);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi012(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi012", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, i;
|
||||||
|
for (i = 0; i < TRandom() % 100; i++) { // Get a random number between 0 and 100
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(g_swTmrID);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, i, j;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_swTmrID, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST); // delete swtmr in hwi on other cpu
|
||||||
|
|
||||||
|
for (j = 0; j < TRandom() % 500; j++) { // Get a random number between 0 and 500
|
||||||
|
LOS_SwtmrStart(g_swTmrID); // start swtmr in task on current cpu
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(g_testPeriod + 1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, NULL);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(g_swTmrID);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwi013(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwi013", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
ICUNIT_GOTO_EQUAL(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid(), EXIT);
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid(); // currernt cpu
|
||||||
|
|
||||||
|
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11); // 01:0kernel,10:1kernel,11:0kernel& 1kernel
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi001(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; // other cpu
|
||||||
|
|
||||||
|
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi002(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
g_targetCpuid = currCpuid; // other cpu
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1, CPUID_TO_AFFI_MASK(currCpuid));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time
|
||||||
|
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi003(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ArchCurrCpuid(), g_targetCpuid, ArchCurrCpuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM); // other cpu
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1, CPUID_TO_AFFI_MASK(currCpuid));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time
|
||||||
|
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi004(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
|
||||||
|
|
||||||
|
PRINT_DEBUG("g_targetCpuid = %d\n", g_targetCpuid);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi005(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||||
|
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, index;
|
||||||
|
index = ArchCurrCpuid();
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[index], 0);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i, j;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (j + 1), g_testCount, EXIT);
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[i]);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
LOS_SwtmrDelete(g_szId[i]);
|
||||||
|
}
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi006(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
/* for debugging */
|
||||||
|
STATIC UINT32 g_ipiTriggerTimes = 0;
|
||||||
|
STATIC UINT32 g_ipiRecieveTimes[LOSCFG_KERNEL_CORE_NUM] = { 0 };
|
||||||
|
|
||||||
|
static UINT32 g_szId[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||||
|
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, index;
|
||||||
|
index = ArchCurrCpuid();
|
||||||
|
g_ipiRecieveTimes[index]++;
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[index]);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i, j;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_szId[i], 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_ipiTriggerTimes++;
|
||||||
|
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
PRINTK("sent %u time\n", g_ipiTriggerTimes);
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
PRINTK(" cpu%d recieved %u times\n", i, g_ipiRecieveTimes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (j + 1), g_testCount, EXIT);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
ret = LOS_SwtmrDelete(g_szId[i]);
|
||||||
|
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
PRINT_DEBUG("---%d---\n", g_szId[i]);
|
||||||
|
LOS_SwtmrDelete(g_szId[i]);
|
||||||
|
}
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi007(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID SwtmrF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicDec(&g_testCount);
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret, id;
|
||||||
|
|
||||||
|
id = ArchCurrCpuid() % 3; // 3, Get the current CPU
|
||||||
|
switch (id) {
|
||||||
|
case 0:
|
||||||
|
LOS_SwtmrStart(g_swTmrID);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
LOS_SwtmrDelete(g_swTmrID);
|
||||||
|
break;
|
||||||
|
case 2: // 2, when id is 2
|
||||||
|
LOS_SwtmrStop(g_swTmrID);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
g_targetCpuid = (1 << LOSCFG_KERNEL_CORE_NUM) - 1; // all cpu
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
ret = LOS_SwtmrCreate(g_testPeriod, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)SwtmrF01, &g_swTmrID, 0);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
HalIrqSendIpi(g_targetCpuid, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM * (i + 1), g_testCount, EXIT);
|
||||||
|
LOS_SwtmrDelete(g_swTmrID);
|
||||||
|
}
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
LOS_SwtmrDelete(g_swTmrID);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiIpi008(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiIpi008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid();
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT12); // currernt cpu;
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest001(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
extern EVENT_CB_S g_event;
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
LOS_EventWrite(&g_event, 0x1 << (ArchCurrCpuid()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
LOS_EventInit(&g_event);
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
ret = LOS_EventRead(&g_event, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, ret, EXIT);
|
||||||
|
|
||||||
|
g_targetCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM; // other cpu
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT12);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
LOS_EventDestroy(&g_event);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest002(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest003(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_TEST1);
|
||||||
|
#endif
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM)); // other cpu
|
||||||
|
|
||||||
|
#ifndef TEST1980
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
#else
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(ArchCurrCpuid()), HWI_NUM_TEST);
|
||||||
|
#endif
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest004(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT12);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid(); // current cpu
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest005(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
HalIrqSendIpi(((ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM) + 1, HWI_NUM_INT12);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
HalIrqUnmask(HWI_NUM_INT12);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT12, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid(); // current cpu
|
||||||
|
HalIrqSendIpi(g_targetCpuid + 1, HWI_NUM_INT11);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT12);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest006(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK(g_targetCpuid), HWI_NUM_INT11); // currernt cpu;
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid();
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest007(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
static UINT32 g_targetCpuid;
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
HalIrqSendIpi(CPUID_TO_AFFI_MASK((g_targetCpuid + 1) % LOSCFG_KERNEL_CORE_NUM), HWI_NUM_INT11); // other cpu;
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
g_testPeriod = 10; // 10, Timeout interval of a periodic software timer.
|
||||||
|
g_targetCpuid = 0;
|
||||||
|
|
||||||
|
HalIrqUnmask(HWI_NUM_INT11);
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_INT11, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); // ipi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); // spi
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); // curret cpu
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK((ArchCurrCpuid() + i + 1) %
|
||||||
|
LOSCFG_KERNEL_CORE_NUM)); // let current cpu 's task create at the last
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_targetCpuid = ArchCurrCpuid();
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST1);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2,The expected value
|
||||||
|
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
TEST_HwiDelete(HWI_NUM_INT11);
|
||||||
|
TEST_HwiDelete(HWI_NUM_TEST1);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiNest008(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiNest008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare001(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare002(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare003(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
TestDumpCpuid();
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0x100, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare004(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
g_testCount = 0;
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_001_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(ArchCurrCpuid()));
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0xff, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare005(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev1, g_dev2;
|
||||||
|
extern EVENT_CB_S g_event;
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID HwiF02(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicAdd(&g_testCount, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(void)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
LOS_EventWrite(&g_event, 0x1);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
LOS_EventInit(&g_event);
|
||||||
|
|
||||||
|
g_dev1.pDevId = (void *)1;
|
||||||
|
g_dev1.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev1); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
g_dev2.pDevId = (void *)2; // 2, Set device ID
|
||||||
|
g_dev2.swIrq = HWI_NUM_TEST;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF02, &g_dev2); // 3, Set the interrupt priority
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
currCpuid = (ArchCurrCpuid() + 1) % (LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_002_task", TaskF01, TASK_PRIO_TEST - 1,
|
||||||
|
CPUID_TO_AFFI_MASK(currCpuid)); // cross task
|
||||||
|
ret = LOS_TaskCreate(&g_testTaskID01, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_EventRead(&g_event, 0x1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, 0x1, ret, EXIT);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0xff, g_testCount, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
LOS_EventDestroy(&g_event);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_EventDestroy(&g_event);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev1);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev2);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare006(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
extern EVENT_CB_S g_event;
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev[LOSCFG_KERNEL_CORE_NUM];
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF02(VOID)
|
||||||
|
{
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_EventWrite(&g_event, 0x1 << LOSCFG_KERNEL_CORE_NUM);
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(UINTPTR devIndex)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
// 3, Set the interrupt priority
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[devIndex]));
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_EventWrite(&g_event, 0x1 << devIndex);
|
||||||
|
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
LOS_EventInit(&g_event);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
g_dev[i].pDevId = (void *)(i + 1);
|
||||||
|
g_dev[i].swIrq = HWI_NUM_TEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT(testTask, "it_hwi_share_task", TaskF01,
|
||||||
|
TASK_PRIO_TEST + 1); // not set cpuaffi
|
||||||
|
testTask.auwArgs[0] = i;
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = LOS_EventRead(&g_event, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, (0x1 << LOSCFG_KERNEL_CORE_NUM) - 1, ret, EXIT);
|
||||||
|
|
||||||
|
TEST_TASK_PARAM_INIT(testTask, "it_hwi_share_task", TaskF02,
|
||||||
|
TASK_PRIO_TEST + 1); // not set cpuaffi
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_EventRead(&g_event, (0x1 << (LOSCFG_KERNEL_CORE_NUM + 1)) - 1, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, (0x1 << (LOSCFG_KERNEL_CORE_NUM + 1)) - 1, ret, EXIT);
|
||||||
|
|
||||||
|
LOS_TaskDelay(2); // 2, set delay time
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, LOSCFG_KERNEL_CORE_NUM, g_testCount, EXIT);
|
||||||
|
EXIT:
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[i]));
|
||||||
|
}
|
||||||
|
LOS_EventDestroy(&g_event);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare007(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static UINT32 g_ret = 0;
|
||||||
|
static HwiIrqParam g_dev;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01()
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev); // 3, Set the interrupt priority
|
||||||
|
g_ret |= ret;
|
||||||
|
TestDumpCpuid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i, j;
|
||||||
|
|
||||||
|
g_dev.pDevId = (void *)(1);
|
||||||
|
g_dev.swIrq = HWI_NUM_TEST;
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
g_testCount = 0;
|
||||||
|
g_ret = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1,
|
||||||
|
CPUID_TO_AFFI_MASK(i));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
}
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare008(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare008", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev;
|
||||||
|
static UINT32 g_ret = 0;
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
TEST_HwiClear(HWI_NUM_TEST);
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID TaskF01()
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
g_ret |= ret;
|
||||||
|
TestDumpCpuid();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid;
|
||||||
|
UINT32 i, j;
|
||||||
|
|
||||||
|
g_dev.pDevId = (void *)(1);
|
||||||
|
g_dev.swIrq = HWI_NUM_TEST;
|
||||||
|
|
||||||
|
for (j = 0; j < LOOP; j++) {
|
||||||
|
g_testCount = 0;
|
||||||
|
g_ret = 0;
|
||||||
|
// 3, Set the interrupt priority
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &g_dev);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1,
|
||||||
|
CPUID_TO_AFFI_MASK(i));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_TaskDelay(1);
|
||||||
|
ICUNIT_GOTO_NOT_EQUAL(g_ret, 0, g_ret, EXIT);
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
}
|
||||||
|
return LOS_OK;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &g_dev);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare009(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare009", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
* 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_smp_hwi.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||||
|
|
||||||
|
static HwiIrqParam g_dev[3]; // 3, Three devices
|
||||||
|
|
||||||
|
static VOID HwiF01(void)
|
||||||
|
{
|
||||||
|
LOS_AtomicInc(&g_testCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01()
|
||||||
|
{
|
||||||
|
UINT32 ret, index, i;
|
||||||
|
index = ArchCurrCpuid();
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
// 3, Set the interrupt priority
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[0]));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[0]));
|
||||||
|
TestDumpCpuid();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
// 3, Set the interrupt priority
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[1]));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[1]));
|
||||||
|
TestDumpCpuid();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: // 2, when CPU id is
|
||||||
|
for (i = 0; i < LOOP; i++) {
|
||||||
|
// 3, Set the interrupt priority; 2, index
|
||||||
|
ret = LOS_HwiCreate(HWI_NUM_TEST, 3, IRQF_SHARED, (HWI_PROC_FUNC)HwiF01, &(g_dev[2]));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
TestHwiTrigger(HWI_NUM_TEST);
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[2])); // 2, index
|
||||||
|
TestDumpCpuid();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
TestDumpCpuid();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[0]));
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[1]));
|
||||||
|
LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[2])); // 2, index
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(void)
|
||||||
|
{
|
||||||
|
TSK_INIT_PARAM_S testTask;
|
||||||
|
UINT32 ret, testid, currCpuid;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) { // 3, max index
|
||||||
|
g_dev[i].pDevId = (void *)(i + 1);
|
||||||
|
g_dev[i].swIrq = HWI_NUM_TEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||||
|
TEST_TASK_PARAM_INIT_AFFI(testTask, "it_hwi_share_task", TaskF01, TASK_PRIO_TEST + 1, CPUID_TO_AFFI_MASK(i));
|
||||||
|
ret = LOS_TaskCreate(&testid, &testTask);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOS_TaskDelay(100); // 100, set delay time
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) { // 3, max index
|
||||||
|
ret = LOS_HwiDelete(HWI_NUM_TEST, &(g_dev[i]));
|
||||||
|
PRINT_DEBUG("ret = 0x%x\n", ret);
|
||||||
|
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
}
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSmpLosHwiShare010(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItSmpLosHwiShare010", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#define RECORD_SIZE 100
|
||||||
|
|
||||||
|
UINT32 g_intrTrace[RECORD_SIZE];
|
||||||
|
UINT32 g_traceIdx = 0;
|
||||||
|
UINT32 g_intrHandleEnd = 0;
|
||||||
|
|
||||||
|
VOID RecordIntrTrace(INT32 irq, INT32 direction)
|
||||||
|
{
|
||||||
|
g_intrTrace[g_traceIdx++] = irq | (direction << 31); // 31, Bit shift mark.
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ResetIntrTrace(VOID)
|
||||||
|
{
|
||||||
|
g_traceIdx = 0;
|
||||||
|
memset(g_intrTrace, 0, RECORD_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num)
|
||||||
|
{
|
||||||
|
UINT32 ret = LOS_OK;
|
||||||
|
INT32 idx = 0;
|
||||||
|
|
||||||
|
if ((expect == NULL) || (num > RECORD_SIZE)) {
|
||||||
|
return LOS_NOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; idx < g_traceIdx; idx++) {
|
||||||
|
if (expect[idx] != g_intrTrace[idx]) {
|
||||||
|
ret = LOS_NOK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == LOS_NOK) {
|
||||||
|
for (idx = 0; idx < g_traceIdx; idx++) {
|
||||||
|
dprintf("%u ", g_intrTrace[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dprintf("\n");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItSuiteHwiNesting(VOID)
|
||||||
|
{
|
||||||
|
#if defined(LOSCFG_TEST_FULL)
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
ItLosHwiNest001();
|
||||||
|
ItLosHwiNest002();
|
||||||
|
ItLosHwiNest003();
|
||||||
|
ItLosHwiNest004();
|
||||||
|
ItLosHwiNest005();
|
||||||
|
ItLosHwiNest006();
|
||||||
|
ItLosHwiNest007();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* 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 "osTest.h"
|
||||||
|
#include "los_hwi.h"
|
||||||
|
#include "gic_common.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#define HIGHT_PRIO_INTR 100
|
||||||
|
#define MIDDLE_PRIO_INTR 101
|
||||||
|
#define LOW_PRIO_INTR 102
|
||||||
|
|
||||||
|
#define SPI_HIGHT_PRIO 0
|
||||||
|
#define SPI_MIDDLE_PRIO ((GIC_MAX_INTERRUPT_PREEMPTION_LEVEL - 2) << PRIORITY_SHIFT)
|
||||||
|
#define SPI_LOW_PRIO MIN_INTERRUPT_PRIORITY
|
||||||
|
|
||||||
|
#define INTR_ENTRY 0
|
||||||
|
#define INTR_EXIT 1
|
||||||
|
|
||||||
|
extern UINT32 g_intrHandleEnd;
|
||||||
|
VOID RecordIntrTrace(INT32 irq, INT32 direction);
|
||||||
|
VOID ResetIntrTrace(VOID);
|
||||||
|
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num);
|
||||||
|
VOID ItLosHwiNest001(VOID);
|
||||||
|
VOID ItLosHwiNest002(VOID);
|
||||||
|
VOID ItLosHwiNest003(VOID);
|
||||||
|
VOID ItLosHwiNest004(VOID);
|
||||||
|
VOID ItLosHwiNest005(VOID);
|
||||||
|
VOID ItLosHwiNest006(VOID);
|
||||||
|
VOID ItLosHwiNest007(VOID);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
/* low in -> middle in -> hight in -> hight out -> middle out -> low out */
|
||||||
|
static UINT32 g_expect[] = {
|
||||||
|
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID NestingPrioLow(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
|
||||||
|
|
||||||
|
g_intrHandleEnd = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqUnmask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqUnmask(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqMask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqMask(LOW_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
ResetIntrTrace();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItLosHwiNest001(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest001", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
/* middle in -> middle out -> low in -> hight in -> hight out -> low out */
|
||||||
|
static UINT32 g_expect[] = {
|
||||||
|
MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR,
|
||||||
|
HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID NestingPrioLow(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
|
||||||
|
while (nestingDelay-- > 0);
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
|
||||||
|
|
||||||
|
g_intrHandleEnd = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
|
||||||
|
while (nestingDelay-- > 0);
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqUnmask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqUnmask(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqMask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqMask(LOW_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
ResetIntrTrace();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID ItLosHwiNest002(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest002", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
/* hight in -> hight out -> middle in -> middle out -> low in -> low out */
|
||||||
|
static UINT32 g_expect[] = {
|
||||||
|
HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID NestingPrioLow(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
|
||||||
|
|
||||||
|
g_intrHandleEnd = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqUnmask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqUnmask(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqMask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqMask(LOW_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
ResetIntrTrace();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItLosHwiNest003(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest003", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
/* middle in -> middle out -> low in -> low out -> hight in -> hight out */
|
||||||
|
static UINT32 g_expect[] = {
|
||||||
|
MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR,
|
||||||
|
HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID NestingPrioLow(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
|
||||||
|
while (nestingDelay-- > 0);
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
|
||||||
|
|
||||||
|
g_intrHandleEnd = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR); /* pending low prio interrupt */
|
||||||
|
while (nestingDelay-- > 0);
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(LOW_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqUnmask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqUnmask(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqMask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqMask(LOW_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
ResetIntrTrace();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID ItLosHwiNest004(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest004", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
/* low in -> middle in -> hight in -> hight out -> middle out -> low out */
|
||||||
|
/* loop trigger */
|
||||||
|
static UINT32 g_expect[] = {
|
||||||
|
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR, MIDDLE_PRIO_INTR, HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | HIGHT_PRIO_INTR,
|
||||||
|
0x80000000 | MIDDLE_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR,
|
||||||
|
LOW_PRIO_INTR,
|
||||||
|
0x80000000 | LOW_PRIO_INTR,
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID NestingPrioLow(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
if (g_intrHandleEnd < 3) { // 3, Interrupt callback function count.
|
||||||
|
HalIrqPending(MIDDLE_PRIO_INTR); /* pending middle prio interrupt */
|
||||||
|
}
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(LOW_PRIO_INTR, INTR_EXIT);
|
||||||
|
|
||||||
|
g_intrHandleEnd++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioMiddle(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
volatile UINT64 nestingDelay = 10000000; // 10000000, The loop frequency.
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR); /* pending hight prio interrupt */
|
||||||
|
while (nestingDelay-- > 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordIntrTrace(MIDDLE_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_ENTRY);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
RecordIntrTrace(HIGHT_PRIO_INTR, INTR_EXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(MIDDLE_PRIO_INTR, SPI_MIDDLE_PRIO, 0, (HWI_PROC_FUNC)NestingPrioMiddle, &g_nestingPara);
|
||||||
|
LOS_HwiCreate(LOW_PRIO_INTR, SPI_LOW_PRIO, 0, (HWI_PROC_FUNC)NestingPrioLow, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqUnmask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqUnmask(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
HalIrqPending(LOW_PRIO_INTR);
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckIntrTrace(g_expect, sizeof(g_expect));
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(MIDDLE_PRIO_INTR, &g_nestingPara);
|
||||||
|
LOS_HwiDelete(LOW_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqMask(MIDDLE_PRIO_INTR);
|
||||||
|
HalIrqMask(LOW_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
ResetIntrTrace();
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItLosHwiNest005(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest005", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
g_intrHandleEnd = 1;
|
||||||
|
UINT32 temp[0x100][2] = {0};
|
||||||
|
memset(temp, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID TaskF01(VOID)
|
||||||
|
{
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR);
|
||||||
|
}
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret, taskID;
|
||||||
|
|
||||||
|
TSK_INIT_PARAM_S task1 = { 0 };
|
||||||
|
|
||||||
|
// 4, Task priority calculation.
|
||||||
|
TEST_TASK_PARAM_INIT(task1, "ItLosHwiNest010", (TSK_ENTRY_FUNC)TaskF01, TASK_PRIO_TEST - 4);
|
||||||
|
task1.uwStackSize = 0x2000;
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
|
||||||
|
ret = LOS_TaskCreate(&taskID, &task1);
|
||||||
|
|
||||||
|
while (g_intrHandleEnd == 0) {
|
||||||
|
LOS_TaskDelay(10); // 10, set delay time.
|
||||||
|
}
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_intrHandleEnd, 1, g_intrHandleEnd, EXIT);
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
g_intrHandleEnd = 0;
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID ItLosHwiNest006(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest006", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
* 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_hwi_nesting.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOSCFG_ARCH_INTERRUPT_PREEMPTION
|
||||||
|
|
||||||
|
#define MAX_RECORD_SIZE 1000
|
||||||
|
static HwiIrqParam g_nestingPara;
|
||||||
|
static INT32 g_saveIndex = 0;
|
||||||
|
static UINT64 g_intPendTime;
|
||||||
|
static UINT64 g_recordTime[MAX_RECORD_SIZE] = {0};
|
||||||
|
static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||||
|
{
|
||||||
|
UINT64 curTime;
|
||||||
|
curTime = LOS_CurrNanosec();
|
||||||
|
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
|
||||||
|
if (g_saveIndex == MAX_RECORD_SIZE) {
|
||||||
|
g_saveIndex = 0;
|
||||||
|
}
|
||||||
|
dprintf("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
|
||||||
|
dprintf("%lld\n", curTime - g_intPendTime);
|
||||||
|
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
|
||||||
|
g_saveIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID DumpResult()
|
||||||
|
{
|
||||||
|
UINT32 i, count;
|
||||||
|
UINT64 avg, sum;
|
||||||
|
sum = 0;
|
||||||
|
count = 0;
|
||||||
|
for (i = 0; i < MAX_RECORD_SIZE; i++) {
|
||||||
|
if (g_recordTime[i] != 0) {
|
||||||
|
dprintf("%lld ");
|
||||||
|
sum += g_recordTime[i];
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
avg = sum / count;
|
||||||
|
dprintf("***hwi perf test dump***: \n");
|
||||||
|
dprintf("avg = %lld \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID SwtmrF01(VOID)
|
||||||
|
{
|
||||||
|
g_intPendTime = LOS_CurrNanosec();
|
||||||
|
HalIrqPending(HIGHT_PRIO_INTR);
|
||||||
|
}
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret, swtmrId;
|
||||||
|
|
||||||
|
LOS_HwiCreate(HIGHT_PRIO_INTR, SPI_HIGHT_PRIO, 0, (HWI_PROC_FUNC)NestingPrioHigh, &g_nestingPara);
|
||||||
|
HalIrqUnmask(HIGHT_PRIO_INTR);
|
||||||
|
|
||||||
|
// 10, Timing duration of the software timer to be created.
|
||||||
|
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swtmrId,
|
||||||
|
0xffff);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
LOS_SwtmrStart(swtmrId);
|
||||||
|
|
||||||
|
/* EXIT time control */
|
||||||
|
LOS_TaskDelay(100); // 100, set delay time.
|
||||||
|
|
||||||
|
LOS_SwtmrStop(swtmrId);
|
||||||
|
DumpResult();
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
LOS_SwtmrDelete(swtmrId);
|
||||||
|
LOS_HwiDelete(HIGHT_PRIO_INTR, &g_nestingPara);
|
||||||
|
HalIrqMask(HIGHT_PRIO_INTR);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID ItLosHwiNest007(VOID)
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosHwiNest007", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL1, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
* 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_swtmr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
EVENT_CB_S g_eventCB1, g_eventCB2, g_eventCB3;
|
||||||
|
|
||||||
|
VOID ItSuiteLosSwtmr(VOID)
|
||||||
|
{
|
||||||
|
int ret = LOS_SetProcessScheduler(LOS_GetCurrProcessID(), LOS_SCHED_RR, TASK_PRIO_TEST_SWTMR);
|
||||||
|
if (ret != LOS_OK) {
|
||||||
|
dprintf("%s set test process schedule failed! %d\n", ret);
|
||||||
|
}
|
||||||
|
ret = LOS_SetTaskScheduler(LOS_CurTaskIDGet(), LOS_SCHED_RR, TASK_PRIO_TEST_SWTMR);
|
||||||
|
if (ret != LOS_OK) {
|
||||||
|
dprintf("%s set test task schedule failed! %d\n", ret);
|
||||||
|
}
|
||||||
|
#if defined(LOSCFG_TEST_SMOKE)
|
||||||
|
ItLosSwtmr053();
|
||||||
|
ItLosSwtmr058();
|
||||||
|
#endif
|
||||||
|
#if (LOSCFG_KERNEL_SMP == YES)
|
||||||
|
ItSmpLosSwtmr001(); /* Concurrent Multi-core */
|
||||||
|
ItSmpLosSwtmr002(); /* Stop Across Cores */
|
||||||
|
ItSmpLosSwtmr003();
|
||||||
|
ItSmpLosSwtmr004();
|
||||||
|
ItSmpLosSwtmr005();
|
||||||
|
ItSmpLosSwtmr006();
|
||||||
|
ItSmpLosSwtmr007();
|
||||||
|
ItSmpLosSwtmr008();
|
||||||
|
ItSmpLosSwtmr009();
|
||||||
|
ItSmpLosSwtmr010();
|
||||||
|
ItSmpLosSwtmr011();
|
||||||
|
ItSmpLosSwtmr012();
|
||||||
|
ItSmpLosSwtmr013();
|
||||||
|
ItSmpLosSwtmr014();
|
||||||
|
ItSmpLosSwtmr015();
|
||||||
|
ItSmpLosSwtmr016();
|
||||||
|
ItSmpLosSwtmr017();
|
||||||
|
ItSmpLosSwtmr018();
|
||||||
|
ItSmpLosSwtmr019();
|
||||||
|
ItSmpLosSwtmr020();
|
||||||
|
ItSmpLosSwtmr021();
|
||||||
|
ItSmpLosSwtmr022();
|
||||||
|
ItSmpLosSwtmr023();
|
||||||
|
ItSmpLosSwtmr024();
|
||||||
|
ItSmpLosSwtmr025();
|
||||||
|
ItSmpLosSwtmr026();
|
||||||
|
ItSmpLosSwtmr027();
|
||||||
|
ItSmpLosSwtmr028();
|
||||||
|
ItSmpLosSwtmr029();
|
||||||
|
ItSmpLosSwtmr030();
|
||||||
|
ItSmpLosSwtmr031();
|
||||||
|
ItSmpLosSwtmr032();
|
||||||
|
ItSmpLosSwtmr033();
|
||||||
|
ItSmpLosSwtmr034();
|
||||||
|
ItSmpLosSwtmr035();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_FULL)
|
||||||
|
ItLosSwtmr001();
|
||||||
|
ItLosSwtmr002();
|
||||||
|
ItLosSwtmr003();
|
||||||
|
ItLosSwtmr005();
|
||||||
|
ItLosSwtmr006();
|
||||||
|
ItLosSwtmr007();
|
||||||
|
ItLosSwtmr008();
|
||||||
|
ItLosSwtmr009();
|
||||||
|
ItLosSwtmr010();
|
||||||
|
ItLosSwtmr011();
|
||||||
|
ItLosSwtmr012();
|
||||||
|
ItLosSwtmr013();
|
||||||
|
ItLosSwtmr014();
|
||||||
|
ItLosSwtmr015();
|
||||||
|
ItLosSwtmr016();
|
||||||
|
ItLosSwtmr017();
|
||||||
|
ItLosSwtmr018();
|
||||||
|
ItLosSwtmr019();
|
||||||
|
ItLosSwtmr020();
|
||||||
|
ItLosSwtmr021();
|
||||||
|
ItLosSwtmr022();
|
||||||
|
ItLosSwtmr030();
|
||||||
|
ItLosSwtmr033();
|
||||||
|
ItLosSwtmr036();
|
||||||
|
ItLosSwtmr037();
|
||||||
|
ItLosSwtmr039();
|
||||||
|
ItLosSwtmr040();
|
||||||
|
ItLosSwtmr041();
|
||||||
|
ItLosSwtmr042();
|
||||||
|
ItLosSwtmr043();
|
||||||
|
ItLosSwtmr044();
|
||||||
|
ItLosSwtmr045();
|
||||||
|
ItLosSwtmr046();
|
||||||
|
ItLosSwtmr047();
|
||||||
|
ItLosSwtmr048();
|
||||||
|
ItLosSwtmr049();
|
||||||
|
ItLosSwtmr050();
|
||||||
|
ItLosSwtmr051();
|
||||||
|
ItLosSwtmr052();
|
||||||
|
ItLosSwtmr054();
|
||||||
|
ItLosSwtmr055();
|
||||||
|
ItLosSwtmr056();
|
||||||
|
ItLosSwtmr057();
|
||||||
|
ItLosSwtmr059();
|
||||||
|
ItLosSwtmr060();
|
||||||
|
ItLosSwtmr061();
|
||||||
|
ItLosSwtmr062();
|
||||||
|
ItLosSwtmr063();
|
||||||
|
ItLosSwtmr064();
|
||||||
|
ItLosSwtmr065();
|
||||||
|
ItLosSwtmr066();
|
||||||
|
ItLosSwtmr067();
|
||||||
|
ItLosSwtmr068();
|
||||||
|
ItLosSwtmr069();
|
||||||
|
ItLosSwtmr070();
|
||||||
|
ItLosSwtmr071();
|
||||||
|
ItLosSwtmr075();
|
||||||
|
ItLosSwtmr076();
|
||||||
|
ItLosSwtmr077();
|
||||||
|
ItLosSwtmr078();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_PRESSURE)
|
||||||
|
ItLosSwtmr004();
|
||||||
|
ItLosSwtmr024();
|
||||||
|
ItLosSwtmr025();
|
||||||
|
ItLosSwtmr026();
|
||||||
|
ItLosSwtmr027();
|
||||||
|
ItLosSwtmr028();
|
||||||
|
ItLosSwtmr029();
|
||||||
|
ItLosSwtmr031();
|
||||||
|
ItLosSwtmr032();
|
||||||
|
ItLosSwtmr034();
|
||||||
|
ItLosSwtmr035();
|
||||||
|
ItLosSwtmr038();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_LLT)
|
||||||
|
ItLosSwtmr073();
|
||||||
|
#if !defined(TESTPBXA9) && !defined(TESTVIRTA53) && !defined(TEST3516DV300) && !defined(TESTHI1980IMU)
|
||||||
|
ItLosSwtmr072(); // SwtmrTimeGet
|
||||||
|
ItLosSwtmr074(); // across cores
|
||||||
|
ItLosSwtmr079(); // sched_clock_swtmr
|
||||||
|
#endif
|
||||||
|
ItLosSwtmr080();
|
||||||
|
ItLosSwtmr023();
|
||||||
|
#endif
|
||||||
|
ret = LOS_SetProcessScheduler(LOS_GetCurrProcessID(), LOS_SCHED_RR, 20); // 20, set a reasonable priority.
|
||||||
|
if (ret != LOS_OK) {
|
||||||
|
dprintf("%s set test process schedule failed! %d\n", ret);
|
||||||
|
}
|
||||||
|
ret = LOS_SetTaskScheduler(LOS_CurTaskIDGet(), LOS_SCHED_RR, TASK_PRIO_TEST);
|
||||||
|
if (ret != LOS_OK) {
|
||||||
|
dprintf("%s set test task schedule failed! %d\n", ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
@ -0,0 +1,213 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef IT_LOS_SWTMR_H
|
||||||
|
#define IT_LOS_SWTMR_H
|
||||||
|
|
||||||
|
#include "los_swtmr.h"
|
||||||
|
#include "osTest.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
#define LOOP 100
|
||||||
|
|
||||||
|
#define SELF_DELETED 0
|
||||||
|
#define SYS_EXIST_SWTMR 1
|
||||||
|
#define SWTMR_LOOP_NUM 10
|
||||||
|
#define TEST_HWI_RUNTIME 0x100000
|
||||||
|
|
||||||
|
extern EVENT_CB_S g_eventCB1;
|
||||||
|
extern EVENT_CB_S g_eventCB2;
|
||||||
|
extern EVENT_CB_S g_eventCB3;
|
||||||
|
|
||||||
|
extern LITE_OS_SEC_BSS SWTMR_CTRL_S *m_pstSwtmrFreeList;
|
||||||
|
|
||||||
|
static UINT32 g_swTmrMaxNum;
|
||||||
|
|
||||||
|
static UINT16 g_swTmrID1;
|
||||||
|
static UINT16 g_swTmrID2;
|
||||||
|
static UINT16 g_swTmrID3;
|
||||||
|
|
||||||
|
static UINT32 g_swtmrCountA;
|
||||||
|
static UINT32 g_swtmrCountB;
|
||||||
|
static UINT32 g_swtmrCountC;
|
||||||
|
static UINT64 g_cpuTickCountA;
|
||||||
|
static UINT64 g_cpuTickCountB;
|
||||||
|
|
||||||
|
extern UINT32 OsSwTmrGetNextTimeout(VOID);
|
||||||
|
extern UINT32 OsSwtmrTimeGet(SWTMR_CTRL_S *swtmr);
|
||||||
|
|
||||||
|
extern VOID LOS_GetCpuTick(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
||||||
|
extern VOID ItSuiteLosSwtmr(VOID);
|
||||||
|
|
||||||
|
#if defined(LOSCFG_KERNEL_SMP)
|
||||||
|
VOID ItSmpLosSwtmr001(VOID);
|
||||||
|
VOID ItSmpLosSwtmr002(VOID);
|
||||||
|
VOID ItSmpLosSwtmr003(VOID);
|
||||||
|
VOID ItSmpLosSwtmr004(VOID);
|
||||||
|
VOID ItSmpLosSwtmr005(VOID);
|
||||||
|
VOID ItSmpLosSwtmr006(VOID);
|
||||||
|
VOID ItSmpLosSwtmr007(VOID);
|
||||||
|
VOID ItSmpLosSwtmr008(VOID);
|
||||||
|
VOID ItSmpLosSwtmr009(VOID);
|
||||||
|
VOID ItSmpLosSwtmr010(VOID);
|
||||||
|
VOID ItSmpLosSwtmr011(VOID);
|
||||||
|
VOID ItSmpLosSwtmr012(VOID);
|
||||||
|
VOID ItSmpLosSwtmr013(VOID);
|
||||||
|
VOID ItSmpLosSwtmr014(VOID);
|
||||||
|
VOID ItSmpLosSwtmr015(VOID);
|
||||||
|
VOID ItSmpLosSwtmr016(VOID);
|
||||||
|
VOID ItSmpLosSwtmr017(VOID);
|
||||||
|
VOID ItSmpLosSwtmr018(VOID);
|
||||||
|
VOID ItSmpLosSwtmr019(VOID);
|
||||||
|
VOID ItSmpLosSwtmr020(VOID);
|
||||||
|
VOID ItSmpLosSwtmr021(VOID);
|
||||||
|
VOID ItSmpLosSwtmr022(VOID);
|
||||||
|
VOID ItSmpLosSwtmr023(VOID);
|
||||||
|
VOID ItSmpLosSwtmr024(VOID);
|
||||||
|
VOID ItSmpLosSwtmr025(VOID);
|
||||||
|
VOID ItSmpLosSwtmr026(VOID);
|
||||||
|
VOID ItSmpLosSwtmr027(VOID);
|
||||||
|
VOID ItSmpLosSwtmr028(VOID);
|
||||||
|
VOID ItSmpLosSwtmr029(VOID);
|
||||||
|
VOID ItSmpLosSwtmr030(VOID);
|
||||||
|
VOID ItSmpLosSwtmr031(VOID);
|
||||||
|
VOID ItSmpLosSwtmr032(VOID);
|
||||||
|
VOID ItSmpLosSwtmr033(VOID);
|
||||||
|
VOID ItSmpLosSwtmr034(VOID);
|
||||||
|
VOID ItSmpLosSwtmr035(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_SMOKE)
|
||||||
|
VOID ItLosSwtmr053(VOID);
|
||||||
|
VOID ItLosSwtmr058(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_FULL)
|
||||||
|
VOID ItLosSwtmr001(VOID);
|
||||||
|
VOID ItLosSwtmr002(VOID);
|
||||||
|
VOID ItLosSwtmr003(VOID);
|
||||||
|
VOID ItLosSwtmr005(VOID);
|
||||||
|
VOID ItLosSwtmr006(VOID);
|
||||||
|
VOID ItLosSwtmr007(VOID);
|
||||||
|
VOID ItLosSwtmr008(VOID);
|
||||||
|
VOID ItLosSwtmr009(VOID);
|
||||||
|
VOID ItLosSwtmr010(VOID);
|
||||||
|
VOID ItLosSwtmr011(VOID);
|
||||||
|
VOID ItLosSwtmr012(VOID);
|
||||||
|
VOID ItLosSwtmr013(VOID);
|
||||||
|
VOID ItLosSwtmr014(VOID);
|
||||||
|
VOID ItLosSwtmr015(VOID);
|
||||||
|
VOID ItLosSwtmr016(VOID);
|
||||||
|
VOID ItLosSwtmr017(VOID);
|
||||||
|
VOID ItLosSwtmr018(VOID);
|
||||||
|
VOID ItLosSwtmr019(VOID);
|
||||||
|
VOID ItLosSwtmr020(VOID);
|
||||||
|
VOID ItLosSwtmr021(VOID);
|
||||||
|
VOID ItLosSwtmr022(VOID);
|
||||||
|
VOID ItLosSwtmr030(VOID);
|
||||||
|
VOID ItLosSwtmr033(VOID);
|
||||||
|
VOID ItLosSwtmr036(VOID);
|
||||||
|
VOID ItLosSwtmr037(VOID);
|
||||||
|
VOID ItLosSwtmr038(VOID);
|
||||||
|
VOID ItLosSwtmr039(VOID);
|
||||||
|
VOID ItLosSwtmr040(VOID);
|
||||||
|
VOID ItLosSwtmr041(VOID);
|
||||||
|
VOID ItLosSwtmr042(VOID);
|
||||||
|
VOID ItLosSwtmr043(VOID);
|
||||||
|
VOID ItLosSwtmr044(VOID);
|
||||||
|
VOID ItLosSwtmr045(VOID);
|
||||||
|
VOID ItLosSwtmr046(VOID);
|
||||||
|
VOID ItLosSwtmr047(VOID);
|
||||||
|
VOID ItLosSwtmr048(VOID);
|
||||||
|
VOID ItLosSwtmr049(VOID);
|
||||||
|
VOID ItLosSwtmr050(VOID);
|
||||||
|
VOID ItLosSwtmr051(VOID);
|
||||||
|
VOID ItLosSwtmr052(VOID);
|
||||||
|
VOID ItLosSwtmr054(VOID);
|
||||||
|
VOID ItLosSwtmr055(VOID);
|
||||||
|
VOID ItLosSwtmr056(VOID);
|
||||||
|
VOID ItLosSwtmr057(VOID);
|
||||||
|
VOID ItLosSwtmr059(VOID);
|
||||||
|
VOID ItLosSwtmr060(VOID);
|
||||||
|
VOID ItLosSwtmr061(VOID);
|
||||||
|
VOID ItLosSwtmr062(VOID);
|
||||||
|
VOID ItLosSwtmr063(VOID);
|
||||||
|
VOID ItLosSwtmr064(VOID);
|
||||||
|
VOID ItLosSwtmr065(VOID);
|
||||||
|
VOID ItLosSwtmr066(VOID);
|
||||||
|
VOID ItLosSwtmr067(VOID);
|
||||||
|
VOID ItLosSwtmr068(VOID);
|
||||||
|
VOID ItLosSwtmr069(VOID);
|
||||||
|
VOID ItLosSwtmr070(VOID);
|
||||||
|
VOID ItLosSwtmr071(VOID);
|
||||||
|
VOID ItLosSwtmr075(VOID);
|
||||||
|
VOID ItLosSwtmr076(VOID);
|
||||||
|
VOID ItLosSwtmr077(VOID);
|
||||||
|
VOID ItLosSwtmr078(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_PRESSURE)
|
||||||
|
VOID ItLosSwtmr004(VOID);
|
||||||
|
VOID ItLosSwtmr024(VOID);
|
||||||
|
VOID ItLosSwtmr025(VOID);
|
||||||
|
VOID ItLosSwtmr026(VOID);
|
||||||
|
VOID ItLosSwtmr027(VOID);
|
||||||
|
VOID ItLosSwtmr028(VOID);
|
||||||
|
VOID ItLosSwtmr029(VOID);
|
||||||
|
VOID ItLosSwtmr031(VOID);
|
||||||
|
VOID ItLosSwtmr032(VOID);
|
||||||
|
VOID ItLosSwtmr034(VOID);
|
||||||
|
VOID ItLosSwtmr035(VOID);
|
||||||
|
VOID ItLosSwtmr081(VOID);
|
||||||
|
VOID ItLosSwtmr082(VOID);
|
||||||
|
VOID ItLosSwtmr083(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LOSCFG_TEST_LLT)
|
||||||
|
VOID ItLosSwtmr072(VOID);
|
||||||
|
VOID ItLosSwtmr073(VOID);
|
||||||
|
VOID ItLosSwtmr074(VOID);
|
||||||
|
VOID ItLosSwtmr079(VOID);
|
||||||
|
VOID ItLosSwtmr080(VOID);
|
||||||
|
VOID ItLosSwtmr023(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* IT_LOS_SWTMR_H */
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* 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_swtmr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
static VOID SwtmrF01(UINT32 arg)
|
||||||
|
{
|
||||||
|
if (arg != 0xffff) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_testCount++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
UINT16 swTmrID;
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
// 4, Timeout interval of a periodic software timer.
|
||||||
|
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_ONCE, SwtmrF01, &swTmrID, 0xffff);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrStart(swTmrID);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_TaskDelay(10); // 10, set delay time
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
|
|
||||||
|
ret = LOS_TaskDelay(5); // 5, set delay time
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount);
|
||||||
|
#if SELF_DELETED
|
||||||
|
ret = LOS_SwtmrDelete(swTmrID);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
#endif
|
||||||
|
return LOS_OK;
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
ret = LOS_SwtmrDelete(swTmrID);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItLosSwtmr001(VOID) // IT_Layer_ModuleORFeature_No
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosSwtmr001", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* 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_swtmr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
|
static VOID SwtmrF01(UINT32 arg)
|
||||||
|
{
|
||||||
|
if (arg != 0xabcdbcda) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_testCount++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 Testcase(VOID)
|
||||||
|
{
|
||||||
|
UINT32 ret;
|
||||||
|
UINT16 swTmrID;
|
||||||
|
g_testCount = 0;
|
||||||
|
|
||||||
|
// 4, Timeout interval of a periodic software timer.
|
||||||
|
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, SwtmrF01, &swTmrID, 0xabcdbcda);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_SwtmrStart(swTmrID);
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ret = LOS_TaskDelay(10); // 10, set delay time
|
||||||
|
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
|
||||||
|
|
||||||
|
ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, The expected value
|
||||||
|
|
||||||
|
ret = LOS_SwtmrDelete(swTmrID);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ret = LOS_TaskDelay(10); // 10, set delay time
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, The expected value
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
|
||||||
|
EXIT:
|
||||||
|
ret = LOS_SwtmrDelete(swTmrID);
|
||||||
|
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ItLosSwtmr002(VOID) // IT_Layer_ModuleORFeature_No
|
||||||
|
{
|
||||||
|
TEST_ADD_CASE("ItLosSwtmr002", Testcase, TEST_LOS, TEST_SWTMR, TEST_LEVEL2, TEST_FUNCTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
#endif /* __cpluscplus */
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue