#ifndef __HARDWARE_IRQ_H__ #define __HARDWARE_IRQ_H__ #include "m0plus_reg.h" #define IRQ_PERI_BASE (16) #define IRQ_NUM_BASE (0 - IRQ_PERI_BASE) #define RESET_IRQ (1 + IRQ_NUM_BASE) #define NMI_IRQ (2 + IRQ_NUM_BASE) #define HARDFAULT_IRQ (3 + IRQ_NUM_BASE) #define SVCALL_IRQ (11 + IRQ_NUM_BASE) #define PENDSV_IRQ (14 + IRQ_NUM_BASE) #define SYSTICK_IRQ (15 + IRQ_NUM_BASE) #define TIMER_IRQ_0 (0) #define TIMER_IRQ_1 (1) #define TIMER_IRQ_2 (2) #define TIMER_IRQ_3 (3) #define PWM_IRQ_WRAP (4) #define USBCTRL_IRQ (5) #define XIP_IRQ (6) #define PIO0_IRQ_0 (7) #define PIO0_IRQ_1 (8) #define PIO1_IRQ_0 (9) #define PIO1_IRQ_1 (10) #define DMA_IRQ_0 (11) #define DMA_IRQ_1 (12) #define IO_IRQ_BANK0 (13) #define IO_IRQ_QSPI (14) #define SIO_IRQ_PROC0 (15) #define SIO_IRQ_PROC1 (16) #define CLOCKS_IRQ (17) #define SPI0_IRQ (18) #define SPI1_IRQ (19) #define UART0_IRQ (20) #define UART1_IRQ (21) #define ADC_IRQ_FIFO (22) #define I2C0_IRQ (23) #define I2C1_IRQ (24) #define RTC_IRQ (25) #define MAX_IRQ (26) #define IRQ_NUM_MAX (IRQ_PERI_BASE + MAX_IRQ) #ifdef __cplusplus extern "C" { #endif typedef void (*irq_handler_t)(void); static inline void irq_enable_global(void) { __asm volatile ("cpsie i" : : : "memory"); } static inline void irq_disable_global(void) { __asm volatile ("cpsid i" : : : "memory"); } void irq_init(void); void irq_attach(int irq, irq_handler_t isr); void irq_detach(int irq); void irq_set_priority(int irq, uint8_t priority); void irq_enable(int irq); void irq_disable(int irq); int irq_is_enabled(int irq); #ifdef __cplusplus } #endif #endif /* __HARDWARE_IRQ_H__ */