summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/flash.h b/flash.h
index 3985c60..b33e133 100644
--- a/flash.h
+++ b/flash.h
@@ -58,6 +58,36 @@
#define INL inl
#endif
+static inline void writeb(uint8_t b, volatile void *addr)
+{
+ *(volatile uint8_t *) addr = b;
+}
+
+static inline void writew(uint16_t b, volatile void *addr)
+{
+ *(volatile uint16_t *) addr = b;
+}
+
+static inline void writel(uint32_t b, volatile void *addr)
+{
+ *(volatile uint32_t *) addr = b;
+}
+
+static inline uint8_t readb(const volatile void *addr)
+{
+ return *(volatile uint8_t *) addr;
+}
+
+static inline uint16_t readw(const volatile void *addr)
+{
+ return *(volatile uint16_t *) addr;
+}
+
+static inline uint32_t readl(const volatile void *addr)
+{
+ return *(volatile uint32_t *) addr;
+}
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
struct flashchip {
OpenPOWER on IntegriCloud