Cortex-M3 Processor (Reference Material)
UG0331 User Guide Revision 15.0 50
The following table lists the functions that CMSIS provides for accessing the special registers using
MRS
and
MSR
instructions.
3.6.3 About the Instruction Descriptions
The following sections provide more information about using the instructions:
3.6.3.1 Operands
An instruction operand can be an ARM register, a constant, or another instruction-specific parameter.
Instructions act on the operands and often store the result in a destination register. When there is a
destination register in the instruction, it is usually specified before the operands.
Operands in some instructions are flexible in that they can either be a register or a constant. Refer to
Flexible Second Operand, page 51.
3.6.3.2 Restrictions when Using PC or SP
Many instructions have restrictions on whether you can use the Program Counter (PC) or Stack Pointer
(SP) for the operands or destination register. See instruction descriptions for more information.
Bit[0] of any address you write to the PC with a
BX
,
BLX
,
LDM
,
LDR
, or
POP
instruction must be 1 for correct
execution, because this bit indicates the required instruction set, and the Cortex-M3 processor only
supports Thumb instructions.
3.6.3.3 Flexible Second Operand
Many general data processing instructions have a flexible second operand. This is shown as
Operand2
in
the descriptions of the syntax of each instruction.
Operand2
can be a constant or a register with optional shift.
3.6.3.3.1 Constant
You specify an Operand2 constant in the form:
#constant
where constant can be:
• any constant that can be produced by shifting an 8-bit value left by any number of bits within a 32-bit
word
• any constant of the form
0x00XY00XY
Table 28 • CMSIS Functions to Access the Special Registers
Special Register Access CMSIS function
PRIMASK Read uint32_t __get_PRIMASK (void)
Write void __set_PRIMASK (uint32_t value)
FAULTMASK Read uint32_t __get_FAULTMASK (void)
Write void __set_FAULTMASK (uint32_t value)
BASEPRI Read uint32_t __get_BASEPRI (void)
Write void __set_BASEPRI (uint32_t value)
CONTROL Read uint32_t __get_CONTROL (void)
Write void __set_CONTROL (uint32_t value)
MSP Read uint32_t __get_MSP (void)
Write void __set_MSP (uint32_t TopOfMainStack)
PSP Read uint32_t __get_PSP (void)
Write void __set_PSP (uint32_t TopOfProcStack)