在线时间2220 小时
UID3253523
注册时间2016-3-21
NXP金币2848
该用户从未签到
超级版主
 
- 积分
- 24858
- 最后登录
- 2025-7-17
|
发表于 2016-8-8 09:37:28
|
显示全部楼层
进入VLPR的代码:
- int enter_vlpr(void)
- {
- int i;
- unsigned int return_value = 0; //default return value = indicates error
- if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 4){
- return_value = 0x14;
- }
- /* The PMPROT register may have already been written by init code
- If so then this next write is not done.
- PMPROT is write once after RESET
- this write-once bit allows the MCU to enter the
- very low power modes: VLPR, VLPW, and VLPS */
- SMC_PMPROT = SMC_PMPROT_AVLP_MASK;
-
- /* Set the (for MC1)LPLLSM or (for MC2)STOPM field
- to 0b010 for VLPS mode -
- and RUNM bits to 0b010 for VLPR mode */
- SMC_PMCTRL &= ~SMC_PMCTRL_RUNM_MASK;
- SMC_PMCTRL |= SMC_PMCTRL_RUNM(0x2);
- /* Wait for VLPS regulator mode to be confirmed */
- for (i = 0 ; i < 10000 ; i++)
- { /* check that the value of REGONS bit is not 0
- once it is a zero we can stop checking */
- if ((PMC_REGSC & PMC_REGSC_REGONS_MASK) ==0x04){
- /* 0 Regulator is in stop regulation or in transition
- to/from it
- 1 MCU is in Run regulation mode */
- }
- else break;
- }
- if ((PMC_REGSC & PMC_REGSC_REGONS_MASK) ==0x04)
- {
- return_value = 0x24;
- }
- /* SMC_PMSTAT register only exist in Mode Controller 2 MCU versions */
- if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK) == 4)
- {
- return_value = SMC_PMSTAT;
- }
- return (return_value);
- }<p> </p>
复制代码
|
|