Zephyr Project API 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lib_helpers.h File Reference
#include <stdint.h>

Go to the source code of this file.

Macros

#define read_sysreg32(op1, CRn, CRm, op2)
 
#define write_sysreg32(val, op1, CRn, CRm, op2)
 
#define read_sysreg64(op1, CRm)
 
#define write_sysreg64(val, op1, CRm)
 
#define MAKE_REG_HELPER(reg, op1, CRn, CRm, op2)
 
#define MAKE_REG64_HELPER(reg, op1, CRm)
 
#define write_sysreg(val, reg)   write_##reg(val)
 
#define read_sysreg(reg)   read_##reg()
 
#define sev()   __asm__ volatile("sev" : : : "memory")
 
#define wfe()   __asm__ volatile("wfe" : : : "memory")
 

Functions

static ALWAYS_INLINE uint32_t read_mpuir (void)
 
static ALWAYS_INLINE void write_mpuir (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_mpidr (void)
 
static ALWAYS_INLINE void write_mpidr (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_sctlr (void)
 
static ALWAYS_INLINE void write_sctlr (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_prselr (void)
 
static ALWAYS_INLINE void write_prselr (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_prbar (void)
 
static ALWAYS_INLINE void write_prbar (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_prlar (void)
 
static ALWAYS_INLINE void write_prlar (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_mair0 (void)
 
static ALWAYS_INLINE void write_mair0 (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_vbar (void)
 
static ALWAYS_INLINE void write_vbar (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_cntv_ctl (void)
 
static ALWAYS_INLINE void write_cntv_ctl (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_ctr (void)
 
static ALWAYS_INLINE void write_ctr (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_tpidruro (void)
 
static ALWAYS_INLINE void write_tpidruro (uint32_t val)
 
static ALWAYS_INLINE uint64_t read_ICC_SGI1R (void)
 
static ALWAYS_INLINE void write_ICC_SGI1R (uint64_t val)
 
static ALWAYS_INLINE uint64_t read_cntvct (void)
 
static ALWAYS_INLINE void write_cntvct (uint64_t val)
 
static ALWAYS_INLINE uint64_t read_cntv_cval (void)
 
static ALWAYS_INLINE void write_cntv_cval (uint64_t val)
 
static ALWAYS_INLINE uint32_t read_ICC_PMR_EL1 (void)
 
static ALWAYS_INLINE void write_ICC_PMR_EL1 (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_ICC_IAR1_EL1 (void)
 
static ALWAYS_INLINE void write_ICC_IAR1_EL1 (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_ICC_EOIR1_EL1 (void)
 
static ALWAYS_INLINE void write_ICC_EOIR1_EL1 (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_ICC_SRE_EL1 (void)
 
static ALWAYS_INLINE void write_ICC_SRE_EL1 (uint32_t val)
 
static ALWAYS_INLINE uint32_t read_ICC_IGRPEN1_EL1 (void)
 
static ALWAYS_INLINE void write_ICC_IGRPEN1_EL1 (uint32_t val)
 

Macro Definition Documentation

◆ MAKE_REG64_HELPER

#define MAKE_REG64_HELPER (   reg,
  op1,
  CRm 
)
Value:
static ALWAYS_INLINE uint64_t read_##reg(void) \
{ \
return read_sysreg64(op1, CRm); \
} \
static ALWAYS_INLINE void write_##reg(uint64_t val) \
{ \
write_sysreg64(val, op1, CRm); \
}
workaround assembler barfing for ST if else st aa endif endm endr macro PUSHR r push r endm macro POPR r pop r endm macro LRR aux lr aux endm macro SRR aux sr aux endm irp nz macro ADDR cc v add cc v endm endr irp nz macro ADD2R cc v add2 cc v endm endr macro ADD3R v add3 v endm macro SUBR v sub v endm macro BMSKNR v bmskn v endm macro LSRR v lsr v endm macro ASLR v asl v endm macro ANDR v and v endm macro v or v endm irp eq macro BRR cc lbl br cc lbl endm endr macro BREQR lbl breq lbl endm macro CMPR op1
Definition asm-macro-32-bit-gnu.h:99
#define read_sysreg64(op1, CRm)
Definition lib_helpers.h:31
#define ALWAYS_INLINE
Definition common.h:129
__UINT64_TYPE__ uint64_t
Definition stdint.h:91

◆ MAKE_REG_HELPER

#define MAKE_REG_HELPER (   reg,
  op1,
  CRn,
  CRm,
  op2 
)
Value:
static ALWAYS_INLINE uint32_t read_##reg(void) \
{ \
return read_sysreg32(op1, CRn, CRm, op2); \
} \
static ALWAYS_INLINE void write_##reg(uint32_t val) \
{ \
write_sysreg32(val, op1, CRn, CRm, op2); \
}
#define read_sysreg32(op1, CRn, CRm, op2)
Definition lib_helpers.h:17
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

◆ read_sysreg

#define read_sysreg (   reg)    read_##reg()

◆ read_sysreg32

#define read_sysreg32 (   op1,
  CRn,
  CRm,
  op2 
)
Value:
({ \
uint32_t val; \
__asm__ volatile ("mrc p15, " #op1 ", %0, c" #CRn ", c" \
#CRm ", " #op2 : "=r" (val) :: "memory"); \
val; \
})

◆ read_sysreg64

#define read_sysreg64 (   op1,
  CRm 
)
Value:
({ \
uint64_t val; \
__asm__ volatile ("mrrc p15, " #op1 ", %Q0, %R0, c" \
#CRm : "=r" (val) :: "memory"); \
val; \
})

◆ sev

#define sev ( )    __asm__ volatile("sev" : : : "memory")

◆ wfe

#define wfe ( )    __asm__ volatile("wfe" : : : "memory")

◆ write_sysreg

#define write_sysreg (   val,
  reg 
)    write_##reg(val)

◆ write_sysreg32

#define write_sysreg32 (   val,
  op1,
  CRn,
  CRm,
  op2 
)
Value:
({ \
__asm__ volatile ("mcr p15, " #op1 ", %0, c" #CRn ", c" \
#CRm ", " #op2 :: "r" (val) : "memory"); \
})

◆ write_sysreg64

#define write_sysreg64 (   val,
  op1,
  CRm 
)
Value:
({ \
__asm__ volatile ("mcrr p15, " #op1 ", %Q0, %R0, c" \
#CRm :: "r" (val) : "memory"); \
})

Function Documentation

◆ read_cntv_ctl()

static ALWAYS_INLINE uint32_t read_cntv_ctl ( void  )
static

◆ read_cntv_cval()

static ALWAYS_INLINE uint64_t read_cntv_cval ( void  )
static

◆ read_cntvct()

static ALWAYS_INLINE uint64_t read_cntvct ( void  )
static

◆ read_ctr()

static ALWAYS_INLINE uint32_t read_ctr ( void  )
static

◆ read_ICC_EOIR1_EL1()

static ALWAYS_INLINE uint32_t read_ICC_EOIR1_EL1 ( void  )
static

◆ read_ICC_IAR1_EL1()

static ALWAYS_INLINE uint32_t read_ICC_IAR1_EL1 ( void  )
static

◆ read_ICC_IGRPEN1_EL1()

static ALWAYS_INLINE uint32_t read_ICC_IGRPEN1_EL1 ( void  )
static

◆ read_ICC_PMR_EL1()

static ALWAYS_INLINE uint32_t read_ICC_PMR_EL1 ( void  )
static

◆ read_ICC_SGI1R()

static ALWAYS_INLINE uint64_t read_ICC_SGI1R ( void  )
static

◆ read_ICC_SRE_EL1()

static ALWAYS_INLINE uint32_t read_ICC_SRE_EL1 ( void  )
static

◆ read_mair0()

static ALWAYS_INLINE uint32_t read_mair0 ( void  )
static

◆ read_mpidr()

static ALWAYS_INLINE uint32_t read_mpidr ( void  )
static

◆ read_mpuir()

static ALWAYS_INLINE uint32_t read_mpuir ( void  )
static

◆ read_prbar()

static ALWAYS_INLINE uint32_t read_prbar ( void  )
static

◆ read_prlar()

static ALWAYS_INLINE uint32_t read_prlar ( void  )
static

◆ read_prselr()

static ALWAYS_INLINE uint32_t read_prselr ( void  )
static

◆ read_sctlr()

static ALWAYS_INLINE uint32_t read_sctlr ( void  )
static

◆ read_tpidruro()

static ALWAYS_INLINE uint32_t read_tpidruro ( void  )
static

◆ read_vbar()

static ALWAYS_INLINE uint32_t read_vbar ( void  )
static

◆ write_cntv_ctl()

static ALWAYS_INLINE void write_cntv_ctl ( uint32_t  val)
static

◆ write_cntv_cval()

static ALWAYS_INLINE void write_cntv_cval ( uint64_t  val)
static

◆ write_cntvct()

static ALWAYS_INLINE void write_cntvct ( uint64_t  val)
static

◆ write_ctr()

static ALWAYS_INLINE void write_ctr ( uint32_t  val)
static

◆ write_ICC_EOIR1_EL1()

static ALWAYS_INLINE void write_ICC_EOIR1_EL1 ( uint32_t  val)
static

◆ write_ICC_IAR1_EL1()

static ALWAYS_INLINE void write_ICC_IAR1_EL1 ( uint32_t  val)
static

◆ write_ICC_IGRPEN1_EL1()

static ALWAYS_INLINE void write_ICC_IGRPEN1_EL1 ( uint32_t  val)
static

◆ write_ICC_PMR_EL1()

static ALWAYS_INLINE void write_ICC_PMR_EL1 ( uint32_t  val)
static

◆ write_ICC_SGI1R()

static ALWAYS_INLINE void write_ICC_SGI1R ( uint64_t  val)
static

◆ write_ICC_SRE_EL1()

static ALWAYS_INLINE void write_ICC_SRE_EL1 ( uint32_t  val)
static

◆ write_mair0()

static ALWAYS_INLINE void write_mair0 ( uint32_t  val)
static

◆ write_mpidr()

static ALWAYS_INLINE void write_mpidr ( uint32_t  val)
static

◆ write_mpuir()

static ALWAYS_INLINE void write_mpuir ( uint32_t  val)
static

◆ write_prbar()

static ALWAYS_INLINE void write_prbar ( uint32_t  val)
static

◆ write_prlar()

static ALWAYS_INLINE void write_prlar ( uint32_t  val)
static

◆ write_prselr()

static ALWAYS_INLINE void write_prselr ( uint32_t  val)
static

◆ write_sctlr()

static ALWAYS_INLINE void write_sctlr ( uint32_t  val)
static

◆ write_tpidruro()

static ALWAYS_INLINE void write_tpidruro ( uint32_t  val)
static

◆ write_vbar()

static ALWAYS_INLINE void write_vbar ( uint32_t  val)
static