My question is about the most efficient and safe way to set the BASEPRI register to mask interrupts above a certain level in the TI CCS C/C++ compiler. I've searched the documentation, but I could not find any intrinsic function to do this. I'm reluctant to use naive inline assembly, because the BASEPRI register must be set by means of the MSR instruction, which in turn requires clobbering a register. As far as I know, there is no way of telling the compiler that the asm instruction has clobbered a register (as it is in the GCC compiler, for example).
Currently, the only option I see is to call a function defined in assembly. But this breaks the pipeline twice, which uses many more CPU cycles than the actual setting of the BASEPRI register.
The other ARM compilers for Cortex-M, such as Keil, IAR and GNU, allow setting the BASEPRI register inline with just two instructions. It would be nice if the TI compiler could match it.
Any help would be greatly appreciated.