CMSIS-Core (Cortex-A): cmsis_armcc.h File Reference

| CMSIS-Core (Cortex-A) Version 1.1.2 CMSIS-Core support for Cortex-A processor-based devices

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
cmsis_armcc.h File Reference

CMSIS compiler specific macros, functions, instructions. More...

## Macros
#define | __ARM_ARCH_7A__ 1
| Set to 1 when generating code for Armv7-A (Cortex-A7) More...
#define | __ASM __asm
| Pass information from the compiler to the assembler. More...
#define | __INLINE __inline
| Recommend that function should be inlined by the compiler. More...
#define | __FORCEINLINE __forceinline
#define | __STATIC_INLINE static __inline
| Define a static function should be inlined by the compiler. More...
#define | __STATIC_FORCEINLINE static __forceinline
#define | __NO_RETURN __declspec(noreturn)
| Inform the compiler that a function does not return. More...
#define | CMSIS_DEPRECATED __attribute__((deprecated))
#define | __USED __attribute__((used))
| Inform that a variable shall be retained in executable image. More...
#define | __WEAK __attribute__((weak))
| Export a function or variable weakly to allow overwrites. More...
#define | __PACKED __attribute__((packed))
| Request smallest possible alignment. More...
#define | __PACKED_STRUCT __packed struct
#define | __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
#define | __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
#define | __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
#define | __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
#define | __ALIGNED(x) __attribute__((aligned(x)))
| Minimum alignment for a variable. More...
#define | __NOP __nop
| No Operation. More...
#define | __WFI __wfi
| Wait For Interrupt. More...
#define | __WFE __wfe
| Wait For Event. More...
#define | __SEV __sev
| Send Event. More...
#define | __ISB()
| Instruction Synchronization Barrier. More...
#define | __DSB()
| Data Synchronization Barrier. More...
#define | __DMB()
| Data Memory Barrier. More...
#define | __REV __rev
| Reverse byte order (32 bit) More...
#define | __ROR __ror
| Reverse byte order (16 bit) More...
#define | __BKPT(value) __breakpoint(value)
| Breakpoint. More...
#define | __RBIT __rbit
| Reverse bit order of value. More...
#define | __CLZ __clz
| Count leading zeros. More...
#define | __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
| LDR Exclusive (8 bit) More...
#define | __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
| LDR Exclusive (16 bit) More...
#define | __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
| LDR Exclusive (32 bit) More...
#define | __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
| STR Exclusive (8 bit) More...
#define | __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
| STR Exclusive (16 bit) More...
#define | __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
| STR Exclusive (32 bit) More...
#define | __CLREX __clrex
| Remove the exclusive lock. More...
#define | __SSAT __ssat
| Signed Saturate. More...
#define | __USAT __usat
| Unsigned Saturate. More...
#define | __get_CP(cp, op1, Rt, CRn, CRm, op2) do { register volatile uint32_t tmp __ASM("cp" # cp ":" # op1 ":c" # CRn ":c" # CRm ":" # op2); (Rt) = tmp; } while(0)
#define | __set_CP(cp, op1, Rt, CRn, CRm, op2) do { register volatile uint32_t tmp __ASM("cp" # cp ":" # op1 ":c" # CRn ":c" # CRm ":" # op2); tmp = (Rt); } while(0)
#define | __get_CP64(cp, op1, Rt, CRm)
#define | __set_CP64(cp, op1, Rt, CRm)

## Functions
__STATIC_INLINE uint32_t | __get_FPSCR (void)
| Get FPSCR (Floating Point Status/Control) More...
__STATIC_INLINE void | __set_FPSCR (uint32_t fpscr)
| Set FPSCR (Floating Point Status/Control) More...
__STATIC_INLINE uint32_t | __get_CPSR (void)
| Get CPSR (Current Program Status Register) More...
__STATIC_INLINE void | __set_CPSR (uint32_t cpsr)
| Set CPSR (Current Program Status Register) More...
__STATIC_INLINE uint32_t | __get_mode (void)
| Get Mode. More...
__STATIC_INLINE __ASM void | __set_mode (uint32_t mode)
| Set Mode. More...
__STATIC_INLINE __ASM uint32_t | __get_SP (void)
| Get Stack Pointer. More...
__STATIC_INLINE __ASM void | __set_SP (uint32_t stack)
| Set Stack Pointer. More...
__STATIC_INLINE __ASM uint32_t | __get_SP_usr (void)
| Get USR/SYS Stack Pointer. More...
__STATIC_INLINE __ASM void | __set_SP_usr (uint32_t topOfProcStack)
| Set USR/SYS Stack Pointer. More...
__STATIC_INLINE uint32_t | __get_FPEXC (void)
| Get FPEXC (Floating Point Exception Control Register) More...
__STATIC_INLINE void | __set_FPEXC (uint32_t fpexc)
| Set FPEXC (Floating Point Exception Control Register) More...
__STATIC_INLINE __ASM void | __FPU_Enable (void)
| Enable Floating Point Unit. More...

## Description

Version
  V1.0.2

