hotislandn commented on code in PR #6151:
URL: https://github.com/apache/incubator-nuttx/pull/6151#discussion_r859280109
##########
arch/risc-v/src/common/riscv_mtimer.c:
##########
@@ -104,7 +110,16 @@ static void riscv_mtimer_set_mtimecmp(struct
riscv_mtimer_lowerhalf_s *priv,
uint64_t value)
{
#ifdef CONFIG_ARCH_RV64
- putreg64(value, priv->mtimecmp);
+ if (-1 == priv->mtime)
+ {
+ putreg32(0, priv->mtimecmp);
+ putreg32((uint32_t)(value >> 32), priv->mtimecmp + 4);
+ putreg32((uint32_t)value, priv->mtimecmp);
+ }
+ else
+ {
+ putreg64(value, priv->mtimecmp);
+ }
Review Comment:
It has been modified because 64bit/DWORD access to the cmp regs(low+high) at
once (putreg64) is not allowed on this SoC, only WORD access sequence leads to
the correct behavior of MTIMER.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]