Compare commits

..

2 Commits

Author SHA1 Message Date
openharmony_ci
76366bc358 !600 fix: posix线程和LOS_TaskCreate任务不兼容,补齐接口防护,防止访问野指针
Merge pull request !600 from zhushengle/cherry-pick-1645010283
2022-02-16 12:20:42 +00:00
zhushengle
11e7f0f5e2 fixed 60805e1 from https://gitee.com/zhushengle/kernel_liteos_m/pulls/599
fix: posix线程和LOS_TaskCreate任务不兼容,补齐接口防护,防止访问野指针

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I03040e86a5ac618d3ede671c497a0ae88a3717ae
2022-02-16 11:18:03 +00:00
114 changed files with 496 additions and 2491 deletions

View File

@@ -166,7 +166,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -232,22 +233,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -261,14 +262,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask(hwiNum);
LOS_IntRestore(intSave);
@@ -280,13 +277,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -201,7 +201,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -267,22 +268,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -300,14 +301,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -321,13 +318,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -192,7 +192,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -258,22 +259,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -291,14 +292,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -312,13 +309,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -192,7 +192,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -258,22 +259,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -291,14 +292,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -312,13 +309,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -198,7 +198,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -266,22 +267,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINTPTR intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -299,14 +300,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -320,13 +317,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -198,7 +198,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -266,22 +267,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINTPTR intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -299,14 +300,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -320,13 +317,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -196,7 +196,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -262,22 +263,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -295,14 +296,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -316,13 +313,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -202,7 +202,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -268,22 +269,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -301,14 +302,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -322,13 +319,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -196,7 +196,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -262,22 +263,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -295,14 +296,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -316,13 +313,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -191,7 +191,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -257,22 +258,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -290,14 +291,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -311,13 +308,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -198,7 +198,8 @@ inline UINT32 ArchIsIntActive(VOID)
/*lint -e529*/
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -264,22 +265,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -297,14 +298,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -318,13 +315,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -282,7 +282,8 @@ inline UINT32 ArchIsIntActive(VOID)
**************************************************************************** */
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%x\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%x\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -343,22 +344,22 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
if (hwiNum >= OS_HWI_MAX_NUM) {
@@ -375,14 +376,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
}
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask(hwiNum);
(VOID)HwiSetPriority(hwiNum, (UINT8)hwiPrio);
@@ -395,13 +392,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -53,11 +53,6 @@ typedef VOID (*HWI_PROC_FUNC)(VOID *parm);
#else
typedef VOID (*HWI_PROC_FUNC)(void);
#endif
typedef struct tagIrqParam {
int swIrq; /**< The interrupt number */
VOID *pDevId; /**< The pointer to the device ID that launches the interrupt */
const CHAR *pName; /**< The interrupt name */
} HwiIrqParam;
typedef struct {
UINT32 (*triggerIrq)(HWI_HANDLE_T hwiNum);
@@ -114,15 +109,14 @@ UINT32 ArchIntUnLock(VOID);
* </ul>
*
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
* @param irqParam [IN] Type #HwiIrqParam *. ID of hardware interrupt which will base on
* when delete the hardware interrupt.
*
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
* @retval #LOS_OK 0 : The interrupt is successfully delete.
* @par Dependency:
* <ul><li>los_interrupt.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum);
/**
* @ingroup los_interrupt
@@ -143,8 +137,7 @@ UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
* @param mode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
* @param handler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
* @param irqParam [IN] Type#HwiIrqParam: input parameter of the interrupt
* handler used when a hardware interrupt is triggered.
* @param arg [IN] Type#HWI_ARG_T: input parameter of the interrupt handler used when a hardware interrupt is triggered.
*
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
@@ -159,7 +152,7 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HwiIrqParam *irqParam);
HWI_ARG_T arg);
STATIC INLINE UINT32 ArchIntTrigger(HWI_HANDLE_T hwiNum)
{

View File

@@ -86,9 +86,9 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- hwi interrupt hwiMode, between vector or non-vector
hwiHandler --- hwi handler
irqParam --- set trig hwiMode of the hwi handler
mode --- hwi interrupt mode, between vector or non-vector
handler --- hwi handler
arg --- set trig mode of the hwi handler
Level Triggerred = 0
Postive/Rising Edge Triggered = 1
Negtive/Falling Edge Triggered = 3
@@ -97,24 +97,24 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
*****************************************************************************/
UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (hwiMode > ECLIC_VECTOR_INTERRUPT) {
if (mode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID;
}
if ((irqParam == NULL) || (irqParam->pDevId > ECLIC_NEGTIVE_EDGE_TRIGGER)) {
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
return OS_ERRNO_HWI_ARG_INVALID;
}
/* set interrupt vector hwiMode */
ECLIC_SetShvIRQ(hwiNum, hwiMode);
/* set interrupt trigger hwiMode and polarity */
ECLIC_SetTrigIRQ(hwiNum, irqParam->pDevId);
/* set interrupt vector mode */
ECLIC_SetShvIRQ(hwiNum, mode);
/* set interrupt trigger mode and polarity */
ECLIC_SetTrigIRQ(hwiNum, arg);
/* set interrupt level */
// default to 0
ECLIC_SetLevelIRQ(hwiNum, 0);
@@ -124,9 +124,9 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
/* set interrupt priority */
// low 16 bit for priority
ECLIC_SetPriorityIRQ(hwiNum, (hwiPrio & 0xffff));
if (hwiHandler != NULL) {
if (handler != NULL) {
/* set interrupt handler entry to vector table */
ECLIC_SetVector(hwiNum, (rv_csr_t)hwiHandler);
ECLIC_SetVector(hwiNum, (rv_csr_t)handler);
}
/* enable interrupt */
HwiUnmask(hwiNum);
@@ -137,12 +137,10 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Return : LOS_OK on success or error code on failure
*****************************************************************************/
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
// change func to default func
ECLIC_SetVector(hwiNum, (rv_csr_t)HalHwiDefaultHandler);
// disable interrupt

View File

@@ -165,7 +165,7 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_ARG_T irqParam)
{
UINT32 intSave;
@@ -186,11 +186,8 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
g_hwiForm[hwiNum].pfnHook = hwiHandler;
if (irqParam != NULL) {
g_hwiForm[hwiNum].uwParam = (VOID *)irqParam->pDevId;
} else {
g_hwiForm[hwiNum].uwParam = NULL;
}
g_hwiForm[hwiNum].uwParam = (VOID *)irqParam;
if (hwiNum >= OS_RISCV_SYS_VECTOR_CNT) {
HalSetLocalInterPri(hwiNum, hwiPrio);
}
@@ -204,12 +201,10 @@ LITE_OS_SEC_TEXT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Return : LOS_OK on success or error code on failure
*****************************************************************************/
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -61,10 +61,7 @@ STATIC UINT32 SysTickStart(HWI_PROC_FUNC handler)
ArchTickTimer *tick = &g_archTickTimer;
UINT32 period = (UINT32)LOSCFG_BASE_CORE_TICK_RESPONSE_MAX;
HwiIrqParam irqParam;
irqParam.pDevId = (VOID *)period;
UINT32 ret = LOS_HwiCreate(RISCV_MACH_TIMER_IRQ, 0x1, 0, handler, &irqParam);
UINT32 ret = LOS_HwiCreate(RISCV_MACH_TIMER_IRQ, 0x1, 0, handler, period);
if (ret != LOS_OK) {
return ret;
}

View File

@@ -249,7 +249,8 @@ INLINE UINT32 ArchIsIntActive(VOID)
**************************************************************************** */
VOID HalHwiDefaultHandler(VOID)
{
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, HwiNumGet());
UINT32 irqNum = HwiNumGet();
PRINT_ERR("%s irqnum:%u\n", __FUNCTION__, irqNum);
while (1) {}
}
@@ -313,22 +314,22 @@ VOID HalInterrupt(VOID)
Description : create hardware interrupt
Input : hwiNum --- hwi num to create
hwiPrio --- priority of the hwi
hwiMode --- unused
hwiHandler --- hwi handler
irqParam --- param of the hwi handler
mode --- unused
handler --- hwi handler
arg --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
HWI_PRIOR_T hwiPrio,
HWI_MODE_T hwiMode,
HWI_PROC_FUNC hwiHandler,
HwiIrqParam *irqParam)
HWI_MODE_T mode,
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
(VOID)hwiMode;
(VOID)mode;
UINT32 intSave;
if (hwiHandler == NULL) {
if (handler == NULL) {
return OS_ERRNO_HWI_PROC_FUNC_NULL;
}
@@ -346,14 +347,10 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
intSave = LOS_IntLock();
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
if (irqParam != NULL) {
OsSetVector(hwiNum, hwiHandler, irqParam->pDevId);
} else {
OsSetVector(hwiNum, hwiHandler, NULL);
}
OsSetVector(hwiNum, handler, arg);
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
(VOID)arg;
OsSetVector(hwiNum, handler);
#endif
HwiUnmask(hwiNum);
@@ -366,13 +363,11 @@ UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
Function : ArchHwiDelete
Description : Delete hardware interrupt
Input : hwiNum --- hwi num to delete
irqParam --- param of the hwi handler
Output : None
Return : LOS_OK on success or error code on failure
**************************************************************************** */
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam)
LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum)
{
(VOID)irqParam;
UINT32 intSave;
if (hwiNum >= OS_HWI_MAX_NUM) {

View File

@@ -1475,110 +1475,6 @@ OUT:
return ret;
}
ssize_t fatfs_pread(int fd, void *buf, size_t nbyte, off_t offset)
{
INT32 ret;
off_t savepos, pos;
if (buf == NULL) {
errno = EFAULT;
return FS_FAILURE;
}
ret = FsLock();
if (ret != 0) {
errno = ret;
return FS_FAILURE;
}
if (!IsValidFd(fd)) {
FsUnlock();
errno = EBADF;
return FS_FAILURE;
}
savepos = (off_t)fatfs_lseek(fd, 0, SEEK_CUR);
if (savepos == (off_t)-1) {
errno = FatfsErrno(savepos);
return FS_FAILURE;
}
pos = (off_t)fatfs_lseek(fd, offset, SEEK_SET);
if (pos == (off_t)-1) {
errno = FatfsErrno(pos);
return FS_FAILURE;
}
ret = fatfs_read(fd, buf, nbyte);
if (ret < 0) {
FsUnlock();
errno = FatfsErrno(ret);
return FS_FAILURE;
}
pos = (off_t)fatfs_lseek(fd, savepos, SEEK_SET);
if ((pos == (off_t)-1) && (ret >= 0)) {
errno = FatfsErrno(pos);
return FS_FAILURE;
}
FsUnlock();
return (ssize_t)ret;
}
ssize_t fatfs_pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
INT32 ret;
off_t savepos, pos;
if (buf == NULL) {
errno = EFAULT;
return FS_FAILURE;
}
ret = FsLock();
if (ret != 0) {
errno = ret;
return FS_FAILURE;
}
if (!IsValidFd(fd)) {
FsUnlock();
errno = EBADF;
return FS_FAILURE;
}
savepos = (off_t)fatfs_lseek(fd, 0, SEEK_CUR);
if (savepos == (off_t)-1) {
errno = FatfsErrno(savepos);
return FS_FAILURE;
}
pos = (off_t)fatfs_lseek(fd, offset, SEEK_SET);
if (pos == (off_t)-1) {
errno = FatfsErrno(pos);
return FS_FAILURE;
}
ret = fatfs_write(fd, buf, nbyte);
if (ret < 0) {
FsUnlock();
errno = FatfsErrno(ret);
return FS_FAILURE;
}
pos = (off_t)fatfs_lseek(fd, savepos, SEEK_SET);
if ((pos == (off_t)-1) && (ret >= 0)) {
errno = FatfsErrno(pos);
return FS_FAILURE;
}
FsUnlock();
return (ssize_t)ret;
}
struct MountOps g_fatfsMnt = {
.Mount = fatfs_mount,
.Umount = fatfs_umount,
@@ -1602,6 +1498,4 @@ struct FileOps g_fatfsFops = {
.Getattr = fatfs_stat,
.Fsync = fatfs_fsync,
.Fstat = fatfs_fstat,
.Pread = fatfs_pread,
.Pwrite = fatfs_pwrite,
};

View File

@@ -69,8 +69,6 @@ int fatfs_rmdir(const char *path);
int fatfs_rename(const char *oldName, const char *newName);
int fatfs_statfs(const char *path, struct statfs *buf);
int fatfs_ftruncate(int fd, off_t length);
ssize_t fatfs_pread(int fd, void *buf, size_t nbyte, off_t offset);
ssize_t fatfs_pwrite(int fd, const void *buf, size_t nbyte, off_t offset);
/**
* @brief divide a physical drive (SD card, U disk, and MMC card), this function is OHOS-specific

View File

@@ -323,8 +323,6 @@ const struct FileOps g_lfsFops = {
.Getattr = LfsStat,
.Fsync = LfsFsync,
.Fstat = LfsFstat,
.Pread = LfsPread,
.Pwrite = LfsPwrite,
};
int LfsMount(const char *source, const char *target, const char *fileSystemType, unsigned long mountflags,
@@ -803,89 +801,5 @@ int LfsFstat(int fd, struct stat *buf)
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
return ret;
}
int LfsPread(int fd, void *buf, size_t nbyte, off_t offset)
{
int ret;
off_t savepos, pos;
if (buf == NULL) {
errno = EFAULT;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
return VFS_ERROR;
}
savepos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), 0, SEEK_CUR);
if (savepos == (off_t)-1) {
errno = LittlefsErrno(savepos);
return VFS_ERROR;
}
pos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), offset, SEEK_SET);
if (pos == (off_t)-1) {
errno = LittlefsErrno(pos);
return VFS_ERROR;
}
ret = lfs_file_read(g_handle[fd].lfsHandle, &(g_handle[fd].file), buf, nbyte);
if (ret < 0) {
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
pos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), savepos, SEEK_SET);
if ((pos == (off_t)-1) && (ret >= 0)) {
errno = LittlefsErrno(pos);
return VFS_ERROR;
}
return ret;
}
int LfsPwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
int ret;
off_t savepos, pos;
if (buf == NULL) {
errno = EFAULT;
return VFS_ERROR;
}
if (LfsFdIsValid(fd) == FALSE) {
errno = EBADF;
return VFS_ERROR;
}
savepos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), 0, SEEK_CUR);
if (savepos == (off_t)-1) {
errno = LittlefsErrno(savepos);
return VFS_ERROR;
}
pos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), offset, SEEK_SET);
if (pos == (off_t)-1) {
errno = LittlefsErrno(pos);
return VFS_ERROR;
}
ret = lfs_file_write(g_handle[fd].lfsHandle, &(g_handle[fd].file), buf, nbyte);
if (ret < 0) {
errno = LittlefsErrno(ret);
ret = VFS_ERROR;
}
pos = (off_t)lfs_file_seek(g_handle[fd].lfsHandle, &(g_handle[fd].file), savepos, SEEK_SET);
if ((pos == (off_t)-1) && (ret >= 0)) {
errno = LittlefsErrno(pos);
return VFS_ERROR;
}
return ret;
}

View File

@@ -97,8 +97,6 @@ int LfsStat(const char *path, struct stat *buf);
int LfsFsync(int fd);
int LfsFstat(int fd, struct stat *buf);
int SetDefaultMountPath(int pathNameIndex, const char* target);
int LfsPread(int fd, void *buf, size_t nbyte, off_t offset);
int LfsPwrite(int fd, const void *buf, size_t nbyte, off_t offset);
#endif /* _LFS_API_H_ */

View File

@@ -75,8 +75,6 @@ struct FileOps {
int (*Fstat)(int fd, struct stat *buf);
int (*Stat)(const char *path, struct stat *buf);
int (*Ftruncate)(int fd, off_t length);
int (*Pread)(int fd, void *buf, size_t nbyte, off_t offset);
int (*Pwrite)(int fd, const void *buf, size_t nbyte, off_t offset);
};
#endif /* _FS_OPERATIONS_H_ */

View File

@@ -595,55 +595,3 @@ int LOS_Ftruncate(int fd, off_t length)
}
return g_fs->fsFops->Ftruncate(fd, length);
}
ssize_t LOS_Pread(int fd, void *buf, size_t nbyte, off_t offset)
{
#ifdef LOSCFG_RANDOM_DEV
if (fd == RANDOM_DEV_FD) {
if (nbyte == 0) {
return FS_SUCCESS;
}
if (buf == NULL) {
errno = EINVAL;
return FS_FAILURE;
}
if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
}
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};
if (hks_generate_random(&key) != 0) {
errno = EIO;
return FS_FAILURE;
}
return (ssize_t)nbyte;
}
#endif
if (g_fs == NULL) {
errno = ENODEV;
return FS_FAILURE;
}
if (g_fs->fsFops == NULL || g_fs->fsFops->Pread == NULL) {
errno = ENOSYS;
return FS_FAILURE;
}
return g_fs->fsFops->Pread(fd, buf, nbyte, offset);
}
ssize_t LOS_Pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
#ifdef LOSCFG_RANDOM_DEV
if (fd == RANDOM_DEV_FD) {
errno = EBADF; /* "/dev/random" is readonly */
return FS_FAILURE;
}
#endif
if (g_fs == NULL) {
errno = ENODEV;
return FS_FAILURE;
}
if (g_fs->fsFops == NULL || g_fs->fsFops->Pwrite == NULL) {
errno = ENOSYS;
return FS_FAILURE;
}
return g_fs->fsFops->Pwrite(fd, buf, nbyte, offset);
}

