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

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

commit 806a2ca78dd7b50e5691b1fce6e8fc269c18abb7
Author: buxiasen <[email protected]>
AuthorDate: Fri Nov 27 21:00:33 2026 +0800

    arch/tricore: make oneshot timer state per-CPU for BMP
    
    Give each core its own oneshot lower-half instance and initialize the 
operations pointer at runtime. Preserve the current free-running timer base and 
IRQ initialization.
    
    Signed-off-by: buxiasen <[email protected]>
---
 arch/tricore/src/common/tricore_stm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/tricore/src/common/tricore_stm.c 
b/arch/tricore/src/common/tricore_stm.c
index 282290577f2..6b98996ad0e 100644
--- a/arch/tricore/src/common/tricore_stm.c
+++ b/arch/tricore/src/common/tricore_stm.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <nuttx/irq.h>
+#include <nuttx/percpu.h>
 #include <nuttx/timers/oneshot.h>
 #include <nuttx/timers/arch_alarm.h>
 
@@ -290,10 +291,10 @@ static const struct oneshot_operations_s 
g_tricore_oneshot_ops =
   .max_delay      = tricore_systimer_max_delay
 };
 
-static struct tricore_systimer_lowerhalf_s g_tricore_oneshot_lowerhalf =
-{
-  .lower.ops = &g_tricore_oneshot_ops
-};
+static DEFINE_PER_CPU_BSS_BMP(struct tricore_systimer_lowerhalf_s,
+                              g_tricore_oneshot_lowerhalf);
+#define g_tricore_oneshot_lowerhalf \
+  this_cpu_var_bmp(g_tricore_oneshot_lowerhalf)
 
 /****************************************************************************
  * Public Functions
@@ -315,6 +316,7 @@ tricore_systimer_initialize(uintptr_t tbase, uintptr_t 
fr_tbase,
   struct tricore_systimer_lowerhalf_s *priv = &g_tricore_oneshot_lowerhalf;
   uint32_t regval;
 
+  priv->lower.ops = &g_tricore_oneshot_ops;
   priv->tbase = tbase;
   priv->freerun_tbase = fr_tbase;
   priv->irq = irq;

Reply via email to