1
我嘗試從內核空間設置RTC。但rtc_set_time()
被阻止並不返回。打印出"111"
,而不打印"222"
。如何在內核空間中設置rtc時間?
如何在Linux(2.6.32)內核空間中設置RTC時間?
struct device *dev = NULL;
struct rtc_device *rtc_dev = NULL;
struct rtc_time rtc_tm;
/* set rtc_tm */
/* ... */
dev = bus_find_device_by_name(&platform_bus_type, NULL, "at91_rtt.0");
if (!dev) {
printk(KERN_INFO "%s: NOT FIND DEVICE\n", __FUNCTION__);
return -1;
}
rtc_dev = to_rtc_device(dev);
printk(KERN_INFO "%s: 111\n", __FUNCTION__);
ret = rtc_set_time(rtc_dev, &rtc_tm);
printk(KERN_INFO "%s: 222\n", __FUNCTION__);
感謝您的提示。 – AndreyKeen
'rtc_dev = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);' – AndreyKeen
很高興幫助:) – bytefire