[rtems commit] leon, ckinit: avoid assuming 1MHz timer pre-scaler clock

Daniel Hellstrom danielh at rtems.org
Thu Mar 11 16:51:34 UTC 2021


Module:    rtems
Branch:    master
Commit:    9c00cc130128a32655b4bc109f4c3e124605c260
Changeset: http://git.rtems.org/rtems/commit/?id=9c00cc130128a32655b4bc109f4c3e124605c260

Author:    Daniel Hellstrom <daniel at gaisler.com>
Date:      Fri Apr 12 12:20:07 2019 +0200

leon,ckinit: avoid assuming 1MHz timer pre-scaler clock

---

 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 5a34d97..bc52ff4 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
   );



More information about the vc mailing list