CMSIS-Core (Cortex-A)  
CMSIS-Core support for Cortex-A processor-based devices
 
Loading...
Searching...
No Matches
cmsis_armclang_a.h File Reference

Macros

#define __ASM   __asm
 Pass information from the compiler to the assembler.
 
#define __INLINE   __inline
 Recommend that function should be inlined by the compiler.
 
#define __FORCEINLINE   __attribute__((always_inline))
 
#define __STATIC_INLINE   static __inline
 Define a static function should be inlined by the compiler.
 
#define __STATIC_FORCEINLINE   __attribute__((always_inline)) static __inline
 
#define __NO_RETURN   __attribute__((__noreturn__))
 Inform the compiler that a function does not return.
 
#define CMSIS_DEPRECATED   __attribute__((deprecated))
 
#define __USED   __attribute__((used))
 Inform that a variable shall be retained in executable image.
 
#define __WEAK   __attribute__((weak))
 Export a function or variable weakly to allow overwrites.
 
#define __PACKED   __attribute__((packed, aligned(1)))
 Request smallest possible alignment.
 
#define __PACKED_STRUCT   struct __attribute__((packed, aligned(1)))
 
#define __UNALIGNED_UINT16_WRITE(addr, val)   (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
 
#define __UNALIGNED_UINT16_READ(addr)   (((const struct T_UINT16_READ *)(const void *)(addr))->v)
 
#define __UNALIGNED_UINT32_WRITE(addr, val)   (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
 
#define __UNALIGNED_UINT32_READ(addr)   (((const struct T_UINT32_READ *)(const void *)(addr))->v)
 
#define __ALIGNED(x)   __attribute__((aligned(x)))
 Minimum alignment for a variable.
 
#define __COMPILER_BARRIER()   __ASM volatile("":::"memory")
 
#define __NOP   __builtin_arm_nop
 No Operation.
 
#define __WFI   __builtin_arm_wfi
 Wait For Interrupt.
 
#define __WFE   __builtin_arm_wfe
 Wait For Event.
 
#define __SEV   __builtin_arm_sev
 Send Event.
 
#define __ISB()   __builtin_arm_isb(0xF)
 Instruction Synchronization Barrier.
 
#define __DSB()   __builtin_arm_dsb(0xF)
 Data Synchronization Barrier.
 
#define __DMB()   __builtin_arm_dmb(0xF)
 Data Memory Barrier.
 
#define __REV(value)   __builtin_bswap32(value)
 Reverse byte order (32 bit)
 
#define __REV16(value)   __ROR(__REV(value), 16)
 Reverse byte order (16 bit)
 
#define __REVSH(value)   (int16_t)__builtin_bswap16(value)
 Reverse byte order (16 bit)
 
#define __BKPT(value)   __ASM volatile ("bkpt "#value)
 Breakpoint.
 
#define __RBIT   __builtin_arm_rbit
 Reverse bit order of value.
 
#define __LDREXB   (uint8_t)__builtin_arm_ldrex
 LDR Exclusive (8 bit)
 
#define __LDREXH   (uint16_t)__builtin_arm_ldrex
 LDR Exclusive (16 bit)
 
#define __LDREXW   (uint32_t)__builtin_arm_ldrex
 LDR Exclusive (32 bit)
 
#define __STREXB   (uint32_t)__builtin_arm_strex
 STR Exclusive (8 bit)
 
#define __STREXH   (uint32_t)__builtin_arm_strex
 STR Exclusive (16 bit)
 
#define __STREXW   (uint32_t)__builtin_arm_strex
 STR Exclusive (32 bit)
 
#define __CLREX   __builtin_arm_clrex
 Remove the exclusive lock.
 
#define __SSAT   __builtin_arm_ssat
 Signed Saturate.
 
#define __USAT   __builtin_arm_usat
 Unsigned Saturate.
 
#define __get_CP(cp, op1, Rt, CRn, CRm, op2)   __ASM volatile("MRC p" # cp ", " # op1 ", %0, c" # CRn ", c" # CRm ", " # op2 : "=r" (Rt) : : "memory" )
 
#define __set_CP(cp, op1, Rt, CRn, CRm, op2)   __ASM volatile("MCR p" # cp ", " # op1 ", %0, c" # CRn ", c" # CRm ", " # op2 : : "r" (Rt) : "memory" )
 
