Skip to content

Commit fa4a894

Browse files
committed
drivers: interrupt: pint: Add API to get pin used IRQ slot
PINT connects GPIO pin to seperate IRQ slot. Add new API to get which IRQ slot is connected to, based on pin index. Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
1 parent 075aae2 commit fa4a894

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/interrupt_controller/intc_nxp_pint.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ void nxp_pint_pin_unset_callback(uint8_t pin)
175175
pint_irq_cfg[slot].callback = NULL;
176176
}
177177

178+
int nxp_pint_pin_get_slot_index(uint8_t pin)
179+
{
180+
int slot;
181+
182+
if (pin > ARRAY_SIZE(pin_pint_id)) {
183+
return -EINVAL;
184+
}
185+
186+
slot = pin_pint_id[pin];
187+
if (slot == NO_PINT_ID) {
188+
return -EINVAL;
189+
}
190+
191+
return slot;
192+
}
193+
178194
/* NXP PINT ISR handler- called with PINT slot ID */
179195
static void nxp_pint_isr(uint8_t *slot)
180196
{

include/zephyr/drivers/interrupt_controller/nxp_pint.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,12 @@ int nxp_pint_pin_set_callback(uint8_t pin, nxp_pint_cb_t cb, void *data);
7979
*/
8080
void nxp_pint_pin_unset_callback(uint8_t pin);
8181

82+
/**
83+
* @brief Get PINT slot index the pin is allocated to
84+
*
85+
* @param pin: The pin to get the PINT slot index for
86+
* @return The allocated slot index, if not allocated, return -EINVAL.
87+
*/
88+
int nxp_pint_pin_get_slot_index(uint8_t pin);
8289

8390
#endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_NXP_PINT_H_ */

0 commit comments

Comments
 (0)