diff options
Diffstat (limited to 'flash.h')
-rw-r--r-- | flash.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 { |