简体   繁体   English

需要向__set_PRIMASK解释CMSIS中的ARM Cortex-M3汇编指令

[英]Need explanation of ARM Cortex-M3 assembly instruction in CMSIS to __set_PRIMASK

Below is a code snippet from the ARM CMSIS library that is used to set the value of the PRIMASK register. 以下是ARM CMSIS库中的代码段,用于设置PRIMASK寄存器的值。

/**
 * @brief  Set the Priority Mask value
 *
 * @param  priMask  PriMask
 *
 * Set the priority mask bit in the priority mask register
 */
static __INLINE void __set_PRIMASK(uint32_t priMask)
{
   register uint32_t __regPriMask         __ASM("primask");
   __regPriMask = (priMask);
}

The part that I don't understand is the inline assembly instruction 我不明白的部分是内联汇编指令

__ASM("primask");

I haven't read anything about addressing registers by name in this way. 我还没有读过任何有关通过这种方式按名称寻址寄存器的信息。 How can you have inline assembly without an op-code first? 如何在没有操作码的情况下进行内联汇编? Is this assigning __regPriMask to this register location? 这是否将__regPriMask分配给该寄存器位置? Can anyone point to a reference document? 任何人都可以指向参考文件吗?

register uint32_t __regPriMask __ASM("primask");

...is the declaration of a local register variable called __regPriMask that is stored in the primask register. ...是本地寄存器变量 __regPriMask的声明,该变量存储在primask寄存器中。

In other words, assigning to that register variable will set the value of the register primask . 换句话说,分配给该寄存器变量将设置寄存器primask的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM