Skip to content

Commit 91c4c43

Browse files
ajf58kartben
authored andcommitted
drivers: gpio_rpi_pico: Add gpio_get_pending_int API
Implement `gpio_get_pending_int`. Signed-off-by: Andrew Featherstone <[email protected]>
1 parent 608e6a3 commit 91c4c43

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpio/gpio_rpi_pico.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2021, Yonatan Schachter
3+
* Copyright (c) 2025, Andrew Featherstone
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
@@ -193,6 +194,19 @@ static int gpio_rpi_manage_callback(const struct device *dev,
193194
return gpio_manage_callback(&data->callbacks, callback, set);
194195
}
195196

197+
static uint32_t gpio_rpi_get_pending_int(const struct device *dev)
198+
{
199+
io_bank0_irq_ctrl_hw_t *irq_ctrl_base =
200+
get_core_num() ? &io_bank0_hw->proc1_irq_ctrl : &io_bank0_hw->proc0_irq_ctrl;
201+
ARRAY_FOR_EACH_PTR(irq_ctrl_base->ints, p) {
202+
if (*p) {
203+
return 1;
204+
}
205+
}
206+
207+
return 0;
208+
}
209+
196210
static DEVICE_API(gpio, gpio_rpi_driver_api) = {
197211
.pin_configure = gpio_rpi_configure,
198212
.port_get_raw = gpio_rpi_port_get_raw,
@@ -202,6 +216,7 @@ static DEVICE_API(gpio, gpio_rpi_driver_api) = {
202216
.port_toggle_bits = gpio_rpi_port_toggle_bits,
203217
.pin_interrupt_configure = gpio_rpi_pin_interrupt_configure,
204218
.manage_callback = gpio_rpi_manage_callback,
219+
.get_pending_int = gpio_rpi_get_pending_int,
205220
};
206221

207222
static void gpio_rpi_isr(const struct device *dev)

0 commit comments

Comments
 (0)