Skip to content

Commit 5b69b03

Browse files
committed
Add SPARE_IRQ definitions to RP2040 intctrl.h, and add assertions on competing #defines as these were called USER_IRQs in the SDK 1.x
1 parent fd594af commit 5b69b03

File tree

2 files changed

+18
-0
lines changed
  • src
    • rp2040/hardware_regs/include/hardware/regs
    • rp2_common/hardware_irq

2 files changed

+18
-0
lines changed

src/rp2040/hardware_regs/include/hardware/regs/intctrl.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ typedef enum irq_num_rp2040 {
7171
I2C0_IRQ = 23, ///< Select I2C0's IRQ output
7272
I2C1_IRQ = 24, ///< Select I2C1's IRQ output
7373
RTC_IRQ = 25, ///< Select RTC's IRQ output
74+
SPARE_IRQ_0 = 26, ///< Select SPARE IRQ 0
75+
SPARE_IRQ_1 = 27, ///< Select SPARE IRQ 1
76+
SPARE_IRQ_2 = 28, ///< Select SPARE IRQ 2
77+
SPARE_IRQ_3 = 29, ///< Select SPARE IRQ 3
78+
SPARE_IRQ_4 = 30, ///< Select SPARE IRQ 4
79+
SPARE_IRQ_5 = 31, ///< Select SPARE IRQ 5
7480
IRQ_COUNT
7581
} irq_num_t;
7682
#endif
@@ -101,6 +107,12 @@ typedef enum irq_num_rp2040 {
101107
#define isr_i2c0 isr_irq23
102108
#define isr_i2c1 isr_irq24
103109
#define isr_rtc isr_irq25
110+
#define isr_spare_0 isr_irq26
111+
#define isr_spare_1 isr_irq27
112+
#define isr_spare_2 isr_irq28
113+
#define isr_spare_3 isr_irq29
114+
#define isr_spare_4 isr_irq30
115+
#define isr_spare_5 isr_irq31
104116

105117
#endif // _INTCTRL_H
106118

src/rp2_common/hardware_irq/irq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
PICO_RUNTIME_INIT_FUNC_PER_CORE(runtime_init_per_core_irq_priorities, PICO_RUNTIME_INIT_PER_CORE_IRQ_PRIORITIES);
1616
#endif
1717

18+
static_assert(IRQ_COUNT == NUM_IRQS, "");
19+
// "USER IRQs" use the spare irq numbers
20+
#if NUM_USER_IRQS
21+
static_assert(IRQ_COUNT - NUM_USER_IRQS == SPARE_IRQ_0, "");
22+
#endif
23+
1824
#if PICO_VTABLE_PER_CORE
1925
static uint8_t user_irq_claimed[NUM_CORES];
2026
static inline uint8_t *user_irq_claimed_ptr(void) {

0 commit comments

Comments
 (0)