Compare commits
4 Commits
OpenHarmon
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
40
components/debugtools/BUILD.gn
Executable file
40
components/debugtools/BUILD.gn
Executable file
@@ -0,0 +1,40 @@
|
||||
# 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_stackdump.c" ]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
59
components/debugtools/los_debugtools.h
Executable file
59
components/debugtools/los_debugtools.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
#define PRINT_PER_ROW 4
|
||||
|
||||
/* Shell Callback */
|
||||
extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv);
|
||||
|
||||
/* other module Callback */
|
||||
|
||||
/* External Interface */
|
||||
extern VOID LOS_TaskStackDump(UINT32 taskID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
155
components/debugtools/los_stackdump.c
Executable file
155
components/debugtools/los_stackdump.c
Executable 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,9 @@ 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},
|
||||
#endif
|
||||
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -509,7 +509,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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user