View File

@@ -92,10 +92,6 @@ int LOS_FsMount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data);
ssize_t LOS_Pread(int fd, void *buf, size_t nbyte, off_t offset);
ssize_t LOS_Pwrite(int fd, const void *buf, size_t nbyte, off_t offset);
#ifdef __cplusplus
#if __cplusplus
extern "C" {

View File

@@ -157,7 +157,6 @@ STATIC VOID ParseAndExecCmdline(CmdParsed *cmdParsed, const CHAR *cmdline, UINT3
ret = ShellMsgTypeGet(cmdParsed, cmdName);
if (ret != LOS_OK) {
PRINTK("%s:command not found\n", cmdName);
free(cmdName);
return;
}

View File

@@ -144,7 +144,6 @@ STATIC VOID SignalHandle(LosTaskCB *task, BOOL cleanStatus)
STATIC VOID SignalEntry(INT32 sigNo)
{
(void)sigNo;
LosTaskCB *task = OsCurrTaskGet();
OsSigCB *sigCB = (OsSigCB *)task->sig;

View File

@@ -244,49 +244,37 @@ osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr
{
UINT32 tid;
UINT32 ret;
osThreadAttr_t attrTemp = {0};
TSK_INIT_PARAM_S stTskInitParam = {0};
LosTaskCB *pstTaskCB = NULL;
TSK_INIT_PARAM_S stTskInitParam = {NULL};
UINT16 priority;
if (OS_INT_ACTIVE || (func == NULL)) {
return (osThreadId_t)NULL;
}
if (attr == NULL) {
attrTemp.priority = osPriorityNormal,
attr = &attrTemp;
}
priority = LOS_PRIORITY(attr->priority);
priority = attr ? LOS_PRIORITY(attr->priority) : LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO;
if (!ISVALID_LOS_PRIORITY(priority)) {
/* unsupported priority */
return (osThreadId_t)NULL;
}
stTskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)func;
stTskInitParam.uwArg = (UINT32)argument;
if ((attr->stack_mem != NULL) && (attr->stack_size != 0)) {
stTskInitParam.stackAddr = (UINTPTR)attr->stack_mem;
stTskInitParam.uwStackSize = attr->stack_size;
} else if (attr->stack_size != 0) {
stTskInitParam.uwStackSize = attr->stack_size;
} else {
stTskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
}
if (attr->name != NULL) {
stTskInitParam.pcName = (char *)attr->name;
} else {
stTskInitParam.pcName = "CmsisTask";
}
if (attr->attr_bits == osThreadJoinable) {
stTskInitParam.uwStackSize = attr ? attr->stack_size : LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
stTskInitParam.pcName = (CHAR *)(attr ? attr->name : "[NULL]");
stTskInitParam.usTaskPrio = priority;
if ((attr != NULL) && (attr->attr_bits == osThreadJoinable)) {
stTskInitParam.uwResved = LOS_TASK_ATTR_JOINABLE;
}
stTskInitParam.usTaskPrio = priority;
ret = LOS_TaskCreate(&tid, &stTskInitParam);
if (ret != LOS_OK) {
return (osThreadId_t)NULL;
}
return (osThreadId_t)OS_TCB_FROM_TID(tid);
pstTaskCB = OS_TCB_FROM_TID(tid);
return (osThreadId_t)pstTaskCB;
}
const char *osThreadGetName(osThreadId_t thread_id)
@@ -853,7 +841,6 @@ osEventFlagsId_t osEventFlagsNew(const osEventFlagsAttr_t *attr)
const char *osEventFlagsGetName(osEventFlagsId_t ef_id)
{
(void)ef_id;
if (OS_INT_ACTIVE) {
return NULL;
}

View File

@@ -144,13 +144,3 @@ int ftruncate(int fd, off_t length)
{
return LOS_Ftruncate(fd, length);
}
ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset)
{
return LOS_Pread(fd, buf, nbyte, offset);
}
ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
return LOS_Pwrite(fd, buf, nbyte, offset);
}

View File

@@ -147,16 +147,6 @@ int ioctl(int fd, int req, ...)
return -1;
}
ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset)
{
return LOS_Pread(fd, buf, nbyte, offset);
}
ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
{
return LOS_Pwrite(fd, buf, nbyte, offset);
}
#else /* #ifdef LOSCFG_FS_VFS */
int _open(const char *path, int oflag, ...)

