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 53c53fd1a66314728c4220fd40a98332232396f7
Author: Saravanan Sekar <[email protected]>
AuthorDate: Thu Nov 5 22:05:15 2026 +0530

    arch/tricore: Add the interrupt router register definitions.
    
    TRICORE_SRC2IRQ takes the SRC base from the iLLD MODULE_SRC, and the
    interrupt code reaches the service request control (SRC) registers only
    through IfxSrc.  Add the SRC base addresses and bit fields of TC3xx and
    TC4xx, which differ, as checked against the TC39xB and TC4Dx iLLD
    headers, and use the SRC base in TRICORE_SRC2IRQ.
    
    Signed-off-by: Saravanan Sekar <[email protected]>
---
 arch/tricore/include/irq.h       |  5 +++--
 arch/tricore/include/tc3xx/irq.h | 18 ++++++++++++++++++
 arch/tricore/include/tc4xx/irq.h | 20 ++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/arch/tricore/include/irq.h b/arch/tricore/include/irq.h
index 36cc85ea7ab..e11e0834e90 100644
--- a/arch/tricore/include/irq.h
+++ b/arch/tricore/include/irq.h
@@ -133,9 +133,10 @@
 
 #define TRICORE_SRCNUM_PER_GPSR  8
 #define TRICORE_SRC2IRQ(src_addr) \
-  (((uintptr_t)(src_addr) - (uintptr_t)&MODULE_SRC) / 4)
+  (((uintptr_t)(src_addr) - TRICORE_SRC_BASE) / 4)
 #define TRICORE_GPSR_IRQNUM(src_cpu, dest_cpu)  \
-  TRICORE_SRC2IRQ(&SRC_GPSR00 + src_cpu * 8 + dest_cpu)
+  TRICORE_SRC2IRQ(TRICORE_SRC_GPSR_BASE + \
+                  ((src_cpu) * TRICORE_SRCNUM_PER_GPSR + (dest_cpu)) * 4)
 
 /* For use with EABI and floating point, the stack must be aligned to 8-byte
  * addresses.
diff --git a/arch/tricore/include/tc3xx/irq.h b/arch/tricore/include/tc3xx/irq.h
index 155e0620780..633ec1442ef 100644
--- a/arch/tricore/include/tc3xx/irq.h
+++ b/arch/tricore/include/tc3xx/irq.h
@@ -37,6 +37,24 @@
 
 #define TRICORE_UART_RX_IRQ      21
 
+/* Interrupt router: the IRQ number is the index of the service request
+ * control (SRC) register from TRICORE_SRC_BASE.
+ */
+
+#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_SRC_SRPN_MASK    0xff        /* Service request priority */
+#define TRICORE_SRC_SRE          (1 << 10)   /* Service request enable */
+#define TRICORE_SRC_TOS_SHIFT    11          /* Type of service (core) */
+#define TRICORE_SRC_TOS_MASK     (0x7 << TRICORE_SRC_TOS_SHIFT)
+#define TRICORE_SRC_CLRR         (1 << 25)   /* Clear request */
+
+/* TOS of a core: 0 is CPU0, 1 is the DMA, 2 to 6 are CPU1 to CPU5 */
+
+#define TRICORE_SRC_TOS_CPU(n)   ((n) == 0 ? 0 : (n) + 1)
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
diff --git a/arch/tricore/include/tc4xx/irq.h b/arch/tricore/include/tc4xx/irq.h
index 0204d07586e..1545ea1273c 100644
--- a/arch/tricore/include/tc4xx/irq.h
+++ b/arch/tricore/include/tc4xx/irq.h
@@ -37,6 +37,26 @@
 
 #define TRICORE_UART_RX_IRQ      173
 
+/* Interrupt router: the IRQ number is the index of the service request
+ * control (SRC) register from TRICORE_SRC_BASE.
+ */
+
+#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_SRC_SRPN_MASK    0xff        /* Service request priority */
+#define TRICORE_SRC_VM_MASK      (0x7 << 8)  /* Virtual machine */
+#define TRICORE_SRC_CS           (1 << 11)   /* Set by the CSRM core */
+#define TRICORE_SRC_TOS_SHIFT    12          /* Type of service (core) */
+#define TRICORE_SRC_TOS_MASK     (0xf << TRICORE_SRC_TOS_SHIFT)
+#define TRICORE_SRC_SRE          (1 << 23)   /* Service request enable */
+#define TRICORE_SRC_CLRR         (1 << 25)   /* Clear request */
+
+/* TOS of a core: 0 to 5 are CPU0 to CPU5, 6 is the CSRM core */
+
+#define TRICORE_SRC_TOS_CPU(n)   (n)
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/

Reply via email to