Compare commits

...

56 Commits

Author SHA1 Message Date
openharmony_ci
df9387c28f !725 fix: 修复系统时间比RTC时间过快的问题
Merge pull request !725 from zhushengle/tick_master
2022-06-25 09:41:52 +00:00
openharmony_ci
d08a3e3f13 !732 LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败修改
Merge pull request !732 from wangchen/0623_hwi
2022-06-24 11:49:12 +00:00
openharmony_ci
48ff5189b8 !727 OsShellCmdFreeInfo打印换行修改
Merge pull request !727 from wangchen/0622_m
2022-06-24 10:37:52 +00:00
zhushengle
600283a96f fix: 修复系统时间比RTC时间过快的问题
1.标记在时间接口中更新base后在中断中不再更新base
2.优化tick计算

Close #I5DCRB

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ic3df09142519357353906d40e3fd3cdca5cac71d
2022-06-24 17:47:06 +08:00
openharmony_ci
a333e8f88e !734 删除osTimerNew接口中对传入的定时器类型的重复判断
Merge pull request !734 from Mr.W/dev
2022-06-24 06:41:02 +00:00
wangmeng
ce49331798 删除osTimerNew接口中对传入的定时器类型的重复判断
Signed-off-by: wangmeng <wangmeng90798@talkweb.com.cn>
2022-06-24 10:05:39 +08:00
wangchen
fc8c547b05 fix: LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败修改
【背景】LOSCFG_PLATFORM_HWI_WITH_ARG开启后M核编译失败

【修改方案】
对涉及的函数指针进行强制转换

【影响】
对现有的产品编译不会有影响。
re #I4W4GM
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-23 11:43:29 +00:00
openharmony_ci
8cfadb9b4d !729 禁止导出符号被编译器优化掉
Merge pull request !729 from xuxinyu/master
2022-06-23 11:17:05 +00:00
openharmony_ci
2c5b750a46 !731 so 解析脚本单位表示错误
Merge pull request !731 from xuxinyu/FixdylinkSO_pares
2022-06-23 11:16:40 +00:00
x_xiny
3df936f1a1 禁止导出符号被编译器优化掉
re #I4XQC1

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I79a59e70ddaba746a50bd92aea647778c4e90a0c
2022-06-23 17:31:57 +08:00
x_xiny
6fa1fe5993 so 解析脚本单位表示错误
re #I4X3AL

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Idd6d3c171b785ebd332402d3f29ffb484e644545
2022-06-23 17:18:57 +08:00
openharmony_ci
8a05eb6e08 !722 修复liteos_m仓库中存在的一些拼写错误
Merge pull request !722 from Hongjin Li/dev
2022-06-23 04:10:35 +00:00
lihongjin
243fe55c68 style: Misspelling
Signed-off-by: lihongjin <lihongjin1@huawei.com>
Change-Id: Ie14607b483d31a6efdf17e40e9937fe4bc2484c2
2022-06-23 09:46:16 +08:00
openharmony_ci
a7341d81d1 !702 【OpenHarmony开源贡献者计划2022】更新readme中的目录结构
Merge pull request !702 from yjzhkh/master
2022-06-23 00:51:41 +00:00
wangchen
c8ce65f408 fix: OsShellCmdFreeInfo打印换行格式混用修改
【背景】OsShellCmdFreeInfo打印换行格式混用

【修改方案】
删除\r

【影响】
对现有的产品编译不会有影响。
re #I52MES
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-22 07:50:26 +00:00
openharmony_ci
c1e3856bbe !714 eat: normalize drivers framework component and repos
Merge pull request !714 from yuanbo/master
2022-06-17 06:40:26 +00:00
yuanbo
3a887c616a feat: normalize drivers framework component and repos
Signed-off-by: yuanbo <yuanbo@huawei.com>
2022-06-15 20:07:10 +08:00
openharmony_ci
3303cd7bc1 !709 feature: C库适配iar
Merge pull request !709 from xuxinyu/master
2022-06-14 11:57:16 +00:00
x_xiny
7c5a05f352 feature: C库适配iar
re #I5BUG3

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I84591c7593622de22a33f411b7011d17034c6d55
2022-06-14 15:46:29 +08:00
openharmony_ci
5df101eae5 !703 TCB结构体扩展宏添加分号
Merge pull request !703 from 方烨/master
2022-06-14 05:47:21 +00:00
fangye
128c3dffb5 TCB结构体扩展宏添加分号
Signed-off-by: fangye <fangye@talkweb.com.cn>
Change-Id: Ic31310a1da1842adb1b19a0afb1448aa0f4720ef
2022-06-14 11:31:18 +08:00
openharmony_ci
e8f3f9674c !708 fix:测试套问题修复
Merge pull request !708 from Zhaotianyu/0613test_fix
2022-06-13 11:10:51 +00:00
arvinzzz
5cfec18d24 fix: 测试套问题修复
CLOCK_REALTIME在musl与newlib中的定义值不一致,测试套中不能写死某一个值,要用CLOCK_REALTIME

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie88eaf3af2ae938a7c02f7acf08526dcf333fb93
2022-06-13 16:44:59 +08:00
openharmony_ci
def41f8edd !701 内存水线shell命令
Merge pull request !701 from wangchen/0607_water
2022-06-10 06:00:05 +00:00
yangjinzhuang
3387c32b8a 更新readme
Signed-off-by: yangjinzhuang <yangjinzhuang@kaihongdigi.com>
2022-06-10 10:32:37 +08:00
wangchen
6881d3da46 fix: 内存水线shell命令
【背景】内存水线shell命令

【修改方案】
1,添加shell命令, 通过LOS_MemInfoGet获取水线
2, 增加task命令显示任务的alloc情况
影响范围:
【影响】
对现有的产品编译不会有影响。
re #I5B6VT
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-09 02:55:32 +00:00
openharmony_ci
e21e8753d1 !700 debugtools 自验问题修复
Merge pull request !700 from wangchen/0607_up
2022-06-07 10:40:24 +00:00
wangchen
397f24dd6f fix: debugtools 自验问题修复
【背景】debugtools 自验问题修复

【修改方案】
1,hwi打印可能存在负数,不能使用%u
2,LOS_SchedTraceStop函数可能被单独调用,导致重复释放

影响范围:
【影响】
对现有的产品编译不会有影响。
re #I5B668
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-07 10:17:32 +00:00
openharmony_ci
831d089652 !697 M核函数命名错误
Merge pull request !697 from wangchen/0601_up
2022-06-06 07:02:07 +00:00
wangchen
f5fa92feff fix: M核函数命名错误
【背景】OsRecyleFinishedTask拼写问题

【修改方案】
Recyle -> Recycle

影响范围:
【影响】
对现有的产品编译不会有影响。
re #I56JB1
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-06-01 06:48:13 +00:00
openharmony_ci
bed1d28df8 !689 M核添加维测, 调度信息dump
Merge pull request !689 from wangchen/0512_track
2022-05-28 08:48:37 +00:00
wangchen
efebc00f87 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I55DJV
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-28 08:24:30 +00:00
openharmony_ci
28c1529e2f !695 开启cpup后启动挂死
Merge pull request !695 from wangchen/0526_up
2022-05-26 11:55:22 +00:00
wangchen
159d304275 fix: 开启cpup后启动挂死
【背景】开启cpup后启动挂死

【修改方案】
1, cpup开启后,task模块会在g_cpup初始化前赋值。
    因此需提前cpup模块的初始化。
【影响】
对现有的产品编译不会有影响。
re #I59DDE
Signed-off-by: wangchen <wangchen64@huawei.com>
https://gitee.com/openharmony/kernel_liteos_m/issues/I59DDE
2022-05-26 11:42:02 +00:00
openharmony_ci
18f65ae0b3 !694 修复RISCV32 newlib情况下FD_ISSET设置问题
Merge pull request !694 from 大仙/master
2022-05-24 11:08:44 +00:00
openharmony_ci
5363e4b472 !690 【OpenHarmony 开源贡献者计划 2022】fix: fix warning while compiling test suites
Merge pull request !690 from rtos_shang/master
2022-05-23 12:03:34 +00:00
openharmony_ci
c65d908905 !692 【OpenHarmony 开源贡献者计划 2022】fix: fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
Merge pull request !692 from rtos_shang/warning2
2022-05-23 12:03:08 +00:00
openharmony_ci
1b9d59aa9a !691 【OpenHarmony 开源贡献者计划 2022】fix: fix warning label 'EXIT' defined but not used
Merge pull request !691 from rtos_shang/warning
2022-05-23 12:02:42 +00:00
大仙
c6958aa181 修复SoftBusSocketFdIsset在M核RISCV32架构的newlib情况下设置的问题
fix #I52ACL

Signed-off-by: 大仙 <leicx@digitalchina.com>
2022-05-20 16:55:27 +08:00
zhumingxian
315a448142 fix: fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
fix warning: 'PthreadFuncTestSuiteTearDown' defined but not used
fix warning: 'PthreadFuncTestSuiteSetUp' defined but not used

close #I58COM

Signed-off-by: zhumingxian <zhuwanshu@ohos.com.cn>
2022-05-19 21:28:46 +08:00
zhumingxian
32a2e193f4 fix: fix warning label 'EXIT' defined but not used
fix testsuites/sample/kernel/hwi/it_los_hwi_039.c:39:1: warning: label 'EXIT' defined but not used [-Wunused-label]

close #I58CNP

Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-05-19 21:13:46 +08:00
zhumingxian
b35792fa6c fix: fix warning while compiling test suites
fix testsuites/include/iCunit.h:248:20: warning: 'return' with a value, in function returning void

