S3C2440驱动篇—RTC驱动分析

2014-11-24 09:56:41 · 作者: · 浏览: 0

static struct platform_device *smdk2440_devices[] __initdata = {


&s3c_device_usb, /* arch/arm/mach-s3c2440/mach-smdk2440.c */


&s3c_device_lcd,


&s3c_device_wdt,


&s3c_device_i2c0,


&s3c_device_iis,


&s3c_device_rtc,


};


驱动实现:


配置内核,加入RTC驱动支持


Devide drivers --->


<*> Real Time Clock --->


<*> Samsung S3C series SoC RTC


测试:


# cat /proc/devices 查看rtc设备号


# ls –l /dev/rtc


crw-r--r-- 1 root root 254, 0 Jan 1 1970 /dev/rtc


lrwxr--r-- 1 root root 3Jan 1 1970 /dev/rtc0 -> rtc


date –s 072021352011 设置系统时间为2011-07-20 21:35


hwclock –w 把刚设置的系统时间存入RTC


开机时使用hwclock –s把RTC时间恢复到系统时间


hwclock参数说明:


Options:


-r Show hardware clock time


-s Set system time from hardware clock


-w Set hardware clock to system time


-u Hardware clock is in UTC


-l Hardware clock is in local time


-f FILE Use specified device (e.g. /dev/rtc2)