File tree 3 files changed +57
-0
lines changed
drivers/interrupt_controller
include/zephyr/drivers/interrupt_controller
3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,29 @@ bool arm_gic_irq_is_enabled(unsigned int irq)
57
57
return (enabler & (1 << int_off )) != 0 ;
58
58
}
59
59
60
+ bool arm_gic_irq_is_pending (unsigned int irq )
61
+ {
62
+ int int_grp , int_off ;
63
+ unsigned int enabler ;
64
+
65
+ int_grp = irq / 32 ;
66
+ int_off = irq % 32 ;
67
+
68
+ enabler = sys_read32 (GICD_ISPENDRn + int_grp * 4 );
69
+
70
+ return (enabler & (1 << int_off )) != 0 ;
71
+ }
72
+
73
+ void arm_gic_irq_clear_pending (unsigned int irq )
74
+ {
75
+ int int_grp , int_off ;
76
+
77
+ int_grp = irq / 32 ;
78
+ int_off = irq % 32 ;
79
+
80
+ sys_write32 ((1 << int_off ), (GICD_ICPENDRn + int_grp * 4 ));
81
+ }
82
+
60
83
void arm_gic_irq_set_priority (
61
84
unsigned int irq , unsigned int prio , uint32_t flags )
62
85
{
Original file line number Diff line number Diff line change @@ -213,6 +213,25 @@ bool arm_gic_irq_is_enabled(unsigned int intid)
213
213
return (val & mask ) != 0 ;
214
214
}
215
215
216
+ bool arm_gic_irq_is_pending (unsigned int intid )
217
+ {
218
+ uint32_t mask = BIT (intid & (GIC_NUM_INTR_PER_REG - 1 ));
219
+ uint32_t idx = intid / GIC_NUM_INTR_PER_REG ;
220
+ uint32_t val ;
221
+
222
+ val = sys_read32 (ISPENDR (GET_DIST_BASE (intid ), idx ));
223
+
224
+ return (val & mask ) != 0 ;
225
+ }
226
+
227
+ void arm_gic_irq_clear_pending (unsigned int intid )
228
+ {
229
+ uint32_t mask = BIT (intid & (GIC_NUM_INTR_PER_REG - 1 ));
230
+ uint32_t idx = intid / GIC_NUM_INTR_PER_REG ;
231
+
232
+ sys_write32 (mask , ICPENDR (GET_DIST_BASE (intid ), idx ));
233
+ }
234
+
216
235
unsigned int arm_gic_get_active (void )
217
236
{
218
237
int intid ;
Original file line number Diff line number Diff line change @@ -294,6 +294,21 @@ void arm_gic_irq_disable(unsigned int irq);
294
294
*/
295
295
bool arm_gic_irq_is_enabled (unsigned int irq );
296
296
297
+ /**
298
+ * @brief Check if an interrupt is pending
299
+ *
300
+ * @param irq interrupt ID
301
+ * @return Returns true if interrupt is pending, false otherwise
302
+ */
303
+ bool arm_gic_irq_is_pending (unsigned int irq );
304
+
305
+ /**
306
+ * @brief Clear the pending irq
307
+ *
308
+ * @param irq interrupt ID
309
+ */
310
+ void arm_gic_irq_clear_pending (unsigned int irq );
311
+
297
312
/**
298
313
* @brief Set interrupt priority
299
314
*
You can’t perform that action at this time.
0 commit comments