summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcpu/arm/cortex-a/gtimer.c8
-rw-r--r--libcpu/arm/cortex-a/gtimer.h1
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);