diff --git a/arch/arm/arm9/gcc/los_interrupt.c b/arch/arm/arm9/gcc/los_interrupt.c index a82fe435..d0f20ec7 100644 --- a/arch/arm/arm9/gcc/los_interrupt.c +++ b/arch/arm/arm9/gcc/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif #include "los_reg.h" #define OS_INT_IRQ_ENABLE (1U << 0) @@ -61,6 +64,30 @@ ExcInfo g_excInfo = {0}; */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -204,6 +231,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -217,8 +247,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -268,6 +306,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, #else (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); +#endif +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; #endif HwiUnmask(hwiNum); LOS_IntRestore(intSave); diff --git a/arch/arm/cortex-m3/keil/los_interrupt.c b/arch/arm/cortex-m3/keil/los_interrupt.c index 26e3de7b..9db69e64 100644 --- a/arch/arm/cortex-m3/keil/los_interrupt.c +++ b/arch/arm/cortex-m3/keil/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif UINT32 g_intCount = 0; @@ -54,6 +57,30 @@ LITE_OS_SEC_VEC */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -237,6 +264,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -250,8 +280,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -306,6 +344,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m33/gcc/NTZ/los_interrupt.c b/arch/arm/cortex-m33/gcc/NTZ/los_interrupt.c index d8dd8db8..63605b90 100644 --- a/arch/arm/cortex-m33/gcc/NTZ/los_interrupt.c +++ b/arch/arm/cortex-m33/gcc/NTZ/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif #define DEF_HANDLER_START_INDEX 2 UINT32 g_intCount = 0; @@ -50,6 +53,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -228,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -241,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -297,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m33/gcc/TZ/non_secure/los_interrupt.c b/arch/arm/cortex-m33/gcc/TZ/non_secure/los_interrupt.c index f0e54875..8e0ab702 100644 --- a/arch/arm/cortex-m33/gcc/TZ/non_secure/los_interrupt.c +++ b/arch/arm/cortex-m33/gcc/TZ/non_secure/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif #define DEF_HANDLER_START_INDEX 2 UINT32 g_intCount = 0; @@ -49,6 +52,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -228,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -241,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -297,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m33/iar/NTZ/los_interrupt.c b/arch/arm/cortex-m33/iar/NTZ/los_interrupt.c index 59b86aeb..9e435fc1 100644 --- a/arch/arm/cortex-m33/iar/NTZ/los_interrupt.c +++ b/arch/arm/cortex-m33/iar/NTZ/los_interrupt.c @@ -40,6 +40,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif /*lint -save -e40 -e522 -e533*/ UINT32 g_intCount = 0; @@ -53,6 +56,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m33/iar/TZ/non_secure/los_interrupt.c b/arch/arm/cortex-m33/iar/TZ/non_secure/los_interrupt.c index 59b86aeb..9e435fc1 100644 --- a/arch/arm/cortex-m33/iar/TZ/non_secure/los_interrupt.c +++ b/arch/arm/cortex-m33/iar/TZ/non_secure/los_interrupt.c @@ -40,6 +40,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif /*lint -save -e40 -e522 -e533*/ UINT32 g_intCount = 0; @@ -53,6 +56,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m4/gcc/los_interrupt.c b/arch/arm/cortex-m4/gcc/los_interrupt.c index a71c31d7..4c07bab1 100644 --- a/arch/arm/cortex-m4/gcc/los_interrupt.c +++ b/arch/arm/cortex-m4/gcc/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif UINT32 g_intCount = 0; @@ -48,6 +51,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -231,6 +258,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -244,8 +274,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -300,6 +338,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m4/iar/los_interrupt.c b/arch/arm/cortex-m4/iar/los_interrupt.c index 3ab655f7..e2380e5f 100644 --- a/arch/arm/cortex-m4/iar/los_interrupt.c +++ b/arch/arm/cortex-m4/iar/los_interrupt.c @@ -40,6 +40,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif UINT32 g_intCount = 0; @@ -55,6 +58,30 @@ LITE_OS_SEC_VEC */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m55/gcc/NTZ/los_interrupt.c b/arch/arm/cortex-m55/gcc/NTZ/los_interrupt.c index b7572b9b..882af806 100644 --- a/arch/arm/cortex-m55/gcc/NTZ/los_interrupt.c +++ b/arch/arm/cortex-m55/gcc/NTZ/los_interrupt.c @@ -38,6 +38,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif #define DEF_HANDLER_START_INDEX 2 UINT32 g_intCount = 0; @@ -49,6 +52,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -232,6 +259,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -245,8 +275,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -301,6 +339,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m7/gcc/los_interrupt.c b/arch/arm/cortex-m7/gcc/los_interrupt.c index bfff8de4..10f77bce 100644 --- a/arch/arm/cortex-m7/gcc/los_interrupt.c +++ b/arch/arm/cortex-m7/gcc/los_interrupt.c @@ -39,6 +39,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif UINT32 g_intCount = 0; @@ -48,6 +51,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -226,6 +253,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -239,8 +269,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -295,6 +333,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/arm/cortex-m7/iar/los_interrupt.c b/arch/arm/cortex-m7/iar/los_interrupt.c index 36795fe0..aa7822d1 100644 --- a/arch/arm/cortex-m7/iar/los_interrupt.c +++ b/arch/arm/cortex-m7/iar/los_interrupt.c @@ -40,6 +40,9 @@ #include "los_sched.h" #include "los_memory.h" #include "los_membox.h" +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_cpup.h" +#endif UINT32 g_intCount = 0; @@ -51,6 +54,30 @@ UINT32 g_intCount = 0; */ STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0}; +#if (LOSCFG_DEBUG_TOOLS == 1) +STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0}; +STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0}; + +UINT32 OsGetHwiFormCnt(UINT32 index) +{ + return g_hwiFormCnt[index]; +} + +CHAR *OsGetHwiFormName(UINT32 index) +{ + return g_hwiFormName[index]; +} + +BOOL OsGetHwiCreated(UINT32 index) +{ + if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) { + return TRUE; + } + + return FALSE; +} +#endif + #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) typedef struct { @@ -235,6 +262,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) hwiIndex = HwiNumGet(); OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqStart(hwiIndex); +#endif HalPreInterruptHandler(hwiIndex); @@ -248,8 +278,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID) } #endif +#if (LOSCFG_DEBUG_TOOLS == 1) + ++g_hwiFormCnt[hwiIndex]; +#endif + HalAftInterruptHandler(hwiIndex); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) + OsCpupIrqEnd(hwiIndex); +#endif + OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex); intSave = LOS_IntLock(); @@ -304,6 +342,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, (VOID)irqParam; OsSetVector(hwiNum, hwiHandler); #endif + +#if (LOSCFG_DEBUG_TOOLS == 1) + if ((irqParam != NULL) && (irqParam->pName != NULL)) { + g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName; + } + g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0; +#endif + HwiUnmask((IRQn_Type)hwiNum); HwiSetPriority((IRQn_Type)hwiNum, hwiPrio); diff --git a/arch/include/los_interrupt.h b/arch/include/los_interrupt.h index 80e9e018..257e4a77 100644 --- a/arch/include/los_interrupt.h +++ b/arch/include/los_interrupt.h @@ -214,6 +214,12 @@ STATIC INLINE HwiControllerOps *ArchIntOpsGet(VOID) return &g_archHwiOps; } +#if (LOSCFG_DEBUG_TOOLS == 1) +extern UINT32 OsGetHwiFormCnt(UINT32 index); +extern CHAR *OsGetHwiFormName(UINT32 index); +extern BOOL OsGetHwiCreated(UINT32 index); +#endif + #ifdef __cplusplus #if __cplusplus } diff --git a/components/cpup/los_cpup.c b/components/cpup/los_cpup.c index cffe7398..f802639f 100644 --- a/components/cpup/los_cpup.c +++ b/components/cpup/los_cpup.c @@ -35,8 +35,15 @@ #include "los_debug.h" #include "los_tick.h" -#if (LOSCFG_BASE_CORE_CPUP == 1) +#if (LOSCFG_BASE_CORE_SWTMR == 1) +#include "los_swtmr.h" +#endif +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +#include "los_arch_interrupt.h" +#endif + +#if (LOSCFG_BASE_CORE_CPUP == 1) /** * @ingroup los_cpup * CPU usage-type macro: used for tasks. @@ -54,8 +61,63 @@ LITE_OS_SEC_BSS UINT16 g_cpupInitFlg = 0; LITE_OS_SEC_BSS OsCpupCB *g_cpup = NULL; LITE_OS_SEC_BSS UINT64 g_lastRecordTime; -LITE_OS_SEC_BSS UINT16 g_hisPos; /* g_irqCpup[intNum].timeMax) { + g_irqCpup[intNum].timeMax = usedTime; + } + return; +} + +LITE_OS_SEC_TEXT_MINOR OsIrqCpupCB *OsGetIrqCpupArrayBase(VOID) +{ + return g_irqCpup; +} + +LITE_OS_SEC_TEXT_MINOR STATIC VOID OsGetIrqPositions(UINT16 mode, UINT16* curPosAddr, UINT16* prePosAddr) +{ + UINT16 curPos; + UINT16 prePos = 0; + + curPos = g_irqHisPos; + + if (mode == CPUP_IN_1S) { + curPos = OsGetPrePos(curPos); + prePos = OsGetPrePos(curPos); + } else if (mode == CPUP_LESS_THAN_1S) { + curPos = OsGetPrePos(curPos); + } + + *curPosAddr = curPos; + *prePosAddr = prePos; +} + +LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllTime(VOID) +{ + INT32 i; + UINT64 cpuCycleAll = 0; + for (i = 0; i < OS_CPUP_HISTORY_RECORD_NUM; i++) { + cpuCycleAll += g_cpuHistoryTime[i]; + } + + return cpuCycleAll; +} + +LITE_OS_SEC_TEXT_MINOR STATIC UINT64 OsGetIrqAllHisTime(UINT32 num) +{ + INT32 i; + UINT64 historyTime = 0; + for (i = 0; i < OS_CPUP_HISTORY_RECORD_NUM; i++) { + historyTime += g_irqCpup[num].historyTime[i]; + } + + return historyTime; +} + +LITE_OS_SEC_TEXT_MINOR UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cpupInfo) +{ + UINT16 loopNum; + UINT16 curPos; + UINT16 prePos = 0; + UINT32 intSave; + UINT64 cpuCycleAll; + UINT64 cpuCycleCurIrq; + + if (g_irqCpupInitFlg == 0) { + return LOS_ERRNO_CPUP_NO_INIT; + } + + if (cpupInfo == NULL) { + return LOS_ERRNO_CPUP_TASK_PTR_NULL; + } + + intSave = LOS_IntLock(); + + OsGetIrqPositions(mode, &curPos, &prePos); + if (mode == CPUP_IN_10S) { + cpuCycleAll = OsGetIrqAllTime(); + } else { + cpuCycleAll = g_cpuHistoryTime[curPos] - g_cpuHistoryTime[prePos]; + } + + for (loopNum = 0; loopNum < LOSCFG_PLATFORM_HWI_LIMIT; loopNum++) { + if (g_irqCpup[loopNum].status != OS_CPUP_USED) { + continue; + } + + cpupInfo[loopNum].usStatus = g_irqCpup[loopNum].status; + + if (mode == CPUP_IN_10S) { + cpuCycleCurIrq = OsGetIrqAllHisTime(loopNum); + } else { + cpuCycleCurIrq = g_irqCpup[loopNum].historyTime[curPos] - g_irqCpup[loopNum].historyTime[prePos]; + } + + if (cpuCycleAll != 0) { + cpupInfo[loopNum].uwUsage = (UINT32)((LOS_CPUP_PRECISION * cpuCycleCurIrq) / cpuCycleAll); + } + } + + LOS_IntRestore(intSave); + return LOS_OK; +} +#endif + #endif /* LOSCFG_BASE_CORE_CPUP */ diff --git a/components/cpup/los_cpup.h b/components/cpup/los_cpup.h index ab418846..eec1f7f5 100644 --- a/components/cpup/los_cpup.h +++ b/components/cpup/los_cpup.h @@ -139,6 +139,18 @@ typedef struct { extern OsCpupCB *g_cpup; +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +typedef struct { + UINT32 cpupID; /**< Irq ID */ + UINT16 status; /**< Irq status */ + UINT64 allTime; /**< Total running time */ + UINT64 startTime; /**< Time before a task is invoked */ + UINT64 timeMax; /**< Irq samples count */ + UINT64 count; /**< Irq samples count */ + UINT64 historyTime[OS_CPUP_HISTORY_RECORD_NUM]; /**< Historical running time */ +} OsIrqCpupCB; +#endif + /** * @ingroup los_cpup * @brief Initialization cpup. @@ -357,6 +369,13 @@ extern UINT32 LOS_AllTaskCpuUsage(CPUP_INFO_S *cpupInfo, UINT16 mode); */ extern UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E mode, UINT32 taskID); +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) +extern VOID OsCpupIrqStart(UINT32 intNum); +extern VOID OsCpupIrqEnd(UINT32 intNum); +extern OsIrqCpupCB *OsGetIrqCpupArrayBase(VOID); +extern UINT32 LOS_GetAllIrqCpuUsage(UINT16 mode, CPUP_INFO_S *cpupInfo); +#endif + #ifdef __cplusplus #if __cplusplus } diff --git a/components/debugtools/BUILD.gn b/components/debugtools/BUILD.gn old mode 100755 new mode 100644 index 74f520da..3a79bcc9 --- a/components/debugtools/BUILD.gn +++ b/components/debugtools/BUILD.gn @@ -31,7 +31,10 @@ import("//kernel/liteos_m/liteos.gni") module_switch = defined(LOSCFG_DEBUG_TOOLS) module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { - sources = [ "los_stackdump.c" ] + sources = [ + "los_hwidump.c", + "los_stackdump.c", + ] configs += [ "$LITEOSTOPDIR:warn_config" ] } diff --git a/components/debugtools/los_debugtools.h b/components/debugtools/los_debugtools.h old mode 100755 new mode 100644 index 863bb832..de03c64b --- a/components/debugtools/los_debugtools.h +++ b/components/debugtools/los_debugtools.h @@ -44,6 +44,7 @@ extern "C" { /* Shell Callback */ extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv); +extern UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv); /* other module Callback */ diff --git a/components/debugtools/los_hwidump.c b/components/debugtools/los_hwidump.c new file mode 100644 index 00000000..2c60058c --- /dev/null +++ b/components/debugtools/los_hwidump.c @@ -0,0 +1,149 @@ +/* + * 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 "los_debugtools.h" +#include "securec.h" +#include "los_debug.h" +#include "los_memory.h" +#include "los_arch.h" +#include "los_interrupt.h" +#include "los_arch_interrupt.h" + +#if (LOSCFG_DEBUG_TOOLS == 1) + +#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) && (LOSCFG_BASE_CORE_SWTMR == 1) +#include "los_cpup.h" + +#define IRQ_CPUP_INFO_SIZE (sizeof(CPUP_INFO_S) * LOSCFG_PLATFORM_HWI_LIMIT) +#define IRQ_CPUP_ALL_INFO_SIZE (IRQ_CPUP_INFO_SIZE + IRQ_CPUP_INFO_SIZE) +#define IRQ_DATA_SIZE sizeof(OsIrqCpupCB) +#define CPUP_PRECISION_MULT LOS_CPUP_PRECISION_MULT + +STATIC VOID ShellCmdHwiInfoShow(OsIrqCpupCB *irqData, CPUP_INFO_S *hwiCpup1s, + CPUP_INFO_S *hwiCpup10s) +{ + UINT32 i; + UINT32 intSave; + UINT32 count; + UINT64 cycles = 0; + UINT64 timeMax = 0; + CHAR *irqName = NULL; + + OsIrqCpupCB *irqDataBase = OsGetIrqCpupArrayBase(); + if (irqDataBase == NULL) { + PRINT_ERR("get hwi info error\n"); + return; + } + + for (i = 0; i < LOSCFG_PLATFORM_HWI_LIMIT; i++) { + if ((OsGetHwiCreated(i) != TRUE) || (OsGetHwiFormCnt(i) == 0)) { + continue; + } + + intSave = LOS_IntLock(); + (VOID)memcpy_s(irqData, IRQ_DATA_SIZE, &irqDataBase[i], IRQ_DATA_SIZE); + LOS_IntRestore(intSave); + + if (irqData->status == 0) { + continue; + } + + count = OsGetHwiFormCnt(i); + if (count != 0) { + if (irqData->count != 0) { + cycles = (irqData->allTime * OS_NS_PER_CYCLE) / (irqData->count * OS_SYS_NS_PER_US); + } + timeMax = (irqData->timeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US; + } + irqName = OsGetHwiFormName(i); + + PRINTK(" %10u:%11u%11llu%10llu%9u.%-2u%9u.%-2u %-12s\n", i - OS_SYS_VECTOR_CNT, count, cycles, timeMax, + hwiCpup1s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup1s[i].uwUsage % CPUP_PRECISION_MULT, + hwiCpup10s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup10s[i].uwUsage % CPUP_PRECISION_MULT, + (irqName != NULL) ? irqName : NULL); + } +} + +STATIC VOID HwiInfoDump(VOID) +{ + UINT32 size; + + size = IRQ_CPUP_ALL_INFO_SIZE + IRQ_DATA_SIZE; + CHAR *irqCpup = LOS_MemAlloc(m_aucSysMem0, size); + if (irqCpup == NULL) { + return; + } + + CPUP_INFO_S *hwiCpup10s = (CPUP_INFO_S *)(irqCpup); + CPUP_INFO_S *hwiCpup1s = (CPUP_INFO_S *)(hwiCpup10s + IRQ_CPUP_INFO_SIZE); + OsIrqCpupCB *irqData = (OsIrqCpupCB *)(irqCpup + IRQ_CPUP_ALL_INFO_SIZE); + + (VOID)LOS_GetAllIrqCpuUsage(CPUP_IN_1S, hwiCpup1s); + (VOID)LOS_GetAllIrqCpuUsage(CPUP_IN_10S, hwiCpup10s); + + PRINTK(" InterruptNo Count ATime(us) MTime(us) CPUUSE1s CPUUSE10s Name\n"); + ShellCmdHwiInfoShow(irqData, hwiCpup1s, hwiCpup10s); + (VOID)LOS_MemFree(m_aucSysMem0, irqCpup); + return; +} +#else +STATIC VOID HwiInfoDump(VOID) +{ + INT32 i; + + PRINTK(" InterruptNo Count Name\n"); + for (i = 0; i < LOSCFG_PLATFORM_HWI_LIMIT; i++) { + if ((OsGetHwiCreated(i) != TRUE) || (OsGetHwiFormCnt(i) == 0)) { + continue; + } + + if (OsGetHwiFormName(i) != NULL) { + PRINTK(" %8d:%10d %-s\n", i - OS_SYS_VECTOR_CNT, OsGetHwiFormCnt(i), OsGetHwiFormName(i)); + } else { + PRINTK(" %8d:%10d\n", i - OS_SYS_VECTOR_CNT, OsGetHwiFormCnt(i)); + } + } + return; +} +#endif + +UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv) +{ + (VOID)argv; + + if (argc > 1) { + PRINT_ERR("\nUsage:hwi\n"); + return LOS_NOK; + } + + HwiInfoDump(); + return LOS_OK; +} +#endif /* LOSCFG_STACK_DUMP == 1 */ diff --git a/components/debugtools/los_stackdump.c b/components/debugtools/los_stackdump.c old mode 100755 new mode 100644 diff --git a/components/shell/src/base/shcmd.c b/components/shell/src/base/shcmd.c index 4d30781d..48b5ff73 100644 --- a/components/shell/src/base/shcmd.c +++ b/components/shell/src/base/shcmd.c @@ -68,6 +68,7 @@ CmdItem g_shellcmdAll[] = { #endif #if (LOSCFG_DEBUG_TOOLS == 1) {CMD_TYPE_EX, "stack", 1, (CmdCallBackFunc)OsShellCmdStackDump}, + {CMD_TYPE_EX, "hwi", 1, (CmdCallBackFunc)OsShellCmdHwiDump}, #endif {CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp}, }; diff --git a/kernel/src/los_init.c b/kernel/src/los_init.c index be44330c..09c86187 100644 --- a/kernel/src/los_init.c +++ b/kernel/src/los_init.c @@ -181,14 +181,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID) OsTaskMonInit(); #endif -#if (LOSCFG_BASE_CORE_CPUP == 1) - ret = OsCpupInit(); - if (ret != LOS_OK) { - PRINT_ERR("OsCpupInit error\n"); - return ret; - } -#endif - #if (LOSCFG_BASE_IPC_SEM == 1) ret = OsSemInit(); if (ret != LOS_OK) { @@ -219,6 +211,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID) } #endif +#if (LOSCFG_BASE_CORE_CPUP == 1) + ret = OsCpupInit(); + if (ret != LOS_OK) { + PRINT_ERR("OsCpupInit error\n"); + return ret; + } +#endif + #if (LOSCFG_FS_VFS == 1) ret = OsVfsInit(); if (ret != LOS_OK) { diff --git a/testsuites/sample/kernel/swtmr/It_los_swtmr_024.c b/testsuites/sample/kernel/swtmr/It_los_swtmr_024.c index c9797dc8..a26d0ad8 100644 --- a/testsuites/sample/kernel/swtmr/It_los_swtmr_024.c +++ b/testsuites/sample/kernel/swtmr/It_los_swtmr_024.c @@ -53,7 +53,7 @@ static UINT32 Testcase(VOID) g_testCount = 0; for (j = 0; j < SWTMR_LOOP_NUM; j++) { - for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT; i++) { + for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT + 1; i++) { // 4, Timeout interval of a periodic software timer. ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case1, &swTmrID[i], 0xabcdbcda #if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1) @@ -61,20 +61,16 @@ static UINT32 Testcase(VOID) OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE #endif ); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, i, EXIT); + if (ret != LOS_OK) { + ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_MAXSIZE, ret, EXIT); + } } - // 4, Timeout interval of a periodic software timer. - ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case1, &swTmrID[i], 0xabcdbcda -#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1) - , - OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE -#endif - ); - ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_MAXSIZE, ret, EXIT); for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT; i++) { ret = LOS_SwtmrDelete(swTmrID[i]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); + if (ret != LOS_OK) { + ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT); + } } } return LOS_OK;