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 2ec54e4717b0c7a48b95cdb1e36a6ba1bcfdb368 Author: zhangyu117 <[email protected]> AuthorDate: Fri Oct 30 23:13:23 2026 +0800 arch/tricore: use lasr register to get irq number Read the irq number from the ICU LASR register of the current core instead of translating the SRPN through g_srpn_to_irq. LASR must be read before interrupts are re-enabled. Signed-off-by: zhangyu117 <[email protected]> --- arch/tricore/include/tc3xx/irq.h | 2 ++ arch/tricore/include/tc4xx/irq.h | 2 ++ arch/tricore/src/common/tricore_doirq.c | 3 +-- arch/tricore/src/common/tricore_internal.h | 17 ++++++++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/arch/tricore/include/tc3xx/irq.h b/arch/tricore/include/tc3xx/irq.h index 387b332f9b3..78034888436 100644 --- a/arch/tricore/include/tc3xx/irq.h +++ b/arch/tricore/include/tc3xx/irq.h @@ -44,6 +44,8 @@ #define TRICORE_SRC_BASE 0xf0038000 /* SRC_CPU0SB, IRQ 0 */ #define TRICORE_SRC_GPSR_BASE 0xf0038990 /* SRC_GPSR0SR0 */ #define TRICORE_INT_SRB_BASE 0xf0037010 /* INT_SRB0 */ +#define TRICORE_INT_LASR_BASE 0xf0037204 /* INT_LASR0 */ +#define TRICORE_INT_LASR_SPACING 0x10 /* INT_LASRn spacing */ #define TRICORE_SRC_SRPN_MASK 0xff /* Service request priority */ #define TRICORE_SRC_SRE (1 << 10) /* Service request enable */ diff --git a/arch/tricore/include/tc4xx/irq.h b/arch/tricore/include/tc4xx/irq.h index 7a5e51e4ef2..abc68f82a2e 100644 --- a/arch/tricore/include/tc4xx/irq.h +++ b/arch/tricore/include/tc4xx/irq.h @@ -44,6 +44,8 @@ #define TRICORE_SRC_BASE 0xf4432000 /* SRC_CPU0SB, IRQ 0 */ #define TRICORE_SRC_GPSR_BASE 0xf4433460 /* SRC_GPSR0SR0 */ #define TRICORE_INT_SRB_BASE 0xf4430b00 /* INT_SRB0 */ +#define TRICORE_INT_LASR_BASE 0xf4430c20 /* INT_LASR0 */ +#define TRICORE_INT_LASR_SPACING 0x34 /* INT_LASRn spacing */ #define TRICORE_SRC_SRPN_MASK 0xff /* Service request priority */ #define TRICORE_SRC_VM_MASK (0x7 << 8) /* Virtual machine */ diff --git a/arch/tricore/src/common/tricore_doirq.c b/arch/tricore/src/common/tricore_doirq.c index 830c2ada8e7..84fda848276 100644 --- a/arch/tricore/src/common/tricore_doirq.c +++ b/arch/tricore/src/common/tricore_doirq.c @@ -62,8 +62,7 @@ void tricore_doirq(void) #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); #else - int irq = tricore_srpn_to_irq(tricore_mfcr(TRICORE_CPU_ICR) & - TRICORE_ICR_CCPN_MASK); + int irq = tricore_irq_from_lasr(); uintptr_t *regs = tricore_csa2addr(tricore_mfcr(TRICORE_CPU_PCXI)); if (*running_task != NULL) diff --git a/arch/tricore/src/common/tricore_internal.h b/arch/tricore/src/common/tricore_internal.h index cc4c7e641e5..edbabc056eb 100644 --- a/arch/tricore/src/common/tricore_internal.h +++ b/arch/tricore/src/common/tricore_internal.h @@ -162,6 +162,22 @@ extern uintptr_t _eheap[]; /* End+1 of .heap */ * Inline Functions ****************************************************************************/ +/**************************************************************************** + * Name: tricore_irq_from_lasr + * + * Description: + * Get irq number from ICU's last acknowledged SRN register + * + ****************************************************************************/ + +static inline_function int tricore_irq_from_lasr(void) +{ + uintptr_t addr = TRICORE_INT_LASR_BASE + + up_cpu_index() * TRICORE_INT_LASR_SPACING; + + return (getreg32(addr) >> 16) & 0x7ff; +} + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -169,7 +185,6 @@ extern uintptr_t _eheap[]; /* End+1 of .heap */ /* Interrupt ****************************************************************/ void tricore_ack_irq(int irq); -void tricore_doirq(void); int tricore_srpn_to_irq(int srpn); int tricore_irq_to_srpn(int irq);
