arm 待机指令 WFI和WFE

百度百科上对于待机的解释:
待机是将当前处于运行状态的数据保存在内存中,机器只对内存供电,而硬盘、屏幕和CPU等部件则停止供电。由于数据存储在速度快的内存中,因此进入等待状态和唤醒的速度比较快。
对于手机而言,待机就是除了DDR保持低频刷新,维护DDR中数据以外,其他的外围设备都断电,cpu core也进入low power 模式,
停止工作,等待外部事件唤醒。


arm core进入待机依赖两个arm 指令,WFI(Wait for interrupt)和WFE(Wait for event)。
这两个指令都可以使cpu core进入低电模式,但是也有细微差别,
具体看下arm解释。


Wait for Event WFE:
If the event register is currently set, WFE (Wait For Event) clears it and returns immediately. If the event register is not set, the processor suspends execution (Clock is stopped) until one of the following events take place:
An IRQ interrupt, unless masked by the CPSR I Bit
An FIQ interrupt, unless masked by the CPSR F Bit
A Debug Entry request made to the processor and Debug is enabled
An event is signaled by another processor using Send Event.
Another MP11 CPU return from exception.


Wait for Interrupt WFI:
WFI (Wait For Interrupt) makes the processor suspend execution (Clock is stopped) until one of the following events take place:
An IRQ interrupt
An FIQ interrupt
A Debug Entry request made to the processor.


对WFI来说,执行WFI指令后,ARM core会立即进入low-power standby state,直到有WFI Wakeup events发生。
而WFE则稍微不同,执行WFE指令后,根据Event Register(一个单bit的寄存器,每个PE一个)的状态,有两种情况:如果Event Register为1,该指令会把它清零,然后执行完成(不会standby);如果Event Register为0,和WFI类似,进入low-power standby state,直到有WFE Wakeup events发生。


而在系统待机时候,当执行完task freeze,所有device suspend后,执行WFI指令进入待机状态,然后等待外围中断唤醒。
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值