ldivmod, uldivmod: fix qdivrem calls
[minix.git] / include / minix / mmio.h
blob8c23a352006c82344c88b57769fdd081e08f3e8e
1 #ifndef __MMIO_H__
2 #define __MMIO_H__
4 #define REG(x)(*((volatile uint32_t *)(x)))
5 #define BIT(x)(0x1 << x)
7 /* Write a uint32_t value to a memory address. */
8 static inline void
9 write32(uint32_t address, uint32_t value)
11 REG(address) = value;
14 /* Read an uint32_t from a memory address */
15 static inline uint32_t
16 read32(uint32_t address)
18 return REG(address);
21 /* Set a 32 bits value depending on a mask */
22 static inline void
23 set32(uint32_t address, uint32_t mask, uint32_t value)
25 uint32_t val;
26 val = read32(address);
27 /* clear the bits */
28 val &= ~(mask);
29 /* apply the value using the mask */
30 val |= (value & mask);
31 write32(address, val);
33 #endif /* __MMIO_H__ */