#define __get_CP64(cp, op1, Rt, CRm)   __ASM volatile("MRRC p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : "=r" (Rt) : : "memory" )
 
#define __set_CP64(cp, op1, Rt, CRm)   __ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )
 

Functions

__STATIC_FORCEINLINE uint32_t __ROR (uint32_t op1, uint32_t op2)
 Rotate Right in unsigned value (32 bit)
 
__STATIC_FORCEINLINE uint8_t __CLZ (uint32_t value)
 Count leading zeros.
 
__STATIC_FORCEINLINE uint32_t __RRX (uint32_t value)
 Rotate Right with Extend (32 bit)
 
__STATIC_FORCEINLINE uint8_t __LDRBT (volatile uint8_t *ptr)
 LDRT Unprivileged (8 bit)
 
__STATIC_FORCEINLINE uint16_t __LDRHT (volatile uint16_t *ptr)
 LDRT Unprivileged (16 bit)
 
__STATIC_FORCEINLINE uint32_t __LDRT (volatile uint32_t *ptr)
 LDRT Unprivileged (32 bit)
 
__STATIC_FORCEINLINE void __STRBT (uint8_t value, volatile uint8_t *ptr)
 STRT Unprivileged (8 bit)
 
__STATIC_FORCEINLINE void __STRHT (uint16_t value, volatile uint16_t *ptr)
 STRT Unprivileged (16 bit)
 
__STATIC_FORCEINLINE void __STRT (uint32_t value, volatile uint32_t *ptr)
 STRT Unprivileged (32 bit)
 
__STATIC_FORCEINLINE void __enable_irq (void)
 Enable IRQ Interrupts.
 
__STATIC_FORCEINLINE void __disable_irq (void)
 Disable IRQ Interrupts.
 
__STATIC_FORCEINLINE void __enable_fault_irq (void)
 Enable FIQ.
 
__STATIC_FORCEINLINE void __disable_fault_irq (void)
 Disable FIQ.
 
__STATIC_FORCEINLINE uint32_t __get_FPSCR (void)
 Get FPSCR.
 
__STATIC_FORCEINLINE void __set_FPSCR (uint32_t fpscr)
 Set FPSCR.
 
__STATIC_FORCEINLINE uint32_t __get_CPSR (void)
 Get CPSR Register.
 
__STATIC_FORCEINLINE void __set_CPSR (uint32_t cpsr)
 Set CPSR Register.
 
__STATIC_FORCEINLINE uint32_t __get_mode (void)
 Get Mode.
 
__STATIC_FORCEINLINE void __set_mode (uint32_t mode)
 Set Mode.
 
__STATIC_FORCEINLINE uint32_t __get_SP (void)
 Get Stack Pointer.
 
__STATIC_FORCEINLINE void __set_SP (uint32_t stack)
 Set Stack Pointer.
 
__STATIC_FORCEINLINE uint32_t __get_SP_usr (void)
 Get USR/SYS Stack Pointer.
 
__STATIC_FORCEINLINE void __set_SP_usr (uint32_t topOfProcStack)
 Set USR/SYS Stack Pointer.
 
__STATIC_FORCEINLINE uint32_t __get_FPEXC (void)
 Get FPEXC.
 
__STATIC_FORCEINLINE void __set_FPEXC (uint32_t fpexc)
 Set FPEXC.
 
__STATIC_INLINE void __FPU_Enable (void)
 Enable Floating Point Unit.
 

Variables