View File

@@ -92,23 +92,27 @@ static inline bool IsPthread(pthread_t thread)
return true;
}
static int PthreadAttrCheck(const pthread_attr_t *threadAttr, TSK_INIT_PARAM_S *taskInitParam)
static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutine)(void *), void *arg,
TSK_INIT_PARAM_S *taskInitParam)
{
INT32 ret;
const pthread_attr_t *threadAttr = attr;
struct sched_param schedParam = { 0 };
INT32 policy = 0;
pthread_attr_t attrTmp;
INT32 ret;
if (!attr) {
(VOID)pthread_attr_init(&attrTmp);
threadAttr = &attrTmp;
}
if (threadAttr->stackaddr_set != 0) {
return ENOTSUP;
}
if (threadAttr->stacksize < PTHREAD_STACK_MIN) {
return EINVAL;
}
if ((threadAttr->stackaddr_set != 0) && (threadAttr->stacksize_set != 0)) {
taskInitParam->stackAddr = (UINTPTR)threadAttr->stackaddr;
}
if (threadAttr->stacksize_set != 0) {
taskInitParam->uwStackSize = threadAttr->stacksize;
} else {
taskInitParam->uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
}
taskInitParam->uwStackSize = threadAttr->stacksize;
if (threadAttr->inheritsched == PTHREAD_EXPLICIT_SCHED) {
taskInitParam->usTaskPrio = (UINT16)threadAttr->schedparam.sched_priority;
} else if (IsPthread(pthread_self())) {
@@ -120,25 +124,6 @@ static int PthreadAttrCheck(const pthread_attr_t *threadAttr, TSK_INIT_PARAM_S *
} else {
taskInitParam->usTaskPrio = (UINT16)threadAttr->schedparam.sched_priority;
}
return 0;
}
static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutine)(void *), void *arg,
TSK_INIT_PARAM_S *taskInitParam)
{
const pthread_attr_t *threadAttr = attr;
pthread_attr_t attrTmp;
INT32 ret;
if (attr == NULL) {
(VOID)pthread_attr_init(&attrTmp);
threadAttr = &attrTmp;
}
ret = PthreadAttrCheck(threadAttr, taskInitParam);
if (ret != 0) {
return ret;
}
PthreadData *pthreadData = (PthreadData *)malloc(sizeof(PthreadData));
if (pthreadData == NULL) {
@@ -174,7 +159,7 @@ static int CheckForCancel(void)
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return 0;
}
@@ -230,7 +215,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)
{
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -254,7 +239,7 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param
int pthread_setschedprio(pthread_t thread, int prio)
{
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -272,7 +257,7 @@ int pthread_once(pthread_once_t *onceControl, void (*initRoutine)(void))
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -303,7 +288,7 @@ int pthread_setcancelstate(int state, int *oldState)
PthreadData *pthreadData = NULL;
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -336,7 +321,7 @@ int pthread_setcanceltype(int type, int *oldType)
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -367,7 +352,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *par
UINT32 prio;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -418,7 +403,7 @@ int pthread_cancel(pthread_t thread)
LosTaskCB *tcb = NULL;
PthreadData *pthreadData = NULL;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
intSave = LOS_IntLock();
@@ -460,7 +445,7 @@ int pthread_join(pthread_t thread, void **retval)
UINTPTR result;
UINT32 ret;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -487,7 +472,7 @@ int pthread_detach(pthread_t thread)
{
UINT32 ret;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -507,7 +492,7 @@ void pthread_exit(void *retVal)
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
goto EXIT;
}
@@ -540,7 +525,7 @@ int pthread_setname_np(pthread_t thread, const char *name)
char *taskName = NULL;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -577,7 +562,7 @@ int pthread_getname_np(pthread_t thread, char *buf, size_t buflen)
const char *name = NULL;
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -628,7 +613,7 @@ int pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -666,7 +651,7 @@ int pthread_key_delete(pthread_key_t k)
pthread_t thread = pthread_self();
if (!IsPthread(thread)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, thread);
return EINVAL;
}
@@ -707,7 +692,7 @@ int pthread_setspecific(pthread_key_t k, const void *x)
pthread_t self = pthread_self();
if (!IsPthread(self)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, self);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, self);
return EINVAL;
}
@@ -748,7 +733,7 @@ void *pthread_getspecific(pthread_key_t k)
void *key = NULL;
pthread_t self = pthread_self();
if (!IsPthread(self)) {
PRINT_ERR("[%s:%d] This task %lu is not a posix thread!!!\n", __FUNCTION__, __LINE__, self);
PRINT_ERR("[%s:%d] This task %d is not a posix thread!!!\n", __FUNCTION__, __LINE__, self);
return NULL;
}

