Skip to content

Commit f3fa3fd

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 f31911d commit f3fa3fd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

drivers/interrupt_controller/intc_nxp_pint.c

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

178+
/**
179+
* @brief Get PINT slot index the pin is allocated to
180+
*
181+
* @param pin: The pin to get the PINT slot index for
182+
* @return The allocated slot index, if not allocated, return -1
183+
*/
184+
int nxp_pint_pin_get_slot_index(uint8_t pin)
185+
{
186+
int slot;
187+
188+
if (pin > ARRAY_SIZE(pin_pint_id)) {
189+
return -1;
190+
}
191+
192+
slot = pin_pint_id[pin];
193+
if (slot == NO_PINT_ID) {
194+
return -1;
195+
}
196+
197+
return slot;
198+
}
199+
178200
/* NXP PINT ISR handler- called with PINT slot ID */
179201
static void nxp_pint_isr(uint8_t *slot)
180202
{

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 -1
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)