close #I58CM9

Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-05-19 20:59:50 +08:00
openharmony_ci
a5e651cb01 !673 Fix : liteos_m核 内存waterline 缺陷BUG
Merge pull request !673 from yinjiaming/fix
2022-05-19 09:19:42 +00:00
yinjiaming
f12dd8bbe6 fix: 修复liteos_m核 内存waterline 缺陷BUG
【背景】
OsMemWaterUsedRecord的第二个参数错误,导致waterline统计错误

【修改方案】
将OsMemWaterUsedRecord的第二个入参修改为
OS_MEM_NODE_GET_SIZE(node->sizeAndFlag) - nodeSize

【影响】
对现有的产品编译不会有影响

re #I4QBG2

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I1cc213d98230ec9723c6bf1871b4e46da3b3467d
2022-05-19 02:44:54 +00:00
openharmony_ci
3f41c36926 !686 M核添加维测, 中断信息dump
Merge pull request !686 from wangchen/0505_hwidump
2022-05-12 07:17:01 +00:00
openharmony_ci
a3daa77e53 !688 fix: 修改内核子系统markdown文件目录错误问题
Merge pull request !688 from Kiita/220510_md
2022-05-11 02:17:31 +00:00
wangchen
fb740f9b23 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I5644Y
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-11 01:44:36 +00:00
zhangyan
a45bf8797c fix:修改内核子系统markdown文件目录错误问题
re #I535PJ
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I772ec6ff9cf1d45d9decd0f4f11535fe1dfa5e7b
2022-05-10 07:10:59 +00:00
openharmony_ci
84f89b9660 !683 「OpenHarmony 开源贡献者计划」SWTMR模块无法关闭
Merge pull request !683 from yangzelin/fix_swtmr
2022-05-10 00:51:11 +00:00
openharmony_ci
03b4650a16 !685 M核添加维测, 任务栈dump
Merge pull request !685 from wangchen/0505_stackdump
2022-05-06 08:35:18 +00:00
wangchen
728aca27f5 fix: M核添加维测接口
【背景】M核添加维测接口

【修改方案】
1, 添加任务栈dump接口
2, 添加中断dump接口
3, 添加任务调度流程dump
【影响】
对现有的产品编译不会有影响。
re #I50KLG
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-05-06 07:44:02 +00:00
yangzelin
91743d3ea4 Signed-off-by: yangzelin <yangzelin@talkweb.com.cn>
fix: 解决关闭SWTMR模块后无法编译的问题

关闭SWTMR模块后, 屏蔽相关全局变量以及函数调用
2022-04-28 09:49:15 +08:00
openharmony_ci
fcd677feba !671 在riscv32_virt中新增graphic适配,将riscv32_virt编译从musl调整为newlib
Merge pull request !671 from xiexg-dc/riscv32-virt
2022-04-24 13:23:12 +00:00
openharmony_ci
c4fd9be138 !680 Delete redundancy third party unity
Merge pull request !680 from peitaiyi/master
2022-04-24 12:06:31 +00:00
taiyipei
81249a0384 delete redundancy third party unity deps
Signed-off-by: taiyipei <peitaiyi@huawei.com>
2022-04-24 00:21:25 -07:00
xiexg-dc
8746f5abe5 feat: 在riscv32_virt中新增graphic适配,将musl调整为newlib
在riscv32_virt中新增graphic适配,将riscv32_virt编译从musl调整为newlib。

fix #I52IID

Signed-off-by: xiexg-dc <xiexg@digitalchina.com>
Change-Id: I1a774666609172c5de6310fe43b33185f86ac872
2022-04-13 15:05:51 +08:00
89 changed files with 1907 additions and 324 deletions

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-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:
@@ -82,11 +82,10 @@ config("stdinc_config") {
"-isystem",
std_include,
]
cflags += [ "-nostdinc" ]
asmflags = cflags
if (defined(LOSCFG_LIBC_NEWLIB)) {
cflags -= [ "-nostdinc" ]
if (defined(LOSCFG_LIBC_MUSL)) {
cflags += [ "-nostdinc" ]
}
asmflags = cflags
}
config("ssp_config") {

14
Kconfig
View File

@@ -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
@@ -574,7 +581,7 @@ config MEM_LEAKCHECK
depends on DEBUG_VERSION && MEM_DEBUG
select KERNEL_BACKTRACE
help
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the informations of mem node.
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not"
default n
@@ -590,6 +597,11 @@ config VM_OVERLAP_CHECK
depends on DEBUG_VERSION && MEM_DEBUG
help
Answer Y to enable vm overlap check.
config TASK_MEM_USED
bool "Enable show task mem used or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
endmenu

View File

@@ -26,6 +26,7 @@ OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系
│ │ ├── cortex-m3 # cortex-m3架构代码
│ │ ├── cortex-m33 # cortex-m33架构代码
│ │ ├── cortex-m4 # cortex-m4架构代码
│ │ ├── cortex-m55 # cortex-m55架构代码
│ │ ├── cortex-m7 # cortex-m7架构代码
│ │ └── include # arm架构公共头文件目录
│ ├── csky # csky架构代码

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#include "los_reg.h"
#define OS_INT_IRQ_ENABLE (1U << 0)
@@ -61,6 +64,30 @@ ExcInfo g_excInfo = {0};
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -204,6 +231,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -217,8 +247,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -268,6 +306,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
#else
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask(hwiNum);
LOS_IntRestore(intSave);

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
UINT32 g_intCount = 0;
@@ -54,6 +57,30 @@ LITE_OS_SEC_VEC
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -237,6 +264,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -250,8 +280,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -306,6 +344,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -576,19 +622,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
UINT32 g_intCount = 0;
@@ -50,6 +53,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -228,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -241,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -297,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -572,14 +618,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
UINT32 g_intCount = 0;
@@ -49,6 +52,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -228,6 +255,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -241,8 +271,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -297,6 +335,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -572,14 +618,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -40,6 +40,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
@@ -53,6 +56,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -577,19 +623,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -40,6 +40,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
/*lint -save -e40 -e522 -e533*/
UINT32 g_intCount = 0;
@@ -53,6 +56,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -577,19 +623,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
UINT32 g_intCount = 0;
@@ -48,6 +51,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -231,6 +258,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -244,8 +274,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -300,6 +338,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -580,19 +626,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -40,6 +40,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
UINT32 g_intCount = 0;
@@ -55,6 +58,30 @@ LITE_OS_SEC_VEC
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -239,6 +266,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -252,8 +282,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -308,6 +346,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -578,19 +624,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -38,6 +38,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
#define DEF_HANDLER_START_INDEX 2
UINT32 g_intCount = 0;
@@ -49,6 +52,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -232,6 +259,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -245,8 +275,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -301,6 +339,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -580,14 +626,14 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsTickHandler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -39,6 +39,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
UINT32 g_intCount = 0;
@@ -48,6 +51,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC __attribute__((aligned(LOSCFG_ARCH_HWI_VECTOR_ALIGN))) g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -226,6 +253,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -239,8 +269,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -295,6 +333,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -565,19 +611,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

@@ -40,6 +40,9 @@
#include "los_sched.h"
#include "los_memory.h"
#include "los_membox.h"
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_cpup.h"
#endif
UINT32 g_intCount = 0;
@@ -51,6 +54,30 @@ UINT32 g_intCount = 0;
*/
STATIC HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
#if (LOSCFG_DEBUG_TOOLS == 1)
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
}
CHAR *OsGetHwiFormName(UINT32 index)
{
return g_hwiFormName[index];
}
BOOL OsGetHwiCreated(UINT32 index)
{
if (g_hwiForm[index] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
return TRUE;
}
return FALSE;
}
#endif
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
typedef struct {
@@ -235,6 +262,9 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HwiNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqStart(hwiIndex);
#endif
HalPreInterruptHandler(hwiIndex);
@@ -248,8 +278,16 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
}
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
++g_hwiFormCnt[hwiIndex];
#endif
HalAftInterruptHandler(hwiIndex);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
OsCpupIrqEnd(hwiIndex);
#endif
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock();
@@ -304,6 +342,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum,
(VOID)irqParam;
OsSetVector(hwiNum, hwiHandler);
#endif
#if (LOSCFG_DEBUG_TOOLS == 1)
if ((irqParam != NULL) && (irqParam->pName != NULL)) {
g_hwiFormName[hwiNum + OS_SYS_VECTOR_CNT] = (CHAR *)irqParam->pName;
}
g_hwiFormCnt[hwiNum + OS_SYS_VECTOR_CNT] = 0;
#endif
HwiUnmask((IRQn_Type)hwiNum);
HwiSetPriority((IRQn_Type)hwiNum, hwiPrio);
@@ -574,19 +620,19 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
UINT32 index;
g_hwiForm[0] = 0; /* [0] Top of Stack */
g_hwiForm[1] = Reset_Handler; /* [1] reset */
g_hwiForm[1] = (HWI_PROC_FUNC)Reset_Handler; /* [1] reset */
for (index = 2; index < OS_VECTOR_CNT; index++) { /* 2: The starting position of the interrupt */
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
}
/* Exception handler register */
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = SysTick_Handler;
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcNMI;
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcHardFault;
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalExcSvcCall;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)SysTick_Handler;
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;

View File

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

View File

