d long s3c_irqwake_intmask = 0xfffffff0L;
(2)修改U-boot
系统睡眠在唤醒后会运行复位程序,当然就是U-boot了.为了让唤醒后的系统能够恢复正常工作状态,及进入到睡眠前运行的位置,需要修改U-boot
将下面的代码加入到uboot的cpu/arm920t/start.s中,注意:要放在sdram初始化后,参考本文的第四标题“S3C2410掉电模式唤醒过程”
/* Power Manage Check if this is a wake-up from sleep */
ldr r1, =0x560000B4
ldr r0, [r1]
tst r0, #0x02
beq notPowerOFF
/****led test****
ldr r0, =0x56000050
ldr r1,=0x55555555
str r1,[r0]
ldr r0, =0x56000054
ldr r1,=0x0
str r1,[r0]
*/
WakeupStart:
//Clear sleep reset bit
ldr r0, =0x560000B4
mov r1, #0x2
str r1, [r0]
ldr r0, =0x56000080 //Release the SDRAM signal protections
ldr r1, =0x00010330
str r1, [r0]
ldr r0, =0x48000024
ldr r1, [r0]
bic r1, r1, #0x400000
str r1, [r0]
mov r1, #0x1000
1: subs r1, r1, #1 // wait until the SelfRefresh is released.
bne 1b
/*
ldr r0, =0x56000050
ldr r1,=0x55555555
str r1,[r0]
ldr r0, =0x56000054
ldr r1,=0x5555
str r1,[r0]
*/
ldr r0, =0x560000B8 //read a return address go to s3c2410_cpu_resume
ldr r1, [r0]
mov pc, r1 //go to resume 恢复到睡眠前的位置
nop
nop
1: b 1b
notPowerOFF:
(3)编写测试程序
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include
<linux/ioctl.h>
#define APM_IOC_STANDBY _IO(''A'', 1)
#define APM_IOC_SUSPEND _IO(''A'', 2)
int main (void)
{
int fd;
fd = open ("/dev/apm_bios",O_RDWR);
if (fd < 0) {
printf ("fd open failedn");
exit(0);
}
printf ("n/dev/apm_bios opened, fd=%dn",fd);
ioctl (fd, APM_IOC_SUSPEND);
close (fd);
printf ("/dev/apm_bios closed :)n");
return 0;
}
(4)测试效果
#./test
.....
sleep: irq wakeup masks: fffffff0,fffffff0
GSTATUS3 0x30367140
GSTATUS4 0x00000000
进入睡眠状态,此时按K10按键,即中断0,唤醒系统
GPIO[0] CON 007fffff => 007fffff, DAT 00000000 => 00000000
GPIO[1] CON 00044555 => 00044555, DAT 00000540 => 00000540
GPIO[2] CON aaaaaaaa => aaaaaaaa, DAT 00000000 => 00000000
GPIO[3] CON aaaaaaaa => aaaaaaaa, DAT 00000000 => 00000000
GPIO[4] CON aaaaa6aa => aaaaa6aa, DAT 0000ffc5 => 0000ffc5
GPIO[5] CON 000055aa => 000055a