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 f221878204 risc-v/nuttsbi: use ARCH_RV_MMIO_BITS for mtimer access 
selection
f221878204 is described below

commit f221878204f940a60759168289125aa1d4a0b164
Author: Yanfeng Liu <yfliu2...@qq.com>
AuthorDate: Fri Jan 12 09:33:15 2024 +0800

    risc-v/nuttsbi: use ARCH_RV_MMIO_BITS for mtimer access selection
    
    Chips like K230 has ARCH_RV64 but only supports 32-bit MMIO. So using
    ARCH_RV_MMIO_BITS is more proper here.
    
    Signed-off-by: Yanfeng Liu <yfliu2...@qq.com>
---
 arch/risc-v/src/nuttsbi/sbi_mtimer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/nuttsbi/sbi_mtimer.c 
b/arch/risc-v/src/nuttsbi/sbi_mtimer.c
index 4fae0db2b2..e633fc48fb 100644
--- a/arch/risc-v/src/nuttsbi/sbi_mtimer.c
+++ b/arch/risc-v/src/nuttsbi/sbi_mtimer.c
@@ -66,7 +66,7 @@ void sbi_init_mtimer(uintptr_t mtime, uintptr_t mtimecmp)
 
 uint64_t sbi_get_mtime(void)
 {
-#ifdef CONFIG_ARCH_RV64
+#if CONFIG_ARCH_RV_MMIO_BITS == 64
   return getreg64(g_mtime);
 #else
   uint32_t hi;
@@ -86,7 +86,7 @@ uint64_t sbi_get_mtime(void)
 void sbi_set_mtimecmp(uint64_t value)
 {
   uintptr_t mtimecmp = g_mtimecmp + READ_CSR(mhartid) * sizeof(uintptr_t);
-#ifdef CONFIG_ARCH_RV64
+#if CONFIG_ARCH_RV_MMIO_BITS == 64
   putreg64(value, mtimecmp);
 #else
   putreg32(UINT32_MAX, mtimecmp + 4);

Reply via email to