View File

@@ -219,32 +219,30 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stackSize)
attr->stacksize_set = 1;
attr->stacksize = stackSize;
return 0;
}
int pthread_attr_setstack(pthread_attr_t *attr, void *stackAddr, size_t stackSize)
{
if ((attr == NULL) || (stackAddr == NULL) || (stackSize < PTHREAD_STACK_MIN)) {
return EINVAL;
}
(void)attr;
(void)stackAddr;
(void)stackSize;
PRINT_ERR("%s: Don't support the pthread stack func currently!\n", __FUNCTION__);
errno = ENOSYS;
attr->stacksize_set = 1;
attr->stacksize = stackSize;
attr->stackaddr_set = 1;
attr->stackaddr = stackAddr;
return 0;
return -1;
}
int pthread_attr_getstack(const pthread_attr_t *attr, void **stackAddr, size_t *stackSize)
{
if ((attr == NULL) || (stackAddr == NULL) || (stackSize == NULL) ||
!attr->stacksize_set || !attr->stackaddr_set) {
return EINVAL;
}
(void)attr;
(void)stackAddr;
(void)stackSize;
PRINT_ERR("%s: Don't support the pthread stack func currently!\n", __FUNCTION__);
errno = ENOSYS;
*stackAddr = attr->stackaddr;
*stackSize = attr->stacksize;
return 0;
return -1;
}
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)

View File

