jlaitine commented on code in PR #15929: URL: https://github.com/apache/nuttx/pull/15929#discussion_r1979105024
########## 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: That would only make sense if it wasn't a tick timer which counts one tick at a time; also I am now not entirely sure how it it works. When counting one tick at a time, the accuracy is the same anyways. I'd go with this, as it is tested to work, and let you reason why there is a need to complicate this. Remind that that in risc-v systems the mtime is minimum 1us resolution, so the tick accuracy is more than enough (and typically even evenly divisible). -- 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