!686 M核添加维测, 中断信息dump

Merge pull request !686 from wangchen/0505_hwidump
This commit is contained in:
openharmony_ci 2022-05-12 07:17:01 +00:00 committed by Gitee
commit 3f41c36926
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
21 changed files with 920 additions and 22 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
}

View File

@ -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; /* <current Sampling point of historyTime */
LITE_OS_SEC_BSS UINT16 g_hisPos; /* current Sampling point of historyTime */
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
LITE_OS_SEC_BSS UINT16 g_irqCpupInitFlg = 0;
LITE_OS_SEC_BSS UINT16 g_irqHisPos = 0; /* current Sampling point of historyTime */
LITE_OS_SEC_BSS UINT64 g_irqLastRecordTime;
LITE_OS_SEC_BSS OsIrqCpupCB *g_irqCpup = NULL;
LITE_OS_SEC_BSS STATIC UINT64 g_cpuHistoryTime[OS_CPUP_HISTORY_RECORD_NUM];
#define OS_CPUP_USED 0x1U
#if (LOSCFG_BASE_CORE_SWTMR == 1)
LITE_OS_SEC_TEXT_INIT VOID OsCpupGuard(VOID)
{
UINT16 prevPos;
UINT32 loop;
UINT32 intSave;
intSave = LOS_IntLock();
prevPos = g_irqHisPos;
if (g_irqHisPos == OS_CPUP_HISTORY_RECORD_NUM - 1) {
g_irqHisPos = 0;
} else {
g_irqHisPos++;
}
g_cpuHistoryTime[prevPos] = 0;
for (loop = 0; loop < LOSCFG_PLATFORM_HWI_LIMIT; loop++) {
if (g_irqCpup[loop].status != OS_CPUP_USED) {
continue;
}
g_irqCpup[loop].historyTime[prevPos] = g_irqCpup[loop].allTime;
g_cpuHistoryTime[prevPos] += g_irqCpup[loop].allTime;
}
LOS_IntRestore(intSave);
return;
}
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
{
UINT32 cpupSwtmrID;
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
(VOID)LOS_SwtmrCreate(LOSCFG_BASE_CORE_TICK_PER_SECOND, LOS_SWTMR_MODE_PERIOD,
(SWTMR_PROC_FUNC)OsCpupGuard, &cpupSwtmrID, 0,
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE);
#else
(VOID)LOS_SwtmrCreate(LOSCFG_BASE_CORE_TICK_PER_SECOND, LOS_SWTMR_MODE_PERIOD,
(SWTMR_PROC_FUNC)OsCpupGuard, &cpupSwtmrID, 0);
#endif
(VOID)LOS_SwtmrStart(cpupSwtmrID);
return LOS_OK;
}
#endif
#endif
/*****************************************************************************
Function : OsCpupInit
Description: initialization of CPUP
@ -77,6 +139,21 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
(VOID)memset_s(g_cpup, size, 0, size);
g_cpupInitFlg = 1;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size = LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
g_irqCpup = (OsIrqCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
if (g_irqCpup == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY;
}
(VOID)memset_s(g_irqCpup, size, 0, size);
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
#endif
#endif
return LOS_OK;
}
@ -513,4 +590,146 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E
return LOS_OK;
}
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqStart(UINT32 intNum)
{
if (g_irqCpupInitFlg == 0) {
return;
}
g_irqCpup[intNum].startTime = LOS_SysCycleGet();
return;
}
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT32 intNum)
{
UINT64 cpuCycle;
UINT64 usedTime;
if (g_irqCpupInitFlg == 0) {
return;
}
if (g_irqCpup[intNum].startTime == 0) {
return;
}
cpuCycle = LOS_SysCycleGet();
if (cpuCycle < g_irqCpup[intNum].startTime) {
cpuCycle += g_cyclesPerTick;
}
g_irqCpup[intNum].cpupID = intNum;
g_irqCpup[intNum].status = OS_CPUP_USED;
usedTime = cpuCycle - g_irqCpup[intNum].startTime;
if (g_irqCpup[intNum].count <= 1000) { /* 1000, Take 1000 samples */
g_irqCpup[intNum].allTime += usedTime;
g_irqCpup[intNum].count++;
} else {
g_irqCpup[intNum].allTime = 0;
g_irqCpup[intNum].count = 0;
}
g_irqCpup[intNum].startTime = 0;
if (usedTime > 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 */

View File

@ -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
}

5
components/debugtools/BUILD.gn Executable file → Normal file
View File

@ -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" ]
}

1
components/debugtools/los_debugtools.h Executable file → Normal file
View File

@ -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 */

View File

@ -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 */

0
components/debugtools/los_stackdump.c Executable file → Normal file
View File

View File

@ -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},
};

View File

@ -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) {

View File

@ -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;