@@ -82,8 +82,8 @@ int sem_init(sem_t *sem, int shared, unsigned int value)
return -1;
}
sem->s_magic = (INT32)_SEM_MAGIC;
sem->s_handle = (INT32)semHandle;
sem->s_magic = (int)_SEM_MAGIC;
sem->s_handle = (int)semHandle;
return 0;
}
@@ -92,7 +92,7 @@ int sem_destroy(sem_t *sem)
{
UINT32 ret;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
if ((sem == NULL) || (sem->s_magic != (int)_SEM_MAGIC)) {
errno = EINVAL;
return -1;
}
@@ -110,7 +110,7 @@ int sem_wait(sem_t *sem)
{
UINT32 ret;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
if ((sem == NULL) || (sem->s_magic != (int)_SEM_MAGIC)) {
errno = EINVAL;
return -1;
}
@@ -128,7 +128,7 @@ int sem_post(sem_t *sem)
{
UINT32 ret;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
if ((sem == NULL) || (sem->s_magic != (int)_SEM_MAGIC)) {
errno = EINVAL;
return -1;
}
@@ -146,7 +146,7 @@ int sem_trywait(sem_t *sem)
{
UINT32 ret;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
if ((sem == NULL) || (sem->s_magic != _SEM_MAGIC)) {
errno = EINVAL;
return -1;
}
@@ -165,7 +165,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *timeout)
UINT32 ret;
UINT64 tickCnt;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
if ((sem == NULL) || (sem->s_magic != (int)_SEM_MAGIC)) {
errno = EINVAL;
return -1;
}
@@ -193,7 +193,7 @@ int sem_getvalue(sem_t *sem, int *currVal)
{
UINT32 ret;
if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)|| (currVal == NULL)) {
if ((sem == NULL) || (sem->s_magic != _SEM_MAGIC)|| (currVal == NULL)) {
errno = EINVAL;
return -1;
}

View File

@@ -35,7 +35,6 @@
#include "los_task.h"
#include "los_interrupt.h"
#include "los_tick.h"
#include "los_sortlink.h"
#ifdef __cplusplus
#if __cplusplus
@@ -44,7 +43,7 @@ extern "C" {
#endif /* __cplusplus */
#define OS_SCHED_MINI_PERIOD (g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI)
#define OS_SCHED_MAX_RESPONSE_TIME OS_SORT_LINK_UINT64_MAX
#define OS_SCHED_MAX_RESPONSE_TIME (UINT64)(((UINT64)-1) - 1U)
extern UINT32 g_taskScheduled;
typedef BOOL (*SchedScan)(VOID);

View File

@@ -457,7 +457,6 @@ typedef struct tagTskInitParam {
TSK_ENTRY_FUNC pfnTaskEntry; /**< Task entrance function */
UINT16 usTaskPrio; /**< Task priority */
UINT32 uwArg; /**< Task parameters */
UINTPTR stackAddr; /**< Task satck memory */
UINT32 uwStackSize; /**< Task stack size */
CHAR *pcName; /**< Task name */
UINT32 uwResved; /**< Reserved */
@@ -1277,14 +1276,6 @@ extern UINT32 LOS_TaskDetach(UINT32 taskID);
*/
#define OS_TASK_STATUS_EXIT 0x0100
/**
* @ingroup los_task
* Flag that indicates the task or task control block status.
*
* Task stack allocated by the system.
*/
#define OS_TASK_FLAG_STACK_FREE 0x0800
/**
* @ingroup los_task
* Flag that indicates the task property.

View File

@@ -131,7 +131,7 @@ VOID OsSchedUpdateExpireTime(VOID)
isPmMode = OsIsPmMode();
#endif
if ((runTask->taskID != g_idleTaskID) && !isPmMode) {
INT32 timeSlice = (runTask->timeSlice <= OS_TIME_SLICE_MIN) ? (INT32)OS_SCHED_TIME_SLICES : runTask->timeSlice;
INT32 timeSlice = (runTask->timeSlice <= OS_TIME_SLICE_MIN) ? OS_SCHED_TIME_SLICES : runTask->timeSlice;
endTime = runTask->startTime + timeSlice;
} else {
endTime = OS_SCHED_MAX_RESPONSE_TIME - OS_TICK_RESPONSE_PRECISION;

View File

@@ -126,28 +126,19 @@ STATIC_INLINE UINT32 OsCheckTaskIDValid(UINT32 taskID)
return ret;
}
STATIC INLINE VOID OsInsertTCBToFreeList(LosTaskCB *taskCB)
{
UINT32 taskID = taskCB->taskID;
(VOID)memset_s(taskCB, sizeof(LosTaskCB), 0, sizeof(LosTaskCB));
taskCB->taskID = taskID;
taskCB->taskStatus = OS_TASK_STATUS_UNUSED;
LOS_ListAdd(&g_losFreeTask, &taskCB->pendList);
}
STATIC VOID OsRecycleTaskResources(LosTaskCB *taskCB, UINTPTR *stackPtr)
{
if ((taskCB->taskStatus & OS_TASK_FLAG_STACK_FREE) && (taskCB->topOfStack != 0)) {
if (!(taskCB->taskStatus & OS_TASK_STATUS_EXIT)) {
LOS_ListAdd(&g_losFreeTask, &taskCB->pendList);
taskCB->taskStatus = OS_TASK_STATUS_UNUSED;
}
if (taskCB->topOfStack != 0) {
#if (LOSCFG_EXC_HARDWARE_STACK_PROTECTION == 1)
*stackPtr = taskCB->topOfStack - OS_TASK_STACK_PROTECT_SIZE;
#else
*stackPtr = taskCB->topOfStack;
#endif
taskCB->topOfStack = (UINT32)NULL;
taskCB->taskStatus &= ~OS_TASK_FLAG_STACK_FREE;
}
if (!(taskCB->taskStatus & OS_TASK_STATUS_EXIT)) {
OsInsertTCBToFreeList(taskCB);
}
}
@@ -668,6 +659,7 @@ LITE_OS_SEC_TEXT_INIT STATIC_INLINE UINT32 OsTaskInitParamCheck(TSK_INIT_PARAM_S
if (taskInitParam->uwStackSize == 0) {
taskInitParam->uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
}
taskInitParam->uwStackSize = ALIGN(taskInitParam->uwStackSize, OS_TASK_STACK_ADDR_ALIGN);
if (taskInitParam->uwStackSize < LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE) {
return LOS_ERRNO_TSK_STKSZ_TOO_SMALL;
@@ -675,9 +667,10 @@ LITE_OS_SEC_TEXT_INIT STATIC_INLINE UINT32 OsTaskInitParamCheck(TSK_INIT_PARAM_S
return LOS_OK;
}
STATIC UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *taskInitParam)
LITE_OS_SEC_TEXT_INIT UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *taskInitParam, VOID *topOfStack)
{
taskCB->arg = taskInitParam->uwArg;
taskCB->topOfStack = (UINT32)(UINTPTR)topOfStack;
taskCB->stackSize = taskInitParam->uwStackSize;
taskCB->taskSem = NULL;
taskCB->taskMux = NULL;
@@ -702,32 +695,9 @@ STATIC UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *taskInitParam)
LOS_ListInit(&taskCB->joinList);
}
if (taskInitParam->stackAddr == (UINTPTR)NULL) {
taskCB->stackSize = ALIGN(taskInitParam->uwStackSize, OS_TASK_STACK_ADDR_ALIGN);
#if (LOSCFG_EXC_HARDWARE_STACK_PROTECTION == 1)
UINT32 stackSize = taskCB->stackSize + OS_TASK_STACK_PROTECT_SIZE;
UINTPTR stackPtr = (UINTPTR)LOS_MemAllocAlign(OS_TASK_STACK_ADDR, stackSize, OS_TASK_STACK_PROTECT_SIZE);
taskCB->topOfStack = stackPtr + OS_TASK_STACK_PROTECT_SIZE;
#else
taskCB->topOfStack = (UINTPTR)LOS_MemAllocAlign(OS_TASK_STACK_ADDR, taskCB->stackSize,
LOSCFG_STACK_POINT_ALIGN_SIZE);
#endif
if (taskCB->topOfStack == (UINTPTR)NULL) {
return LOS_ERRNO_TSK_NO_MEMORY;
}
taskCB->taskStatus |= OS_TASK_FLAG_STACK_FREE;
} else {
taskCB->topOfStack = LOS_Align(taskInitParam->stackAddr, LOSCFG_STACK_POINT_ALIGN_SIZE);
taskCB->stackSize = taskInitParam->uwStackSize - (taskCB->topOfStack - taskInitParam->stackAddr);
taskCB->stackSize = TRUNCATE(taskCB->stackSize, OS_TASK_STACK_ADDR_ALIGN);
}
/* initialize the task stack, write magic num to stack top */
(VOID)memset_s((VOID *)taskCB->topOfStack, taskCB->stackSize,
(INT32)(OS_TASK_STACK_INIT & 0xFF), taskCB->stackSize);
*((UINT32 *)taskCB->topOfStack) = OS_TASK_MAGIC_WORD;
taskCB->stackPointer = ArchTskStackInit(taskCB->taskID, taskCB->stackSize, (VOID *)taskCB->topOfStack);
return LOS_OK;
}
@@ -741,6 +711,7 @@ STATIC UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *taskInitParam)
LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S *taskInitParam)
{
UINT32 intSave;
VOID *topOfStack = NULL;
LosTaskCB *taskCB = NULL;
UINT32 retVal;
@@ -763,13 +734,29 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_losFreeTask));
LOS_ListDelete(LOS_DL_LIST_FIRST(&g_losFreeTask));
LOS_IntRestore(intSave);
retVal = OsNewTaskInit(taskCB, taskInitParam);
if (retVal != LOS_OK) {
#if (LOSCFG_EXC_HARDWARE_STACK_PROTECTION == 1)
UINTPTR stackPtr = (UINTPTR)LOS_MemAllocAlign(OS_TASK_STACK_ADDR, taskInitParam->uwStackSize +
OS_TASK_STACK_PROTECT_SIZE, OS_TASK_STACK_PROTECT_SIZE);
topOfStack = (VOID *)(stackPtr + OS_TASK_STACK_PROTECT_SIZE);
#else
topOfStack = (VOID *)LOS_MemAllocAlign(OS_TASK_STACK_ADDR, taskInitParam->uwStackSize,
LOSCFG_STACK_POINT_ALIGN_SIZE);
#endif
if (topOfStack == NULL) {
intSave = LOS_IntLock();
OsInsertTCBToFreeList(taskCB);
LOS_ListAdd(&g_losFreeTask, &taskCB->pendList);
LOS_IntRestore(intSave);
return LOS_ERRNO_TSK_NO_MEMORY;
}
/* initialize the task stack, write magic num to stack top */
(VOID)memset_s(topOfStack, taskInitParam->uwStackSize,
(INT32)(OS_TASK_STACK_INIT & 0xFF), taskInitParam->uwStackSize);
retVal = OsNewTaskInit(taskCB, taskInitParam, topOfStack);
if (retVal != LOS_OK) {
return retVal;
}
@@ -1123,7 +1110,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
if (!(taskCB->taskStatus & OS_TASK_STATUS_EXIT)) {
taskCB->taskStatus |= OS_TASK_STATUS_UNUSED;
taskCB->taskStatus = OS_TASK_STATUS_UNUSED;
OsRunningTaskDelete(taskID, taskCB);
}
LOS_IntRestore(intSave);

View File

@@ -47,8 +47,6 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define EXIT0_IRQ 9
UINT8 __attribute__ ((aligned (8))) g_memStart[OS_SYS_MEM_SIZE];
VOID TaskSampleEntry2(VOID)
@@ -83,9 +81,6 @@ VOID TaskSample(VOID)
UINT32 taskID1;
UINT32 taskID2;
TSK_INIT_PARAM_S stTask = {0};
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = (VOID *)ECLIC_LEVEL_TRIGGER;
stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1;
stTask.uwStackSize = 0x0800;
@@ -106,7 +101,7 @@ VOID TaskSample(VOID)
}
LOS_HwiInit();
LOS_HwiCreate(EXTI0_IRQn, EXIT0_IRQ, ECLIC_NON_VECTOR_INTERRUPT, EXTI0_IRQHandler, &irqParam);
LOS_HwiCreate(EXTI0_IRQn, 9, ECLIC_NON_VECTOR_INTERRUPT, EXTI0_IRQHandler, ECLIC_LEVEL_TRIGGER);
}
VOID RunTaskSample(VOID)

