您的位置:首页 > 其它

为 uboot 添加 wince 唤醒功能

2013-03-20 09:19 281 查看
前一段时间,做了uboot启动wince,但是一直没有实现wince在uboot下的唤醒功能,在这里就不再讲述wince 休眠唤醒的原理了(网上有很多资料),给出解决方法:



修改uboot源码目录下的

cpu\arm920t\start.S 文件





/*

     * we do sys-critical inits only at reboot,

     * not when booting from 

     */

#ifndef CONFIG_SKIP_LOWLEVEL_INIT

    bl    cpu_init_crit

#endif

/* 从这个地方开始添加代码 */

/* Apollo +*/

/* Power Manage Check if this is a wake-up
 from sleep */

  ldr r1, =0x560000B4                /* GSTATUS2 */

  ldr r0, [r1]

  tst r0, #0x02

  beq BringUpWinCE

WakeupStart:

    ldr     r1, =0x56000080 /* ; 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, SCKE:L->H */

    str    r0, [r1]

/* 1. Checksum Calculation saved Data */

    ldr r5, =0x30028000 /* pointer to physical address of reserved Sleep mode
 info data structure */

    mov r3, r5 /* pointer for checksum
 calculation*/

    ldr r2, =0x0

    ldr r0, =(25-1) /* get size of data
 structure to do checksum on*/

again:

    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 again /*; loop till done */

    ldr r0,=0x560000B8                                    /* 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, #12] /*; load
 the MMU domain access info*/

    ldr r9, [r5, #8] /*; load
 the MMU TTB info */

    ldr r8, [r5, #4] /*; load
 the MMU control info */

    ldr r7, [r5, #0 ] /*; load
 the LR address*/

    nop 

    nop

    nop

    nop

    nop

/* if software reset*/

    mov r1, #0

    teq r1, r7

    bne wakeup

    b     BringUpWinCE

/*; wakeup routine*/

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*/

/*; 3. Jump to Kernel Image's
 fw.s (Awake_address)*/

    mov pc, r7 /*; jump to new VA (back up Power management stack)*/

    nop

BringUpWinCE:

/* Apollo -*/

/*添加代码结束*/

/***************** CHECK_CODE_POSITION ******************************************/

    adr    r0, _start        /* r0 <- current position of code */

    ldr    r1, _TEXT_BASE        /* test if we run from flash or RAM */

    cmp r0, r1 /* don't reloc during debug */

    beq stack_setup

/***************** CHECK_CODE_POSITION ******************************************/


http://blog.chinaunix.net/uid-8087110-id-1989043.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: