CMSIS-CORE  Version 4.30
CMSIS-CORE support for Cortex-M processor-based devices
 All Data Structures Files Functions Variables Enumerations Enumerator Groups Pages
Intrinsic Functions for CPU Instructions

Functions that generate specific Cortex-M CPU Instructions. More...

Functions

void __NOP (void)
 No Operation.
 
void __WFI (void)
 Wait For Interrupt.
 
void __WFE (void)
 Wait For Event.
 
void __SEV (void)
 Send Event.
 
void __BKPT (uint8_t value)
 Set Breakpoint.
 
void __ISB (void)
 Instruction Synchronization Barrier.
 
void __DSB (void)
 Data Synchronization Barrier.
 
void __DMB (void)
 Data Memory Barrier.
 
uint32_t __REV (uint32_t value)
 Reverse byte order (32 bit)
 
uint32_t __REV16 (uint32_t value)
 Reverse byte order (16 bit)
 
int32_t __REVSH (int32_t value)
 Reverse byte order in signed short value.
 
uint32_t __RBIT (uint32_t value)
 Reverse bit order of value [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __ROR (uint32_t value, uint32_t shift)
 Rotate a value right by a number of bits.
 
uint8_t __LDREXB (volatile uint8_t *addr)
 LDR Exclusive (8 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint16_t __LDREXH (volatile uint16_t *addr)
 LDR Exclusive (16 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __LDREXW (volatile uint32_t *addr)
 LDR Exclusive (32 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __STREXB (uint8_t value, volatile uint8_t *addr)
 STR Exclusive (8 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __STREXH (uint16_t value, volatile uint16_t *addr)
 STR Exclusive (16 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __STREXW (uint32_t value, volatile uint32_t *addr)
 STR Exclusive (32 bit) [not for Cortex-M0, Cortex-M0+, or SC000].
 
void __CLREX (void)
 Remove the exclusive lock [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __SSAT (unint32_t value, uint32_t sat)
 Signed Saturate [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __USAT (uint32_t value, uint32_t sat)
 Unsigned Saturate [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint8_t __CLZ (uint32_t value)
 Count leading zeros [not for Cortex-M0, Cortex-M0+, or SC000].
 
uint32_t __RRX (uint32_t value)
 Rotate Right with Extend (32 bit)
 
uint8_t __LDRBT (uint8_t ptr)
 LDRT Unprivileged (8 bit)
 
uint16_t __LDRHT (uint16_t ptr)
 LDRT Unprivileged (16 bit)
 
uint32_t __LDRT (uint32_t ptr)
 LDRT Unprivileged (32 bit)
 
void __STRBT (uint8_t value, uint8_t ptr)
 STRT Unprivileged (8 bit)
 
void __STRHT (uint16_t value, uint16_t ptr)
 STRT Unprivileged (16 bit)
 
void __STRT (uint32_t value, uint32_t ptr)
 STRT Unprivileged (32 bit)
 

Description

The following functions generate specific Cortex-M instructions that cannot be directly accessed by the C/C++ Compiler. Refer to the Cortex-M Reference Manuals for detailed information about these Cortex-M instructions.

Note
When using the ARM Compiler Toolchain the following Intrinsic Functions for CPU Instructions are implemented using the Embedded Assembler: __RRX, <Bruno: add more...>. The usage of the Embedded Assembler can be disabled by with define __NO_EMBEDDED_ASM. This avoids potential side effects of the Embedded Assembler. Refer to Compiler User Guide - Using the Inline and Embedded Assemblers of the ARM Compiler for more information.

Function Documentation

void __BKPT ( uint8_t  value)

This function causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached.

Parameters
[in]valueis ignored by the processor. If required, a debugger can use it to obtain additional information about the breakpoint.
void __CLREX ( void  )

This function removes the exclusive lock which is created by LDREX [not for Cortex-M0, Cortex-M0+, or SC000].

uint8_t __CLZ ( uint32_t  value)

This function counts the number of leading zeros of a data value [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to count the leading zeros
Returns
number of leading zeros in value
void __DMB ( void  )

This function ensures the apparent order of the explicit memory operations before and after the instruction, without ensuring their completion.

void __DSB ( void  )

This function acts as a special kind of Data Memory Barrier. It completes when all explicit memory accesses before this instruction complete.

void __ISB ( void  )

Instruction Synchronization Barrier flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the instruction has been completed.

uint8_t __LDRBT ( uint8_t  ptr)

This function executed an Unprivileged LDRT command for 8 bit value.

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

This function executed an exclusive LDR command for 8 bit value [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]*addrPointer to data
Returns
value of type uint8_t at (*addr)
uint16_t __LDREXH ( volatile uint16_t *  addr)

This function executed an exclusive LDR command for 16 bit values [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]*addrPointer to data
Returns
value of type uint16_t at (*addr)
uint32_t __LDREXW ( volatile uint32_t *  addr)

This function executed an exclusive LDR command for 32 bit values [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]*addrPointer to data
Returns
value of type uint32_t at (*addr)
uint16_t __LDRHT ( uint16_t  ptr)

This function executed an Unprivileged LDRT command for 16 bit values.

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

This function executed an Unprivileged LDRT command for 32 bit values.

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

This function does nothing. This instruction can be used for code alignment purposes.

uint32_t __RBIT ( uint32_t  value)

This function reverses the bit order of the given value [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to reverse
Returns
Reversed value
uint32_t __REV ( uint32_t  value)

This function reverses the byte order in integer value.

Parameters
[in]valueValue to reverse
Returns
Reversed value
uint32_t __REV16 ( uint32_t  value)

This function reverses the byte order in two unsigned short values.

Parameters
[in]valueValue to reverse
Returns
Reversed value
int32_t __REVSH ( int32_t  value)

This function reverses the byte order in a signed short value with sign extension to integer.

Parameters
[in]valueValue to reverse
Returns
Reversed value
uint32_t __ROR ( uint32_t  value,
uint32_t  shift 
)

This function rotates a value right by a specified number of bits.

Parameters
[in]valueValue to be shifted right
[in]shiftNumber of bits in the range [1..31]
Returns
Rotated value
uint32_t __RRX ( uint32_t  value)

This function 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
void __SEV ( void  )

Send Event is a hint instruction. It causes an event to be signaled to the CPU.

uint32_t __SSAT ( unint32_t  value,
uint32_t  sat 
)

This function saturates a signed value [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to be saturated
[in]satBit position to saturate to [1..32]
Returns
Saturated value
void __STRBT ( uint8_t  value,
uint8_t  ptr 
)

This function executed an Unprivileged STRT command for 8 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
uint32_t __STREXB ( uint8_t  value,
volatile uint8_t *  addr 
)

This function executed an exclusive STR command for 8 bit values [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to store
[in]*addrPointer to location
Returns
0 Function succeeded
1 Function failed
uint32_t __STREXH ( uint16_t  value,
volatile uint16_t *  addr 
)

This function executed an exclusive STR command for 16 bit values [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to store
[in]*addrPointer to location
Returns
0 Function succeeded
1 Function failed
uint32_t __STREXW ( uint32_t  value,
volatile uint32_t *  addr 
)

This function executed an exclusive STR command for 32 bit values [not for Cortex-M0, Cortex-M0+, or SC000].

Parameters
[in]valueValue to store
[in]*addrPointer to location
Returns
0 Function succeeded
1 Function failed
void __STRHT ( uint16_t  value,
uint16_t  ptr 
)

This function executed an Unprivileged STRT command for 16 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
void __STRT ( uint32_t  value,
uint32_t  ptr 
)

This function executed an Unprivileged STRT command for 32 bit values.

Parameters
[in]valueValue to store
[in]ptrPointer to location
uint32_t __USAT ( uint32_t  value,
uint32_t  sat 
)

This function saturates an unsigned value [not for Cortex-M0, Cortex-M0+, or SC000].

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

Wait For Event is a hint instruction that permits the processor to enter a low-power state until an events occurs:

  • If the event register is 0, then WFE suspends execution until one of the following events occurs:
    • An exception, unless masked by the exception mask registers or the current priority level.
    • An exception enters the Pending state, if SEVONPEND in the System Control Register is set.
    • A Debug Entry request, if Debug is enabled.
    • An event signaled by a peripheral or another processor in a multiprocessor system using the SEV instruction.
  • If the event register is 1, then WFE clears it to 0 and returns immediately.
void __WFI ( void  )

WFI is a hint instruction that suspends execution until one of the following events occurs:

  • A non-masked interrupt occurs and is taken.
  • An interrupt masked by PRIMASK becomes pending.
  • A Debug Entry request.