2.5.2.8 Programming Hints for the Synchronization Primitives
ISO/IEC C cannot directly generate the exclusive access instructions. Some CMSIS provides intrinsic functions for generation of these instructions. The following table lists the functions that CMSIS provides.
Instruction | Intrinsic Function |
---|---|
LDREX, LDREXH, or LDREXB | unsigned char__LDREXB(volatile char *ptr) unsigned short __LDREXH(volatile short *ptr) unsigned int __LDREXB(volatile int *ptr) |
STREX, STREXH, or STREXB | int __STREXB(unsigned char val, volatile char *ptr) int __STREXB(unsigned short val, volatile short *ptr) int __STREXB(unsigned int val, volatile int *ptr) |
CLREX | void __CLREX(void) |
The actual exclusive access instruction generated depends on the data type of the pointer passed to the intrinsic function.