diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2017-03-26 21:41:28 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2017-03-26 21:41:28 +0100 |
commit | 580d6e3f9ef185e8bbf486d84303f6dec270080a (patch) | |
tree | 2c783f786afb0cc74aed49edc8481b5a7aaf964a | |
parent | 2d6bf67be33c28991fc9ab439a9fa28962ec8dd8 (diff) | |
download | fmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.tar.gz fmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.tar.xz fmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.zip |
asm: wfi, set/get_BASEPRI
-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 */ |