__PACKED_STRUCT T_UINT16_WRITE { uint16_t v
 
__PACKED_STRUCT T_UINT16_READ { uint16_t v
 
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v
 
__PACKED_STRUCT T_UINT32_READ { uint32_t v
 

Macro Definition Documentation

◆ __CLREX

#define __CLREX   __builtin_arm_clrex

Remove the exclusive lock.

Removes the exclusive lock which is created by LDREX.

◆ __COMPILER_BARRIER

#define __COMPILER_BARRIER ( )    __ASM volatile("":::"memory")

◆ __FORCEINLINE

#define __FORCEINLINE   __attribute__((always_inline))

◆ __get_CP

#define __get_CP (   cp,
  op1,
  Rt,
  CRn,
  CRm,
  op2 
)    __ASM volatile("MRC p" # cp ", " # op1 ", %0, c" # CRn ", c" # CRm ", " # op2 : "=r" (Rt) : : "memory" )

◆ __get_CP64

#define __get_CP64 (   cp,
  op1,
  Rt,
  CRm 
)    __ASM volatile("MRRC p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : "=r" (Rt) : : "memory" )

◆ __LDREXB

#define __LDREXB   (uint8_t)__builtin_arm_ldrex

LDR Exclusive (8 bit)

Executes a exclusive LDR instruction for 8 bit value.

Parameters
[in]ptrPointer to data
Returns
value of type uint8_t at (*ptr)

◆ __LDREXH

#define __LDREXH   (uint16_t)__builtin_arm_ldrex

LDR Exclusive (16 bit)

Executes a exclusive LDR instruction for 16 bit values.

Parameters
[in]ptrPointer to data
Returns
value of type uint16_t at (*ptr)

◆ __LDREXW

#define __LDREXW   (uint32_t)__builtin_arm_ldrex

LDR Exclusive (32 bit)

Executes a exclusive LDR instruction for 32 bit values.

Parameters
[in]ptrPointer to data
Returns
value of type uint32_t at (*ptr)

◆ __PACKED_STRUCT

#define __PACKED_STRUCT   struct __attribute__((packed, aligned(1)))

◆ __RBIT

#define __RBIT   __builtin_arm_rbit

Reverse bit order of value.

Reverses the bit order of the given value.

Parameters
[in]valueValue to reverse
Returns
Reversed value

◆ __REV

#define __REV (   value)    __builtin_bswap32(value)

Reverse byte order (32 bit)

Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.

Parameters
[in]valueValue to reverse
Returns
Reversed value

◆ __REV16

#define __REV16 (   value)    __ROR(__REV(value), 16)

Reverse byte order (16 bit)

Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.

Parameters
[in]valueValue to reverse
Returns
Reversed value

◆ __REVSH

#define __REVSH (   value)    (int16_t)__builtin_bswap16(value)

Reverse byte order (16 bit)

Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.

Parameters
[in]valueValue to reverse
Returns
Reversed value

◆ __set_CP

#define __set_CP (   cp,
  op1,
  Rt,
  CRn,
  CRm,
  op2 
)    __ASM volatile("MCR p" # cp ", " # op1 ", %0, c" # CRn ", c" # CRm ", " # op2 : : "r" (Rt) : "memory" )

◆ __set_CP64

#define __set_CP64 (   cp,
  op1,
  Rt,
  CRm 
)    __ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )

◆ __SSAT

#define __SSAT   __builtin_arm_ssat

Signed Saturate.

Saturates a signed value.

Parameters
[in]valueValue to be saturated
[in]satBit position to saturate to (1..32)
Returns
Saturated value

◆ __STATIC_FORCEINLINE

#define __STATIC_FORCEINLINE   __attribute__((always_inline)) static __inline

◆ __STREXB

#define __STREXB   (uint32_t)__builtin_arm_strex

STR Exclusive (8 bit)

Executes a exclusive STR instruction for 8 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
Returns
0 Function succeeded
1 Function failed

◆ __STREXH

#define __STREXH   (uint32_t)__builtin_arm_strex

STR Exclusive (16 bit)

Executes a exclusive STR instruction for 16 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
Returns
0 Function succeeded
1 Function failed

◆ __STREXW

#define __STREXW   (uint32_t)__builtin_arm_strex

STR Exclusive (32 bit)

Executes a exclusive STR instruction for 32 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
Returns
0 Function succeeded
1 Function failed

◆ __UNALIGNED_UINT16_READ

#define __UNALIGNED_UINT16_READ (   addr)    (((const struct T_UINT16_READ *)(const void *)(addr))->v)

◆ __UNALIGNED_UINT16_WRITE

#define __UNALIGNED_UINT16_WRITE (   addr,
  val 
)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))

◆ __UNALIGNED_UINT32_READ

#define __UNALIGNED_UINT32_READ (   addr)    (((const struct T_UINT32_READ *)(const void *)(addr))->v)

◆ __UNALIGNED_UINT32_WRITE

#define __UNALIGNED_UINT32_WRITE (   addr,
  val 
)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))

◆ __USAT

#define __USAT   __builtin_arm_usat

Unsigned Saturate.

Saturates an unsigned value.

