×
单片机 > 单片机程序设计 > 详情

ARM MPCore -- (2)

发布时间:2020-06-02 发布时间:
|
1. NOP

    NOP不一定会占用CPU执行时间,可能在执行该指令前,CPU已将其从管道中移除。

    可以用NOP进行填充,使后续指令处于64bit边界上。

2. SEV

    向所有CPU Core发送事件信息。

 

3. WFE (Wait For Event)

    如果未设置事件寄存器,则 WFE 会暂时中断挂起执行,直至发生任一以下事件后再恢复执行:
    (1)发生 IRQ 中断,除非被 CPSR I 位屏蔽
    (2)发生 FIQ 中断,除非被 CPSR F 位屏蔽
    (3)发生不精确的数据中止,除非被 CPSR A 位屏蔽
    (4)出现调试进入请求(需启用调试)
    (5)另一个处理器利用 SEV 指令向事件发送信号
    ----------------------------
    如果设置了事件寄存器,则 WFE 会清除该设置,然后立即返回。
    如果实现了 WFE,则还必须实现 SEV。

 

4. WFI (Wait For Interrupt)

    WFI 会暂时将执行中断挂起,直至发生以下事件后再恢复执行:
    (1)发生 IRQ 中断,不考虑 CPSR I 位
    (2)发生 FIQ 中断,不考虑 CPSR F 位
    (3)发生不精确的数据中止,除非被 CPSR A 位屏蔽
    (4)出现调试进入请求,无论是否启用调试


5. SEV/WFE用处

  SEV/WFE are not intended for synchronisation - but for power management. Because of the way WFE is defined, there is no guarantee that the CPU1 will only awake when CPU0 executes SEV. It could wake at time for any number of reasons. Usually examples show SEV/WFE as a form of simple power management in a spin-lock. Something like:

lock_spin_lock (assume addr in r0)
LDREX r1, [r0]
CMP r1, #UNLOCKED
WFENE ; If not unlocked go to sleep
BNE lock_spin_lock ; on waking, re-check the spin-lock
...

It's the spin-lcok that provides the synchronisation, not the WFE. The WFE just is a way of saving power while you wait for the resource to become free

关键字:ARM  MPCor

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
浅谈AVR中定时器几种工作模式