arm 睡眠模式进入和退出的区别 WFE、WFI [英] arm sleep mode entry and exit differences WFE, WFI

查看:174
本文介绍了arm 睡眠模式进入和退出的区别 WFE、WFI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 ARM 体系结构相当陌生,我正在努力了解唤醒机制.

I am reasonably new to the ARM architectures and I am trying to wrap my head around the wake up mechanism.

所以首先,我发现很难找到关于此的好的信息.ARM 的文档在这个主题上似乎非常简洁.

So first of all I am finding it difficult to find good info on this. ARM's documentation seems to be very terse on the topic.

我想了解的是 Cortex(尤其是 M0,因为我正在使用它)何时会醒来.

What I'd like to understand is when the Cortex (particularly the M0 as that's what I am working with) will wake up.

作为参考,我也参考了以下内容:

For reference, I have also consulted the following:

WFE 说明上的文档是:

The docs on the WFE instructions are:

    3.7.11. WFE
    Wait For Event.
    Syntax
    WFE
    Operation
    If the event register is 0, WFE suspends execution until 
      one of the following events occurs:
    an exception, unless masked by the exception mask registers or the current
      priority level
    an exception enters the Pending state, if SEVONPEND in the 
      System Control Register is set
    a Debug Entry request, if debug is enabled
    an event signaled by a peripheral or another processor in a 
      multiprocessor system using the SEV instruction.
    If the event register is 1, WFE clears it to 0 and completes immediately.
    For more information see Power management.
    Note
    WFE is intended for power saving only. When writing software assume 
      that WFE might behave as NOP.
    Restrictions
    There are no restrictions.
    Condition flags
    This instruction does not change the flags.
    Examples
        WFE  ; Wait for event

WFI:

    3.7.12. WFI
    Wait for Interrupt.
    Syntax
    WFI
    Operation
    WFI suspends execution until one of the following events occurs:
    an exception
    an interrupt becomes pending, which would preempt if PRIMASK was clear
    a Debug Entry request, regardless of whether debug is enabled.
    Note
    WFI is intended for power saving only. When writing software assume 
    that WFI might behave as a NOP operation.
    Restrictions
    There are no restrictions.
    Condition flags
    This instruction does not change the flags.
    Examples
        WFI ; Wait for interrupt

那么,一些问题:

1)首先,有人可以澄清以下之间的区别:

1) Firstly, can someone please clarify the difference between:

a) 系统处理程序优先级寄存器

a) System Handler Priority Registers

b) 中断优先级寄存器.只是 b) 用于与系统无关的中断,例如 pendSv?

b) Interrupt Priority Registers. Is it just that b) are for interrupts that aren't system related such as pendSv?

现在是一些场景.我真的很想了解以下情况如何管理:NVIC IRQ 使能NVIC待定面具

Now for some scenarios. Really I would like to understand how the scenarios governed by the: NVIC IRQ enable NVIC pending PRIMASK

影响WFE和WFI的进入和退出.

affect the entry and exit of WFE and WFI.

因此这些位的各种组合产生了 8 种不同的场景{NVIC_IRQ 启用,NVIC 挂起,PRIMASK}.

So the various combinations of these bits yields 8 different scenarios {NVIC_IRQ enable, NVIC pending, PRIMASK}.

到目前为止我已经补充了我的模糊理解.请帮我弄这张桌子.

I have already added my vague understanding so far. Please help me with this table.

  • 000 - 不阻止 WFE 或 WFI 进入,但也没有唤醒条件
  • 001 - 作为 000
  • 010 - 挂起对 WFE 和 WFI 进入睡眠模式有何影响?
  • 011 - 我猜这里的答案是 010,但唤醒条件可能不同?
  • 100 - 我猜 WFE 和 WFI 都进入低功耗模式并退出低功耗模式没问题.
  • 101 - 此处退出 WFE 和 WFI 电源模式有什么不同吗?
  • 110 - 不知道!
  • 111 - 不知道!

我在这里排除了优先级,因为我还不太关心异常处理顺序.

I am excluding the priorities here as I'm not too concerned about the exception handling order just yet.

排除 SEV 和事件信号,如果 SEVONPEND 为 0,WFE 的行为是否与 WFI 相同?

Excluding SEV and the event signals, does WFE behave the same as WFI if SEVONPEND is 0?

推荐答案

您将在 Cortex-M 上看到的主要唤醒机制是中断,因此是 WFI(等待中断).在我见过的所有实现中,都会导致内核时钟门控,尽管如果设计支持,有时可以使用更深的睡眠/更高的延迟模式.

The primary mechanism for wake that you'll see on a Cortex-M is an interrupt, hence WFI (wait for interrupt). On all of the implementations that I've seen that results in clock-gating the core, although deeper sleep/higher latency modes are sometimes available if the design supports it.

WFE 与多处理器设计更相关.

WFE is more relevant in multi-processor designs.

关于问题——1. Cortex-M 中的中断和系统处理程序非常相似,主要区别在于它们的触发方式.架构区分了它们,但实际上它们是相同的.

With regard to the questions - 1. Interrupts and System Handlers are very similar in the Cortex-M, differing primarily by how they are triggered. The architecture distinguishes between them, but in practice they are the same.

用于您的位表,它们没有任何意义.每个 Cortex-M 实现对 WFI 期间发生的事情都有自己的解释.它可以从基本时钟门控到深度睡眠模式.有关真实情况,请参阅您的微处理器文档.

Are for your bit tables, they don't really make sense. Each Cortex-M implementation has it's own interpretation of what happens during WFI. It can vary from basic clock gating to deep-sleep modes. Consult your microprocessor documentation for the real story.

PRIMASK 不会影响从睡眠中唤醒的行为.

PRIMASK doesn't affect wake from sleep behavior.

这篇关于arm 睡眠模式进入和退出的区别 WFE、WFI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