The intrinsics in Table 6-7 enable you to get/set the CPSR register and to enable/disable interrupts. All but the _call_swi() function are only available when compiling in ARM mode. Additional intrinsices for ARM assembly instructions are provided in Section 5.14.
C/C++ Compiler Intrinsic | Assembly
Instruction |
Description |
---|---|---|
void _call_swi(unsigned int src); | SWI$src | Call a software interrupt. The src must be an immediate. |
unsigned int dst = _disable_FIQ( ); | Cortex-R4/A8:
MRSdst, FAULTMASK CPSIDf |
Disable FIQ interrupts and return previous FAULTMASK or CPSR setting. |
unsigned int dst = _disable_interrupts( ); | Cortex-M0:
MRSdst, PRIMASK CPSIDi Cortex-M3/M4/R4/A8: MRSdst, FAULTMASK CPSIDf |
Disable all interrupts and return previous PRIMASK or FAULTMASK setting. The assembly instructions are dependent on the architecture. |
unsigned int dst = _disable_IRQ( ); | MRSdst, PRIMASK
CPSIDi |
Disable IRQ interrupts and return previous PRIMASK setting. |
unsigned int dst = _enable_FIQ( ); | Cortex-R4/A8:
MRSdst, FAULTMASK CPSIEf |
Enable FIQ interrupts and return previous FAULTMASK or CPSR setting. |
unsigned int dst = _enable_interrupts( ); | Cortex-M0:
MRSdst, PRIMASK CPSIEi Cortex-M3/M4/R4/A8: MRSdst, FAULTMASK CPSIEf |
Enable all interrupts and return previous PRIMASK or FAULTMASK setting. The assembly instructions are dependent on the architecture. |
unsigned int dst = _enable_IRQ( ); | MRSdst, PRIMASK
CPSIEi |
Enable IRQ interrupts and return previous PRIMASK setting. |
unsigned int dst = _get_CPSR( ); | MRSdst, CPSR | Get the CPSR register. |
void _restore_interupts(unsigned int src); | Cortex-M0:
MSR PRIMASKsrc Cortex-M3/M4: MSR FAULTMASKsrc Cortex-R4: MSR CPSR_cf ,src |
Restores interrupts to state indicated by value returned from _disable_interrupts. The assembly instructions are dependent on the architecture. |
void _set_CPSR(unsigned int src); | MSR CPSR, src | Set the CPSR register. |
void _set_CPSR_flg(unsigned int src); | MSRdst, CPSR | Set the CPSR flag bits. The src is rotated by the intrinsic. |
unsigned int dst = _set_interrupt_priority( unsigned int src) ; | Cortex-M0/M3/M4 only:
MRSdst, BASEPRI MSR BASEPRI,src |
Set interrupt priority and return the previous setting. |