SmartSnippets DA1459x SDK
interrupts.h
Go to the documentation of this file.
1 
44 #ifndef INTERRUPTS_H_
45 #define INTERRUPTS_H_
46 
47 #include <stdbool.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
99 void set_interrupt_priorities(const int8_t prios[]);
100 
106 __STATIC_FORCEINLINE bool in_interrupt(void)
107 {
108  return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
109 }
110 
111 
116 extern const int8_t __dialog_interrupt_priorities[];
117 
118 # define LAST_IRQn GPIO_P1_IRQn
119 
120 /*
121  * Following macros allow easy way to build table with interrupt priorities.
122  * See example in set_interrupt_priorities function description.
123  */
124 #define INTERRUPT_PRIORITY_CONFIG_START(name) const int8_t name[] = {
125 #define PRIORITY_0 (LAST_IRQn + 1)
126 #define PRIORITY_1 (LAST_IRQn + 2)
127 #define PRIORITY_2 (LAST_IRQn + 3)
128 #define PRIORITY_3 (LAST_IRQn + 4)
129 #define PRIORITY_4 (LAST_IRQn + 5)
130 #define PRIORITY_5 (LAST_IRQn + 6)
131 #define PRIORITY_6 (LAST_IRQn + 7)
132 #define PRIORITY_7 (LAST_IRQn + 8)
133 #define PRIORITY_8 (LAST_IRQn + 9)
134 #define PRIORITY_9 (LAST_IRQn + 10)
135 #define PRIORITY_10 (LAST_IRQn + 11)
136 #define PRIORITY_11 (LAST_IRQn + 12)
137 #define PRIORITY_12 (LAST_IRQn + 13)
138 #define PRIORITY_13 (LAST_IRQn + 14)
139 #define PRIORITY_14 (LAST_IRQn + 15)
140 #define PRIORITY_15 (LAST_IRQn + 16)
141 #define PRIORITY_TABLE_END (LAST_IRQn + 17)
142 #define INTERRUPT_PRIORITY_CONFIG_END PRIORITY_TABLE_END };
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* INTERRUPTS_H_ */
149 
__dialog_interrupt_priorities
const int8_t __dialog_interrupt_priorities[]
Default interrupt priorities table.
SCB
#define SCB
Definition: core_cm0.h:542
in_interrupt
__STATIC_FORCEINLINE bool in_interrupt(void)
Check whether running in interrupt context.
Definition: interrupts.h:106
SCB_ICSR_VECTACTIVE_Msk
#define SCB_ICSR_VECTACTIVE_Msk
Definition: core_cm0.h:399
set_interrupt_priorities
void set_interrupt_priorities(const int8_t prios[])
Setup interrupt priorities.