ARM Compatiable Functions

group NMSIS_Core_ARMCompatiable_Functions

A few functions that compatiable with ARM CMSIS-Core.

Here we provided a few functions that compatiable with ARM CMSIS-Core, mostly used in the DSP and NN library.

Defines

__ISB() __RWMB()

Instruction Synchronization Barrier, compatiable with ARM.

__DSB() __RWMB()

Data Synchronization Barrier, compatiable with ARM.

__DMB() __RWMB()

Data Memory Barrier, compatiable with ARM.

__LDRBT(ptr) __LB((ptr))

LDRT Unprivileged (8 bit), ARM Compatiable.

__LDRHT(ptr) __LH((ptr))

LDRT Unprivileged (16 bit), ARM Compatiable.

__LDRT(ptr) __LW((ptr))

LDRT Unprivileged (32 bit), ARM Compatiable.

__STRBT(ptr) __SB((ptr))

STRT Unprivileged (8 bit), ARM Compatiable.

__STRHT(ptr) __SH((ptr))

STRT Unprivileged (16 bit), ARM Compatiable.

__STRT(ptr) __SW((ptr))

STRT Unprivileged (32 bit), ARM Compatiable.

__RBIT(value) __RV_BITREV((value), 31)

Reverse bit order of value.

Reverses the bit order of the given value.

Return

Reversed value

Parameters
  • [in] value: Value to reverse

__CLZ(data) __RV_CLZ32(data)

Count leading zeros.

Counts the number of leading zeros of a data value.

Return

number of leading zeros in value

Parameters
  • [in] data: Value to count the leading zeros

Functions

__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

Signed Saturate.

Saturates a signed value.

Return

Saturated value

Parameters
  • [in] value: Value to be saturated

  • [in] sat: Bit position to saturate to (1..32)

__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)

Unsigned Saturate.

Saturates an unsigned value.

Return

Saturated value

Parameters
  • [in] value: Value to be saturated

  • [in] sat: Bit position to saturate to (0..31)

__STATIC_FORCEINLINE uint32_t __REV(uint32_t value)

Reverse byte order (32 bit)

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

Return

Reversed value

Parameters
  • [in] value: Value to reverse

__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value)

Reverse byte order (16 bit)

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

Return

Reversed value

Parameters
  • [in] value: Value to reverse

__STATIC_FORCEINLINE int16_t __REVSH(int16_t 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.

Return

Reversed value

Parameters
  • [in] value: Value to reverse

__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)

Rotate Right in unsigned value (32 bit)

Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.

Return

Rotated value

Parameters
  • [in] op1: Value to rotate

  • [in] op2: Number of Bits to rotate(0-31)