jlaitine commented on code in PR #15929: URL: https://github.com/apache/nuttx/pull/15929#discussion_r1982034021
########## 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: Both approaches are correct. Only the first one dictates that the actual tick time is not exactly what you requested, but it may be shorter if the time is not evenly divisible by the underlying hw timer frequency. It makes no difference if the tick time is not exactly what was requested, as long as it is taken account in xSEC2TICK macros, as I pointed out previously. The second approach will cause other problems, which I will point out later. -- 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