View File

@@ -51,7 +51,6 @@ kernel_module("test_init") {
group("testsuites") {
deps = [
":test_init",
"sample/cmsis:test_cmsis",
"sample/kernel/atomic:test_atomic",
"sample/kernel/event:test_event",
"sample/kernel/hwi:test_hwi",
@@ -62,7 +61,6 @@ group("testsuites") {
"sample/kernel/sem:test_sem",
"sample/kernel/swtmr:test_swtmr",
"sample/kernel/task:test_task",
"sample/posix:test_posix",
]
if (defined(LOSCFG_DYNLINK)) {
deps += [ "sample/kernel/dynlink:test_dynlink" ]

View File

@@ -48,9 +48,7 @@
#include "los_event.h"
#include "los_memory.h"
#include "los_queue.h"
#if (LOSCFG_BASE_CORE_CPUP == 1)
#include "los_cpup.h"
#endif
#include "los_tick.h"
#include "los_swtmr.h"
#include "los_mux.h"
@@ -87,17 +85,12 @@ extern "C" {
#define LOS_KERNEL_MEM_TEST 1
#define LOS_KERNEL_DYNLINK_TEST 0
#define LOS_KERNEL_TICKLESS_TEST 0
#if (LOSCFG_KERNEL_PM == 1)
#define LOS_KERNEL_PM_TEST 1
#else
#define LOS_KERNEL_PM_TEST 0
#endif
#define LOS_KERNEL_LMS_TEST 0
#define LOS_KERNEL_LMK_TEST 0
#define LOS_KERNEL_SIGNAL_TEST 0
#define LOS_POSIX_TEST 1
#define LOS_CMSIS_TEST 1
#define LITEOS_CMSIS_TEST 0
#define LOS_CMSIS2_CORE_TASK_TEST 0
#define LOS_CMSIS2_IPC_MUX_TEST 0
#define LOS_CMSIS2_IPC_SEM_TEST 0
@@ -337,7 +330,7 @@ typedef struct tagHwiHandleForm {
UINT32 uwPrioMask;
} HWI_HANDLE_FORM_S;
#endif
#define TEST_HwiCreate(ID, prio, mode, Func, irqParam) LOS_HwiCreate(ID, prio, mode, Func, irqParam)
#define TEST_HwiCreate(ID, prio, mode, Func, arg) LOS_HwiCreate(ID, prio, mode, Func, arg)
#define uart_printf_func printf
extern VOID ItSuiteLosTask(void);
@@ -354,10 +347,6 @@ extern VOID ItSuiteLosPm(void);
extern VOID ItSuiteLosLmk(void);
extern VOID ItSuiteLosSignal(void);
extern int PthreadFuncTestSuite(void);
extern void CmsisFuncTestSuite(void);
extern VOID ItSuite_Cmsis_Lostask(void);
extern VOID ItSuite_Cmsis_Lostask_add(void);
extern VOID ItSuite_CMSIS_Losmsg(void);

View File

@@ -1,33 +0,0 @@
# Copyright (c) 2022-2022 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.
static_library("test_cmsis") {
sources = [ "cmsis_func_test.c" ]
configs += [ "//kernel/liteos_m/testsuites:include" ]
}

View File

@@ -1,84 +0,0 @@
/*
* Copyright (c) 2022-2022 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 <securec.h>
#include "osTest.h"
#include "cmsis_os.h"
#define TEST_STR(func) ItLos##func
#define TEST_TO_STR(x) #x
#define TEST_HEAD_TO_STR(x) TEST_TO_STR(x)
#define ADD_TEST_CASE(func) \
TEST_ADD_CASE(TEST_HEAD_TO_STR(TEST_STR(func)), func, TEST_LOS, TEST_TASK, TEST_LEVEL0, TEST_FUNCTION)
#define Function 0
#define MediumTest 0
#define Level1 0
#define LITE_TEST_CASE(module, function, flag) static int function(void)
static VOID CmsisStackFunc01(void)
{
g_testCount++;
return;
}
/**
* @tc.number : SUB_KERNEL_PTHREAD_OPERATION_001
* @tc.name : event operation for join
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis001, Function | MediumTest | Level1)
{
osThreadId_t threadId;
osThreadAttr_t attr = {0};
g_testCount = 0;
void *stackAddr = malloc(OS_TSK_TEST_STACK_SIZE);
ICUNIT_ASSERT_NOT_EQUAL(stackAddr, NULL, stackAddr);
attr.stack_mem = stackAddr;
attr.stack_size = OS_TSK_TEST_STACK_SIZE;
attr.priority = osPriorityNormal;
attr.attr_bits = osThreadDetached;
threadId = osThreadNew((osThreadFunc_t)CmsisStackFunc01, NULL, &attr);
ICUNIT_GOTO_NOT_EQUAL(threadId, 0, threadId, EXIT);
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
EXIT:
free(stackAddr);
return LOS_OK;
};
void CmsisFuncTestSuite(void)
{
ADD_TEST_CASE(TestCmsis001);
}

View File

@@ -28,7 +28,7 @@
* 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 "it_los_hwi.h"
@@ -43,11 +43,9 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiDelete(HWI_NUM_TEST);

View File

@@ -38,11 +38,9 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, NULL, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, NULL, arg);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_PROC_FUNC_NULL, ret);
return LOS_OK;

View File

@@ -44,23 +44,21 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
hwiPrio = 2; // 2, set new hwi priority
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
hwiPrio = 6; // 6, set new hwi priority
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
hwiPrio = 7; // 7, set new hwi priority
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT3);
TestHwiDelete(HWI_NUM_TEST);

View File

@@ -43,11 +43,9 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiDelete(HWI_NUM_TEST);

View File

@@ -49,20 +49,18 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_INT1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_INT1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
TestHwiDelete(HWI_NUM_TEST1);

View File

@@ -44,11 +44,9 @@ static UINT32 Testcase(VOID)
HWI_HANDLE_T hwiNum = 241;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(hwiNum, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(hwiNum, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
return LOS_OK;

View File

@@ -44,14 +44,12 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
intSave = LOS_IntLock();

View File

@@ -43,17 +43,15 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
EXIT:

View File

@@ -66,19 +66,17 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -44,15 +44,13 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave1;
UINT32 intSave2;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
intSave1 = LOS_IntLock();

View File

@@ -79,21 +79,19 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
hwiPrio = 2; // 2, set new hwi priority
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
hwiPrio = 1;
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
TestHwiTrigger(HWI_NUM_TEST3);

View File

@@ -79,21 +79,19 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
hwiPrio = 2; // set new hwi priority is 2
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
hwiPrio = 3; // set new hwi priority is 3
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -67,18 +67,16 @@ static UINT32 Testcase(VOID)
HWI_PRIOR_T hwiPrio = 1;
#endif
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
hwiPrio = 2; // set new hwi priority is 2
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST2, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
#ifdef __RISC_V__
@@ -86,7 +84,7 @@ static UINT32 Testcase(VOID)
#else
hwiPrio = 3; // set new hwi priority is 3
#endif
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
intSave = LOS_IntLock();

View File

@@ -63,20 +63,18 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
intSave = LOS_IntLock();

View File

@@ -64,10 +64,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "Tsk015A";
@@ -77,7 +75,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -98,11 +98,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTsk016A";
@@ -135,7 +132,7 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testTaskID03, &task);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3);
LOS_TaskUnlock();

View File

@@ -44,16 +44,14 @@ static VOID TaskF01(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT);
g_testCount++;
TestHwiDelete(HWI_NUM_TEST);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
EXIT:
@@ -66,7 +64,7 @@ EXIT:
static VOID HwiF01(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
TestHwiClear(HWI_NUM_TEST);
@@ -88,13 +86,11 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -69,11 +69,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTsk018A";
@@ -83,7 +80,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -78,11 +78,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTsk019A";
@@ -92,7 +89,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -28,7 +28,7 @@
* 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 "it_los_hwi.h"
@@ -52,7 +52,7 @@ EXIT:
static VOID HwiF01(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
TestHwiClear(HWI_NUM_TEST);
@@ -96,11 +96,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTsk020A";
@@ -110,7 +107,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -47,7 +47,7 @@ EXIT:
static VOID HwiF01(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
TestHwiClear(HWI_NUM_TEST);
@@ -88,11 +88,8 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTsk021A";
@@ -102,7 +99,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -55,14 +55,12 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_EventInit(&g_exampleEvent);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -71,13 +71,11 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -82,11 +82,8 @@ static UINT32 Testcase(VOID)
UINT32 semCount = 1;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
TSK_INIT_PARAM_S task = {0};
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task;
task.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task.pcName = "HwiTask024A";
@@ -102,7 +99,7 @@ static UINT32 Testcase(VOID)
ret = LOS_SemPend(g_usSemID, LOS_NO_WAIT);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_TaskCreate(&g_testTaskID01, &task);

View File

@@ -29,7 +29,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "osTest.h"
#include "it_los_hwi.h"
@@ -59,14 +59,12 @@ static UINT32 Testcase(VOID)
UINT32 semCount = 1;
HWI_PRIOR_T hwiPrio = 7;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_SemCreate(semCount, &g_usSemID);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
@@ -88,5 +86,5 @@ Testcase brief in English
VOID ItLosHwi025(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("ItLosHwi025", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL2, TEST_FUNCTION);
}
}

View File

@@ -45,11 +45,9 @@ static VOID SwtmrF01(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -45,16 +45,14 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
for (index = 0; index < HWI_LOOP_NUM; index++) {
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, OS_ERRNO_HWI_ALREADY_CREATED, ret, EXIT);
}
TestHwiDelete(HWI_NUM_TEST);

View File

@@ -58,23 +58,20 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave1;
UINT32 intSave2;
UINT32 intSave3;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
intSave1 = LOS_IntLock();

View File

@@ -74,19 +74,17 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = 2;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST3, hwiPrio, mode, (HWI_PROC_FUNC)HwiF02, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1, hwiPrio, mode, (HWI_PROC_FUNC)HwiF03, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -48,14 +48,12 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = 2;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
UINT32 intSave;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
intSave = LOS_IntLock();

View File

@@ -48,14 +48,12 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -28,7 +28,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#if (LOS_KERNEL_MULTI_HWI_TEST == 1)
@@ -63,15 +63,13 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
/* Creates 3 interrupts in a row with interrupt number */
for (g_uwIndex = 0; g_uwIndex < 3; g_uwIndex++) {
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_INT0 + g_uwIndex);
}
@@ -80,7 +78,7 @@ static UINT32 Testcase(VOID)
for (g_uwIndex = 4; g_uwIndex < TEST_MAX_NUMBER_HWI; g_uwIndex++) {
/* if interrupt number is not HWI_NUM_INT0 + 5 */
if (g_uwIndex != 5) {
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_INT0 + g_uwIndex, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_INT0 + g_uwIndex);
}

View File

@@ -51,15 +51,13 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = OS_HWI_PRIO_LOWEST;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
for (index = 0; index < OS_HWI_MAX_USED_NUM; index++) {
/* if not Interrupt number HWI_NUM_TEST1 + 3\4\32\35\36. */
if ((index != 3) && (index != 4) && (index != 32) && (index != 35) && (index != 36)) {
ret = LOS_HwiCreate(HWI_NUM_TEST1 + index, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST1 + index, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
}

View File

@@ -47,13 +47,11 @@ static UINT32 Testcase(VOID)
UINT32 loop;
HWI_PRIOR_T hwiPrio = 2;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
for (loop = 0; loop < HWI_LOOP_NUM; loop++) {
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -45,12 +45,10 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 2;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
LOS_HwiDisable(HWI_NUM_TEST);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -86,10 +86,7 @@ static UINT32 Testcase(VOID)
UINT32 irqNum = 0;
HWI_PRIOR_T hwiPrio = 2; // 2, Set hwi priority.
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
HwiControllerOps *ops = NULL;
HwiControllerOps *opsBac = (HwiControllerOps *)malloc(sizeof(HwiControllerOps));
if (opsBac == NULL) {
@@ -100,19 +97,19 @@ static UINT32 Testcase(VOID)
(VOID)memset_s(opsBac, sizeof(HwiControllerOps), 0, sizeof(HwiControllerOps));
g_testCount = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiTrigger(LOSCFG_PLATFORM_HWI_LIMIT + 1);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
ret = LOS_HwiEnable(OS_HWI_MAX_NUM + 1);
ret = LOS_HwiEnable(LOSCFG_PLATFORM_HWI_LIMIT + 1);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
ret = LOS_HwiDisable(OS_HWI_MAX_NUM + 1);
ret = LOS_HwiDisable(LOSCFG_PLATFORM_HWI_LIMIT + 1);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
ret = LOS_HwiClear(OS_HWI_MAX_NUM + 1);
ret = LOS_HwiClear(LOSCFG_PLATFORM_HWI_LIMIT + 1);
ICUNIT_ASSERT_EQUAL(ret, OS_ERRNO_HWI_NUM_INVALID, ret);
hwiPrio = 3; // 3, Set hwi priority.
ret = LOS_HwiSetPriority(OS_HWI_MAX_NUM + 1, hwiPrio);
ret = LOS_HwiSetPriority(LOSCFG_PLATFORM_HWI_LIMIT + 1, hwiPrio);
ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_OK, ret);
ops = LOS_HwiOpsGet();

View File

@@ -29,14 +29,14 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "osTest.h"
#include "osTest.h"
#include "it_los_hwi.h"
static VOID TaskF01(VOID)
{
}
VOID ItHwiM3B001F001()
{
return;
@@ -49,10 +49,7 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 2;
HWI_MODE_T mode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
@@ -64,8 +61,8 @@ static UINT32 Testcase(VOID)
ret = LOS_TaskCreate(&g_testTaskIdHwi, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_INT0, hwiPrio, mode, (HWI_PROC_FUNC)ItHwiM3B001F001, &irqParam);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = LOS_HwiCreate(HWI_NUM_INT0, hwiPrio, mode, (HWI_PROC_FUNC)ItHwiM3B001F001, arg);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
return LOS_OK;
@@ -83,5 +80,5 @@ Testcase brief in English
VOID LltLosHwi035(VOID) // IT_Layer_ModuleORFeature_No
{
TEST_ADD_CASE("LltLosHwi035", Testcase, TEST_LOS, TEST_HWI, TEST_LEVEL3, TEST_PRESSURE);
}
}

View File

@@ -74,8 +74,8 @@ static VOID TaskF02(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task;
TSK_INIT_PARAM_S task2;
g_testCount = 0;

View File

@@ -46,7 +46,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
ret = LOS_MuxCreate(&g_mutexTest);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);

View File

@@ -55,7 +55,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
ret = LOS_MuxCreate(&g_mutexTest);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);

View File

@@ -59,7 +59,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
ret = LOS_MuxCreate(&g_mutexTest);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);

View File

@@ -54,8 +54,8 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task;
TSK_INIT_PARAM_S task2;
ret = LOS_MuxCreate(&g_mutexTest);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);

View File

@@ -61,7 +61,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
ret = LOS_MuxCreate(&g_mutexTest);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);

View File

@@ -56,7 +56,7 @@ static VOID TaskF01(void)
VOID TaskF02(void)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
g_testCount++;
@@ -83,7 +83,7 @@ VOID TaskF02(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;

View File

@@ -57,7 +57,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;

View File

@@ -47,7 +47,7 @@ static VOID TaskF01(void)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;

View File

@@ -85,8 +85,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
@@ -145,7 +144,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;

View File

@@ -78,8 +78,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -124,7 +123,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(void)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -78,8 +78,7 @@ static VOID TaskFuncC(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -129,7 +128,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -73,8 +73,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -122,7 +121,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -76,8 +76,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -128,7 +127,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -81,8 +81,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -124,7 +123,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -79,8 +79,7 @@ static VOID TaskFuncB(VOID)
static VOID TaskFuncA(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task2 = {0};
TSK_INIT_PARAM_S task1, task2;
g_testCount++;
ICUNIT_ASSERT_EQUAL_VOID(g_testCount, 1, g_testCount); // 1, Here, assert that g_testCount is equal to 1.
@@ -122,7 +121,7 @@ static VOID TaskFuncA(VOID)
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task = {0};
TSK_INIT_PARAM_S task;
g_testCount = 0;
ret = LOS_MuxCreate(&g_mutexTest1);

View File

@@ -44,13 +44,8 @@ static UINT32 Testcase(VOID)
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 0xFFFE);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_QUEUE_SIZE_TOO_BIG, ret, EXIT);
#ifdef __CSKY_V2__
// CB2201 Board is low memory device, set max message size 0x4000.
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 0x4000);
#else
// 0x8000, is the middle number.
ret = LOS_QueueCreate("Q1", 1, &g_testQueueID01, 0, 0x8000);
#endif
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_QueueWrite(g_testQueueID01 + 1, &buff1, QUEUE_BASE_MSGSIZE, 0);

View File

@@ -69,7 +69,7 @@ static UINT32 Testcase(VOID)
CHAR buff1[8] = "UniDSP";
TSK_INIT_PARAM_S task1 = { 0 };
TSK_INIT_PARAM_S task2 = { 0 };
TSK_INIT_PARAM_S task2;
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)ItQueueHead032F01;
task1.pcName = "TskName1";

View File

@@ -63,20 +63,18 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T hwiMode;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
// 1, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, &irqParam
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, arg
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
hwiMode = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);
LOS_TaskDelay(5); // 5, set delay time.

View File

@@ -62,13 +62,11 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 1;
HWI_MODE_T hwiMode;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
// 1, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, &irqParam
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)Case2, &g_swtmrId1, arg
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
@@ -76,7 +74,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
hwiMode = 0;
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
TestHwiTrigger(HWI_NUM_TEST);

