Skip to content

Commit 9c62aa6

Browse files
committed
tests: interrupt_util: Update RX irq trigger method
The QEMU RX doesn't allow to write value to IR flag, There is also mentioned in RX HWM that the IR should not be write 1 to. So we change the method to trigger interrupt here is to call directly to SW irq table Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
1 parent c5c1c3e commit 9c62aa6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

subsys/testsuite/include/zephyr/interrupt_util.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ static inline uint32_t get_available_nvic_line(uint32_t initial_offset)
5858
static inline void trigger_irq(int irq)
5959
{
6060
printk("Triggering irq : %d\n", irq);
61-
#if defined(CONFIG_SOC_TI_LM3S6965_QEMU) || defined(CONFIG_CPU_CORTEX_M0) \
62-
|| defined(CONFIG_CPU_CORTEX_M0PLUS) || defined(CONFIG_CPU_CORTEX_M1)\
63-
|| defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
61+
#if defined(CONFIG_SOC_TI_LM3S6965_QEMU) || defined(CONFIG_CPU_CORTEX_M0) || \
62+
defined(CONFIG_CPU_CORTEX_M0PLUS) || defined(CONFIG_CPU_CORTEX_M1) || \
63+
defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
6464
/* QEMU does not simulate the STIR register: this is a workaround */
6565
NVIC_SetPendingIRQ(irq);
6666
#else
@@ -84,8 +84,7 @@ static inline void trigger_irq(int irq)
8484
* requesting CPU.
8585
*/
8686
#if CONFIG_GIC_VER <= 2
87-
sys_write32(GICD_SGIR_TGTFILT_REQONLY | GICD_SGIR_SGIINTID(irq),
88-
GICD_SGIR);
87+
sys_write32(GICD_SGIR_TGTFILT_REQONLY | GICD_SGIR_SGIINTID(irq), GICD_SGIR);
8988
#else
9089
uint64_t mpidr = GET_MPIDR();
9190
uint8_t aff0 = MPIDR_AFFLVL(mpidr, 0);
@@ -108,7 +107,7 @@ static inline void trigger_irq(int irq)
108107
#define VECTOR_MASK 0xFF
109108
#else
110109
#include <zephyr/arch/arch_interface.h>
111-
#define LOAPIC_ICR_IPI_TEST 0x00004000U
110+
#define LOAPIC_ICR_IPI_TEST 0x00004000U
112111
#endif
113112

114113
/*
@@ -175,9 +174,7 @@ static inline void trigger_irq(int irq)
175174
{
176175
uint32_t mip;
177176

178-
__asm__ volatile ("csrrs %0, mip, %1\n"
179-
: "=r" (mip)
180-
: "r" (1 << irq));
177+
__asm__ volatile("csrrs %0, mip, %1\n" : "=r"(mip) : "r"(1 << irq));
181178
}
182179
#endif
183180
#elif defined(CONFIG_XTENSA)
@@ -218,7 +215,8 @@ static inline void trigger_irq(int irq)
218215
__ASSERT(irq < CONFIG_NUM_IRQS, "attempting to trigger invalid IRQ (%u)", irq);
219216
__ASSERT(irq >= CONFIG_GEN_IRQ_START_VECTOR, "attempting to trigger reserved IRQ (%u)",
220217
irq);
221-
WRITE_BIT(REG(IR_BASE_ADDRESS + irq), 0, true);
218+
_sw_isr_table[irq - CONFIG_GEN_IRQ_START_VECTOR].isr(
219+
_sw_isr_table[irq - CONFIG_GEN_IRQ_START_VECTOR].arg);
222220
}
223221

224222
#else

0 commit comments

Comments
 (0)