summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2017-03-26 21:41:28 +0100
committerTomasz Kramkowski <tk@the-tk.com>2017-03-26 21:41:28 +0100
commit580d6e3f9ef185e8bbf486d84303f6dec270080a (patch)
tree2c783f786afb0cc74aed49edc8481b5a7aaf964a
parent2d6bf67be33c28991fc9ab439a9fa28962ec8dd8 (diff)
downloadfmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.tar.gz
fmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.tar.xz
fmk-580d6e3f9ef185e8bbf486d84303f6dec270080a.zip
asm: wfi, set/get_BASEPRI
-rw-r--r--asm.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/asm.h b/asm.h
index f6489e6..f638d58 100644
--- a/asm.h
+++ b/asm.h
@@ -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 */