NUM_PIO_IRQS off-by-one error in hardware_pio #3035

Closed
opened 2026-06-27 11:07:38 -05:00 by headblockhead · 1 comment
headblockhead commented 2026-06-27 11:07:38 -05:00 (Migrated from github.com)

In src/rp2_common/hardware_pio/include/hardware/pio.h, some functions have incorrect assertions:

This check is performed correctly in the same file in the function pio_get_irq_num:

Fixed by pull request #3036.

In src/rp2_common/hardware_pio/include/hardware/pio.h, some functions have incorrect assertions: - https://github.com/raspberrypi/pico-sdk/blob/fb53c3802096668606399aba8137ca48398a5401/src/rp2_common/hardware_pio/include/hardware/pio.h#L1432-L1441 - https://github.com/raspberrypi/pico-sdk/blob/fb53c3802096668606399aba8137ca48398a5401/src/rp2_common/hardware_pio/include/hardware/pio.h#L1449-L1458 These assertions are incorrect, as the functions (pio_set_irqn_source_enabled and pio_set_irqn_source_mask_enabled) expect irq_index to be either 0 or 1. As NUM_PIO_IRQS equals 2 for both the [rp2040](https://github.com/raspberrypi/pico-sdk/blob/fb53c3802096668606399aba8137ca48398a5401/src/rp2040/hardware_regs/include/hardware/platform_defs.h#L28) and the [rp2350](https://github.com/raspberrypi/pico-sdk/blob/fb53c3802096668606399aba8137ca48398a5401/src/rp2350/hardware_regs/include/hardware/platform_defs.h#L29), these assertions incorrectly accept the unexpected value of 2. This check is performed correctly in the same file in the function pio_get_irq_num: - https://github.com/raspberrypi/pico-sdk/blob/fb53c3802096668606399aba8137ca48398a5401/src/rp2_common/hardware_pio/include/hardware/pio.h#L2135-L2144 Fixed by pull request #3036.
kilograham commented 2026-06-27 15:59:04 -05:00 (Migrated from github.com)

fix merged into develop

fix merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#3035
No description provided.