View File

@@ -74,28 +74,25 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T hwiMode = 0;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount1 = 0;
TestHwiClear(HWI_NUM_TEST);
// 10, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case3, &g_swtmrId1, &irqParam
ret = LOS_SwtmrCreate(10, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)Case3, &g_swtmrId1, arg
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
// 20, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(20, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)Case2, &g_swtmrId2, &irqParam
ret = LOS_SwtmrCreate(20, LOS_SWTMR_MODE_PERIOD, (SWTMR_PROC_FUNC)Case2, &g_swtmrId2, arg
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
, OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, &irqParam);
ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)Case1, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_SwtmrStart(g_swtmrId2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);

View File

@@ -60,9 +60,7 @@ static UINT32 Testcase(VOID)
UINT32 ret;
HWI_PRIOR_T hwiPrio = 3;
HWI_MODE_T hwiMode;
HwiIrqParam irqParam;
(void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam));
irqParam.pDevId = 0;
HWI_ARG_T arg = 0;
g_testCount = 0;
@@ -75,7 +73,7 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
hwiMode = 0;
ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, &irqParam);
ret = TEST_HwiCreate(HWI_NUM_TEST, hwiPrio, hwiMode, (HWI_PROC_FUNC)HwiF01, arg);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1);
ret = LOS_SwtmrStart(g_swtmrId1);

Some files were not shown because too many files have changed in this diff Show More