10#ifndef ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_A_R_LIB_HELPERS_H_
11#define ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_A_R_LIB_HELPERS_H_
17#define read_sysreg32(op1, CRn, CRm, op2) \
20 __asm__ volatile ("mrc p15, " #op1 ", %0, c" #CRn ", c" \
21 #CRm ", " #op2 : "=r" (val) :: "memory"); \
25#define write_sysreg32(val, op1, CRn, CRm, op2) \
27 __asm__ volatile ("mcr p15, " #op1 ", %0, c" #CRn ", c" \
28 #CRm ", " #op2 :: "r" (val) : "memory"); \
31#define read_sysreg64(op1, CRm) \
34 __asm__ volatile ("mrrc p15, " #op1 ", %Q0, %R0, c" \
35 #CRm : "=r" (val) :: "memory"); \
39#define write_sysreg64(val, op1, CRm) \
41 __asm__ volatile ("mcrr p15, " #op1 ", %Q0, %R0, c" \
42 #CRm :: "r" (val) : "memory"); \
45#define MAKE_REG_HELPER(reg, op1, CRn, CRm, op2) \
46 static ALWAYS_INLINE uint32_t read_##reg(void) \
48 return read_sysreg32(op1, CRn, CRm, op2); \
50 static ALWAYS_INLINE void write_##reg(uint32_t val) \
52 write_sysreg32(val, op1, CRn, CRm, op2); \
55#define MAKE_REG64_HELPER(reg, op1, CRm) \
56 static ALWAYS_INLINE uint64_t read_##reg(void) \
58 return read_sysreg64(op1, CRm); \
60 static ALWAYS_INLINE void write_##reg(uint64_t val) \
62 write_sysreg64(val, op1, CRm); \
99#define write_sysreg(val, reg) write_##reg(val)
100#define read_sysreg(reg) read_##reg()
102#define sev() __asm__ volatile("sev" : : : "memory")
103#define wfe() __asm__ volatile("wfe" : : : "memory")
#define ICC_SRE_EL1
Definition: cpu.h:146
#define ICC_IAR1_EL1
Definition: cpu.h:158
#define ICC_PMR_EL1
Definition: cpu.h:151
#define ICC_EOIR1_EL1
Definition: cpu.h:160
#define ICC_SGI1R
Definition: cpu.h:145
#define ICC_IGRPEN1_EL1
Definition: cpu.h:144
#define MAKE_REG_HELPER(reg, op1, CRn, CRm, op2)
Definition: lib_helpers.h:45
#define MAKE_REG64_HELPER(reg, op1, CRm)
Definition: lib_helpers.h:55