Parameters
[in]valueValue to be saturated
[in]satBit position to saturate to (0..31)
Returns
Saturated value

◆ CMSIS_DEPRECATED

#define CMSIS_DEPRECATED   __attribute__((deprecated))

Function Documentation

◆ __disable_fault_irq()

__STATIC_FORCEINLINE void __disable_fault_irq ( void  )

Disable FIQ.

Disables FIQ interrupts by setting special-purpose register FAULTMASK. Can only be executed in Privileged modes.

◆ __disable_irq()

__STATIC_FORCEINLINE void __disable_irq ( void  )

Disable IRQ Interrupts.

Disables IRQ interrupts by setting the I-bit in the CPSR. Can only be executed in Privileged modes.

◆ __enable_fault_irq()

__STATIC_FORCEINLINE void __enable_fault_irq ( void  )

Enable FIQ.

Enables FIQ interrupts by clearing special-purpose register FAULTMASK. Can only be executed in Privileged modes.

◆ __enable_irq()

__STATIC_FORCEINLINE void __enable_irq ( void  )

Enable IRQ Interrupts.

Enables IRQ interrupts by clearing the I-bit in the CPSR. Can only be executed in Privileged modes.

◆ __get_mode()

__STATIC_FORCEINLINE uint32_t __get_mode ( void  )

Get Mode.

Returns
Processor Mode

◆ __get_SP()

__STATIC_FORCEINLINE uint32_t __get_SP ( void  )

Get Stack Pointer.

Returns
Stack Pointer value

◆ __get_SP_usr()

__STATIC_FORCEINLINE uint32_t __get_SP_usr ( void  )

Get USR/SYS Stack Pointer.

Returns
USR/SYS Stack Pointer value

◆ __LDRBT()

__STATIC_FORCEINLINE uint8_t __LDRBT ( volatile uint8_t *  ptr)

LDRT Unprivileged (8 bit)

Executes a Unprivileged LDRT instruction for 8 bit value.

Parameters
[in]ptrPointer to data
Returns
value of type uint8_t at (*ptr)

◆ __LDRHT()

__STATIC_FORCEINLINE uint16_t __LDRHT ( volatile uint16_t *  ptr)

LDRT Unprivileged (16 bit)

Executes a Unprivileged LDRT instruction for 16 bit values.

Parameters
[in]ptrPointer to data
Returns
value of type uint16_t at (*ptr)

◆ __LDRT()

__STATIC_FORCEINLINE uint32_t __LDRT ( volatile uint32_t *  ptr)

LDRT Unprivileged (32 bit)

Executes a Unprivileged LDRT instruction for 32 bit values.

Parameters
[in]ptrPointer to data
Returns
value of type uint32_t at (*ptr)

◆ __RRX()

__STATIC_FORCEINLINE uint32_t __RRX ( uint32_t  value)

Rotate Right with Extend (32 bit)

Moves each bit of a bitstring right by one bit. The carry input is shifted in at the left end of the bitstring.

Parameters
[in]valueValue to rotate
Returns
Rotated value

◆ __set_mode()

__STATIC_FORCEINLINE void __set_mode ( uint32_t  mode)

Set Mode.

Parameters
[in]modeMode value to set

◆ __STRBT()

__STATIC_FORCEINLINE void __STRBT ( uint8_t  value,
volatile uint8_t *  ptr 
)

STRT Unprivileged (8 bit)

Executes a Unprivileged STRT instruction for 8 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location

◆ __STRHT()

__STATIC_FORCEINLINE void __STRHT ( uint16_t  value,
volatile uint16_t *  ptr 
)

STRT Unprivileged (16 bit)

Executes a Unprivileged STRT instruction for 16 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location

◆ __STRT()

__STATIC_FORCEINLINE void __STRT ( uint32_t  value,
volatile uint32_t *  ptr 
)

STRT Unprivileged (32 bit)

Executes a Unprivileged STRT instruction for 32 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location

Variable Documentation

◆ T_UINT16_READ

__PACKED_STRUCT T_UINT16_READ { uint16_t v

◆ T_UINT16_WRITE

__PACKED_STRUCT T_UINT16_WRITE { uint16_t v

◆ T_UINT32_READ

__PACKED_STRUCT T_UINT32_READ { uint32_t v

◆ T_UINT32_WRITE

__PACKED_STRUCT T_UINT32_WRITE { uint32_t v