@@ -214,6 +214,12 @@ STATIC INLINE HwiControllerOps *ArchIntOpsGet(VOID)
return &g_archHwiOps;
}
#if (LOSCFG_DEBUG_TOOLS == 1)
extern UINT32 OsGetHwiFormCnt(UINT32 index);
extern CHAR *OsGetHwiFormName(UINT32 index);
extern BOOL OsGetHwiCreated(UINT32 index);
#endif
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -51,7 +51,7 @@ extern "C" {
/**
* @ingroup los_hwi
* Count of Nuclei interrupt vector maxium, which is configurable.
* Count of Nuclei interrupt vector maximum, which is configurable.
*/
#define OS_RISCV_CUSTOM_IRQ_VECTOR_CNT SOC_INT_MAX

View File

@@ -193,15 +193,15 @@ VOID HalDisplayTaskInfo(VOID)
/* ****************************************************************************
Function : HalUnalignedAccessFix
Description : Unaligned acess fixes are not supported by default
Description : Unaligned access fixes are not supported by default
Input : None
Output : None
Return : None
**************************************************************************** */
WEAK UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, VOID *sp)
{
/* Unaligned acess fixes are not supported by default */
PRINTK("Unaligned acess fixes are not support by default!\r\n");
/* Unaligned access fixes are not supported by default */
PRINTK("Unaligned access fixes are not support by default!\r\n");
return LOS_NOK;
}

View File

@@ -62,9 +62,9 @@
* - ZEm(data): Zero-Extend data to m-bit.
* - ABS(x): Calculate the absolute value of `x`.
* - CONCAT(x,y): Concatinate `x` and `y` to form a value.
* - u<: Unsinged less than comparison.
* - u<=: Unsinged less than & equal comparison.
* - u>: Unsinged greater than comparison.
* - u<: Unsigned less than comparison.
* - u<=: Unsigned less than & equal comparison.
* - u>: Unsigned greater than comparison.
* - s*: Signed multiplication.
* - u*: Unsigned multiplication.
*
@@ -2641,7 +2641,7 @@ __STATIC_FORCEINLINE long __RV_KHMTT(unsigned int a, unsigned int b)
/* ===== Inline Function Start for 3.38.1. KMABB ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMABB (SIMD Saturating Signed Multiply Bottom Halfs & Add)
* \brief KMABB (SIMD Saturating Signed Multiply Bottom Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2704,7 +2704,7 @@ __STATIC_FORCEINLINE long __RV_KMABB(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.38.2. KMABT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMABT (SIMD Saturating Signed Multiply Bottom & Top Halfs & Add)
* \brief KMABT (SIMD Saturating Signed Multiply Bottom & Top Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2767,7 +2767,7 @@ __STATIC_FORCEINLINE long __RV_KMABT(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.38.3. KMATT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMATT (SIMD Saturating Signed Multiply Top Halfs & Add)
* \brief KMATT (SIMD Saturating Signed Multiply Top Halves & Add)
* \details
* **Type**: SIMD
*
@@ -2830,7 +2830,7 @@ __STATIC_FORCEINLINE long __RV_KMATT(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.39.1. KMADA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADA (SIMD Saturating Signed Multiply Two Halfs and Two Adds)
* \brief KMADA (SIMD Saturating Signed Multiply Two Halves and Two Adds)
* \details
* **Type**: SIMD
*
@@ -2894,7 +2894,7 @@ __STATIC_FORCEINLINE long __RV_KMADA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.39.2. KMAXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMAXDA (SIMD Saturating Signed Crossed Multiply Two Halfs and Two Adds)
* \brief KMAXDA (SIMD Saturating Signed Crossed Multiply Two Halves and Two Adds)
* \details
* **Type**: SIMD
*
@@ -2958,7 +2958,7 @@ __STATIC_FORCEINLINE long __RV_KMAXDA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.1. KMADS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADS (SIMD Saturating Signed Multiply Two Halfs & Subtract & Add)
* \brief KMADS (SIMD Saturating Signed Multiply Two Halves & Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3030,7 +3030,7 @@ __STATIC_FORCEINLINE long __RV_KMADS(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.2. KMADRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMADRS (SIMD Saturating Signed Multiply Two Halfs & Reverse Subtract & Add)
* \brief KMADRS (SIMD Saturating Signed Multiply Two Halves & Reverse Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3102,7 +3102,7 @@ __STATIC_FORCEINLINE long __RV_KMADRS(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.40.3. KMAXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMAXDS (SIMD Saturating Signed Crossed Multiply Two Halfs & Subtract & Add)
* \brief KMAXDS (SIMD Saturating Signed Crossed Multiply Two Halves & Subtract & Add)
* \details
* **Type**: SIMD
*
@@ -3242,7 +3242,7 @@ __STATIC_FORCEINLINE long long __RV_KMAR64(long long t, long a, long b)
/* ===== Inline Function Start for 3.42.1. KMDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMDA (SIMD Signed Multiply Two Halfs and Add)
* \brief KMDA (SIMD Signed Multiply Two Halves and Add)
* \details
* **Type**: SIMD
*
@@ -3293,7 +3293,7 @@ __STATIC_FORCEINLINE long __RV_KMDA(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.42.2. KMXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMXDA (SIMD Signed Crossed Multiply Two Halfs and Add)
* \brief KMXDA (SIMD Signed Crossed Multiply Two Halves and Add)
* \details
* **Type**: SIMD
*
@@ -4330,7 +4330,7 @@ __STATIC_FORCEINLINE long __RV_KMMWT2_U(long a, unsigned long b)
/* ===== Inline Function Start for 3.51.1. KMSDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMSDA (SIMD Saturating Signed Multiply Two Halfs & Add & Subtract)
* \brief KMSDA (SIMD Saturating Signed Multiply Two Halves & Add & Subtract)
* \details
* **Type**: SIMD
*
@@ -4392,7 +4392,7 @@ __STATIC_FORCEINLINE long __RV_KMSDA(long t, unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.51.2. KMSXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief KMSXDA (SIMD Saturating Signed Crossed Multiply Two Halfs & Add & Subtract)
* \brief KMSXDA (SIMD Saturating Signed Crossed Multiply Two Halves & Add & Subtract)
* \details
* **Type**: SIMD
*
@@ -5558,7 +5558,7 @@ __STATIC_FORCEINLINE long __RV_KSUBH(int a, int b)
* **Description**:\n
* The signed lower 32-bit content of Rs2 is subtracted from the signed lower 32-bit
* content of Rs1. And the result is saturated to the 32-bit signed integer range of [-2^31, 2^31-1] and then
* sign-extened and written to Rd. If saturation happens, this instruction sets the OV flag.
* sign-extended and written to Rd. If saturation happens, this instruction sets the OV flag.
*
* **Operations**:\n
* ~~~
@@ -7337,7 +7337,7 @@ __STATIC_FORCEINLINE unsigned long __RV_SLL16(unsigned long a, unsigned int b)
/* ===== Inline Function Start for 3.104. SMAL ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMAL (Signed Multiply Halfs & Add 64-bit)
* \brief SMAL (Signed Multiply Halves & Add 64-bit)
* \details
* **Type**: Partial-SIMD
*
@@ -7397,7 +7397,7 @@ __STATIC_FORCEINLINE long long __RV_SMAL(long long a, unsigned long b)
/* ===== Inline Function Start for 3.105.1. SMALBB ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALBB (Signed Multiply Bottom Halfs & Add 64-bit)
* \brief SMALBB (Signed Multiply Bottom Halves & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7561,7 +7561,7 @@ __STATIC_FORCEINLINE long long __RV_SMALBT(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.105.3. SMALTT ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALTT (Signed Multiply Top Halfs & Add 64-bit)
* \brief SMALTT (Signed Multiply Top Halves & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7643,7 +7643,7 @@ __STATIC_FORCEINLINE long long __RV_SMALTT(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.106.1. SMALDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDA (Signed Multiply Two Halfs and Two Adds 64-bit)
* \brief SMALDA (Signed Multiply Two Halves and Two Adds 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7727,7 +7727,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDA(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.106.2. SMALXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALXDA (Signed Crossed Multiply Two Halfs and Two Adds 64-bit)
* \brief SMALXDA (Signed Crossed Multiply Two Halves and Two Adds 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7811,7 +7811,7 @@ __STATIC_FORCEINLINE long long __RV_SMALXDA(long long t, unsigned long a, unsign
/* ===== Inline Function Start for 3.107.1. SMALDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDS (Signed Multiply Two Halfs & Subtract & Add 64-bit)
* \brief SMALDS (Signed Multiply Two Halves & Subtract & Add 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7902,7 +7902,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDS(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.107.2. SMALDRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALDRS (Signed Multiply Two Halfs & Reverse Subtract & Add 64- bit)
* \brief SMALDRS (Signed Multiply Two Halves & Reverse Subtract & Add 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -7993,7 +7993,7 @@ __STATIC_FORCEINLINE long long __RV_SMALDRS(long long t, unsigned long a, unsign
/* ===== Inline Function Start for 3.107.3. SMALXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMALXDS (Signed Crossed Multiply Two Halfs & Subtract & Add 64- bit)
* \brief SMALXDS (Signed Crossed Multiply Two Halves & Subtract & Add 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -8459,7 +8459,7 @@ __STATIC_FORCEINLINE long __RV_SMTT16(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.1. SMDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMDS (SIMD Signed Multiply Two Halfs and Subtract)
* \brief SMDS (SIMD Signed Multiply Two Halves and Subtract)
* \details
* **Type**: SIMD
*
@@ -8518,7 +8518,7 @@ __STATIC_FORCEINLINE long __RV_SMDS(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.2. SMDRS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMDRS (SIMD Signed Multiply Two Halfs and Reverse Subtract)
* \brief SMDRS (SIMD Signed Multiply Two Halves and Reverse Subtract)
* \details
* **Type**: SIMD
*
@@ -8577,7 +8577,7 @@ __STATIC_FORCEINLINE long __RV_SMDRS(unsigned long a, unsigned long b)
/* ===== Inline Function Start for 3.114.3. SMXDS ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
* \brief SMXDS (SIMD Signed Crossed Multiply Two Halfs and Subtract)
* \brief SMXDS (SIMD Signed Crossed Multiply Two Halves and Subtract)
* \details
* **Type**: SIMD
*
@@ -9016,7 +9016,7 @@ __STATIC_FORCEINLINE long __RV_SMMWT_U(long a, unsigned long b)
/* ===== Inline Function Start for 3.120.1. SMSLDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMSLDA (Signed Multiply Two Halfs & Add & Subtract 64-bit)
* \brief SMSLDA (Signed Multiply Two Halves & Add & Subtract 64-bit)
* \details
* **Type**: DSP (64-bit Profile)
*
@@ -9098,7 +9098,7 @@ __STATIC_FORCEINLINE long long __RV_SMSLDA(long long t, unsigned long a, unsigne
/* ===== Inline Function Start for 3.120.2. SMSLXDA ===== */
/**
* \ingroup NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_64B_ADDSUB
* \brief SMSLXDA (Signed Crossed Multiply Two Halfs & Add & Subtract 64- bit)
* \brief SMSLXDA (Signed Crossed Multiply Two Halves & Add & Subtract 64- bit)
* \details
* **Type**: DSP (64-bit Profile)
*

View File

@@ -282,7 +282,7 @@ __STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits(void)
* This function gets the hardware version information from CLICINFO register.
* \return hardware version number in CLICINFO register.
* \remarks
* - This function gets harware version information from CLICINFO register.
* - This function gets hardware version information from CLICINFO register.
* - Bit 20:17 for architecture version, bit 16:13 for implementation version.
* \sa
* - \ref ECLIC_GetInfoNum

View File

@@ -81,7 +81,7 @@
* \details
* * We can save power by disable FPU Unit.
* * When FPU Unit is disabled, any access to FPU related CSR registers
* and FPU instructions will cause illegal Instuction Exception.
* and FPU instructions will cause illegal Instruction Exception.
* */
#define __disable_FPU() __RV_CSR_CLEAR(CSR_MSTATUS, MSTATUS_FS)

