drivers: interrupt: pint: Add API to get pin used IRQ slot

PINT connects GPIO pin to seperate IRQ slot. This info is
hidden in PINT driver, there is no way to know which IRQ
actually the GPIO pin is connected to.
Add new API to get which IRQ slot is connected to, based on
pin index.

Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
This commit is contained in:
Jason Yu
2025-11-14 15:58:26 +08:00
committed by Anas Nashif
parent d7900d6d5b
commit bba3582b8d
2 changed files with 23 additions and 0 deletions

View File

@@ -175,6 +175,22 @@ void nxp_pint_pin_unset_callback(uint8_t pin)
pint_irq_cfg[slot].callback = NULL;
}
int nxp_pint_pin_get_slot_index(uint8_t pin)
{
int slot;
if (pin > ARRAY_SIZE(pin_pint_id)) {
return -EINVAL;
}
slot = pin_pint_id[pin];
if (slot == NO_PINT_ID) {
return -EINVAL;
}
return slot;
}
/* NXP PINT ISR handler- called with PINT slot ID */
static void nxp_pint_isr(uint8_t *slot)
{

View File

@@ -79,5 +79,12 @@ int nxp_pint_pin_set_callback(uint8_t pin, nxp_pint_cb_t cb, void *data);
*/
void nxp_pint_pin_unset_callback(uint8_t pin);
/**
* @brief Get PINT slot index the pin is allocated to
*
* @param pin: The pin to get the PINT slot index for
* @return The allocated slot index, if not allocated, return -EINVAL.
*/
int nxp_pint_pin_get_slot_index(uint8_t pin);
#endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_NXP_PINT_H_ */