diff options
| author | zhouji <[email protected]> | 2021-05-05 23:13:10 +0800 |
|---|---|---|
| committer | zhouji <[email protected]> | 2021-05-14 16:08:32 +0800 |
| commit | ffe8d06bd3a5796cdfa33c979c1ec57b65703f08 (patch) | |
| tree | 9bb949fef69042b64dc4aab4fce7f095e2dcdb8e /libcpu/arm/cortex-a | |
| parent | 1523e4680d6b17a788314cb38386fd391daad819 (diff) | |
[update] 增加获取cortex-a generic timer频率接口
Diffstat (limited to 'libcpu/arm/cortex-a')
| -rw-r--r-- | libcpu/arm/cortex-a/gtimer.c | 8 | ||||
| -rw-r--r-- | libcpu/arm/cortex-a/gtimer.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libcpu/arm/cortex-a/gtimer.c b/libcpu/arm/cortex-a/gtimer.c index b193a1593d..b35acc6e6f 100644 --- a/libcpu/arm/cortex-a/gtimer.c +++ b/libcpu/arm/cortex-a/gtimer.c @@ -110,6 +110,14 @@ void gtimer_set_counter_frequency(rt_uint32_t 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. */ diff --git a/libcpu/arm/cortex-a/gtimer.h b/libcpu/arm/cortex-a/gtimer.h index 160d0cefde..ec5d54127e 100644 --- a/libcpu/arm/cortex-a/gtimer.h +++ b/libcpu/arm/cortex-a/gtimer.h @@ -14,6 +14,7 @@ #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); |
