Skip to content

Commit 9c955ce

Browse files
raffi-gcarlescufi
authored andcommitted
test: gen_isr_table: Adjust test for clic
The CLIC has different software-triggerable irqs than the PLIC. I adjusted them. Additionally, in a clic the the irq flag 0 would mean triggering on a positive level. To work with software-triggering, the irqs have to trigger on a positive edge, i.e. 1. Signed-off-by: Greter Raffael <[email protected]>
1 parent 5b19fcd commit 9c955ce

File tree

1 file changed

+21
-7
lines changed
  • tests/kernel/gen_isr_table/src

1 file changed

+21
-7
lines changed

tests/kernel/gen_isr_table/src/main.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ extern uint32_t _irq_vector_table[];
2020
#endif
2121

2222
#if defined(CONFIG_RISCV)
23+
#if defined(CONFIG_RISCV_HAS_CLIC)
24+
#define ISR1_OFFSET 3
25+
#define ISR3_OFFSET 17
26+
#define ISR5_OFFSET 18
27+
#define TRIG_CHECK_SIZE 19
28+
#else
29+
2330
/* RISC-V has very few IRQ lines which can be triggered from software */
2431
#define ISR3_OFFSET 1
2532

@@ -31,10 +38,11 @@ extern uint32_t _irq_vector_table[];
3138
#else
3239
#define ISR5_OFFSET 5
3340
#endif
41+
#define TRIG_CHECK_SIZE 6
42+
#endif
3443

3544
#define IRQ_LINE(offset) offset
3645
#define TABLE_INDEX(offset) offset
37-
#define TRIG_CHECK_SIZE 6
3846
#else
3947
#define ISR1_OFFSET 0
4048
#define ISR2_OFFSET 1
@@ -90,6 +98,12 @@ extern uint32_t _irq_vector_table[];
9098
#define ISR5_ARG 0xf0ccac1a
9199
#define ISR6_ARG 0xba5eba11
92100

101+
#if defined(CONFIG_RISCV_HAS_CLIC)
102+
#define IRQ_FLAGS 1 /* rising edge */
103+
#else
104+
#define IRQ_FLAGS 0
105+
#endif
106+
93107
static volatile int trigger_check[TRIG_CHECK_SIZE];
94108

95109
#ifdef HAS_DIRECT_IRQS
@@ -262,15 +276,15 @@ ZTEST(gen_isr_table, test_build_time_direct_interrupt)
262276
#else
263277

264278
#ifdef ISR1_OFFSET
265-
IRQ_DIRECT_CONNECT(IRQ_LINE(ISR1_OFFSET), 0, isr1, 0);
279+
IRQ_DIRECT_CONNECT(IRQ_LINE(ISR1_OFFSET), 0, isr1, IRQ_FLAGS);
266280
irq_enable(IRQ_LINE(ISR1_OFFSET));
267281
TC_PRINT("isr1 isr=%p irq=%d\n", isr1, IRQ_LINE(ISR1_OFFSET));
268282
zassert_ok(check_vector(isr1, ISR1_OFFSET),
269283
"check direct interrpt isr1 failed");
270284
#endif
271285

272286
#ifdef ISR2_OFFSET
273-
IRQ_DIRECT_CONNECT(IRQ_LINE(ISR2_OFFSET), 0, isr2, 0);
287+
IRQ_DIRECT_CONNECT(IRQ_LINE(ISR2_OFFSET), 0, isr2, IRQ_FLAGS);
274288
irq_enable(IRQ_LINE(ISR2_OFFSET));
275289
TC_PRINT("isr2 isr=%p irq=%d\n", isr2, IRQ_LINE(ISR2_OFFSET));
276290

@@ -305,7 +319,7 @@ ZTEST(gen_isr_table, test_build_time_interrupt)
305319
TC_PRINT("_sw_isr_table at location %p\n", _sw_isr_table);
306320

307321
#ifdef ISR3_OFFSET
308-
IRQ_CONNECT(IRQ_LINE(ISR3_OFFSET), 1, isr3, ISR3_ARG, 0);
322+
IRQ_CONNECT(IRQ_LINE(ISR3_OFFSET), 1, isr3, ISR3_ARG, IRQ_FLAGS);
309323
irq_enable(IRQ_LINE(ISR3_OFFSET));
310324
TC_PRINT("isr3 isr=%p irq=%d param=%p\n", isr3, IRQ_LINE(ISR3_OFFSET),
311325
(void *)ISR3_ARG);
@@ -315,7 +329,7 @@ ZTEST(gen_isr_table, test_build_time_interrupt)
315329
#endif
316330

317331
#ifdef ISR4_OFFSET
318-
IRQ_CONNECT(IRQ_LINE(ISR4_OFFSET), 1, isr4, ISR4_ARG, 0);
332+
IRQ_CONNECT(IRQ_LINE(ISR4_OFFSET), 1, isr4, ISR4_ARG, IRQ_FLAGS);
319333
irq_enable(IRQ_LINE(ISR4_OFFSET));
320334
TC_PRINT("isr4 isr=%p irq=%d param=%p\n", isr4, IRQ_LINE(ISR4_OFFSET),
321335
(void *)ISR4_ARG);
@@ -351,7 +365,7 @@ ZTEST(gen_isr_table, test_run_time_interrupt)
351365

352366
#ifdef ISR5_OFFSET
353367
irq_connect_dynamic(IRQ_LINE(ISR5_OFFSET), 1, isr5,
354-
(const void *)ISR5_ARG, 0);
368+
(const void *)ISR5_ARG, IRQ_FLAGS);
355369
irq_enable(IRQ_LINE(ISR5_OFFSET));
356370
TC_PRINT("isr5 isr=%p irq=%d param=%p\n", isr5, IRQ_LINE(ISR5_OFFSET),
357371
(void *)ISR5_ARG);
@@ -361,7 +375,7 @@ ZTEST(gen_isr_table, test_run_time_interrupt)
361375

362376
#ifdef ISR6_OFFSET
363377
irq_connect_dynamic(IRQ_LINE(ISR6_OFFSET), 1, isr6,
364-
(const void *)ISR6_ARG, 0);
378+
(const void *)ISR6_ARG, IRQ_FLAGS);
365379
irq_enable(IRQ_LINE(ISR6_OFFSET));
366380
TC_PRINT("isr6 isr=%p irq=%d param=%p\n", isr6, IRQ_LINE(ISR6_OFFSET),
367381
(void *)ISR6_ARG);

0 commit comments

Comments
 (0)