irq.h File Reference
#include "pico.h"
#include "hardware/address_mapped.h"
#include "hardware/regs/intctrl.h"
#include "hardware/regs/m0plus.h"
Include dependency graph for irq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PICO_MAX_SHARED_IRQ_HANDLERS   4u
 
#define PICO_DISABLE_SHARED_IRQ_HANDLERS   0
 
#define PICO_VTABLE_PER_CORE   0
 
#define PICO_DEFAULT_IRQ_PRIORITY   0x80
 
#define PICO_LOWEST_IRQ_PRIORITY   0xff
 
#define PICO_HIGHEST_IRQ_PRIORITY   0x00
 
#define PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY   0x80
 
#define PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY   0xff
 
#define PICO_SHARED_IRQ_HANDLER_LOWEST_ORDER_PRIORITY   0x00
 
#define PARAM_ASSERTIONS_ENABLED_IRQ   0
 

Typedefs

typedef void(* irq_handler_t) (void)
 Interrupt handler function typeAll interrupts handlers should be of this type, and follow normal ARM EABI register saving conventions.
 

Functions

static void check_irq_param (__unused uint num)
 
void irq_set_priority (uint num, uint8_t hardware_priority)
 Set specified interrupt's priority. More...
 
uint irq_get_priority (uint num)
 Get specified interrupt's priorityNumerically-lower values indicate a higher priority. Hardware priorities range from 0 (highest priority) to 255 (lowest priority) though only the top 2 bits are significant on ARM Cortex-M0+. To make it easier to specify higher or lower priorities than the default, all IRQ priorities are initialized to PICO_DEFAULT_IRQ_PRIORITY by the SDK runtime at startup. PICO_DEFAULT_IRQ_PRIORITY defaults to 0x80. More...
 
void irq_set_enabled (uint num, bool enabled)
 Enable or disable a specific interrupt on the executing core. More...
 
bool irq_is_enabled (uint num)
 Determine if a specific interrupt is enabled on the executing core. More...
 
void irq_set_mask_enabled (uint32_t mask, bool enabled)
 Enable/disable multiple interrupts on the executing core. More...
 
void irq_set_exclusive_handler (uint num, irq_handler_t handler)
 Set an exclusive interrupt handler for an interrupt on the executing core.Use this method to set a handler for single IRQ source interrupts, or when your code, use case or performance requirements dictate that there should no other handlers for the interrupt. More...
 
irq_handler_t irq_get_exclusive_handler (uint num)
 Get the exclusive interrupt handler for an interrupt on the executing core.This method will return an exclusive IRQ handler set on this core by irq_set_exclusive_handler if there is one. More...
 
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 coreUse this method to add a handler on an irq number shared between multiple distinct hardware sources (e.g. GPIO, DMA or PIO IRQs). Handlers added by this method will all be called in sequence from highest order_priority to lowest. The irq_set_exclusive_handler() method should be used instead if you know there will or should only ever be one handler for the interrupt. More...
 
void irq_remove_handler (uint num, irq_handler_t handler)
 Remove a specific interrupt handler for the given irq number on the executing coreThis method may be used to remove an irq set via either irq_set_exclusive_handler() or irq_add_shared_handler(), and will assert if the handler is not currently installed for the given IRQ number. More...
 
bool irq_has_shared_handler (uint num)
 Determine if the current handler for the given number is shared. More...
 
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 (VTOR) of the execution core. More...
 
static void irq_clear (uint int_num)
 Clear a specific interrupt on the executing coreThis method is only useful for "software" IRQs that are not connected to hardware (i.e. IRQs 26-31) as the the NVIC always reflects the current state of the IRQ state of the hardware for hardware IRQs, and clearing of the IRQ state of the hardware is performed via the hardware's registers instead. More...
 
void irq_set_pending (uint num)
 Force an interrupt to be pending on the executing coreThis should generally not be used for IRQs connected to hardware. More...
 
void irq_init_priorities (void)
 Perform IRQ priority initialization for the current core. More...
 
void user_irq_claim (uint irq_num)
 Claim ownership of a user IRQ on the calling coreUser IRQs are numbered 26-31 and are not connected to any hardware, but can be triggered by irq_set_pending. More...
 
void user_irq_unclaim (uint irq_num)
 Mark a user IRQ as no longer used on the calling coreUser IRQs are numbered 26-31 and are not connected to any hardware, but can be triggered by irq_set_pending. More...
 
int user_irq_claim_unused (bool required)
 Claim ownership of a free user IRQ on the calling coreUser IRQs are numbered 26-31 and are not connected to any hardware, but can be triggered by irq_set_pending. More...
 
bool user_irq_is_claimed (uint irq_num)
 

Function Documentation

◆ irq_init_priorities()

void irq_init_priorities ( void  )

Perform IRQ priority initialization for the current core.

Note
This is an internal method and user should generally not call it.