This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a36c168e54 riscv/nsbi: fix up_udelay for rv32
a36c168e54 is described below

commit a36c168e5473bcc973e50f3773cfc6a647ee515a
Author: Yanfeng Liu <[email protected]>
AuthorDate: Tue Jul 23 15:22:44 2024 +0800

    riscv/nsbi: fix up_udelay for rv32
    
    This fixes riscv_sbi_get_time for rv32 and NuttSBI is used.
    
    Signed-off-by: Yanfeng Liu <[email protected]>
---
 arch/risc-v/src/common/supervisor/riscv_sbi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/risc-v/src/common/supervisor/riscv_sbi.c 
b/arch/risc-v/src/common/supervisor/riscv_sbi.c
index c8bdd9425e..626e2d068f 100644
--- a/arch/risc-v/src/common/supervisor/riscv_sbi.c
+++ b/arch/risc-v/src/common/supervisor/riscv_sbi.c
@@ -111,7 +111,11 @@ uint64_t riscv_sbi_get_time(void)
   sbiret_t ret = sbi_ecall(SBI_EXT_FIRMWARE, SBI_EXT_FIRMWARE_GET_MTIME,
                            0, 0, 0, 0, 0, 0);
 
+#  ifdef CONFIG_ARCH_RV64
   return ret.error;
+#  else
+  return (((uint64_t)ret.value << 32) | ret.error);
+#  endif
 #elif defined(CONFIG_ARCH_RV64)
   return READ_CSR(CSR_TIME);
 #else

Reply via email to