jlaitine commented on code in PR #15929:
URL: https://github.com/apache/nuttx/pull/15929#discussion_r1983873683


##########
arch/risc-v/src/common/riscv_mtimer.c:
##########
@@ -211,19 +210,20 @@ static int riscv_mtimer_max_delay(struct 
oneshot_lowerhalf_s *lower,
 
 static int riscv_mtimer_start(struct oneshot_lowerhalf_s *lower,
                               oneshot_callback_t callback, void *arg,
-                              const struct timespec *ts)
+                              clock_t ticks)
 {
   struct riscv_mtimer_lowerhalf_s *priv =
     (struct riscv_mtimer_lowerhalf_s *)lower;
   irqstate_t flags;
   uint64_t mtime;
+  clock_t current;
   uint64_t alarm;
 
   flags = up_irq_save();
 
   mtime = riscv_mtimer_get_mtime(priv);
-  alarm = mtime + ts->tv_sec * priv->freq +
-          ts->tv_nsec * priv->freq / NSEC_PER_SEC;
+  current = mtime * TICK_PER_SEC / priv->freq;
+  alarm = (current + ticks) * priv->freq / TICK_PER_SEC;

Review Comment:
   I have that PR, but I don't use tickless mode. This patch should not affect 
tickless mode afaik. It just corrects the tick timer which is currently broken 
in risc-v. We have had custom patches in our own branches to fix this issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to