24 lines
461 B
C
24 lines
461 B
C
|
#ifndef __GILBRALTAR_MEM__
|
||
|
#define __GILBRALTAR_MEM__
|
||
|
|
||
|
#include <stddef.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
static inline uint8_t read8(uintptr_t addr) {
|
||
|
return *(uint8_t volatile *)addr;
|
||
|
}
|
||
|
|
||
|
static inline void write8(uintptr_t addr, uint8_t v) {
|
||
|
*(uint8_t volatile *)addr = v;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t read32(uintptr_t addr) {
|
||
|
return *(uint32_t volatile *)addr;
|
||
|
}
|
||
|
|
||
|
static inline void write32(uintptr_t addr, uint32_t v) {
|
||
|
*(uint32_t volatile *)addr = v;
|
||
|
}
|
||
|
|
||
|
#endif
|