[rtems commit] arm/xilinx-zynqmp-rpu: Fix clock driver

Sebastian Huber sebh at rtems.org
Tue Mar 19 12:26:27 UTC 2024


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

Author:    Stanislav Pankevich <stanislav at reflexaerospace.com>
Date:      Tue Mar 19 10:34:57 2024 +0100

arm/xilinx-zynqmp-rpu: Fix clock driver

We observed a strange behavior of the 1Hz timer when running cFS on Zynq
RPU. After some investigation, we reduced the error to the truncation
issue. This patch fixes the issue.

---

 bsps/shared/dev/clock/xil-ttc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/shared/dev/clock/xil-ttc.c b/bsps/shared/dev/clock/xil-ttc.c
index 2c47684045..5121773a6f 100644
--- a/bsps/shared/dev/clock/xil-ttc.c
+++ b/bsps/shared/dev/clock/xil-ttc.c
@@ -126,7 +126,7 @@ static void zynqmp_ttc_clock_driver_support_initialize_hardware(void)
 
   /* Setup match register to generate tick IRQ */
   ttc_clock_instance.irq_match_interval =
-    (uint32_t) ((frequency * microsec_per_tick) / 1000000);
+    (uint32_t) (((uint64_t)frequency * microsec_per_tick) / 1000000);
   XTtcPs_WriteReg(BSP_SELECTED_TTC_ADDR, XTTCPS_MATCH_0_OFFSET,
                   ttc_clock_instance.irq_match_interval);
   /* Clear interupts (clear on read) */



More information about the vc mailing list