35 #ifndef ti_sysbios_hal_Hwi__include 36 #define ti_sysbios_hal_Hwi__include 45 #ifdef __IAR_SYSTEMS_ICC__ 46 #include <intrinsics.h> 53 #if (defined(__ARM_ARCH) && ((__ARM_ARCH == 6) && (__ARM_ARCH_PROFILE == 'M'))) || \ 54 (defined(__CORE__) && (__CORE__ == __ARM6M__)) || \ 55 defined(__ARM_ARCH_6M__) 56 #include <ti/sysbios/family/arm/v6m/Hwi.h> 57 #elif (defined(__ARM_ARCH) && ((__ARM_ARCH == 7) && (__ARM_ARCH_PROFILE == 'M'))) || \ 58 (defined(__CORE__) && (__CORE__ == __ARM7M__)) || \ 59 defined(__ARM_ARCH_7M__) 61 #elif (defined(__ARM_ARCH) && ((__ARM_ARCH == 8) && (__ARM_ARCH_PROFILE == 'M'))) || \ 62 (defined(__CORE__) && (__CORE__ == __ARM8M__)) || \ 63 defined(__ARM_ARCH_8M__) 64 #include <ti/sysbios/family/arm/v8m/Hwi.h> 70 extern void Hwi_switchAndRunFunc(
void (*func)(
void));
74 #if (defined(__ARM_ARCH) && ((__ARM_ARCH == 6) && (__ARM_ARCH_PROFILE == 'M'))) || \ 75 (defined(__CORE__) && (__CORE__ == __ARM6M__)) || \ 76 defined(__ARM_ARCH_6M__) 78 #if defined(__TI_COMPILER_VERSION__) && !defined(__clang__) 80 static inline unsigned int Hwi_disable()
82 return ((
unsigned int)__set_PRIMASK(1));
87 static inline unsigned int Hwi_enable()
89 return ((
unsigned int)__set_PRIMASK(0));
94 static inline void Hwi_restore(
unsigned int key)
99 #elif defined(__IAR_SYSTEMS_ICC__) 102 static inline unsigned int Hwi_disable()
106 key = __get_PRIMASK();
112 static inline unsigned int Hwi_enable()
115 key = __get_PRIMASK();
121 static inline void Hwi_restore(
unsigned int key)
128 static inline unsigned int Hwi_disable()
132 __asm__ __volatile__ (
133 "mrs %0, primask\n\t" 142 static inline unsigned int Hwi_enable()
146 __asm__ __volatile__ (
147 "mrs %0, primask\n\t" 156 static inline void Hwi_restore(
unsigned int key)
158 __asm__ __volatile__ (
171 #if defined(__TI_COMPILER_VERSION__) && !defined(__clang__) 173 static inline unsigned int Hwi_disable()
175 return (_set_interrupt_priority(Hwi_disablePriority));
180 static inline unsigned int Hwi_enable()
182 return (_set_interrupt_priority(0));
187 static inline void Hwi_restore(
unsigned int key)
189 (void)_set_interrupt_priority(key);
193 #elif defined(__IAR_SYSTEMS_ICC__) 195 static inline unsigned int Hwi_disable()
199 key = __get_BASEPRI();
200 __set_BASEPRI(Hwi_disablePriority);
207 static inline unsigned int Hwi_enable()
210 key = __get_BASEPRI();
218 static inline void Hwi_restore(
unsigned int key)
225 static inline unsigned int Hwi_disable()
229 __asm__ __volatile__ (
230 "mrs %0, basepri\n\t" 233 :
"r" (Hwi_disablePriority)
241 static inline unsigned int Hwi_enable()
245 __asm__ __volatile__ (
247 "mrs %0, basepri\n\t" 258 static inline void Hwi_restore(
unsigned int key)
260 __asm__ __volatile__ (
Basic constants and types.
Cortex M3/M4 Hardware Interrupt Manager.
const unsigned int Hwi_disablePriority
The priority that BASEPRI is set to by Hwi_disable().