linux內(nèi)核對S3C2410睡眠模式的支持
?。?)編寫測試程序
#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 failed");
exit(0);
}
printf ("/dev/apm_bios opened, fd=%d",fd);
ioctl (fd, APM_IOC_SUSPEND);
close (fd);
printf ("/dev/apm_bios closed :)");
return 0;
}
(4)測試效果
#./test
.....
sleep: irq wakeup masks: fffffff0,fffffff0
GSTATUS3 0x30367140
GSTATUS4 0x00000000
進(jìn)入睡眠狀態(tài),此時按K10按鍵,即中斷0,喚醒系統(tǒng)
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 => 000055aa, DAT 000000fe => 000000ff
GPIO[6] CON ffa5ff30 => ffa5ffba, DAT 0000aced => 0000aced
GPIO[7] CON 002afaaa => 002afaaa, DAT 000001ff => 000001fb
post sleep: IRQs 0x02000001, 0x00000200
IRQ 16 asserted at resume
post sleep, preparing to return
S3C2410 PM Resume (post-restore)
s3c2410-sdi s3c2410-sdi: powered down.
s3c24xx-pm: check if we have anything to wake-up with
Disabling IRQ 52 (pin 192)
Disabling IRQ 53 (pin 193)
Disabling IRQ 55 (pin 195)
dma3: restoring configuration
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
s3c2410-wdt: watchdog disabled
s3c2410-i2c s3c2410-i2c: slave address 0x10
s3c2410-i2c s3c2410-i2c: bus frequency set to 390 KHz
s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
s3c2410-sdi s3c2410-sdi: running at 0kHz (requested: 0kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
s3c2410-sdi s3c2410-sdi: running at 98kHz (requested: 97kHz).
s3c2410-sdi s3c2410-sdi: powered down.
usb usb1: root hub lost power or was reset
Restarting tasks ... done.
/dev/apm_bios closed :)
#
此時系統(tǒng)恢復(fù)了正常運(yùn)行。
評論