[PATCH 17/26] leon, ckinit: avoid assuming 1MHz timer pre-scaler clock

Daniel Hellstrom daniel at gaisler.com
Mon Jun 29 11:28:04 UTC 2020


---
 bsps/shared/grlib/btimer/tlib_ckinit.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/bsps/shared/grlib/btimer/tlib_ckinit.c b/bsps/shared/grlib/btimer/tlib_ckinit.c
index 4f67998..5ac3250 100644
--- a/bsps/shared/grlib/btimer/tlib_ckinit.c
+++ b/bsps/shared/grlib/btimer/tlib_ckinit.c
@@ -209,15 +209,14 @@ static uint32_t simple_tlib_tc_get_timecount(struct timecounter *tc)
 
 static rtems_device_driver simple_initialize_counter(void)
 {
-  uint64_t frequency;
-  unsigned int tick_hz;
+  unsigned int tick_hz, frequency;
 
-  frequency = 1000000;
+  tlib_get_freq(priv.tlib_tick, &frequency, NULL);
   tick_hz = rtems_configuration_get_microseconds_per_tick();
 
   rtems_timecounter_simple_install(
     &priv.tc_simple,
-    frequency,
+    (uint64_t)frequency,
     tick_hz,
     simple_tlib_tc_get_timecount
   );
-- 
2.7.4



More information about the devel mailing list