diff options
-rw-r--r-- | asm.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1,7 +1,24 @@ #ifndef ASM_H #define ASM_H +#include <stdint.h> + #define CLI() __asm__ volatile ("cpsid i") #define STI() __asm__ volatile ("cpsie i") +#define WFI() __asm__ volatile ("wfi") + +static inline uint32_t get_BASEPRI(void) +{ + uint32_t ret; + + __asm__ volatile ("mrs %0, basepri" :"=r"(ret)); + + return ret; +} + +static inline void set_BASEPRI(uint32_t p) +{ + __asm__ volatile ("msr basepri, %0" ::"r"(p)); +} #endif /* ASM_H */ |