3.2. CMSIS functions

ISO/IEC C code cannot directly access some Cortex-M7 processor instructions. This section describes intrinsic functions that can generate these instructions, provided by the CMSIS and that might be provided by a C compiler. If a C compiler does not support an appropriate intrinsic function, you might have to use inline assembler to access some instructions.

The CMSIS provides the following intrinsic functions to generate instructions that ISO/IEC C code cannot directly access:

Table 3.2. CMSIS functions to generate some Cortex-M7 processor instructions

InstructionCMSIS function
CPSIE Ivoid __enable_irq(void)
CPSID Ivoid __disable_irq(void)
CPSIE Fvoid __enable_fault_irq(void)
CPSID Fvoid __disable_fault_irq(void)
ISBvoid __ISB(void)
DSBvoid __DSB(void)
DMBvoid __DMB(void)
REVuint32_t __REV(uint32_t int value)
REV16uint32_t __REV16(uint32_t int value)
REVSHuint32_t __REVSH(uint32_t int value)
RBITuint32_t __RBIT(uint32_t int value)
SEVvoid __SEV(void)
WFEvoid __WFE(void)
WFIvoid __WFI(void)

The CMSIS also provides a number of functions for accessing the special registers using MRS and MSR instructions:

Table 3.3. CMSIS functions to access the special registers

Special registerAccessCMSIS function
PRIMASKReaduint32_t __get_PRIMASK (void)
Writevoid __set_PRIMASK (uint32_t value)
FAULTMASK Readuint32_t __get_FAULTMASK (void)
Writevoid __set_FAULTMASK (uint32_t value)
BASEPRIReaduint32_t __get_BASEPRI (void)
Writevoid __set_BASEPRI (uint32_t value)
CONTROLReaduint32_t __get_CONTROL (void)
Writevoid __set_CONTROL (uint32_t value)
MSPReaduint32_t __get_MSP (void)
Writevoid __set_MSP (uint32_t TopOfMainStack)
PSPReaduint32_t __get_PSP (void)
Writevoid __set_PSP (uint32_t TopOfProcStack)

Copyright © 2015, 2018 Arm. All rights reserved.ARM DUI 0646C