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


##########
arch/risc-v/src/common/riscv_mtimer.c:
##########
@@ -349,11 +345,11 @@ riscv_mtimer_initialize(uintreg_t mtime, uintreg_t 
mtimecmp,
   priv = kmm_zalloc(sizeof(*priv));
   if (priv != NULL)
     {
-      priv->lower.ops = &g_riscv_mtimer_ops;
-      priv->mtime     = mtime;
-      priv->mtimecmp  = mtimecmp;
-      priv->freq      = freq;
-      priv->alarm     = UINT64_MAX;
+      priv->lower.ops      = &g_riscv_mtimer_ops;
+      priv->mtime          = mtime;
+      priv->mtimecmp       = mtimecmp;
+      priv->cycle_per_tick = freq / TICK_PER_SEC;

Review Comment:
   > may not divide evenly, so it's better to save freq like patch: 
[eac9937](https://github.com/apache/nuttx/commit/eac99370e58137bc444fe68a86ed5088c935a74d)
   
   That is a good point, thanks, I will rework this. Although it would only 
increase accuracy if one would set it to trigger after longer than 1 tick, and 
since this is the tick timer, it is not used as such. So in practice there will 
be no difference at the moment.... :) 



-- 
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