@@ -20,6 +20,13 @@ extern uint32_t _irq_vector_table[];
20
20
#endif
21
21
22
22
#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
+
23
30
/* RISC-V has very few IRQ lines which can be triggered from software */
24
31
#define ISR3_OFFSET 1
25
32
@@ -31,10 +38,11 @@ extern uint32_t _irq_vector_table[];
31
38
#else
32
39
#define ISR5_OFFSET 5
33
40
#endif
41
+ #define TRIG_CHECK_SIZE 6
42
+ #endif
34
43
35
44
#define IRQ_LINE (offset ) offset
36
45
#define TABLE_INDEX (offset ) offset
37
- #define TRIG_CHECK_SIZE 6
38
46
#else
39
47
#define ISR1_OFFSET 0
40
48
#define ISR2_OFFSET 1
@@ -90,6 +98,12 @@ extern uint32_t _irq_vector_table[];
90
98
#define ISR5_ARG 0xf0ccac1a
91
99
#define ISR6_ARG 0xba5eba11
92
100
101
+ #if defined(CONFIG_RISCV_HAS_CLIC )
102
+ #define IRQ_FLAGS 1 /* rising edge */
103
+ #else
104
+ #define IRQ_FLAGS 0
105
+ #endif
106
+
93
107
static volatile int trigger_check [TRIG_CHECK_SIZE ];
94
108
95
109
#ifdef HAS_DIRECT_IRQS
@@ -262,15 +276,15 @@ ZTEST(gen_isr_table, test_build_time_direct_interrupt)
262
276
#else
263
277
264
278
#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 );
266
280
irq_enable (IRQ_LINE (ISR1_OFFSET ));
267
281
TC_PRINT ("isr1 isr=%p irq=%d\n" , isr1 , IRQ_LINE (ISR1_OFFSET ));
268
282
zassert_ok (check_vector (isr1 , ISR1_OFFSET ),
269
283
"check direct interrpt isr1 failed" );
270
284
#endif
271
285
272
286
#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 );
274
288
irq_enable (IRQ_LINE (ISR2_OFFSET ));
275
289
TC_PRINT ("isr2 isr=%p irq=%d\n" , isr2 , IRQ_LINE (ISR2_OFFSET ));
276
290
@@ -305,7 +319,7 @@ ZTEST(gen_isr_table, test_build_time_interrupt)
305
319
TC_PRINT ("_sw_isr_table at location %p\n" , _sw_isr_table );
306
320
307
321
#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 );
309
323
irq_enable (IRQ_LINE (ISR3_OFFSET ));
310
324
TC_PRINT ("isr3 isr=%p irq=%d param=%p\n" , isr3 , IRQ_LINE (ISR3_OFFSET ),
311
325
(void * )ISR3_ARG );
@@ -315,7 +329,7 @@ ZTEST(gen_isr_table, test_build_time_interrupt)
315
329
#endif
316
330
317
331
#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 );
319
333
irq_enable (IRQ_LINE (ISR4_OFFSET ));
320
334
TC_PRINT ("isr4 isr=%p irq=%d param=%p\n" , isr4 , IRQ_LINE (ISR4_OFFSET ),
321
335
(void * )ISR4_ARG );
@@ -351,7 +365,7 @@ ZTEST(gen_isr_table, test_run_time_interrupt)
351
365
352
366
#ifdef ISR5_OFFSET
353
367
irq_connect_dynamic (IRQ_LINE (ISR5_OFFSET ), 1 , isr5 ,
354
- (const void * )ISR5_ARG , 0 );
368
+ (const void * )ISR5_ARG , IRQ_FLAGS );
355
369
irq_enable (IRQ_LINE (ISR5_OFFSET ));
356
370
TC_PRINT ("isr5 isr=%p irq=%d param=%p\n" , isr5 , IRQ_LINE (ISR5_OFFSET ),
357
371
(void * )ISR5_ARG );
@@ -361,7 +375,7 @@ ZTEST(gen_isr_table, test_run_time_interrupt)
361
375
362
376
#ifdef ISR6_OFFSET
363
377
irq_connect_dynamic (IRQ_LINE (ISR6_OFFSET ), 1 , isr6 ,
364
- (const void * )ISR6_ARG , 0 );
378
+ (const void * )ISR6_ARG , IRQ_FLAGS );
365
379
irq_enable (IRQ_LINE (ISR6_OFFSET ));
366
380
TC_PRINT ("isr6 isr=%p irq=%d param=%p\n" , isr6 , IRQ_LINE (ISR6_OFFSET ),
367
381
(void * )ISR6_ARG );
0 commit comments