Date
  10. January 2018

## Macro Definition Documentation

#define __CLREX __clrex

Removes the exclusive lock which is created by LDREX.

#define __CLZ __clz

Parameters

  [in] | value | Value to count the leading zeros

Returns
  number of leading zeros in value

#define __FORCEINLINE __forceinline

#define __get_CP | ( |  | cp,
|  |  | op1,
|  |  | Rt,
|  |  | CRn,
|  |  | CRm,
|  |  | op2
| ) |  | do { register volatile uint32_t tmp __ASM("cp" # cp ":" # op1 ":c" # CRn ":c" # CRm ":" # op2); (Rt) = tmp; } while(0)

#define __get_CP64 | ( |  | cp,
|  |  | op1,
|  |  | Rt,
|  |  | CRm
| ) |  |

#define __LDREXB | ( |  | ptr | ) | _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")

Executes a exclusive LDR instruction for 8 bit value.

Parameters

  [in] | ptr | Pointer to data

Returns
  value of type uint8_t at (*ptr)

#define __LDREXH | ( |  | ptr | ) | _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")

Executes a exclusive LDR instruction for 16 bit values.

Parameters

  [in] | ptr | Pointer to data

Returns
  value of type uint16_t at (*ptr)

#define __LDREXW | ( |  | ptr | ) | _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")

Executes a exclusive LDR instruction for 32 bit values.

Parameters

  [in] | ptr | Pointer to data

Returns
  value of type uint32_t at (*ptr)

#define __PACKED_STRUCT __packed struct

#define __RBIT __rbit

Parameters

  [in] | value | Value to reverse

Returns
  Reversed value

#define __REV __rev

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

Parameters

  [in] | value | Value to reverse

Returns
  Reversed value

#define __ROR __ror

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

Parameters

  [in] | value | Value to reverse

Returns
  Reversed 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] | value | Value to reverse

Returns
  Reversed value Rotate Right in unsigned value (32 bit)

Parameters

  [in] | op1 | Value to rotate
  [in] | op2 | Number of Bits to rotate

Returns
  Rotated value

#define __set_CP | ( |  | cp,
|  |  | op1,
|  |  | Rt,
|  |  | CRn,
|  |  | CRm,
|  |  | op2
| ) |  | do { register volatile uint32_t tmp __ASM("cp" # cp ":" # op1 ":c" # CRn ":c" # CRm ":" # op2); tmp = (Rt); } while(0)

#define __set_CP64 | ( |  | cp,
|  |  | op1,
|  |  | Rt,
|  |  | CRm
| ) |  |

#define __SSAT __ssat

Saturates a signed value.

Parameters

  [in] | value | Value to be saturated
  [in] | sat | Bit position to saturate to (1..32)

Returns
  Saturated value

#define __STATIC_FORCEINLINE static __forceinline

#define __STREXB | ( |  | value,
|  |  | ptr
| ) |  | _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")

Executes a exclusive STR instruction for 8 bit values.

Parameters

  [in] | value | Value to store
  [in] | ptr | Pointer to location

Returns
  0 Function succeeded
  1 Function failed

#define __STREXH | ( |  | value,
|  |  | ptr
| ) |  | _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")

Executes a exclusive STR instruction for 16 bit values.

Parameters

  [in] | value | Value to store
  [in] | ptr | Pointer to location

Returns
  0 Function succeeded
  1 Function failed

#define __STREXW | ( |  | value,
|  |  | ptr
| ) |  | _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")

Executes a exclusive STR instruction for 32 bit values.

Parameters

  [in] | value | Value to store
  [in] | ptr | Pointer to location

Returns
  0 Function succeeded
  1 Function failed

#define __UNALIGNED_UINT16_READ | ( |  | addr | ) | (*((const __packed uint16_t *)(addr)))

#define __UNALIGNED_UINT16_WRITE | ( |  | addr,
|  |  | val
| ) |  | ((*((__packed uint16_t *)(addr))) = (val))

#define __UNALIGNED_UINT32_READ | ( |  | addr | ) | (*((const __packed uint32_t *)(addr)))

#define __UNALIGNED_UINT32_WRITE | ( |  | addr,
|  |  | val
| ) |  | ((*((__packed uint32_t *)(addr))) = (val))

#define __USAT __usat

Saturates an unsigned value.

Parameters

  [in] | value | Value to be saturated
  [in] | sat | Bit position to saturate to (0..31)

Returns
  Saturated value

#define CMSIS_DEPRECATED __attribute__((deprecated))

## Function Documentation

__STATIC_INLINE uint32_t __get_mode | ( | void |  | ) |

Returns
  Processor Mode

__STATIC_INLINE __ASM uint32_t __get_SP | ( | void |  | ) |

Returns
  Stack Pointer

__STATIC_INLINE __ASM uint32_t __get_SP_usr | ( | void |  | ) |

Returns
  USR/SYSStack Pointer

__STATIC_INLINE __ASM void __set_mode | ( | uint32_t | mode | ) |

Parameters

  [in] | mode | Mode value to set