Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunke120
rt-thread
提交
ece0c6ee
R
rt-thread
项目概览
yunke120
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ece0c6ee
编写于
10月 07, 2022
作者:
W
Wayne Lin
提交者:
Bernard Xiong
10月 11, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move gtimer driver to libcpu.
上级
5d014e8d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
207 deletion
+7
-207
bsp/ft2004/drivers/gtimer.c
bsp/ft2004/drivers/gtimer.c
+0
-179
bsp/ft2004/drivers/gtimer.h
bsp/ft2004/drivers/gtimer.h
+0
-27
libcpu/arm/cortex-a/armv7.h
libcpu/arm/cortex-a/armv7.h
+6
-0
libcpu/arm/cortex-a/gtimer.c
libcpu/arm/cortex-a/gtimer.c
+1
-1
未找到文件。
bsp/ft2004/drivers/gtimer.c
已删除
100644 → 0
浏览文件 @
5d014e8d
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-03-30 huijie.feng first version
*/
#include "cp15.h"
#include <rtdef.h>
/** Set CNTFRQ
* This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ).
* @param value: CNTFRQ Register value to set
*/
static
inline
void
__set_cntfrq
(
rt_uint32_t
value
)
{
__set_cp
(
15
,
0
,
value
,
14
,
0
,
0
);
}
/** Get CNTFRQ
* This function returns the value of the PL1 Physical Timer Counter Frequency Register (CNTFRQ).
* return CNTFRQ Register value
*/
static
inline
rt_uint32_t
__get_cntfrq
(
void
)
{
rt_uint32_t
result
;
__get_cp
(
15
,
0
,
result
,
14
,
0
,
0
);
return
result
;
}
/** Set CNTP_TVAL
* This function assigns the given value to PL1 Physical Timer Value Register (CNTP_TVAL).
* param value: CNTP_TVAL Register value to set
*/
static
inline
void
__set_cntp_tval
(
rt_uint32_t
value
)
{
__set_cp
(
15
,
0
,
value
,
14
,
2
,
0
);
}
/** Get CNTP_TVAL
* This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL).
* return CNTP_TVAL Register value
*/
static
inline
rt_uint32_t
__get_cntp_tval
(
void
)
{
rt_uint32_t
result
;
__get_cp
(
15
,
0
,
result
,
14
,
2
,
0
);
return
result
;
}
/** Get CNTPCT
* This function returns the value of the 64 bits PL1 Physical Count Register (CNTPCT).
* return CNTPCT Register value
*/
static
inline
rt_uint64_t
__get_cntpct
(
void
)
{
rt_uint64_t
result
;
__get_cp64
(
15
,
0
,
result
,
14
);
return
result
;
}
/** Set CNTP_CVAL
* This function assigns the given value to 64bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
* param value: CNTP_CVAL Register value to set
*/
static
inline
void
__set_cntp_cval
(
rt_uint64_t
value
)
{
__set_cp64
(
15
,
2
,
value
,
14
);
}
/** Get CNTP_CVAL
* This function returns the value of the 64 bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
* return CNTP_CVAL Register value
*/
static
inline
rt_uint64_t
__get_cntp_cval
(
void
)
{
rt_uint64_t
result
;
__get_cp64
(
15
,
2
,
result
,
14
);
return
result
;
}
/** Set CNTP_CTL
* This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL).
* param value: CNTP_CTL Register value to set
*/
static
inline
void
__set_cntp_ctl
(
rt_uint32_t
value
)
{
__set_cp
(
15
,
0
,
value
,
14
,
2
,
1
);
}
/** Get CNTP_CTL register
* return CNTP_CTL Register value
*/
static
inline
rt_uint32_t
__get_cntp_ctl
(
void
)
{
rt_uint32_t
result
;
__get_cp
(
15
,
0
,
result
,
14
,
2
,
1
);
return
result
;
}
/** Configures the frequency the timer shall run at.
* param value The timer frequency in Hz.
*/
void
gtimer_set_counter_frequency
(
rt_uint32_t
value
)
{
__set_cntfrq
(
value
);
__asm__
volatile
(
"isb 0xF"
:::
"memory"
);
}
/** Get the frequency the timer shall run at.
* return timer frequency in Hz.
*/
rt_uint32_t
gtimer_get_counter_frequency
(
void
)
{
return
(
__get_cntfrq
());
}
/** Sets the reset value of the timer.
* param value: The value the timer is loaded with.
*/
void
gtimer_set_load_value
(
rt_uint32_t
value
)
{
__set_cntp_tval
(
value
);
__asm__
volatile
(
"isb 0xF"
:::
"memory"
);
}
/** Get the current counter value.
* return Current counter value.
*/
rt_uint32_t
gtimer_get_current_value
(
void
)
{
return
(
__get_cntp_tval
());
}
/** Get the current physical counter value.
* return Current physical counter value.
*/
rt_uint64_t
gtimer_get_current_physical_value
(
void
)
{
return
(
__get_cntpct
());
}
/** Set the physical compare value.
* param value: New physical timer compare value.
*/
void
gtimer_set_physical_compare_value
(
rt_uint64_t
value
)
{
__set_cntp_cval
(
value
);
__asm__
volatile
(
"isb 0xF"
:::
"memory"
);
}
/** Get the physical compare value.
* return Physical compare value.
*/
rt_uint64_t
gtimer_get_physical_compare_value
(
void
)
{
return
(
__get_cntp_cval
());
}
/** Configure the timer by setting the control value.
* param value: New timer control value.
*/
void
gtimer_set_control
(
rt_uint32_t
value
)
{
__set_cntp_ctl
(
value
);
__asm__
volatile
(
"isb 0xF"
:::
"memory"
);
}
/** Get the control value.
* return Control value.
*/
rt_uint32_t
gtimer_get_control
(
void
)
{
return
(
__get_cntp_ctl
());
}
bsp/ft2004/drivers/gtimer.h
已删除
100644 → 0
浏览文件 @
5d014e8d
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-03-30 huijie.feng first version
*/
#ifndef __GTIMER_H__
#define __GTIMER_H__
#include <rtdef.h>
void
gtimer_set_counter_frequency
(
rt_uint32_t
value
);
rt_uint32_t
gtimer_get_counter_frequency
(
void
);
void
gtimer_set_load_value
(
rt_uint32_t
value
);
rt_uint32_t
gtimer_get_current_value
(
void
);
rt_uint64_t
gtimer_get_current_physical_value
(
void
);
void
gtimer_set_physical_compare_value
(
rt_uint64_t
value
);
rt_uint64_t
gtimer_get_physical_compare_value
(
void
);
void
gtimer_set_control
(
rt_uint32_t
value
);
rt_uint32_t
gtimer_get_control
(
void
);
#endif
libcpu/arm/cortex-a/armv7.h
浏览文件 @
ece0c6ee
...
...
@@ -69,4 +69,10 @@ struct rt_hw_stack
#define E_Bit (1<<9)
#define J_Bit (1<<24)
#define PABT_EXCEPTION 0x1
#define DABT_EXCEPTION 0x2
#define UND_EXCEPTION 0x3
#define SWI_EXCEPTION 0x4
#define RESV_EXCEPTION 0xF
#endif
libcpu/arm/cortex-a/gtimer.c
浏览文件 @
ece0c6ee
...
...
@@ -86,7 +86,7 @@ static inline rt_uint64_t __get_cntp_cval(void)
* This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL).
* param value: CNTP_CTL Register value to set
*/
static
inline
void
__set_cntp_ctl
(
uint32_t
value
)
static
inline
void
__set_cntp_ctl
(
rt_
uint32_t
value
)
{
__set_cp
(
15
,
0
,
value
,
14
,
2
,
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录