Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2020fengziyang
rt-thread
提交
80825913
R
rt-thread
项目概览
2020fengziyang
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
80825913
编写于
6月 14, 2022
作者:
mysterywolf
提交者:
guo
6月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[cputime] suuport perf_counter
上级
b010e434
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
7 deletion
+16
-7
components/drivers/Kconfig
components/drivers/Kconfig
+3
-5
components/drivers/cputime/cputime_cortexm.c
components/drivers/cputime/cputime_cortexm.c
+13
-2
未找到文件。
components/drivers/Kconfig
浏览文件 @
80825913
...
...
@@ -79,12 +79,10 @@ config RT_USING_CPUTIME
if RT_USING_CPUTIME
config RT_USING_CPUTIME_CORTEXM
bool "
Use DWT for CPU time
"
bool "
Support Cortex-M CPU
"
default y
depends on ARCH_ARM_CORTEX_M3 || ARCH_ARM_CORTEX_M4 || ARCH_ARM_CORTEX_M7
help
Some Cortex-M3/4/7 MCU has Data Watchpoint and Trace Register, use
the cycle counter in DWT for CPU time.
depends on ARCH_ARM_CORTEX_M0 || ARCH_ARM_CORTEX_M3 || ARCH_ARM_CORTEX_M4 || ARCH_ARM_CORTEX_M7
select PKG_USING_PERF_COUNTER
endif
config RT_USING_I2C
...
...
components/drivers/cputime/cputime_cortexm.c
浏览文件 @
80825913
...
...
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2017-12-23 Bernard first version
* 2022-06-14 Meco Man suuport pref_counter
*/
#include <rthw.h>
...
...
@@ -13,9 +14,11 @@
#include <rtthread.h>
#include <board.h>
#ifdef PKG_USING_PERF_COUNTER
#include <perf_counter.h>
#endif
/* Use Cycle counter of Data Watchpoint and Trace Register for CPU time */
static
float
cortexm_cputime_getres
(
void
)
{
float
ret
=
1000
*
1000
*
1000
;
...
...
@@ -26,7 +29,11 @@ static float cortexm_cputime_getres(void)
static
uint64_t
cortexm_cputime_gettime
(
void
)
{
#ifdef PKG_USING_PERF_COUNTER
return
get_system_ticks
();
#else
return
DWT
->
CYCCNT
;
#endif
}
const
static
struct
rt_clock_cputime_ops
_cortexm_ops
=
...
...
@@ -35,8 +42,12 @@ const static struct rt_clock_cputime_ops _cortexm_ops =
cortexm_cputime_gettime
};
int
cortexm_cputime_init
(
void
)
{
#ifdef PKG_USING_PERF_COUNTER
clock_cpu_setops
(
&
_cortexm_ops
);
#else
/* check support bit */
if
((
DWT
->
CTRL
&
(
1UL
<<
DWT_CTRL_NOCYCCNT_Pos
))
==
0
)
{
...
...
@@ -52,7 +63,7 @@ int cortexm_cputime_init(void)
clock_cpu_setops
(
&
_cortexm_ops
);
}
#endif
/* PKG_USING_PERF_COUNTER */
return
0
;
}
INIT_BOARD_EXPORT
(
cortexm_cputime_init
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录