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

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

commit 912357a67e987a3900cecc98f185f4bd02342160
Author: zhangyuan29 <[email protected]>
AuthorDate: Fri Nov 20 20:00:31 2026 +0800

    tricore: support up_cpu_index function
    
    Read CORE_ID directly instead of using the iLLD helper. Clamp the
    TC3xx core index to 5 to match IfxCpu_getCoreIndex().
    
    Signed-off-by: zhangyuan29 <[email protected]>
    Signed-off-by: zhangyu117 <[email protected]>
---
 arch/tricore/Kconfig       |  2 ++
 arch/tricore/include/irq.h | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/tricore/Kconfig b/arch/tricore/Kconfig
index c220d924d54..b08ac9ce60a 100644
--- a/arch/tricore/Kconfig
+++ b/arch/tricore/Kconfig
@@ -85,6 +85,7 @@ config ARCH_CHIP_TC3XX
        bool "infineon aurix tc3xx"
        select ARCH_TC1V6
        select ARCH_HAVE_ADDRENV
+       select ARCH_HAVE_MULTICPU
        select ARCH_HAVE_I2CRESET
        select ARCH_MINIMAL_VECTORTABLE
        select ARCH_MINIMAL_VECTORTABLE_DYNAMIC
@@ -99,6 +100,7 @@ config ARCH_CHIP_TC4XX
        select ARCH_TC1V8
        select ARCH_HAVE_ADDRENV
        select ARCH_HAVE_FPU if !TRICORE_CSRM
+       select ARCH_HAVE_MULTICPU
        select ARCH_HAVE_I2CRESET
        select ARCH_MINIMAL_VECTORTABLE
        select ARCH_MINIMAL_VECTORTABLE_DYNAMIC
diff --git a/arch/tricore/include/irq.h b/arch/tricore/include/irq.h
index 492e4be9908..f2586278b39 100644
--- a/arch/tricore/include/irq.h
+++ b/arch/tricore/include/irq.h
@@ -259,7 +259,19 @@ struct xcptcontext
  ****************************************************************************/
 
 #ifdef CONFIG_ARCH_HAVE_MULTICPU
-int up_cpu_index(void) noinstrument_function;
+noinstrument_function
+static inline_function int up_cpu_index(void)
+{
+  /* Register CORE_ID[2:0] holds cpu number. */
+
+  uint8_t id = tricore_mfcr(TRICORE_CPU_CORE_ID) & 0x7;
+
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+  id = id > 5 ? 5 : id;
+#endif
+
+  return id;
+}
 #endif /* CONFIG_ARCH_HAVE_MULTICPU */
 
 /****************************************************************************

Reply via email to