smol-gilbraltar/include/mem.h

24 lines
461 B
C
Raw Normal View History

2024-12-20 22:45:12 +00:00
#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