diff options
Diffstat (limited to 'util/flashrom/flash.h')
-rw-r--r-- | util/flashrom/flash.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/util/flashrom/flash.h b/util/flashrom/flash.h index 3985c600db..b33e1330c4 100644 --- a/util/flashrom/flash.h +++ b/util/flashrom/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 { |