【发布时间】:2015-01-27 02:55:24
【问题描述】:
我对 ARM 架构相当陌生,我正试图围绕唤醒机制展开思考。
首先,我发现很难找到这方面的好信息。 ARM 的文档似乎对这个主题非常简洁。
我想了解的是 Cortex(尤其是我正在使用的 M0)何时会醒来。
作为参考,我还参考了以下内容:
- What is the purpose of WFI and WFE instructions and the event signals?
- Why does the processor enter standby when using WFE instruction but not when using WFI instruction?
关于 WFE 说明的文档是:
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)首先,有人可以澄清一下:
a) 系统处理程序优先级寄存器
b) 中断优先级寄存器。 是否只是 b) 用于与系统无关的中断,例如 pendSv?
现在是一些场景。真的,我想了解以下场景如何管理: NVIC IRQ 启用 NVIC 待定 PRIMASK
影响WFE和WFI的进出。
因此,这些位的各种组合产生了 8 种不同的场景 {NVIC_IRQ 启用,NVIC 挂起,PRIMASK}。
到目前为止,我已经添加了我的模糊理解。请帮我处理这张桌子。
- 000 - 没有阻止 WFE 或 WFI 进入,但也没有唤醒条件
- 001 - 作为 000
- 010 - 挂起如何影响 WFE 和 WFI 进入睡眠模式?
- 011 - 我猜这里的答案是 010,但唤醒条件可能不同?
- 100 - 我猜 WFE 和 WFI 都进入低功耗模式并退出低功耗模式没问题。
- 101 - 此处退出 WFE 和 WFI 电源模式有何不同?
- 110 - 不知道!
- 111 - 不知道!
我在这里排除了优先级,因为我还不太关心异常处理顺序。
除了 SEV 和事件信号,如果 SEVONPEND 为 0,WFE 的行为是否与 WFI 相同?
【问题讨论】:
-
我不能完全理解你的问题。然而,ARM 文档相当含糊,因为由 SOC 实现者将这些信号连接到不同的逻辑。我认为这与 NVIC 无关(我更了解 GIC)所以也许有人可以直接回答你的问题;但是,您应该查阅您的 SOC 文档以查看它是否有任何关于此行为的信息。例如,许多 SOC 都有一个寄存器,可以进一步细化
WFI上发生的事情; 仅暂停 CPU 以 关闭所有时钟,但 DDR 32kHz 自刷新。 -
例如在某些 SOC 上,中断是否会影响
WFI是通过特定于 SOC 的单独寄存器配置的。例如,UART 模块可能支持检测输入字符的异步静态逻辑。您可以将其配置为从最深的睡眠模式中唤醒。所以可能根本不涉及 NVIC 寄存器。有一些内部 WFI_WAKE 类型的信号,SOC 将路由到内核。 -
感谢您提供的信息。我不知道这些额外的信号。我的问题与上述位的含义有关。