PXA300+WINCE5 第一次supend->wake 后立刻进入systemidle问题
请教大家,我的PDA 第一次按power button进入suspend模式之后再唤醒(power button 或者plug usb)后会立刻进入到systemidle,此时若唤醒源为usb则,usb不能连接成功,之后再使系统进入suspend再唤醒不会立刻进入systemidle模式,
硬件环境:
CPU: Marvell PXA300 XScale Processor 624MHz
System Memory/RAM: Mobile DDR/16Bit 64Mbyte
NAND FLASH: NAND Flash/16Bit 128MByte
Power Management with Touch Screen controller chip: Dialog DA9034
SYSTEM: WINCE 5
问题详细描述如下:
操作步骤:
1.上电,启动进入WINCE桌面
2.按power button 使system enter suspend mode
3.再次按Power button 使system wake up ,此过程中屏幕会白屏数秒(大概3~5s),之后显示桌面,但屏幕马上变暗.串口信息显示:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
4.此后再按下power button 使系统suspend 和wake up ,wake up得时间明显比第一次短,而且不会出现屏幕马上变暗,串口信息:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
------------------------------------------------
第二种操作情况:
1.上电,启动进入WINCE桌面
2.按power button 使system enter suspend mode
3.插入USB cable(UAB 另一端与PC相连)使system wake up ,此过程中屏幕会白屏数秒(大概3~5s),之后显示桌面,但屏幕马上变暗.此时usb连接得弹出窗口停留在"Connectting to Host"画面,activsync没有连接成功.
串口信息显示:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x4
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: CYH Power State Flags:0x0
PWM: Waiting for PM state transition notification
AUTORAS:: Dialer notifies: [1] [Dialer Start]
4.重新给系统断电再上电(或者reset按钮 作reset),按power button 使system enter suspend mode
再次按Power button 使system wake up ,
5.
此后再按下power button 使系统suspend 插入USB wake up ,wake up得时间明显比第一次短,而且不会出现屏幕马上变暗,activsync连接成功!
串口信息:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
Statll 0
AUTORAS:: Dialer notifies: [1] [Dialer Start]
gcu reset!OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
Posting WM_NETCONNECT(TRUE) message
AUTORAS:: Dialer notifies: [4] [Dialer Connected]
-------------------------------------------------
DA9034 reg EVENT B bit4:USB_DEV
USB_DEV : USB device detection/removal caused a nIRQ to be generated
请问为什么系统第一次进入suspend wakeup后会立刻进入systemidle并且USB 唤醒得话也不能连接成功那?
我后来作了个实验在pwrbutton.c 里得PWM: PBT_RESUME后调用了函数SystemIdleTimerReset();但是结果一样第一次还是会立刻进入sustemidle.
case PBT_RESUME:
{
RETAILMSG(1, (TEXT("PWM: PBT_RESUME\r\n")));
SystemIdleTimerReset();// prevent systemidle
这样得问题大家见过吗,能否给些建议谢谢!
---------------------------------------------------------------------------
1.以下是上电后第一次按下power button使系统进入supend,再按power button 使系统wake UP得信息
-------------suspend by press power button------------
[SDH1:] SDH_IOControl: Entering D3/D4...
backlight_set 1
[BKL1] Notify IPM Ready For Processor state for driver -84213756
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x200000]: 'suspend'
read DA9034 reg sts A=0x4
read DA9034 reg sts B=0x0
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_SUSPEND
PWM: Waiting for PM state transition notification
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
SA2Video::power_ioctl 3
SA2Video::set_power_state 4, original state 1XllpLCDSuspend
Suspend_Graceful
XllpLCDSuspend-
OALIoCtlHalPreSuspend
SA2Video::PowerHandler 1gcu suspend!
+Touch panel power handler Start
-Touch panel power handler End
[MMC] SDH: +SDH_PowerDown
GPIO - PowerDown
BUZZER - PowerDown
PWB_PowerDown
PWB_PowerDown-MiccoPreSuspend
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
----------WAKE UP by power button---------------
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
+FMD_PowerUp
[FMD] probe the flash successfully, index=2
[FMD] It is 1G 16bit Micron NAND
-FMD_PowerUp
IMM_PowerUp...
1-wire driver Sequent call of CreateFileMapping(MFPRMDB_SHARED_FILENAME)!
Battery Driver::BatteryPDDPowerHandler
PWB_PowerUp
BUZZER - PowerUp
GPIO - PowerUp
[MMC] SDH: +SDH_PowerUp
SA2Video::PowerHandler 0+Touch panel power handler Start
-Touch panel power handler End
[STUART]Close
[STUART]Open
ThreadRun IIR=c0
[UART]Modem interrupt
CBulPdd16550: #### ubModemStatus = 11 ####
CBulPdd16550: #### ubModemStatus = 10 ####
[SDH1:] SDH_IOControl: Entering D0...
backlight_set 95-32
[BKL1] Notify IPM Ready For Processor state for driver -84213756
Battery Driver::BatteryPDDResume
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
[SDH1:] fSimulateCardInsertion
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x0
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x20
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
[BKL1:] MinOP Set/Release FAILED
SA2Video::power_ioctl 0
SA2Video::set_power_state 1, original state 4LCDInitControllerCommon lccr1 0x000
0013f @ 0x00430000
SetDevicePower: Wrong Return Value from 'sdh1:', returning ERROR_GEN_FAILURE
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
PWM: PBT_RESUME
OALIOCtlIPM: Received SET_OP
PWM: Set System status ON
OALIOCtlIPM: next XL=16, HSS=0
read DA9034 reg event C=0x0
OALIOCtlIPM: Received SET_OP
read DA9034 reg event D=0x0
OALIOCtlIPM: next XL=16, HSS=0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x0
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: CYH Power State Flags:0x0
PWM: Waiting for PM state transition notification
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
--------------------------------------------------------------------------------------------------------------------
2.以下是上电后首先按power button 使系统进入suspend ,通过插入USB cable唤醒系统的信息,此时USB 没有连接上(通过activsync).
------------suspend by press power button ----------------
[SDH1:] SDH_IOControl: Entering D3/D4...
backlight_set 1
[BKL1] Notify IPM Ready For Processor state for driver -84213756
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x200000]: 'suspend'
read DA9034 reg sts A=0x4
read DA9034 reg sts B=0x0
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_SUSPEND
PWM: Waiting for PM state transition notification
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
SA2Video::power_ioctl 3
SA2Video::set_power_state 4, original state 1XllpLCDSuspend
Suspend_Graceful
XllpLCDSuspend-
OALIoCtlHalPreSuspend
SA2Video::PowerHandler 1gcu suspend!
+Touch panel power handler Start
-Touch panel power handler End
[MMC] SDH: +SDH_PowerDown
GPIO - PowerDown
BUZZER - PowerDown
PWB_PowerDown
PWB_PowerDown-MiccoPreSuspend
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
----------------plug usb to wake up system,but PDA can not connect with PC via activsync---------------
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
+FMD_PowerUp
[FMD] probe the flash successfully, index=2
[FMD] It is 1G 16bit Micron NAND
-FMD_PowerUp
IMM_PowerUp...
1-wire driver Sequent call of CreateFileMapping(MFPRMDB_SHARED_FILENAME)!
Battery Driver::BatteryPDDPowerHandler
PWB_PowerUp
BUZZER - PowerUp
GPIO - PowerUp
[MMC] SDH: +SDH_PowerUp
SA2Video::PowerHandler 0+Touch panel power handler Start
-Touch panel power handler End
[STUART]Close
[STUART]Open
ThreadRun IIR=c0
[UART]Modem interrupt
CBulPdd16550: #### ubModemStatus = 11 ####
CBulPdd16550: #### ubModemStatus = 10 ####
[SDH1:] SDH_IOControl: Entering D0...
backlight_set 95-32
[BKL1] Notify IPM Ready For Processor state for driver -84213756
Battery Driver::BatteryPDDResume
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
[SDH1:] fSimulateCardInsertion
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x20
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
Statll 0
[BKL1:] MinOP Set/Release FAILED
SA2Video::power_ioctl 0
SA2Video::set_power_state 1, original state 4LCDInitControllerCommon lccr1 0x000
0013f @ 0x00430000
SetDevicePower: Wrong Return Value from 'sdh1:', returning ERROR_GEN_FAILURE
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=0
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=0
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x4
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: CYH Power State Flags:0x0
PWM: Waiting for PM state transition notification
AUTORAS:: Dialer notifies: [1] [Dialer Start]
gcu reset!OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: PBT_POWERINFOCHANGE
PWM: AC line status 0, battery flag 12, backup flag 255, 196608 levels
PWM: Waiting for PM state transition notification
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
----------------------------------------------------------------------------------------------------------------
3.以下是上电后首先按power button 使系统进入suspend 并按Power Button使系统wake up,
之后再按按power button使系统suspend,然后通过插入USB cable唤醒系统的信息,此时USB 可以连接成功(通过activsync)
---------------suspend system by press power button----------------
[SDH1:] SDH_IOControl: Entering D3/D4...
backlight_set 1
[BKL1] Notify IPM Ready For Processor state for driver -84213756
SA2Video::power_ioctl 3
SA2Video::set_power_state 4, original state 1XllpLCDSuspend
Suspend_Graceful
XllpLCDSuspend-
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x200000]: 'suspend'
read DA9034 reg sts A=0x4
read DA9034 reg sts B=0x0
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_SUSPEND
PWM: Waiting for PM state transition notification
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=24, HSS=2
OALIoCtlHalPreSuspend
SA2Video::PowerHandler 1gcu suspend!
+Touch panel power handler Start
-Touch panel power handler End
[MMC] SDH: +SDH_PowerDown
GPIO - PowerDown
BUZZER - PowerDown
PWB_PowerDown
PWB_PowerDown-MiccoPreSuspend
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
------------------wake up system by plug USB cable,PDA can connect with PC via activsync----------
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
+FMD_PowerUp
[FMD] probe the flash successfully, index=2
[FMD] It is 1G 16bit Micron NAND
-FMD_PowerUp
IMM_PowerUp...
1-wire driver Sequent call of CreateFileMapping(MFPRMDB_SHARED_FILENAME)!
Battery Driver::BatteryPDDPowerHandler
PWB_PowerUp
BUZZER - PowerUp
GPIO - PowerUp
[MMC] SDH: +SDH_PowerUp
SA2Video::PowerHandler 0+Touch panel power handler Start
-Touch panel power handler End
[STUART]Close
[STUART]Open
ThreadRun IIR=c0
[UART]Modem interrupt
CBulPdd16550: #### ubModemStatus = 11 ####
CBulPdd16550: #### ubModemStatus = 10 ####
[SDH1:] SDH_IOControl: Entering D0...
backlight_set 95-32
[BKL1] Notify IPM Ready For Processor state for driver -84213756
SA2Video::power_ioctl 0
SA2Video::set_power_state 1, original state 4LCDInitControllerCommon lccr1 0x000
0013f @ 0x00430000
[SDH1:] fSimulateCardInsertion
Battery Driver::BatteryPDDResume
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x1
read DA9034 reg EVENT B=0x4
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
Statll 0
AUTORAS:: Dialer notifies: [1] [Dialer Start]
gcu reset!OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=1
Posting WM_NETCONNECT(TRUE) message
AUTORAS:: Dialer notifies: [4] [Dialer Connected]
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=0
OALIOCtlIPM: Received SET_OP
OALIOCtlIPM: next XL=16, HSS=0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
应该没有吧,我不太清楚,我们只是修改BSP.电源管理是另外一个同事作的,电源管理部分本来的bsp里没有,从win mobile移植过来的.
我刚刚做了试验,我怀疑是经过suspend和resume后初始化了,或者说改变了一些设置,后面就正常了..所以我在 OEMPowerOff()函数里suspend之前和resume之后打印出来电源相关的几个寄存器值,确实如我的猜测.经过一次suspend resume后一些值发生了变化,且以后再suspend和resume这些值就是变化后的值了.
系统上电启动后,第一次按下power button使系统supend,suspend之前以下寄存器的值
ASCR 0x2200
ad3sr 0x0
arsr 0x0
ad3er 0x0
resume后寄存器的值
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
-------------相关的串口信息---------------------------
[MMC] SDH: +SDH_PowerDown
GPIO - PowerDown
BUZZER - PowerDown
PWB_PowerDown
PWB_PowerDown-MiccoPreSuspend
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
ASCR 0x2200
ad3sr 0x0
arsr 0x0
ad3er 0x0
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
+FMD_PowerUp
-----------------------------------------
第二次按下power button使系统supend,suspend之前以下寄存器的值,大家看,已经是上次resume后的值
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
resume 后,寄存器的值,发现没有变
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
-----------相关的串口信息----------------------------
bulverde_usbfn!BulUsbDevice::SetPowerState: Going from D0 to D4
[MMC] SDH: +SDH_PowerDown
GPIO - PowerDown
BUZZER - PowerDown
PWB_PowerDown
PWB_PowerDown-MiccoPreSuspend
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
ASCR 0x2200
ad3sr 0x1
arsr 0x0
ad3er 0x80000001
+FMD_PowerUp
---------------------------------------
查了下两个寄存器好像关系也不大
AD3SR:Application subsystem wakeup fron D3 status Register
bit 0:WS_EXTERNAL[0] Wake-up Status for external input (EXTE_WAKEUP<0>)
0=NO wake-up due to EXT_WAKEUP<0>edge detect
1=Wake-up due to EXT_WAKEUP<0>edge detect
AD3ER application subsystem wakeup from D3 enable Register
bit 0: WE_EXTNAL[0] Wake-up option for EXT_WAKEUP<0>
0=disable wake-up due to EXT_WAKEUP<0>edge detect
1=enable wake up due to EXT_WAKEUP<0>edge detect
bit 31:WERTC Wake-up option for RTC
0=disable wake-up due to RTC
1=enable wake-up due to RTC
CE的PM跟Mobile的PM有比较大的差别,具体可以看Public下面的相关的代码
一般情况下CE没有那么多的状态,而Mobile是有硬性规定的
所以最好是拿CE的参考代码修改PM,而且其实需要改动的地方也很少,关键还是要看你们的实际需求
举个例子:
象Mobile规定系统从Suspend回来到Resume状态,如果在15秒内没有事件让系统回到On,那么系统会再次进入Suspend
而CE就没有这么复杂
看你描述的现象应该是跟PM的定制有关,CPU的这些寄存器不可能影响到系统状态的变化的,两者之间根本没有什么关系
感谢hzdysymbol,我们再查查,移植win mobile的电源部分的原因是我们的板子用的电源管理芯片是DA9034 而 BSP里和开发板(开发板是在marvell买的)里用的是DA9030,移植的时候也只是涉及到DA9034芯片的地方,其中pwrbutton 部分的驱动改的最大.
我昨天在开发板上看了下,开发板的power button 第一次唤醒时没有进入system idle.
我们再继续查一下,看恢复一下powerbutton部分驱动看看结果如何.
(开发板power button设计用了2个键,分别用来suspend和resume,我们设计是用一个power button,两次按下分别是suspend和resume)
做了试验,改回原来的pwrbutton.c,第一次suspend->resume后不会立刻进入systemidle,但是第一次suspend->resume,用USB 唤醒的话还是连接不上USB ,并且停留在弹出的USB窗口"Connectting to HOST",这时点击cancle就会没有反映,象死掉的一样.看来USB 第一次唤醒系统连接不上问题原因还很复杂.
通过试验,改回到原来BSP 原始得pwrbutton.c得代码,发现即使wake up后不立刻进入systemidle ,usb第一次唤醒也不能连接成功.
在backlight.cpp里函数BackLightSetState,第一次wake up时 IPM_notify(is_on); 会返回错误代码3: IPM_STATUS_READ_TIME_OUT,
不明白为什么第一次醒来时会time out,上电启动初始化时也会调用IPM_notify(is_on); ,都是ok得,suspend 调用返回也是ok 得.
下面是两个函数:
==============
BOOL BackLightSetState(DWORD dwContext, CEDEVICE_POWER_STATE state)
{
// sets the backlight state (turns the backlight on and off)
// DEBUGMSG(ZONE_FUNCTION, (L"+BackLightSetState(0x%08x)\r\n", (DWORD) state));//CYH MASK
RETAILMSG(1, (L"+BackLightSetState(0x%08x)\r\n", (DWORD) state));//CYH ADD
BOOL is_on = is_state_on(state);
backlight_set(is_on);
IPM_notify(is_on);
return TRUE;
}
===========
static void IPM_notify(BOOL is_on)
{
DWORD dwProcState;
BOOL ret;
if(is_on)
dwProcState = IPM_PROCESSOR_RING_OSC_RDY |IPM_PROCESSOR_D0_RDY;
else
dwProcState = IPM_PROCESSOR_RING_OSC_RDY |IPM_PROCESSOR_D0_RDY
| IPM_PROCESSOR_D2_RDY | IPM_PROCESSOR_D1_RDY;
NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver %d\r\n"),ipm_client_id);
if (IPM_NotifyReadyForProcState(ipm_client_id, dwProcState, 3000) == IPM_STATUS_SUCCESS)
{
// NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver Completed\r\n"));
}
else
NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver FAILED\r\n"));
if(is_on)
ret = IPM_SetMinOp(ipm_client_id, IPM_OP_104MHZ ,3000);
else
ret = IPM_ReleaseMinOp(ipm_client_id, 1000);
if (ret == IPM_STATUS_SUCCESS)
{
NKDbgPrintfW(_T("[BKL1:] MinOP Set/Release OK!!CYH \r\n"));
//NKDbgPrintfW(_T("[%s] MinOP Set/Release Success!\r\n"),pController->szName);
} else
NKDbgPrintfW(_T("[BKL1:] MinOP Set/Release FAILED %x CYH\r\n"),ret);
}