s3c2440 + wince休眠唤醒的问题

还没想好写什么 2010-03-23 01:28:02
下面是nboot(steldr——boot)里关于休眠唤醒的处理代码
WAKEUP_POWER_OFF
; Release SCLKn after wake-up from the POWER_OFF mode.
ldr r1, =MISCCR
ldr r0, [r1]
bic r0, r0, #(7<<17) ; SCLK0:0->SCLK, SCLK1:0->SCLK, SCKE:L->H.
str r0, [r1]

; Set up the memory control registers.
;
add r0, pc, #SMRDATA - (. + 8)
ldr r1, =BWSCON ; BWSCON Address.
add r2, r0, #52 ; End address of SMRDATA.
3
ldr r3, [r0], #4
str r3, [r1], #4
cmp r2, r0
bne %B3

mov r0, #0x2000
4
subs r0, r0, #1
bne %B4

;------------------------------------------------------------------------------
; Recover Process : Starting Point
;
; 1. Checksum Calculation saved Data
ldr r5, =SLEEPDATA_BASE_PHYSICAL ; pointer to physical address of reserved Sleep mode info data structure
mov r3, r5 ; pointer for checksum calculation
ldr r2, =0x0
ldr r0, =(SLEEPDATA_SIZE-1) ; get size of data structure to do checksum on
50
ldr r1, [r3], #4 ; pointer to SLEEPDATA
and r1, r1, #0x1
mov r1, r1, ROR #31
add r2, r2, r1
subs r0, r0, #1 ; dec the count
bne %b50 ; loop till done

ldr r0,=GSTATUS3
ldr r3, [r0] ; get the Sleep data checksum from the Power Manager Scratch pad register
cmp r2, r3 ; compare to what we saved before going to sleep
bne BringUpWinCE ; bad news - do a cold boot

; 2. MMU Enable
ldr r10, [r5, #SleepState_MMUDOMAIN] ; load the MMU domain access info
ldr r9, [r5, #SleepState_MMUTTB] ; load the MMU TTB info
ldr r8, [r5, #SleepState_MMUCTL] ; load the MMU control info
ldr r7, [r5, #SleepState_WakeAddr ] ; load the LR address
nop
nop
nop
nop
nop

; if software reset
mov r1, #0
teq r1, r7
bne %f60
b BringUpWinCE

; wakeup routine
60 mcr p15, 0, r10, c3, c0, 0 ; setup access to domain 0
mcr p15, 0, r9, c2, c0, 0 ; PT address
mcr p15, 0, r0, c8, c7, 0 ; flush I+D TLBs
mcr p15, 0, r8, c1, c0, 0 ; restore MMU control

; 3. Jump to Kernel Image's fw.s (Awake_address)
mov pc, r7 ; jump to new VA (back up Power management stack)
nop
...全文
157 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
roflsy2010 2010-08-13
  • 打赏
  • 举报
回复
; Release SCLKn after wake-up from the POWER_OFF mode.
ldr r1, =MISCCR ; MISCCR's Bit 17, 18, 19 -> 0
ldr r0, [r1] ; I don't know why, Just fallow Sample Code.
bic r0, r0, #(7 << 17) ; SCLK0:0->SCLK, SCLK1:0->SCLK, OOFREFRESH:0(DISABLE)
str r0, [r1]

; Set memory control registers
add r0, pc, #SMRDATA - (. + 8)
ldr r1, =BWSCON ; BWSCON Address
add r2, r0, #52 ; End address of SMRDATA
loop10
ldr r3, [r0], #4
str r3, [r1], #4
cmp r2, r0
bne loop10

mov r0, #0x2000
loop11
subs r0, r0, #1 ; wait until the SelfRefresh is released.
bne loop11



; ldr r1,=GSTATUS3 ;GSTATUS3 has the start address just after SLEEP wake-up
; 如何保证跳过去的前提是内存数据正确!
ldr r2, =0x201000 ; offset into the RAM
add r2, r2, #0x30000000 ; add physical base
mov pc, r2 ; & jump to StartUp address
nop
nop
nop
b .




;------------------------------------------------------------------------------
; Recover Process : Starting Point
;
; 1. Checksum Calculation saved Data
ldr r5, =SLEEPDATA_BASE_PHYSICAL ; pointer to physical address of reserved Sleep mode info data structure
mov r3, r5 ; pointer for checksum calculation
ldr r2, =0x0
ldr r0, =(SLEEPDATA_SIZE-1) ; get size of data structure to do checksum on
50
ldr r1, [r3], #4 ; pointer to SLEEPDATA
and r1, r1, #0x1
mov r1, r1, ROR #31
add r2, r2, r1
subs r0, r0, #1 ; dec the count
bne %b50 ; loop till done





ldr r0,=GSTATUS3
ldr r3, [r0] ; get the Sleep data checksum from the Power Manager Scratch pad register
cmp r2, r3 ; compare to what we saved before going to sleep
bne BringUpWinCE ; bad news - do a cold boot




; 2. MMU Enable
ldr r10, [r5, #SleepState_MMUDOMAIN] ; load the MMU domain access info
ldr r9, [r5, #SleepState_MMUTTB] ; load the MMU TTB info
ldr r8, [r5, #SleepState_MMUCTL] ; load the MMU control info
ldr r7, [r5, #SleepState_WakeAddr ] ; load the LR address
nop
nop
nop
nop
nop






; if software reset
mov r1, #0
teq r1, r7
bne Wakeup
b BringUpWinCE



Wakeup
;mcr p15, 0, r10, c3, c0, 0 ; setup access to domain 0
;mcr p15, 0, r9, c2, c0, 0 ; PT address
;mcr p15, 0, r0, c8, c7, 0 ; flush I+D TLBs
;mcr p15, 0, r8, c1, c0, 0 ; restore MMU control //到这里就死了,还没有唤醒






;LED ALL ON
ldr r1,=GPBCON
ldr r0,=0x055550
str r0,[r1]
ldr r1,=GPBDAT
ldr r0,=0x61f
str r0,[r1]

; 3. Jump to Kernel (Awake_address)
mov pc, r7 ; jump to new VA (back up Power management stack)
nop
dding 2010-03-23
  • 打赏
  • 举报
回复
还没有解决呢啊,帮你顶,也顶我能唤醒成功,嘿嘿
  • 打赏
  • 举报
回复
强调一下,只有在休眠唤醒后才出现慢慢死机的情况,大概在一分钟之内挂掉,也不是很慢;正常复位启动时没有问题的;;;正常启动和休眠唤醒后内核状态有什么不同呢????既然能唤醒,唤醒流程应该没有问题了吧
  • 打赏
  • 举报
回复
目前我的问题是唤醒后越来越慢,直至死机
在网上查到一个帖子,也使休眠唤醒的,他的代码没有MMU这一块,因为MMU在未检测GSTATUS2之前已经使能了,现在这部分代码关于MMU这一块的操作有问题吗?慢慢死机时什么原因造成的啊?

19,524

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