阅读:2983回复:10
wince下做过SLEEP唤醒的高手指教一下
我的系统是wince50的,硬件是2440,我想实现我的系统sleep后,通过按键唤醒,可是当我选择挂起时,系统执行了CPUPowerOff这个汇编函数,在这个函数中设置了EINT0来唤醒系统,可是当我用按键产生EINT0中断时,系统去不能醒过来不知是什么原因,请指教,谢谢!
LEAF_ENTRY CPUPowerOff ; 1. Push SVC state onto our stack stmdb sp!, {r4-r12} stmdb sp!, {lr} ; 2. Save MMU & CPU Register to RAM ldr r3, =SLEEPDATA_BASE_VIRTUAL ; base of Sleep mode storage ldr r2, =Awake_address ; store Virtual return address str r2, [r3], #4 mrc p15, 0, r2, c1, c0, 0 ; load r2 with MMU Control ldr r0, =MMU_CTL_MASK ; mask off the undefined bits bic r2, r2, r0 str r2, [r3], #4 ; store MMU Control data mrc p15, 0, r2, c2, c0, 0 ; load r2 with TTB address. ldr r0, =MMU_TTB_MASK ; mask off the undefined bits bic r2, r2, r0 str r2, [r3], #4 ; store TTB address mrc p15, 0, r2, c3, c0, 0 ; load r2 with domain access control. str r2, [r3], #4 ; store domain access control str sp, [r3], #4 ; store SVC stack pointer mrs r2, spsr str r2, [r3], #4 ; store SVC status register mov r1, #Mode_FIQ:OR:I_Bit:OR:F_Bit ; Enter FIQ mode, no interrupts msr cpsr, r1 mrs r2, spsr stmia r3!, {r2, r8-r12, sp, lr} ; store the FIQ mode registers mov r1, #Mode_ABT:OR:I_Bit:OR:F_Bit ; Enter ABT mode, no interrupts msr cpsr, r1 mrs r0, spsr stmia r3!, {r0, sp, lr} ; store the ABT mode Registers mov r1, #Mode_IRQ:OR:I_Bit:OR:F_Bit ; Enter IRQ mode, no interrupts msr cpsr, r1 mrs r0, spsr stmia r3!, {r0, sp, lr} ; store the IRQ Mode Registers mov r1, #Mode_UND:OR:I_Bit:OR:F_Bit ; Enter UND mode, no interrupts msr cpsr, r1 mrs r0, spsr stmia r3!, {r0, sp, lr} ; store the UND mode Registers mov r1, #Mode_SYS:OR:I_Bit:OR:F_Bit ; Enter SYS mode, no interrupts msr cpsr, r1 stmia r3!, {sp, lr} ; store the SYS mode Registers mov r1, #Mode_SVC:OR:I_Bit:OR:F_Bit ; Back to SVC mode, no interrupts msr cpsr, r1 ; 3. do Checksum on the Sleepdata ldr r3, =SLEEPDATA_BASE_VIRTUAL ; get pointer to SLEEPDATA ldr r2, =0x0 ldr r0, =(SLEEPDATA_SIZE-1) ; get size of data structure (in words) 30 ldr r1, [r3], #4 and r1, r1, #0x1 mov r1, r1, ROR #31 add r2, r2, r1 subs r0, r0, #1 bne %b30 ldr r0, =vGPIOBASE ;;;add r2, r2, #1 ; test checksum of the Sleep data error str r2, [r0, #oGSTATUS3] ; Store in Power Manager Scratch pad register ldr r0, =vGPIOBASE ldr r1, =0x550a str r1, [r0, #oGPFCON] ldr r1, =0x30 str r1, [r0, #oGPFDAT] ; 4. Interrupt Disable ldr r0, =vINTBASE mvn r2, #0 str r2, [r0, #oINTMSK] str r2, [r0, #oSRCPND] str r2, [r0, #oINTPND] ;; 5. Cache Flush bl OALClearUTLB bl OALFlushICache ldr r0, = (DCACHE_LINES_PER_SET - 1) ldr r1, = (DCACHE_NUM_SETS - 1) ldr r2, = DCACHE_SET_INDEX_BIT ldr r3, = DCACHE_LINE_SIZE bl OALFlushDCache ; 6. Setting Wakeup External Interrupt(EINT0,1,2) Mode ldr r0, =vGPIOBASE ldr r1, =0x550a str r1, [r0, #oGPFCON] ; ldr r1, =0x55550100 ; str r1, [r0, #oGPGCON] ; 7. Go to Power-Off Mode ldr r0, =vMISCCR ; hit the TLB ldr r0, [r0] ldr r0, =vCLKCON ldr r0, [r0] ldr r0, =vREFRESH ldr r1, [r0] ; r1=rREFRESH orr r1, r1, #(1 << 22) ldr r2, =vMISCCR ldr r3, [r2] orr r3, r3, #(3<<17) ; Make sure that SCLK0:SCLK->0, SCLK1:SCLK->0, SCKE=L during boot-up bic r3, r3, #(7<<20) orr r3, r3, #(6<<20) ldr r4, =vCLKCON ldr r5, =0x1ffff8 ; Power Off Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Sometimes it is not working in cache mode. So I modify to jump to ROM area. ; ;;; ldr r6, =0x92000000 ; make address to 0x9200 0020 ;;; add r6, r6, #0x20 ; ;;; mov pc, r6 ; jump to Power off code in ROM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 8. Jump to real Power-Off Address ldr r6, =0x80000000 ; make address to add r6, r6, #0x200000 ; add r6, r6, #0x1000 ; add r6, r6, #0x20 ; mov pc, r6 ; jump to Power off code in ROM 其中SLEEPDATA_BASE_VIRTUAL为0xA0028000 |
|
沙发#
发布于:2007-04-23 10:50
自己顶一下
|
|
板凳#
发布于:2007-10-10 15:59
楼主搞定了么?
|
|
地板#
发布于:2007-10-10 19:14
顶~我也有相同的问题
EINT0 休眠后,就叫不起来了 |
|
地下室#
发布于:2007-10-14 00:48
; 6. Setting Wakeup External Interrupt(EINT0,1,2) Mode
ldr r0, =vGPIOBASE ldr r1, =0x550a str r1, [r0, #oGPFCON] 这里设的唤醒源和你实际用的是一样的吗? 还有你的BOOTLOADER里有相关的实现吗? |
|
|
5楼#
发布于:2007-10-17 16:28
; Sometimes it is not working in cache mode. So I modify to jump to ROM area.
; ;;; ldr r6, =0x92000000 ; make address to 0x9200 0020 ;;; add r6, r6, #0x20 ; ;;; mov pc, r6 ; jump to Power off code in ROM 我觉得这个不对 如果这个0x92000000 是你的物理地址,就不对了, 因为这时候MMU还是打开的,cpu访问不了你的物理地址 |
|
6楼#
发布于:2007-10-18 20:54
我现在是唤醒了,用EINT0唤醒的.cpu有电压.但是不能跑到boot里去.
不知应当做什么更改. |
|
7楼#
发布于:2007-10-18 20:55
to joyfly
那里就是设唤醒源的. |
|
8楼#
发布于:2007-10-19 11:18
走到CPUPowerOff那应该是系统挂起了,这个时候是关中断的。
|
|
9楼#
发布于:2007-10-19 15:48
jasonshi
关中断,也应当留一个中断源吧. |
|
10楼#
发布于:2007-10-22 23:24
注意在CPUPowerOff后到oempoweroff结束都不要加打印信息.我有一次加了就起不来.
|
|