前言
- 移植基于ARM平台的RTOS时,需要掌握一些基本的汇编指令,只有熟悉了这些ARM 的汇编指令,才能真正的掌握RTOS的移植方法
CPSID
- 通过ARM 官方的文档,真正熟悉这个
CPSID
的含义与用法 - 官方关连接:https://developer.arm.com/documentation/dui0489/c/arm-and-thumb-instructions/miscellaneous-instructions/cps
CPS
- 原来 CPSID 是由 CPS 与 ID 两个部分组成的
- CPS (Change Processor State) changes one or more of the mode, A, I, and F bits in the CPSR, without changing the other CPSR bits.
- 更改处理器状态,单独更改 A、 I、 F CPSR的寄存器的位
- CPS is only permitted in privileged software execution, and has no effect in User mode.
- CPS 指令用于需要在特权模式下使用,也就是默认C的代码在用户模式,不能直接操作CPS指令,需要使用汇编来操作
- CPS cannot be conditional, and is not permitted in an IT block.
- CPS 不能中断阻塞
CPS 的Mode
- IE : Interrupt or abort enable. 中断或 abort异常 使能
- ID : Interrupt or abort disable. 中断或 abort 异常 禁能
CPS flags
- a : Enables or disables imprecise aborts. abort 异常
- i : Enables or disables IRQ interrupts. IRQ中断
- f : Enables or disables FIQ interrupts. FIQ中断
CPSID
- CPSID : Change Processor State Interrupt or abort disable : 禁用IRQ中断或abort异常
CPSID I
- CPSID I : Change Processor State disables IRQ interrupts : 禁用 IRQ 中断
CPSIE
- CPSID : Change Processor State Interrupt or abort enable : 使能IRQ中断或abort异常
CPSIE I
- CPSID : Change Processor State enable IRQ interrupts : 使能IRQ中断
小结
- 通过查看ARM官方的文档,真正了解 CPSID 与 CPSIE的 作用与用法