我对ARM架构还比较陌生,正在努力理解唤醒机制。
首先我发现很难找到有关这方面的好资料。ARM的文档在这个主题上似乎非常简略。
我想了解的是Cortex(特别是M0,因为我正在使用它)何时会被唤醒。
供参考,我还查阅了以下内容:
关于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-没想法!
我在这里排除了优先级,因为我还不太关心异常处理顺序。
如果SEVONPEND为0,除了SEV和事件信号之外,WFE是否与WFI表现相同?