12#ifndef PICO_MAX_SHARED_IRQ_HANDLERS
13#define PICO_MAX_SHARED_IRQ_HANDLERS 4
17#ifndef PICO_DISABLE_SHARED_IRQ_HANDLERS
18#define PICO_DISABLE_SHARED_IRQ_HANDLERS 0
22#ifndef PICO_VTABLE_PER_CORE
23#define PICO_VTABLE_PER_CORE 0
30#include "hardware/regs/intctrl.h"
32#include "pico/platform/cpu_regs.h"
162#ifndef PICO_DEFAULT_IRQ_PRIORITY
163#define PICO_DEFAULT_IRQ_PRIORITY 0x80
166#define PICO_LOWEST_IRQ_PRIORITY 0xff
167#define PICO_HIGHEST_IRQ_PRIORITY 0x00
170#ifndef PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY
171#define PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY 0x80
174#define PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY 0xff
175#define PICO_SHARED_IRQ_HANDLER_LOWEST_ORDER_PRIORITY 0x00
178#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_IRQ
179#ifdef PARAM_ASSERTIONS_ENABLED_IRQ
180#define PARAM_ASSERTIONS_ENABLED_HARDWARE_IRQ PARAM_ASSERTIONS_ENABLED_IRQ
182#define PARAM_ASSERTIONS_ENABLED_HARDWARE_IRQ 0
197static inline void check_irq_param(__unused uint num) {
198 invalid_params_if(HARDWARE_IRQ, num >= NUM_IRQS);
380 *((
volatile uint32_t *) (PPB_BASE + M0PLUS_NVIC_ICPR_OFFSET)) = (1u << ((uint32_t) (int_num & 0x1F)));
381#elif defined(__riscv)
383 hazard3_irqarray_clear(RVCSR_MEIFA_OFFSET, int_num / 16, 1u << (int_num % 16));
385 nvic_hw->icpr[int_num/32] = 1 << (int_num % 32);
469bool user_irq_is_claimed(uint irq_num);
471void __unhandled_user_irq(
void);
474enum riscv_vector_num {
475 RISCV_VEC_MACHINE_EXCEPTION = 0,
476 RISCV_VEC_MACHINE_SOFTWARE_IRQ = 3,
477 RISCV_VEC_MACHINE_TIMER_IRQ = 7,
478 RISCV_VEC_MACHINE_EXTERNAL_IRQ = 11,
485static inline void irq_assign_to_ns(uint irq_num,
bool ns) {
486 check_irq_param(irq_num);
487 if (ns) nvic_hw->itns[irq_num >> 5] |= 1u << (irq_num & 0x1fu);
488 else nvic_hw->itns[irq_num >> 5] &= ~(1u << (irq_num & 0x1fu));
bool irq_is_enabled(uint num)
Determine if a specific interrupt is enabled on the executing core.
Definition: irq.c:67
void user_irq_unclaim(uint irq_num)
Mark a user IRQ as no longer used on the calling core.
Definition: irq.c:679
static void irq_clear(uint int_num)
Clear a specific interrupt on the executing core.
Definition: irq.h:378
void irq_set_pending(uint num)
Force an interrupt to be pending on the executing core.
Definition: irq.c:117
irq_handler_t irq_get_exclusive_handler(uint num)
Get the exclusive interrupt handler for an interrupt on the executing core.
Definition: irq.c:232
irq_handler_t irq_get_vtable_handler(uint num)
Get the current IRQ handler for the specified IRQ from the currently installed hardware vector table ...
Definition: irq.c:214
uint irq_get_priority(uint num)
Get specified interrupt's priority.
Definition: irq.c:604
void irq_set_enabled(uint num, bool enabled)
Enable or disable a specific interrupt on the executing core.
Definition: irq.c:61
void(* irq_handler_t)(void)
Interrupt handler function type.
Definition: irq.h:195
void user_irq_claim(uint irq_num)
Claim ownership of a user IRQ on the calling core.
Definition: irq.c:675
int user_irq_claim_unused(bool required)
Claim ownership of a free user IRQ on the calling core.
Definition: irq.c:683
void irq_set_priority(uint num, uint8_t hardware_priority)
Set specified interrupt's priority.
Definition: irq.c:587
void irq_remove_handler(uint num, irq_handler_t handler)
Remove a specific interrupt handler for the given irq number on the executing core.
Definition: irq.c:470
void irq_set_mask_n_enabled(uint n, uint32_t mask, bool enabled)
Enable/disable multiple interrupts on the executing core.
Definition: irq.c:113
bool irq_has_shared_handler(uint num)
Determine if the current handler for the given number is shared.
Definition: irq.c:200
void irq_set_mask_enabled(uint32_t mask, bool enabled)
Enable/disable multiple interrupts on the executing core.
Definition: irq.c:109
void irq_add_shared_handler(uint num, irq_handler_t handler, uint8_t order_priority)
Add a shared interrupt handler for an interrupt on the executing core.
Definition: irq.c:356
void irq_set_exclusive_handler(uint num, irq_handler_t handler)
Set an exclusive interrupt handler for an interrupt on the executing core.
Definition: irq.c:219
void runtime_init_per_core_irq_priorities(void)
Perform IRQ priority initialization for the current core.
Definition: irq.c:651