Skip to content

Commit 2786cb9

Browse files
manuarguecarlescufi
authored andcommitted
drivers: intc: gic: implement set pending interrupt
Implement a function to set pending interrupts for Arm GIC. Signed-off-by: Manuel Argüelles <[email protected]>
1 parent 42c8732 commit 2786cb9

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/interrupt_controller/intc_gic.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) 2018 Marvell
33
* Copyright (c) 2018 Lexmark International, Inc.
44
* Copyright (c) 2019 Stephanos Ioannidis <[email protected]>
5+
* Copyright 2024 NXP
56
*
67
* SPDX-License-Identifier: Apache-2.0
78
*/
@@ -79,6 +80,16 @@ bool arm_gic_irq_is_pending(unsigned int irq)
7980
return (enabler & (1 << int_off)) != 0;
8081
}
8182

83+
void arm_gic_irq_set_pending(unsigned int irq)
84+
{
85+
int int_grp, int_off;
86+
87+
int_grp = irq / 32;
88+
int_off = irq % 32;
89+
90+
sys_write32((1 << int_off), (GICD_ISPENDRn + int_grp * 4));
91+
}
92+
8293
void arm_gic_irq_clear_pending(unsigned int irq)
8394
{
8495
int int_grp, int_off;

drivers/interrupt_controller/intc_gicv3.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2020 Broadcom
3+
* Copyright 2024 NXP
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
@@ -227,6 +228,14 @@ bool arm_gic_irq_is_pending(unsigned int intid)
227228
return (val & mask) != 0;
228229
}
229230

231+
void arm_gic_irq_set_pending(unsigned int intid)
232+
{
233+
uint32_t mask = BIT(intid & (GIC_NUM_INTR_PER_REG - 1));
234+
uint32_t idx = intid / GIC_NUM_INTR_PER_REG;
235+
236+
sys_write32(mask, ISPENDR(GET_DIST_BASE(intid), idx));
237+
}
238+
230239
void arm_gic_irq_clear_pending(unsigned int intid)
231240
{
232241
uint32_t mask = BIT(intid & (GIC_NUM_INTR_PER_REG - 1));

include/zephyr/drivers/interrupt_controller/gic.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ bool arm_gic_irq_is_enabled(unsigned int irq);
302302
*/
303303
bool arm_gic_irq_is_pending(unsigned int irq);
304304

305+
/**
306+
* @brief Set interrupt as pending
307+
*
308+
* @param irq interrupt ID
309+
*/
310+
void arm_gic_irq_set_pending(unsigned int irq);
311+
305312
/**
306313
* @brief Clear the pending irq
307314
*

0 commit comments

Comments
 (0)