View File

@@ -282,7 +282,7 @@ __STATIC_FORCEINLINE void SysTimer_SoftwareReset(void)
* \details Initializes the System Timer and its non-vector interrupt, and starts the System Tick Timer.
*
* In our default implementation, the timer counter will be set to zero, and it will start a timer compare non-vector interrupt
* when it matchs the ticks user set, during the timer interrupt user should reload the system tick using \ref SysTick_Reload function
* when it matches the ticks user set, during the timer interrupt user should reload the system tick using \ref SysTick_Reload function
* or similar function written by user, so it can produce period timer interrupt.
* \param [in] ticks Number of ticks between two interrupts.
* \return 0 Function succeeded.

View File

@@ -325,7 +325,7 @@
* \brief NMSIS Core CSR Register Definitions
* \details
*
* The following macros are used for CSR Register Defintions.
* The following macros are used for CSR Register Definitions.
* @{
*/
/* === Standard RISC-V CSR Registers === */

View File

@@ -47,7 +47,7 @@
* - Neural Network Support Functions
*
* The library has separate functions for operating on different weight and activation data
* types including 8-bit integers (q7_t) and 16-bit integers (q15_t). The descrition of the
* types including 8-bit integers (q7_t) and 16-bit integers (q15_t). The description of the
* kernels are included in the function description. The implementation details are also
* described in this paper [1].
*
@@ -119,7 +119,7 @@ extern "C"
/**
* @brief Basic Q7 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -156,8 +156,8 @@ extern "C"
/**
* @brief Basic Q7 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -202,7 +202,7 @@ extern "C"
/**
* @brief Basic Q15 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -239,7 +239,7 @@ extern "C"
/**
* @brief Fast Q7 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -257,7 +257,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -281,8 +281,8 @@ extern "C"
/**
* @brief Fast Q7 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -304,7 +304,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -333,8 +333,8 @@ extern "C"
/**
* @brief Fast Q7 version of 1x1 convolution (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -360,7 +360,7 @@ extern "C"
* second half of MobileNets after depthwise separable convolution.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 4
* ch_im_out is multiple of 2
*/
@@ -388,7 +388,7 @@ extern "C"
/**
* @brief Q7 version of convolution for RGB image
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -429,7 +429,7 @@ extern "C"
/**
* @brief Fast Q15 convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -447,7 +447,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -471,8 +471,8 @@ extern "C"
/**
* @brief Fast Q15 convolution function (non-sqaure shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -505,7 +505,7 @@ extern "C"
*
* ch_im_in is multiple of 2
*
* ch_im_out is multipe of 2
* ch_im_out is multiple of 2
*
*/
@@ -534,7 +534,7 @@ extern "C"
/**
* @brief Q7 depthwise separable convolution function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -552,7 +552,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -576,8 +576,8 @@ extern "C"
/**
* @brief Q7 depthwise separable convolution function (non-square shape)
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in_x input tensor dimention x
* @param[in] dim_im_in_y input tensor dimention y
* @param[in] dim_im_in_x input tensor dimension x
* @param[in] dim_im_in_y input tensor dimension y
* @param[in] ch_im_in number of input tensor channels
* @param[in] wt pointer to kernel weights
* @param[in] ch_im_out number of filters, i.e., output tensor channels
@@ -599,7 +599,7 @@ extern "C"
* <code>RISCV_MATH_SIZE_MISMATCH</code> or <code>RISCV_MATH_SUCCESS</code> based on the outcome of size checking.
*
* This function is the version with full list of optimization tricks, but with
* some contraints:
* some constraints:
* ch_im_in is multiple of 2
* ch_im_out is multiple of 2
*/
@@ -986,7 +986,7 @@ extern "C"
/**
* @brief Q7 max pooling function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] dim_kernel filter kernel size
* @param[in] padding padding sizes
@@ -1011,7 +1011,7 @@ extern "C"
/**
* @brief Q7 average pooling function
* @param[in] Im_in pointer to input tensor
* @param[in] dim_im_in input tensor dimention
* @param[in] dim_im_in input tensor dimension
* @param[in] ch_im_in number of input tensor channels
* @param[in] dim_kernel filter kernel size
* @param[in] padding padding sizes
@@ -1043,7 +1043,7 @@ extern "C"
/**
* @brief Q7 softmax function
* @param[in] vec_in pointer to input vector
* @param[in] dim_vec input vector dimention
* @param[in] dim_vec input vector dimension
* @param[out] p_out pointer to output vector
* @return none.
*
@@ -1054,7 +1054,7 @@ extern "C"
/**
* @brief Q15 softmax function
* @param[in] vec_in pointer to input vector
* @param[in] dim_vec input vector dimention
* @param[in] dim_vec input vector dimension
* @param[out] p_out pointer to output vector
* @return none.
*
@@ -1081,7 +1081,7 @@ extern "C"
* @param[in] dilation_x Dilation along width. Not used and intended for future enhancement.
* @param[in] dilation_y Dilation along height. Not used and intended for future enhancement.
* @param[in] bias Pointer to optional bias values. If no bias is
* availble, NULL is expected
* available, NULL is expected
* @param[in] input_offset Input tensor zero offset
* @param[in] filter_offset Kernel tensor zero offset
* @param[in] output_offset Output tensor zero offset

View File

@@ -94,6 +94,5 @@
├── los_hook.h
├── los_list.h --- Doubly linked list
└── los_reg.h --- Register macros
└── src
```

View File

@@ -93,6 +93,5 @@
├── los_hook.h
├── los_list.h --- 双向链表
└── los_reg.h --- 寄存器读写宏定义
└── src
```

View File

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

View File

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

View File

@@ -35,8 +35,15 @@
#include "los_debug.h"
#include "los_tick.h"
#if (LOSCFG_BASE_CORE_CPUP == 1)
#if (LOSCFG_BASE_CORE_SWTMR == 1)
#include "los_swtmr.h"
#endif
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
#include "los_arch_interrupt.h"
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
/**
* @ingroup los_cpup
* CPU usage-type macro: used for tasks.
@@ -54,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 */

View File

@@ -139,6 +139,18 @@ typedef struct {
extern OsCpupCB *g_cpup;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
typedef struct {
UINT32 cpupID; /**< Irq ID */
UINT16 status; /**< Irq status */
UINT64 allTime; /**< Total running time */
UINT64 startTime; /**< Time before a task is invoked */
UINT64 timeMax; /**< Irq samples count */
UINT64 count; /**< Irq samples count */
UINT64 historyTime[OS_CPUP_HISTORY_RECORD_NUM]; /**< Historical running time */
} OsIrqCpupCB;
#endif
/**
* @ingroup los_cpup
* @brief Initialization cpup.
@@ -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
}

View 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 = [ "." ]
}

View 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

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_debugtools.h"
#include "securec.h"
#include "los_debug.h"
#include "los_memory.h"
#include "los_arch.h"
#include "los_interrupt.h"
#include "los_arch_interrupt.h"
#if (LOSCFG_DEBUG_TOOLS == 1)
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) && (LOSCFG_BASE_CORE_SWTMR == 1)
#include "los_cpup.h"
#define IRQ_CPUP_INFO_SIZE (sizeof(CPUP_INFO_S) * LOSCFG_PLATFORM_HWI_LIMIT)
#define IRQ_CPUP_ALL_INFO_SIZE (IRQ_CPUP_INFO_SIZE + IRQ_CPUP_INFO_SIZE)
#define IRQ_DATA_SIZE sizeof(OsIrqCpupCB)
#define CPUP_PRECISION_MULT LOS_CPUP_PRECISION_MULT
STATIC VOID ShellCmdHwiInfoShow(OsIrqCpupCB *irqData, CPUP_INFO_S *hwiCpup1s,
CPUP_INFO_S *hwiCpup10s)
{
UINT32 i;
UINT32 intSave;
UINT32 count;
UINT64 cycles = 0;
UINT64 timeMax = 0;
CHAR *irqName = NULL;
OsIrqCpupCB *irqDataBase = OsGetIrqCpupArrayBase();
if (irqDataBase == NULL) {
PRINT_ERR("get hwi info error\n");
return;
}
for (i = 0; i < LOSCFG_PLATFORM_HWI_LIMIT; i++) {
if ((OsGetHwiCreated(i) != TRUE) || (OsGetHwiFormCnt(i) == 0)) {
continue;
}
intSave = LOS_IntLock();
(VOID)memcpy_s(irqData, IRQ_DATA_SIZE, &irqDataBase[i], IRQ_DATA_SIZE);
LOS_IntRestore(intSave);
if (irqData->status == 0) {
continue;
}
count = OsGetHwiFormCnt(i);
if (count != 0) {
if (irqData->count != 0) {
cycles = (irqData->allTime * OS_NS_PER_CYCLE) / (irqData->count * OS_SYS_NS_PER_US);
}
timeMax = (irqData->timeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
}
irqName = OsGetHwiFormName(i);
PRINTK(" %10d:%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 */

View File

@@ -0,0 +1,164 @@
/*
* 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 happened\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;
if (g_traceRingBuf != NULL) {
(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 */

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

View File

@@ -134,7 +134,7 @@ typedef struct {
} SymInfo;
#define SYM_EXPORT(func) \
const SymInfo sym_##func __attribute__((section(".sym."#func))) = { \
const SymInfo sym_##func __attribute__((__used__, section(".sym."#func))) = { \
.name = #func, \
.addr = (UINTPTR)func \
};
@@ -149,7 +149,7 @@ const SymInfo sym_##func __attribute__((section(".sym."#func))) = { \
* then the shared library will be loaded to the heap by pool.
*
* @note When the heap, pool, is not NULL, you should call LOS_MemInit() to initialize the
* pool before calling LOS_SoLoad(). By the way, the system will comsume a certain amount
* pool before calling LOS_SoLoad(). By the way, the system will consume a certain amount
* of memory to initialize the pool. LOS_SoLoad must not be called in interrupt callback.
*
* @return Return NULL if error. Return non-NULL if success.

View File

@@ -60,6 +60,6 @@ ${READELF} -l $1 | while read line; do
done
NEED_SIZE=`tail -n 1 ${TMP_FILE}`
echo "${NEED_SIZE} kb memory to reserve for $1!"
echo "${NEED_SIZE} bytes memory to reserve for $1!"
${RM} -f ${TMP_FILE}

View File

@@ -32,7 +32,7 @@
#include "los_compiler.h"
/* Using task extended field to realize IAR TLS function in target_config.h include this header file. */
#define LOSCFG_TASK_STRUCT_EXTENSION VOID *iarTlsArea;
#define LOSCFG_TASK_STRUCT_EXTENSION VOID *iarTlsArea
#if (__VER__ < 8000000)
#include <yvals.h>

View File

@@ -90,7 +90,7 @@ void sys_init(void)
u32_t sys_now(void)
{
/* Lwip docs mentioned like wraparound is not a problem in this funtion */
/* Lwip docs mentioned like wraparound is not a problem in this function */
return (u32_t)((LOS_TickCountGet() * OS_SYS_MS_PER_SECOND) /
LOSCFG_BASE_CORE_TICK_PER_SECOND);
}

View File

@@ -94,6 +94,7 @@ extern INT32 VfsNormalizePath(const CHAR *directory, const CHAR *filename, CHAR
extern INT32 OsShellCmdDate(INT32 argc, const CHAR **argv);
extern INT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv);
extern UINT32 OsShellCmdFree(INT32 argc, const CHAR **argv);
extern UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR **argv);
extern UINT32 lwip_ifconfig(INT32 argc, const CHAR **argv);
extern UINT32 OsShellPing(INT32 argc, const CHAR **argv);
extern INT32 OsShellCmdTouch(INT32 argc, const CHAR **argv);

