Compare commits
24 Commits
OpenHarmon
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
831d089652 | ||
|
|
f5fa92feff | ||
|
|
bed1d28df8 | ||
|
|
efebc00f87 | ||
|
|
28c1529e2f | ||
|
|
159d304275 | ||
|
|
18f65ae0b3 | ||
|
|
5363e4b472 | ||
|
|
c65d908905 | ||
|
|
1b9d59aa9a | ||
|
|
c6958aa181 | ||
|
|
315a448142 | ||
|
|
32a2e193f4 | ||
|
|
b35792fa6c | ||
|
|
a5e651cb01 | ||
|
|
f12dd8bbe6 | ||
|
|
3f41c36926 | ||
|
|
a3daa77e53 | ||
|
|
fb740f9b23 | ||
|
|
a45bf8797c | ||
|
|
84f89b9660 | ||
|
|
03b4650a16 | ||
|
|
728aca27f5 | ||
|
|
91743d3ea4 |
7
Kconfig
7
Kconfig
@@ -554,6 +554,13 @@ config SHELL_CMD_DEBUG
|
||||
default n
|
||||
depends on DEBUG_VERSION && SHELL
|
||||
|
||||
config DEBUG_TOOLS
|
||||
bool "Enable DEBUG TOOLS"
|
||||
default n
|
||||
depends on DEBUG_VERSION
|
||||
help
|
||||
Answer Y to enable LiteOS debug tools, include stackdump, hwidump, tasktrack.
|
||||
|
||||
config USB_DEBUG
|
||||
bool "Enable USB Debug"
|
||||
default n
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -41,6 +41,52 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM)
|
||||
STATIC INLINE UINTPTR ArchSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
#elif defined(__CLANG_ARM) || defined(__GNUC__)
|
||||
STATIC INLINE UINTPTR ArchSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm volatile("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm volatile("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm volatile("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
#else
|
||||
/* Other platforms to be improved */
|
||||
#endif
|
||||
|
||||
VOID ArchInit(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -94,6 +94,5 @@
|
||||
├── los_hook.h
|
||||
├── los_list.h --- Doubly linked list
|
||||
└── los_reg.h --- Register macros
|
||||
└── src
|
||||
```
|
||||
|
||||
|
||||
@@ -93,6 +93,5 @@
|
||||
├── los_hook.h
|
||||
├── los_list.h --- 双向链表
|
||||
└── los_reg.h --- 寄存器读写宏定义
|
||||
└── src
|
||||
```
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ group("components") {
|
||||
"backtrace",
|
||||
"cppsupport",
|
||||
"cpup",
|
||||
"debugtools",
|
||||
"dynlink",
|
||||
"exchook",
|
||||
"fs",
|
||||
@@ -64,5 +65,6 @@ config("public") {
|
||||
"lmk:public",
|
||||
"lms:public",
|
||||
"signal:public",
|
||||
"debugtools:public",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "los_backtrace.h"
|
||||
#include "los_task.h"
|
||||
#include "los_debug.h"
|
||||
#include "los_arch.h"
|
||||
#if (LOSCFG_BACKTRACE_TYPE == 4)
|
||||
#include "los_arch_regs.h"
|
||||
#endif
|
||||
@@ -60,52 +61,6 @@ WEAK BOOL OsStackDataIsCodeAddr(UINTPTR value)
|
||||
#define OS_BLX_INX_MASK 0xFF00
|
||||
#define OS_BLX_INX 0x4700
|
||||
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM)
|
||||
STATIC INLINE UINTPTR HalSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR HalPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR HalMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
#elif defined(__CLANG_ARM) || defined(__GNUC__)
|
||||
STATIC INLINE UINTPTR HalSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm volatile("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR HalPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm volatile("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR HalMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm volatile("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
#else
|
||||
#error Unknown compiler.
|
||||
#endif
|
||||
|
||||
STATIC INLINE BOOL OsInsIsBlOrBlx(UINTPTR addr)
|
||||
{
|
||||
UINT16 ins1 = *((UINT16 *)addr);
|
||||
@@ -138,8 +93,8 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (HalSpGet() != HalPspGet()) {
|
||||
*stackStart = HalMspGet();
|
||||
if (ArchSpGet() != ArchPspGet()) {
|
||||
*stackStart = ArchMspGet();
|
||||
*stackEnd = CSTACK_END_ADDR;
|
||||
if ((*stackStart < CSTACK_START_ADDR) || (*stackStart >= CSTACK_END_ADDR)) {
|
||||
PRINT_ERR("msp stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n",
|
||||
@@ -148,7 +103,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
|
||||
}
|
||||
PRINTK("msp, start = %x, end = %x\n", *stackStart, *stackEnd);
|
||||
} else {
|
||||
*stackStart = HalPspGet();
|
||||
*stackStart = ArchPspGet();
|
||||
UINT32 taskID = LOS_CurTaskIDGet();
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
|
||||
*stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize;
|
||||
|
||||
@@ -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,7 +61,79 @@
|
||||
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
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsCpupDaemonInit
|
||||
Description: initialization of CPUP Daemon
|
||||
Input : None
|
||||
Return : LOS_OK or Error Information
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit()
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
(VOID)OsCpupGuardCreator();
|
||||
g_irqCpupInitFlg = 1;
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsCpupInit
|
||||
@@ -65,16 +144,24 @@ Return : LOS_OK or Error Information
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
|
||||
{
|
||||
UINT32 size;
|
||||
CHAR *cpupMem = NULL;
|
||||
|
||||
size = g_taskMaxNum * sizeof(OsCpupCB);
|
||||
g_cpup = (OsCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
|
||||
#endif
|
||||
|
||||
if (g_cpup == NULL) {
|
||||
cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
|
||||
if (cpupMem == NULL) {
|
||||
return LOS_ERRNO_CPUP_NO_MEMORY;
|
||||
}
|
||||
(VOID)memset_s(cpupMem, size, 0, size);
|
||||
|
||||
g_cpup = (OsCpupCB *)cpupMem;
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
g_irqCpup = (OsIrqCpupCB *)(cpupMem + g_taskMaxNum * sizeof(OsCpupCB));
|
||||
#endif
|
||||
|
||||
// Ignore the return code when matching CSEC rule 6.6(3).
|
||||
(VOID)memset_s(g_cpup, size, 0, size);
|
||||
g_cpupInitFlg = 1;
|
||||
|
||||
return LOS_OK;
|
||||
@@ -513,4 +600,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 */
|
||||
|
||||
@@ -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.
|
||||
@@ -159,6 +171,7 @@ extern OsCpupCB *g_cpup;
|
||||
*/
|
||||
extern UINT32 OsCpupInit(VOID);
|
||||
|
||||
extern UINT32 OsCpupDaemonInit(VOID);
|
||||
/**
|
||||
* @ingroup los_cpup
|
||||
* @brief Start task to get cycles count in current task ending.
|
||||
@@ -357,6 +370,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
|
||||
}
|
||||
|
||||
44
components/debugtools/BUILD.gn
Normal file
44
components/debugtools/BUILD.gn
Normal file
@@ -0,0 +1,44 @@
|
||||
# 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.
|
||||
|
||||
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_hwidump.c",
|
||||
"los_schedtrace.c",
|
||||
"los_stackdump.c",
|
||||
]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
89
components/debugtools/los_debugtools.h
Normal file
89
components/debugtools/los_debugtools.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_DEBUGTOOLS_H
|
||||
#define _LOS_DEBUGTOOLS_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* StackDump print format */
|
||||
#define PRINT_PER_ROW 4
|
||||
|
||||
/* SchedTrace records number */
|
||||
#define TRACE_NUM 200
|
||||
|
||||
/* sched trace info, users can add their own */
|
||||
typedef struct {
|
||||
UINT32 newTaskID;
|
||||
CHAR newTaskName[LOS_TASK_NAMELEN];
|
||||
UINT32 runTaskID;
|
||||
CHAR runTaskName[LOS_TASK_NAMELEN];
|
||||
} SchedTraceInfo;
|
||||
|
||||
/* SchedTrace record callback */
|
||||
typedef void (*SchedTraceRecordCB)(LosTaskCB *newTask, LosTaskCB *runTask);
|
||||
|
||||
/* SchedTrace show callback, buf is overwrite ringbuf, max amount of storage is TRACE_NUM */
|
||||
typedef void (*SchedTraceShowCB)(SchedTraceInfo *ringBuf, UINT32 count);
|
||||
|
||||
/* Shell callback */
|
||||
extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv);
|
||||
|
||||
/* Other module callback */
|
||||
extern VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask);
|
||||
|
||||
/* External interface */
|
||||
/* dump stack by task id, can be called at any time */
|
||||
extern VOID LOS_TaskStackDump(UINT32 taskID);
|
||||
|
||||
/* register sched trace handle, If not registered, the default fun will be used */
|
||||
extern VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB);
|
||||
/* start sched trace, will alloc buf, and start write to buf when sched */
|
||||
extern VOID LOS_SchedTraceStart(VOID);
|
||||
/* stop sched trace, will stop record and free buf */
|
||||
extern VOID LOS_SchedTraceStop(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
149
components/debugtools/los_hwidump.c
Normal file
149
components/debugtools/los_hwidump.c
Normal 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 */
|
||||
162
components/debugtools/los_schedtrace.c
Normal file
162
components/debugtools/los_schedtrace.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
STATIC BOOL g_startTrace = FALSE;
|
||||
STATIC SchedTraceInfo *g_traceRingBuf = NULL;
|
||||
STATIC UINT32 g_schedCount = 0;
|
||||
STATIC SchedTraceRecordCB g_recordCB = NULL;
|
||||
STATIC SchedTraceShowCB g_showCB = NULL;
|
||||
|
||||
STATIC VOID DefaultShowFormat(SchedTraceInfo *buf, UINT32 count)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 cycle = count / TRACE_NUM;
|
||||
UINT32 point = count % TRACE_NUM;
|
||||
|
||||
PRINTK ("sched %u time, last %u is:\r\n", count, TRACE_NUM);
|
||||
PRINTK("RunTaskID RunTaskName NewTaskID NewTaskName \r\n");
|
||||
if (cycle > 0) {
|
||||
for (i = point; i < TRACE_NUM; i++) {
|
||||
PRINTK("%4u %20s, %4u %20s\n",
|
||||
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
|
||||
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < point; i++) {
|
||||
PRINTK("%4u %20s, %4u %20s\n",
|
||||
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
|
||||
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
|
||||
}
|
||||
|
||||
PRINTK("\r\n");
|
||||
}
|
||||
|
||||
STATIC VOID DefaultRecordHandle(LosTaskCB *newTask, LosTaskCB *runTask)
|
||||
{
|
||||
UINT32 point = g_schedCount % TRACE_NUM;
|
||||
|
||||
g_traceRingBuf[point].newTaskID = newTask->taskID;
|
||||
(VOID)memcpy_s(g_traceRingBuf[point].newTaskName, LOS_TASK_NAMELEN, newTask->taskName, LOS_TASK_NAMELEN);
|
||||
g_traceRingBuf[point].runTaskID = runTask->taskID;
|
||||
(VOID)memcpy_s(g_traceRingBuf[point].runTaskName, LOS_TASK_NAMELEN, runTask->taskName, LOS_TASK_NAMELEN);
|
||||
|
||||
g_schedCount++;
|
||||
}
|
||||
|
||||
STATIC VOID ShowFormat(SchedTraceInfo *buf, UINT32 count)
|
||||
{
|
||||
if (count == 0) {
|
||||
PRINT_ERR("none shed happend\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_showCB != NULL) {
|
||||
g_showCB(buf, count);
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask)
|
||||
{
|
||||
if (g_startTrace == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_recordCB != NULL) {
|
||||
g_recordCB(newTask, runTask);
|
||||
}
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceStart(VOID)
|
||||
{
|
||||
if (g_recordCB == NULL) {
|
||||
g_recordCB = DefaultRecordHandle;
|
||||
}
|
||||
|
||||
g_traceRingBuf = (SchedTraceInfo *)LOS_MemAlloc(OS_SYS_MEM_ADDR, TRACE_NUM * sizeof(SchedTraceInfo));
|
||||
if (g_traceRingBuf == NULL) {
|
||||
PRINT_ERR("alloc failed for dump\n");
|
||||
return;
|
||||
}
|
||||
(VOID)memset_s(g_traceRingBuf, TRACE_NUM * sizeof(SchedTraceInfo), 0, TRACE_NUM * sizeof(SchedTraceInfo));
|
||||
|
||||
g_startTrace = TRUE;
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceStop(VOID)
|
||||
{
|
||||
if (g_showCB == NULL) {
|
||||
g_showCB = DefaultShowFormat;
|
||||
}
|
||||
g_startTrace = FALSE;
|
||||
ShowFormat(g_traceRingBuf, g_schedCount);
|
||||
g_schedCount = 0;
|
||||
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, g_traceRingBuf);
|
||||
g_traceRingBuf = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB)
|
||||
{
|
||||
g_recordCB = recordCB;
|
||||
g_showCB = showCB;
|
||||
}
|
||||
|
||||
UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
PRINT_ERR("\nUsage: st -h\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "-s") == 0) {
|
||||
LOS_SchedTraceStart();
|
||||
} else if (strcmp(argv[0], "-e") == 0) {
|
||||
LOS_SchedTraceStop();
|
||||
} else if (strcmp(argv[0], "-h") == 0) {
|
||||
PRINTK("\nUsage: \nst -s , SchedTrace start\n");
|
||||
PRINTK("st -e , SchedTrace end and show\n");
|
||||
} else {
|
||||
PRINTK("\nUsage: st -h\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif /* LOSCFG_STACK_DUMP == 1 */
|
||||
155
components/debugtools/los_stackdump.c
Normal file
155
components/debugtools/los_stackdump.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
typedef struct {
|
||||
UINT32 waterLine;
|
||||
UINT32 taskSPTop;
|
||||
UINT32 taskSPLimit;
|
||||
UINTPTR taskSP;
|
||||
} DumpInfo;
|
||||
|
||||
STATIC VOID ShowFormat(UINTPTR *buf, DumpInfo *info)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
UINT32 len = info->waterLine / sizeof(UINTPTR);
|
||||
UINTPTR addr = (info->taskSPLimit - info->waterLine);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if ((i % PRINT_PER_ROW) == 0) {
|
||||
PRINTK("\r\n 0x%08x: ", addr);
|
||||
}
|
||||
if (addr == info->taskSP) {
|
||||
PRINTK(" *%08x", buf[i]);
|
||||
} else {
|
||||
PRINTK(" %08x", buf[i]);
|
||||
}
|
||||
addr += sizeof(UINTPTR);
|
||||
}
|
||||
|
||||
PRINTK("\r\n");
|
||||
}
|
||||
|
||||
STATIC INT32 DumpTaskInfo(UINT32 taskID, UINTPTR *buf, DumpInfo *info)
|
||||
{
|
||||
errno_t ret;
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(taskID);
|
||||
|
||||
if (taskID == LOS_CurTaskIDGet()) {
|
||||
info->taskSP = ArchSpGet();
|
||||
} else {
|
||||
info->taskSP = (UINTPTR)taskCB->stackPointer;
|
||||
}
|
||||
|
||||
info->taskSPTop = taskCB->topOfStack;
|
||||
info->taskSPLimit = taskCB->topOfStack + taskCB->stackSize;
|
||||
if ((info->taskSP > info->taskSPLimit) || (info->taskSP < info->taskSPTop)) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
ret = memcpy_s(buf, info->waterLine, (const VOID *)(info->taskSPLimit - info->waterLine), info->waterLine);
|
||||
if (ret != EOK) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID LOS_TaskStackDump(UINT32 taskID)
|
||||
{
|
||||
UINTPTR *buf = NULL;
|
||||
DumpInfo info;
|
||||
UINT32 intSave;
|
||||
INT32 ret;
|
||||
|
||||
if (taskID > g_taskMaxNum) {
|
||||
PRINT_ERR("error taskID %u\r\n", taskID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OS_INT_ACTIVE) {
|
||||
PRINT_ERR("called during an interrupt.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
info.waterLine = OsGetTaskWaterLine(taskID);
|
||||
if (info.waterLine == OS_NULL_INT) {
|
||||
LOS_IntRestore(intSave);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = (UINTPTR *)LOS_MemAlloc(OS_SYS_MEM_ADDR, info.waterLine);
|
||||
if (buf == NULL) {
|
||||
LOS_IntRestore(intSave);
|
||||
PRINT_ERR("alloc failed for dump\n");
|
||||
return;
|
||||
}
|
||||
(VOID)memset_s(buf, info.waterLine, 0, info.waterLine);
|
||||
|
||||
ret = DumpTaskInfo(taskID, buf, &info);
|
||||
if (ret != LOS_OK) {
|
||||
LOS_IntRestore(intSave);
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, buf);
|
||||
PRINT_ERR("SP 0x%x may error or memcpy_s failed, stack space from 0x%x to 0x%x\r\n", \
|
||||
info.taskSP, info.taskSPTop, info.taskSPLimit);
|
||||
return;
|
||||
}
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
PRINTK("Task %u, SP 0x%x, WaterLine 0x%x", taskID, info.taskSP, info.waterLine);
|
||||
ShowFormat(buf, &info);
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv)
|
||||
{
|
||||
UINT32 taskID;
|
||||
|
||||
if (argc != 1) {
|
||||
PRINT_ERR("\nUsage: stack taskID\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
taskID = (UINT32)atoi(argv[0]);
|
||||
|
||||
LOS_TaskStackDump(taskID);
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif /* LOSCFG_STACK_DUMP == 1 */
|
||||
@@ -39,6 +39,10 @@
|
||||
#include "los_mux.h"
|
||||
#include "los_memory.h"
|
||||
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
#include "los_debugtools.h"
|
||||
#endif
|
||||
|
||||
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
|
||||
|
||||
STATIC CmdModInfo cmdInfo;
|
||||
@@ -51,7 +55,7 @@ CmdItem g_shellcmdAll[] = {
|
||||
{CMD_TYPE_EX, "ifconfig", XARGS, (CmdCallBackFunc)lwip_ifconfig},
|
||||
{CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)OsShellPing},
|
||||
#endif
|
||||
#if LOSCFG_FS_VFS
|
||||
#if (LOSCFG_FS_VFS == 1)
|
||||
{CMD_TYPE_EX, "touch", XARGS, (CmdCallBackFunc)OsShellCmdTouch},
|
||||
{CMD_TYPE_EX, "ls", XARGS, (CmdCallBackFunc)OsShellCmdLs},
|
||||
{CMD_TYPE_EX, "pwd", XARGS, (CmdCallBackFunc)OsShellCmdPwd},
|
||||
@@ -62,7 +66,11 @@ CmdItem g_shellcmdAll[] = {
|
||||
{CMD_TYPE_EX, "mkdir", XARGS, (CmdCallBackFunc)OsShellCmdMkdir},
|
||||
{CMD_TYPE_EX, "cp", XARGS, (CmdCallBackFunc)OsShellCmdCp},
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
{CMD_TYPE_EX, "stack", 1, (CmdCallBackFunc)OsShellCmdStackDump},
|
||||
{CMD_TYPE_EX, "hwi", 1, (CmdCallBackFunc)OsShellCmdHwiDump},
|
||||
{CMD_TYPE_EX, "st", 1, (CmdCallBackFunc)OsShellCmdSchedTrace},
|
||||
#endif
|
||||
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
|
||||
};
|
||||
|
||||
|
||||
@@ -46,4 +46,11 @@
|
||||
|
||||
#include_next <sys/select.h>
|
||||
|
||||
#ifdef LOSCFG_ARCH_RISCV
|
||||
#ifdef FD_ISSET(d, s)
|
||||
#undef FD_ISSET(d, s)
|
||||
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //_ADAPT_SYS_SELECT_H
|
||||
|
||||
@@ -56,7 +56,10 @@ typedef struct {
|
||||
} SortLinkAttribute;
|
||||
|
||||
extern SortLinkAttribute g_taskSortLink;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
extern SortLinkAttribute g_swtmrSortLink;
|
||||
#endif
|
||||
|
||||
#define OS_SORT_LINK_INVALID_TIME ((UINT64)-1)
|
||||
#define SET_SORTLIST_VALUE(sortList, value) (((SortLinkList *)(sortList))->responseTime = (value))
|
||||
@@ -98,7 +101,11 @@ STATIC INLINE UINT64 GetSortLinkNextExpireTime(SortLinkAttribute *sortHead, UINT
|
||||
STATIC INLINE UINT64 OsGetNextExpireTime(UINT64 startTime, UINT32 tickPrecision)
|
||||
{
|
||||
UINT64 taskExpireTime = GetSortLinkNextExpireTime(&g_taskSortLink, startTime, tickPrecision);
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
UINT64 swtmrExpireTime = GetSortLinkNextExpireTime(&g_swtmrSortLink, startTime, tickPrecision);
|
||||
#else
|
||||
UINT64 swtmrExpireTime = taskExpireTime;
|
||||
#endif
|
||||
return (taskExpireTime < swtmrExpireTime) ? taskExpireTime : swtmrExpireTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -1584,7 +1584,9 @@ extern UINT32 g_idleTaskID;
|
||||
* Software timer task ID.
|
||||
*
|
||||
*/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
extern UINT32 g_swtmrTaskID;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_task
|
||||
|
||||
@@ -219,6 +219,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
ret = OsCpupDaemonInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsCpupDaemonInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_FS_VFS == 1)
|
||||
ret = OsVfsInit();
|
||||
if (ret != LOS_OK) {
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#if (LOSCFG_KERNEL_PM == 1)
|
||||
#include "los_pm.h"
|
||||
#endif
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
#include "los_debugtools.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -509,7 +512,9 @@ VOID OsSchedStart(VOID)
|
||||
|
||||
OsTickSysTimerStartTimeSet(newTask->startTime);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
OsSwtmrResponseTimeReset(newTask->startTime);
|
||||
#endif
|
||||
|
||||
/* Initialize the schedule timeline and enable scheduling */
|
||||
g_taskScheduled = TRUE;
|
||||
@@ -545,6 +550,9 @@ BOOL OsSchedTaskSwitch(VOID)
|
||||
isTaskSwitch = TRUE;
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_TASK_SWITCHEDIN);
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
OsSchedTraceRecord(newTask, runTask);
|
||||
#endif
|
||||
}
|
||||
|
||||
OsSchedTaskDeQueue(newTask);
|
||||
|
||||
@@ -40,7 +40,10 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
SortLinkAttribute g_taskSortLink;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
SortLinkAttribute g_swtmrSortLink;
|
||||
#endif
|
||||
|
||||
UINT32 OsSortLinkInit(SortLinkAttribute *sortLinkHead)
|
||||
{
|
||||
@@ -85,8 +88,10 @@ VOID OsAdd2SortLink(SortLinkList *node, UINT64 startTime, UINT32 waitTicks, Sort
|
||||
|
||||
if (type == OS_SORT_LINK_TASK) {
|
||||
sortLinkHead = &g_taskSortLink;
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
} else if (type == OS_SORT_LINK_SWTMR) {
|
||||
sortLinkHead = &g_swtmrSortLink;
|
||||
#endif
|
||||
} else {
|
||||
LOS_Panic("Sort link type error : %u\n", type);
|
||||
}
|
||||
@@ -128,18 +133,22 @@ STATIC INLINE VOID SortLinkNodeTimeUpdate(SortLinkAttribute *sortLinkHead, UINT3
|
||||
VOID OsSortLinkResponseTimeConvertFreq(UINT32 oldFreq)
|
||||
{
|
||||
SortLinkAttribute *taskHead = &g_taskSortLink;
|
||||
SortLinkAttribute *swtmrHead = &g_swtmrSortLink;
|
||||
|
||||
SortLinkNodeTimeUpdate(taskHead, oldFreq);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
SortLinkAttribute *swtmrHead = &g_swtmrSortLink;
|
||||
SortLinkNodeTimeUpdate(swtmrHead, oldFreq);
|
||||
#endif
|
||||
}
|
||||
|
||||
SortLinkAttribute *OsGetSortLinkAttribute(SortLinkType type)
|
||||
{
|
||||
if (type == OS_SORT_LINK_TASK) {
|
||||
return &g_taskSortLink;
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
} else if (type == OS_SORT_LINK_SWTMR) {
|
||||
return &g_swtmrSortLink;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRINT_ERR("Invalid sort link type!\n");
|
||||
|
||||
@@ -102,7 +102,11 @@ LITE_OS_SEC_BSS LosTask g_losTask;
|
||||
LITE_OS_SEC_BSS UINT16 g_losTaskLock;
|
||||
LITE_OS_SEC_BSS UINT32 g_taskMaxNum;
|
||||
LITE_OS_SEC_BSS UINT32 g_idleTaskID;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
LITE_OS_SEC_BSS UINT32 g_swtmrTaskID;
|
||||
#endif
|
||||
|
||||
LITE_OS_SEC_DATA_INIT LOS_DL_LIST g_losFreeTask;
|
||||
LITE_OS_SEC_DATA_INIT LOS_DL_LIST g_taskRecycleList;
|
||||
LITE_OS_SEC_BSS BOOL g_taskScheduled = FALSE;
|
||||
@@ -118,8 +122,10 @@ STATIC_INLINE UINT32 OsCheckTaskIDValid(UINT32 taskID)
|
||||
UINT32 ret = LOS_OK;
|
||||
if (taskID == g_idleTaskID) {
|
||||
ret = LOS_ERRNO_TSK_OPERATE_IDLE;
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
} else if (taskID == g_swtmrTaskID) {
|
||||
ret = LOS_ERRNO_TSK_SUSPEND_SWTMR_NOT_ALLOWED;
|
||||
#endif
|
||||
} else if (OS_TSK_GET_INDEX(taskID) >= g_taskMaxNum) {
|
||||
ret = LOS_ERRNO_TSK_ID_INVALID;
|
||||
}
|
||||
@@ -151,7 +157,7 @@ STATIC VOID OsRecycleTaskResources(LosTaskCB *taskCB, UINTPTR *stackPtr)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsRecyleFinishedTask(VOID)
|
||||
STATIC VOID OsRecycleFinishedTask(VOID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
UINT32 intSave;
|
||||
@@ -191,7 +197,7 @@ UINT32 OsPmEnterHandlerSet(VOID (*func)(VOID))
|
||||
LITE_OS_SEC_TEXT VOID OsIdleTask(VOID)
|
||||
{
|
||||
while (1) {
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
|
||||
if (PmEnter != NULL) {
|
||||
PmEnter();
|
||||
@@ -753,7 +759,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
|
||||
return retVal;
|
||||
}
|
||||
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_ListEmpty(&g_losFreeTask)) {
|
||||
@@ -1212,9 +1218,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskID, UINT16 taskPrio)
|
||||
return LOS_ERRNO_TSK_OPERATE_IDLE;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
if (taskID == g_swtmrTaskID) {
|
||||
return LOS_ERRNO_TSK_OPERATE_SWTMR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (OS_CHECK_TSK_PID_NOIDLE(taskID)) {
|
||||
return LOS_ERRNO_TSK_ID_INVALID;
|
||||
@@ -1500,5 +1508,5 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 mSecs)
|
||||
|
||||
VOID LOS_TaskResRecycle(VOID)
|
||||
{
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
}
|
||||
|
||||
@@ -1487,7 +1487,7 @@ STATIC INLINE VOID OsMemMergeNodeForReAllocBigger(VOID *pool, UINT32 allocSize,
|
||||
#endif
|
||||
}
|
||||
OS_MEM_NODE_SET_USED_FLAG(node->sizeAndFlag);
|
||||
OsMemWaterUsedRecord((struct OsMemPoolHead *)pool, node->sizeAndFlag - nodeSize);
|
||||
OsMemWaterUsedRecord((struct OsMemPoolHead *)pool, OS_MEM_NODE_GET_SIZE(node->sizeAndFlag) - nodeSize);
|
||||
#if (LOSCFG_MEM_LEAKCHECK == 1)
|
||||
OsMemLinkRegisterRecord(node);
|
||||
#endif
|
||||
|
||||
@@ -245,7 +245,7 @@ extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
|
||||
do { \
|
||||
if ((param) != (value)) { \
|
||||
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
|
||||
return 1; \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -35,9 +35,6 @@ static VOID HwiF01(VOID)
|
||||
{
|
||||
TestHwiClear(HWI_NUM_TEST);
|
||||
g_testCount++;
|
||||
|
||||
EXIT:
|
||||
return;
|
||||
}
|
||||
|
||||
static UINT32 Testcase(VOID)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -49,25 +49,6 @@ static INT32 g_pthreadSem = 0;
|
||||
#define Level1 0
|
||||
#define LITE_TEST_CASE(module, function, flag) static int function(void)
|
||||
|
||||
/**
|
||||
* @tc.setup : setup for all testcases
|
||||
* @return : setup result, TRUE is success, FALSE is fail
|
||||
*/
|
||||
static BOOL PthreadFuncTestSuiteSetUp(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.teardown : teardown for all testcases
|
||||
* @return : teardown result, TRUE is success, FALSE is fail
|
||||
*/
|
||||
static BOOL PthreadFuncTestSuiteTearDown(void)
|
||||
{
|
||||
printf("+-------------------------------------------+\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static VOID *PthreadJoinF01(void *argument)
|
||||
{
|
||||
g_testCount++;
|
||||
|
||||
Reference in New Issue
Block a user