View File

@@ -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;
@@ -47,11 +51,14 @@ CmdItem g_shellcmdAll[] = {
{CMD_TYPE_STD, "date", XARGS, (CmdCallBackFunc)OsShellCmdDate},
{CMD_TYPE_EX, "task", 1, (CmdCallBackFunc)OsShellCmdDumpTask},
{CMD_TYPE_EX, "free", XARGS, (CmdCallBackFunc)OsShellCmdFree},
#if (LOSCFG_MEM_WATERLINE == 1)
{CMD_TYPE_EX, "memusage", XARGS, (CmdCallBackFunc)OsShellCmdWaterLine},
#endif
#ifdef LWIP_SHELLCMD_ENABLE
{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 +69,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},
};
@@ -75,7 +86,7 @@ CmdModInfo *OsCmdInfoGet(VOID)
* Description: Pass in the string and clear useless space ,which include:
* 1) The overmatch space which is not be marked by Quote's area
* Squeeze the overmatch space into one space
* 2) Clear all space before first vaild character
* 2) Clear all space before first valid character
* Input: cmdKey : Pass in the buff string, which is ready to be operated
* cmdOut : Pass out the buffer string ,which has already been operated
* size : cmdKey length
@@ -104,7 +115,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsCmdKeyShift(const CHAR *cmdKey, CHAR *cmdOut, UI
(VOID)memset_s(output, len + 1, 0, len + 1);
/* Backup the 'output' start address */
outputBak = output;
/* Scan each charactor in 'cmdKey',and squeeze the overmuch space and ignore invaild charactor */
/* Scan each charactor in 'cmdKey',and squeeze the overmuch space and ignore invalid charactor */
for (; *cmdKey != '\0'; cmdKey++) {
/* Detected a Double Quotes, switch the matching status */
if (*(cmdKey) == '\"') {

View File

@@ -49,7 +49,7 @@ LITE_OS_SEC_TEXT_MINOR STATIC UINT32 OsShellCmdFreeInfo(INT32 argc, const CHAR *
if ((argc == 0) ||
((argc == 1) && (strcmp(argv[0], "-k") == 0)) ||
((argc == 1) && (strcmp(argv[0], "-m") == 0))) {
PRINTK("\r\n total used free\n");
PRINTK("\n total used free\n");
}
if ((argc == 1) && (strcmp(argv[0], "-k") == 0)) {
@@ -79,3 +79,32 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdFree(INT32 argc, const CHAR *argv[])
return 0;
}
#if (LOSCFG_MEM_WATERLINE == 1)
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR *argv[])
{
UINT32 ret;
LOS_MEM_POOL_STATUS poolStatus;
if (argc > 1) {
PRINTK("\nUsage: memusage or memusage [-k/-m]\n");
return OS_ERROR;
}
if (LOS_MemInfoGet(m_aucSysMem0, &poolStatus) != LOS_OK) {
return OS_ERROR;
}
if ((argc == 1) && (strcmp(argv[0], "-k") == 0)) {
PRINTK("Mem WaterLine: %-9u\n", MEM_SIZE_TO_KB(poolStatus.usageWaterLine));
} else if ((argc == 1) && (strcmp(argv[0], "-m") == 0)) {
PRINTK("Mem WaterLine: %-9u\n", MEM_SIZE_TO_MB(poolStatus.usageWaterLine));
} else if (argc == 0) {
PRINTK("Mem WaterLine: %-9u\n", poolStatus.usageWaterLine);
} else {
PRINTK("\nUsage: memusage or memusage [-k/-m]\n");
return OS_ERROR;
}
return 0;
}
#endif

View File

@@ -14,7 +14,7 @@ config TRACE_FRAME_CORE_MSG
depends on TRACE_MSG_EXTEND
config TRACE_FRAME_EVENT_COUNT
bool "Record event count, which indicate the sequence of happend events"
bool "Record event count, which indicate the sequence of happened events"
default n
depends on TRACE_MSG_EXTEND

View File

@@ -133,7 +133,7 @@ typedef enum {
/**
* @ingroup los_trace
* Trace event type which indicate the exactly happend events, user can define own module's event type like
* Trace event type which indicate the exactly happened events, user can define own module's event type like
* TRACE_#MODULE#_FLAG | NUMBER.
* 28 4
* 0 0 0 0 0 0 0 0 X X X X X X X X 0 0 0 0 0 0
@@ -241,7 +241,7 @@ typedef struct {
#endif
#if (LOSCFG_TRACE_FRAME_EVENT_COUNT == 1)
UINT32 eventCount; /**< the sequence of happend events */
UINT32 eventCount; /**< the sequence of happened events */
#endif
UINTPTR params[LOSCFG_TRACE_FRAME_MAX_PARAMS]; /**< event frame's params */
@@ -350,8 +350,8 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
#define QUEUE_CREATE_PARAMS(queueId, queueSz, itemSz, queueAddr, memType) \
queueId, queueSz, itemSz, queueAddr, memType
#define QUEUE_DELETE_PARAMS(queueId, state, readable) queueId, state, readable
#define QUEUE_RW_PARAMS(queueId, queueSize, bufSize, operateType, readable, writeable, timeout) \
queueId, queueSize, bufSize, operateType, readable, writeable, timeout
#define QUEUE_RW_PARAMS(queueId, queueSize, bufSize, operateType, readable, writable, timeout) \
queueId, queueSize, bufSize, operateType, readable, writable, timeout
#define SEM_CREATE_PARAMS(semId, type, count) semId, type, count
#define SEM_DELETE_PARAMS(semId, delRetCode) semId, delRetCode

View File

@@ -4,7 +4,7 @@ config DRIVERS
help
Answer Y to enable LiteOS support driver.
source "../../drivers/adapter/khdf/liteos_m/Kconfig"
source "../../drivers/hdf_core/adapter/khdf/liteos_m/Kconfig"
# Device driver Kconfig import
osource "$(DEVICE_PATH)/drivers/Kconfig"

View File

@@ -692,11 +692,6 @@ osTimerId_t osTimerNew(osTimerFunc_t func, osTimerType_t type, void *argument, c
return NULL;
}
if (osTimerOnce == type) {
mode = LOS_SWTMR_MODE_NO_SELFDELETE;
} else {
mode = LOS_SWTMR_MODE_PERIOD;
}
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
if (LOS_SwtmrCreate(1, mode, (SWTMR_PROC_FUNC)func, &swtmrId, (UINT32)(UINTPTR)argument,
osTimerRousesAllow, osTimerAlignIgnore) != LOS_OK) {

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-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:
@@ -32,6 +32,7 @@ import("//kernel/liteos_m/liteos.gni")
module_name = get_path_info(rebase_path("."), "name")
module_group(module_name) {
modules = [
"iccarm",
"musl",
"newlib",
]

View File

@@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
# Copyright (c) 2020-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:
@@ -41,4 +41,8 @@ config LIBC_NEWLIB
bool "newlibc"
rsource "newlib/Kconfig"
config LIBC_ICCARM
bool "iar libc"
rsource "iccarm/Kconfig"
endchoice

42
kal/libc/iccarm/BUILD.gn Normal file
View File

@@ -0,0 +1,42 @@
# 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")
import("//third_party/musl/porting/liteos_m_iccarm/kernel/iccarm.gni")
module_switch = defined(LOSCFG_LIBC_ICCARM)
module_name = get_path_info(rebase_path("."), "name")
kernel_module(module_name) {
configs += [ "$LITEOSTOPDIR:warn_config" ]
deps = [ "//third_party/musl/porting/liteos_m_iccarm/kernel" ]
}
config("public") {
include_dirs = ICCARM_ADAPT_INCLUDE_DIRS
}

38
kal/libc/iccarm/Kconfig Normal file
View File

@@ -0,0 +1,38 @@
# 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.
if LIBC_ICCARM
config LIBC_ICCARM_FS
bool "Enable POSIX file system API support"
default y
depends on FS_VFS
help
This enables POSIX style file system related APIs.
endif # LIBC_ICCARM

View File

@@ -35,4 +35,10 @@
#define O_NDELAY _FNDELAY
#ifdef __riscv
#ifndef O_CLOEXEC
#define O_CLOEXEC 02000000
#endif
#endif /* __riscv */
#endif /* !_ADAPT_SYS_FCNTL_H */

View File

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

View File

@@ -37,4 +37,38 @@
#include_next <time.h>
#ifdef __riscv
#ifndef CLOCK_MONOTONIC_RAW
#define CLOCK_MONOTONIC_RAW 12
#endif
#ifndef CLOCK_REALTIME_COARSE
#define CLOCK_REALTIME_COARSE 5
#endif
#ifndef CLOCK_MONOTONIC_COARSE
#define CLOCK_MONOTONIC_COARSE 6
#endif
#ifndef CLOCK_BOOTTIME
#define CLOCK_BOOTTIME 7
#endif
#ifndef CLOCK_REALTIME_ALARM
#define CLOCK_REALTIME_ALARM 8
#endif
#ifndef CLOCK_BOOTTIME_ALARM
#define CLOCK_BOOTTIME_ALARM 9
#endif
#ifndef CLOCK_SGI_CYCLE
#define CLOCK_SGI_CYCLE 10
#endif
#ifndef CLOCK_TAI
#define CLOCK_TAI 11
#endif
#endif /* __riscv */
#endif /* !_ADAPT_TIME_H */

View File

@@ -45,7 +45,7 @@
#define PTHREAD_NAMELEN 16
#define PTHREAD_KEY_UNUSED 0
#define PTHREAD_KEY_USED 1
#define PTHREAD_TASK_INVAILD 0
#define PTHREAD_TASK_INVALID 0
typedef void (*PthreadKeyDtor)(void *);
typedef struct {
@@ -399,7 +399,7 @@ STATIC UINT32 DoPthreadCancel(LosTaskCB *task)
LOS_TaskLock();
pthreadData = (PthreadData *)(UINTPTR)task->arg;
pthreadData->canceled = 0;
if ((task->taskStatus == PTHREAD_TASK_INVAILD) || (LOS_TaskSuspend(task->taskID) != LOS_OK)) {
if ((task->taskStatus == PTHREAD_TASK_INVALID) || (LOS_TaskSuspend(task->taskID) != LOS_OK)) {
ret = LOS_NOK;
goto OUT;
}

View File

@@ -638,10 +638,8 @@ extern UINT8 *m_aucSysMem0;
/**
* @ingroup los_config
* Task extension field additional functions, such as IAR TLS.
* Please Use the LOSCFG_TASK_STRUCT_EXTENSION macro to define your task extended fields in target_config.h
*/
#ifndef LOSCFG_TASK_STRUCT_EXTENSION
#define LOSCFG_TASK_STRUCT_EXTENSION
#endif
#ifndef LOSCFG_TASK_CREATE_EXTENSION_HOOK
#define LOSCFG_TASK_CREATE_EXTENSION_HOOK(taskCB)
#endif

View File

@@ -238,7 +238,7 @@ extern VOID LOS_ShowBox(VOID *pool);
*
* @param boxMem [IN] Type #VOID* Pointer to the calculate membox.
* @param maxBlk [OUT] Type #UINT32* Record membox max block.
* @param blkCnt [OUT] Type #UINT32* Record membox block count alreay allocated.
* @param blkCnt [OUT] Type #UINT32* Record membox block count already allocated.
* @param blkSize [OUT] Type #UINT32* Record membox block size.
*
* @retval #LOS_OK The heap status calculate success.

View File

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

View File

@@ -1500,7 +1500,9 @@ typedef struct {
#if (LOSCFG_KERNEL_SIGNAL == 1)
VOID *sig; /**< Task signal */
#endif
LOSCFG_TASK_STRUCT_EXTENSION /**< Task extension field */
#ifdef LOSCFG_TASK_STRUCT_EXTENSION
LOSCFG_TASK_STRUCT_EXTENSION; /**< Task extension field */
#endif
} LosTaskCB;
STATIC INLINE BOOL OsTaskIsExit(const LosTaskCB *taskCB)
@@ -1584,7 +1586,9 @@ extern UINT32 g_idleTaskID;
* Software timer task ID.
*
*/
#if (LOSCFG_BASE_CORE_SWTMR == 1)
extern UINT32 g_swtmrTaskID;
#endif
/**
* @ingroup los_task

View File

@@ -157,6 +157,10 @@ extern UINT32 g_sysClock;
#define OS_SYS_NS_TO_CYCLE(time, freq) (((time) / OS_SYS_NS_PER_SECOND) * (freq) + \
((time) % OS_SYS_NS_PER_SECOND) * (freq) / OS_SYS_NS_PER_SECOND)
#define OS_SYS_TICK_TO_CYCLE(ticks) (((UINT64)(ticks) * g_sysClock) / LOSCFG_BASE_CORE_TICK_PER_SECOND)
#define OS_SYS_CYCLE_TO_TICK(cycle) ((((UINT64)(cycle)) * LOSCFG_BASE_CORE_TICK_PER_SECOND) / g_sysClock)
/**
* @ingroup los_tick
* System time basic function error code: Null pointer.

View File

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

View File

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

View File

@@ -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,14 +88,16 @@ 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);
}
intSave = LOS_IntLock();
SET_SORTLIST_VALUE(node, startTime + (UINT64)waitTicks * OS_CYCLE_PER_TICK);
SET_SORTLIST_VALUE(node, startTime + OS_SYS_TICK_TO_CYCLE(waitTicks));
OsAddNode2SortLink(sortLinkHead, node);
LOS_IntRestore(intSave);
}
@@ -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");

View File

@@ -141,8 +141,8 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrTaskCreate(VOID)
STATIC UINT64 OsSwtmrCalcStartTime(UINT64 currTime, SWTMR_CTRL_S *swtmr, const SWTMR_CTRL_S *alignSwtmr)
{
UINT64 usedTime, startTime;
UINT64 alignEnd = (UINT64)alignSwtmr->uwInterval * OS_CYCLE_PER_TICK;
UINT64 swtmrTime = (UINT64)swtmr->uwInterval * OS_CYCLE_PER_TICK;
UINT64 alignEnd = OS_SYS_TICK_TO_CYCLE(alignSwtmr->uwInterval);
UINT64 swtmrTime = OS_SYS_TICK_TO_CYCLE(swtmr->uwInterval);
UINT64 remainTime = OsSortLinkGetRemainTime(currTime, &alignSwtmr->stSortList);
if (remainTime == 0) {
startTime = GET_SORTLIST_VALUE(&alignSwtmr->stSortList);
@@ -357,7 +357,7 @@ LITE_OS_SEC_TEXT UINT32 OsSwtmrGetNextTimeout(VOID)
UINT32 intSave = LOS_IntLock();
UINT64 time = OsSortLinkGetNextExpireTime(g_swtmrSortLinkList);
LOS_IntRestore(intSave);
time = time / OS_CYCLE_PER_TICK;
time = OS_SYS_CYCLE_TO_TICK(time);
if (time > OS_NULL_INT) {
time = OS_NULL_INT;
}
@@ -367,7 +367,7 @@ LITE_OS_SEC_TEXT UINT32 OsSwtmrGetNextTimeout(VOID)
LITE_OS_SEC_TEXT UINT32 OsSwtmrTimeGet(const SWTMR_CTRL_S *swtmr)
{
UINT64 time = OsSortLinkGetTargetExpireTime(OsGetCurrSchedTimeCycle(), &swtmr->stSortList);
time = time / OS_CYCLE_PER_TICK;
time = OS_SYS_CYCLE_TO_TICK(time);
if (time > OS_NULL_INT) {
time = OS_NULL_INT;
}

View File

@@ -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();
@@ -301,18 +307,28 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader(VOID)
{
PRINTK("\r\n TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID");
#if (LOSCFG_TASK_MEM_USED == 1)
PRINTK(" AllocSize");
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
PRINTK(" CPUUSE CPUUSE10s CPUUSE1s ");
#endif /* LOSCFG_BASE_CORE_CPUP */
PRINTK(" TaskEntry name\n");
PRINTK(" --- -------- -------- ");
PRINTK("--------- --------- ---------- ---------- --------- ------ ");
#if (LOSCFG_TASK_MEM_USED == 1)
PRINTK("--------- ");
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
PRINTK("------- --------- -------- ");
#endif /* LOSCFG_BASE_CORE_CPUP */
PRINTK("---------- ----\n");
}
#if (LOSCFG_TASK_MEM_USED == 1)
STATIC UINT32 g_taskMemUsed[LOSCFG_BASE_CORE_TSK_LIMIT + 1];
#endif
/*****************************************************************************
Function : OsGetAllTskInfo
Description : Get all task info.
@@ -332,6 +348,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
CPUP_INFO_S *cpuOneSec = (CPUP_INFO_S *)NULL;
#endif
#if (LOSCFG_TASK_MEM_USED == 1)
(VOID)memset_s(g_taskMemUsed, sizeof(UINT32) * g_taskMaxNum, 0, sizeof(UINT32) * g_taskMaxNum);
OsTaskMemUsed((VOID *)OS_SYS_MEM_ADDR, g_taskMemUsed, g_taskMaxNum);
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
if (OsGetAllTskCpupInfo(&cpuLessOneSec, &cpuTenSec, &cpuOneSec) != LOS_OK) {
return OS_ERROR;
@@ -351,6 +372,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask, semID);
#if (LOSCFG_TASK_MEM_USED == 1)
PRINTK("%#10x", g_taskMemUsed[loopNum]);
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
PRINTK("%6u.%-2u%7u.%-2u%6u.%-2u ",
@@ -753,7 +777,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 +1236,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 +1526,5 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 mSecs)
VOID LOS_TaskResRecycle(VOID)
{
OsRecyleFinishedTask();
OsRecycleFinishedTask();
}

View File

@@ -49,13 +49,17 @@ LITE_OS_SEC_BSS STATIC UINT64 g_tickTimerStartTime;
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
STATIC UINT64 g_tickTimerBase;
STATIC UINT64 g_oldTickTimerBase;
STATIC BOOL g_tickTimerBaseUpdate = FALSE;
LITE_OS_SEC_TEXT STATIC VOID OsUpdateSysTimeBase(VOID)
{
UINT32 period = 0;
(VOID)g_sysTickTimer->getCycle(&period);
g_tickTimerBase += period;
if (g_tickTimerBaseUpdate == FALSE) {
(VOID)g_sysTickTimer->getCycle(&period);
g_tickTimerBase += period;
}
g_tickTimerBaseUpdate = FALSE;
}
LITE_OS_SEC_TEXT VOID OsTickTimerBaseReset(UINT64 currTime)
@@ -96,6 +100,7 @@ LITE_OS_SEC_TEXT UINT64 LOS_SysCycleGet(VOID)
/* Turn the timer count */
g_tickTimerBase += period;
schedTime = g_tickTimerBase + time;
g_tickTimerBaseUpdate = TRUE;
}
LOS_ASSERT(schedTime >= g_oldTickTimerBase);
@@ -285,7 +290,7 @@ Return : current tick
*****************************************************************************/
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_TickCountGet(VOID)
{
return (LOS_SysCycleGet() - g_tickTimerStartTime) / g_cyclesPerTick;
return OS_SYS_CYCLE_TO_TICK(LOS_SysCycleGet() - g_tickTimerStartTime);
}
/*****************************************************************************

View File

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

View File

@@ -52,7 +52,7 @@ import("$root_out_dir/config.gni")
LITEOSTOPDIR = "//kernel/liteos_m"
LITEOSTHIRDPARTY = "//third_party"
HDFTOPDIR = "//drivers/adapter/khdf/liteos_m"
HDFTOPDIR = "//drivers/hdf_core/adapter/khdf/liteos_m"
ARCH = ""
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {

View File

@@ -181,7 +181,7 @@ typedef enum EXCn {
#define __ICACHE_PRESENT 0 /*!< Set to 1 if I-Cache is present */
#define __DCACHE_PRESENT 0 /*!< Set to 1 if D-Cache is present */
#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
#define __Vendor_EXCEPTION 0 /*!< Set to 1 if vendor exception hander is present */
#define __Vendor_EXCEPTION 0 /*!< Set to 1 if vendor exception handler is present */
/** @} */ /* End of group Configuration_of_CMSIS */

View File

@@ -84,7 +84,7 @@
#endif
#endif
/****************** C Compilers dependant keywords ****************************/
/****************** C Compilers dependent keywords ****************************/
/* In HS mode and when the DMA is used, all variables and data structures dealing
with the DMA during the transaction process should be 4-bytes aligned */
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED

View File

@@ -195,7 +195,7 @@ typedef enum EXCn {
#define __ICACHE_PRESENT 0 /*!< Set to 1 if I-Cache is present */
#define __DCACHE_PRESENT 0 /*!< Set to 1 if D-Cache is present */
#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
#define __Vendor_EXCEPTION 0 /*!< Set to 1 if vendor exception hander is present */
#define __Vendor_EXCEPTION 0 /*!< Set to 1 if vendor exception handler is present */
/** @} */ /* End of group Configuration_of_CMSIS */

View File

@@ -94,7 +94,7 @@ OF SUCH DAMAGE.
/* USARTx_CTL1 */
#define USART_CTL1_ADDR BITS(0,3) /*!< address of USART */
#define USART_CTL1_LBLEN BIT(5) /*!< LIN break frame length */
#define USART_CTL1_LBDIE BIT(6) /*!< LIN break detected interrupt eanble */
#define USART_CTL1_LBDIE BIT(6) /*!< LIN break detected interrupt enable */
#define USART_CTL1_CLEN BIT(8) /*!< CK length */
#define USART_CTL1_CPH BIT(9) /*!< CK phase */
#define USART_CTL1_CPL BIT(10) /*!< CK polarity */

View File

@@ -386,11 +386,11 @@ static uint32_t usbd_int_rxfifo (usb_core_driver *udev)
break;
case RSTAT_XFER_COMP:
/* trigger the OUT enpoint interrupt */
/* trigger the OUT endpoint interrupt */
break;
case RSTAT_SETUP_COMP:
/* trigger the OUT enpoint interrupt */
/* trigger the OUT endpoint interrupt */
break;
case RSTAT_SETUP_UPDT:

View File

@@ -56,7 +56,7 @@ void usbd_init (usb_core_driver *udev, usb_core_enum core, usb_class_core *class
/* device descriptor, class and user callbacks */
udev->dev.class_core = class_core;
/* configure USB capabilites */
/* configure USB capabilities */
usb_basic_init (&udev->bp, &udev->regs, core);
/* initailizes the USB core*/

View File

@@ -214,7 +214,7 @@ void usbh_core_task (usb_core_driver *pudev, usbh_host *puhost)
break;
case HOST_CLASS_ENUM:
/* process class standard contol requests state machine */
/* process class standard control requests state machine */
status = puhost->class_cb->class_requests(pudev, puhost);
if (USBH_OK == status) {

View File

@@ -182,7 +182,7 @@ ErrStatus can_init(uint32_t can_periph, can_parameter_struct* can_parameter_init
}else{
CAN_CTL(can_periph) &= ~CAN_CTL_TTC;
}
/* automatic bus-off managment */
/* automatic bus-off management */
if(ENABLE == can_parameter_init->auto_bus_off_recovery){
CAN_CTL(can_periph) |= CAN_CTL_ABOR;
}else{

View File

@@ -665,7 +665,7 @@ void dma_interrupt_flag_clear(uint32_t dma_periph, dma_channel_enum channelx, ui
\param[in] channelx: specify which DMA channel
only one parameter can be selected which is shown as below:
\arg DMA0: DMA_CHx(x=0..6), DMA1: DMA_CHx(x=0..4)
\param[in] source: specify which interrupt to enbale
\param[in] source: specify which interrupt to enable
one or more parameters can be selected which are shown as below
\arg DMA_INT_FTF: channel full transfer finish interrupt
\arg DMA_INT_HTF: channel half transfer finish interrupt
@@ -689,7 +689,7 @@ void dma_interrupt_enable(uint32_t dma_periph, dma_channel_enum channelx, uint32
\param[in] channelx: specify which DMA channel
only one parameter can be selected which is shown as below:
\arg DMA0: DMA_CHx(x=0..6), DMA1: DMA_CHx(x=0..4)
\param[in] source: specify which interrupt to disbale
\param[in] source: specify which interrupt to disable
one or more parameters can be selected which are shown as below
\arg DMA_INT_FTF: channel full transfer finish interrupt
\arg DMA_INT_HTF: channel half transfer finish interrupt

View File

@@ -244,7 +244,7 @@ void rtc_interrupt_flag_clear(uint32_t flag)
/*!
\brief enable RTC interrupt
\param[in] interrupt: specify which interrupt to enbale
\param[in] interrupt: specify which interrupt to enable
one or more parameters can be selected which are shown as below:
\arg RTC_INT_SECOND: second interrupt
\arg RTC_INT_ALARM: alarm interrupt
@@ -259,7 +259,7 @@ void rtc_interrupt_enable(uint32_t interrupt)
/*!
\brief disable RTC interrupt
\param[in] interrupt: specify which interrupt to disbale
\param[in] interrupt: specify which interrupt to disable
one or more parameters can be selected which are shown as below:
\arg RTC_INT_SECOND: second interrupt
\arg RTC_INT_ALARM: alarm interrupt

View File

@@ -80,7 +80,7 @@ void spi_i2s_deinit(uint32_t spi_periph)
/*!
\brief initialize the parameters of SPI struct with the default values
\param[in] spi_struct: SPI parameter stuct
\param[in] spi_struct: SPI parameter struct
\param[out] none
\retval none
*/

View File

@@ -407,7 +407,7 @@ void timer_dma_enable(uint32_t timer_periph, uint16_t dma)
/*!
\brief disable the TIMER DMA
\param[in] timer_periph: TIMERxTIMERx(x=0..6)
\param[in] dma: specify which DMA to disbale
\param[in] dma: specify which DMA to disable
one or more parameters can be selected which are shown as below:
\arg TIMER_DMA_UPD: update DMA enable, TIMERx(x=0..6)
\arg TIMER_DMA_CH0D: channel 0 DMA enable, TIMERx(x=0..4)
@@ -1844,7 +1844,7 @@ void timer_interrupt_enable(uint32_t timer_periph, uint32_t interrupt)
/*!
\brief disable the TIMER interrupt
\param[in] timer_periph: TIMERx(x=0..6)
\param[in] interrupt: specify which interrupt to disbale
\param[in] interrupt: specify which interrupt to disable
one or more parameters can be selected which are shown as below:
\arg TIMER_INT_UP: update interrupt enable, TIMERx(x=0..6)
\arg TIMER_INT_CH0: channel 0 interrupt enable, TIMERx(x=0..4)

View File

@@ -245,7 +245,7 @@ extern void ICunitSaveErr(iiUINT32 line, iiUINT32 retCode);
do { \
if ((param) != (value)) { \
ICunitSaveErr(__LINE__, (iiUINT32)retcode); \
return 1; \
return; \
} \
} while (0)

View File

@@ -300,7 +300,7 @@ extern UINT32 TaskUsedCountGet(VOID);
#define HWI_NUM_TEST 31 // csky_v2 only support one software interrupt number
#define LOS_KERNEL_MULTI_HWI_TEST 0 // csky_v2 not support multiple hwi number test case
#elif __XTENSA_LX6__
#define HWI_NUM_TEST 7 // xtensa_lx6 only suppport one software interrupt number
#define HWI_NUM_TEST 7 // xtensa_lx6 only support one software interrupt number
#define LOS_KERNEL_MULTI_HWI_TEST 0 // xtensa_lx6 not support multiple hwi number test case
#else
#define HWI_NUM_TEST HWI_NUM_INT7

View File

@@ -35,9 +35,6 @@ static VOID HwiF01(VOID)
{
TestHwiClear(HWI_NUM_TEST);
g_testCount++;
EXIT:
return;
}
static UINT32 Testcase(VOID)

View File

@@ -53,7 +53,7 @@ static UINT32 Testcase(VOID)
g_testCount = 0;
for (j = 0; j < SWTMR_LOOP_NUM; j++) {
for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT; i++) {
for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT + 1; i++) {
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case1, &swTmrID[i], 0xabcdbcda
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
@@ -61,20 +61,16 @@ static UINT32 Testcase(VOID)
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, i, EXIT);
if (ret != LOS_OK) {
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_MAXSIZE, ret, EXIT);
}
}
// 4, Timeout interval of a periodic software timer.
ret = LOS_SwtmrCreate(4, LOS_SWTMR_MODE_PERIOD, Case1, &swTmrID[i], 0xabcdbcda
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
,
OS_SWTMR_ROUSES_ALLOW, OS_SWTMR_ALIGN_INSENSITIVE
#endif
);
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_MAXSIZE, ret, EXIT);
for (i = 0; i < LOSCFG_BASE_CORE_SWTMR_LIMIT; i++) {
ret = LOS_SwtmrDelete(swTmrID[i]);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
if (ret != LOS_OK) {
ICUNIT_GOTO_EQUAL(ret, LOS_ERRNO_SWTMR_NOT_CREATED, ret, EXIT);
}
}
}
return LOS_OK;

View File

@@ -56,7 +56,7 @@ static VOID TaskF01(VOID)
ICUNIT_GOTO_STRING_EQUAL(g_taskInfo.acName, "Tsk049A", g_taskInfo.acName, EXIT1);
ICUNIT_GOTO_EQUAL(g_taskInfo.uwTaskID, g_testTaskID01, g_taskInfo.uwTaskID, EXIT1);
// 2, Assert that current task`s priority is equal to the priority was setted.
// 2, Assert that current task`s priority is equal to the priority was set.
ICUNIT_GOTO_EQUAL(g_taskInfo.usTaskPrio, TASK_PRIO_TEST - 2, g_taskInfo.usTaskPrio, EXIT1);
ICUNIT_GOTO_EQUAL(OS_TASK_STATUS_RUNNING & g_taskInfo.usTaskStatus, OS_TASK_STATUS_RUNNING,
OS_TASK_STATUS_RUNNING & g_taskInfo.usTaskStatus, EXIT1);

View File

@@ -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++;
@@ -872,13 +853,13 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread013, Function | MediumTest | Lev
ret = pthread_condattr_getclock(&condattr, &clk);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(clk, 0, clk);
ICUNIT_ASSERT_EQUAL(clk, CLOCK_REALTIME, clk);
ret = pthread_condattr_setclock(&condattr, 0);
ret = pthread_condattr_setclock(&condattr, CLOCK_REALTIME);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ret = pthread_condattr_getclock(&condattr, &clk);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
ICUNIT_ASSERT_EQUAL(clk, 0, clk);
ICUNIT_ASSERT_EQUAL(clk, CLOCK_REALTIME, clk);
struct timespec ts = {0};
ret = clock_getres(CLOCK_MONOTONIC, &ts);

View File

@@ -63,7 +63,6 @@ hctest_suite("PosixTest") {
include_dirs = [
"//test/xts/tools/hctest/include",
"//third_party/unity/src",
"src",
]
cflags = [ "-Wno-error" ]

View File

@@ -93,7 +93,7 @@ static BOOL MqueueFuncTestSuiteTearDown(void)
/**
* @tc.number : SUB_KERNEL_PTHREAD_OPERATION_001
* @tc.name : event operation for creat
* @tc.name : event operation for create
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(MqueueFuncTestSuite, testMqueue001, Function | MediumTest | Level1)

View File

@@ -154,7 +154,7 @@ LITE_TEST_CASE(PosixSemaphoreFuncTestSuite, testIpcSem_Timedwait002, Function |
LOG("\n timeDiff %d", timeDiff);
TEST_ASSERT_LESS_THAN_INT(20, timeDiff);
// try get semphore again
// try get semaphore again
ts = GetDelayedTime(100);
LOG("\n ts %d, %d", ts.tv_sec, ts.tv_nsec);
ret = sem_timedwait((sem_t *)&sem, &ts);

View File

@@ -96,12 +96,12 @@ static int KeepRun(int msec)
clock_gettime(CLOCK_MONOTONIC, &time1);
LOG("KeepRun start : tv_sec=%ld, tv_nsec=%ld\n", time1.tv_sec, time1.tv_nsec);
int loop = 0;
int runned = 0;
while (runned < msec) {
int ran = 0;
while (ran < msec) {
++loop;
clock_gettime(CLOCK_MONOTONIC, &time2);
runned = (time2.tv_sec - time1.tv_sec) * MILLISECONDS_PER_SECOND;
runned += (time2.tv_nsec - time1.tv_nsec) / NANOSECONDS_PER_MILLISECOND;
ran = (time2.tv_sec - time1.tv_sec) * MILLISECONDS_PER_SECOND;
ran += (time2.tv_nsec - time1.tv_nsec) / NANOSECONDS_PER_MILLISECOND;
}
LOG("KeepRun end : tv_sec=%ld, tv_nsec=%ld\n", time2.tv_sec, time2.tv_nsec);