structrtc_time *tm);externintrtc_set_ntp_time(structtimespec64 now,unsignedlong*target_nsec);int__rtc_read_alarm(structrtc_device *rtc,structrtc_wkalrm *alarm);externintrtc_read_alarm(structrtc_device *rtc,structrtc_wkalrm *alrm);externintrtc_set_alarm(structrtc...
mutex_unlock(&rtc->ops_lock);if(copy_from_user(&tm, uarg,sizeof(tm)))return-EFAULT;returnrtc_set_time(rtc, &tm); ... } 函数太长不全贴了,这里以set rtc time为例,指定cmd值为RTC_SET_TIME,即可进入内核,继而调用函数rtc_set_time() 2.函数rtc_set_time()的目的是设置rtc时间,该函数已...
rtc_time_to_tm((high << 17) | (mid << 1) | (low >> 15), time); rtc_time64_to_tm((high << 17) | (mid << 1) | (low >> 15), time);return 0; }static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)...
now_time=rtc_tm_to_time64(now); next_time=rtc_tm_to_time64(next); if(next_time<now_time) { /* Advance one day */ next_time+=60*60*24; rtc_time_to_tm(next_time,next); rtc_time64_to_tm(next_time,next); } } Expand All@@ -123,7 +123,7 @@ static int pm80x_rtc_rea...
tv64.tv_sec = rtc_tm_to_time64(&tm); err = do_settimeofday64(&tv64); dev_info(rtc->dev.parent, "setting system clock to " "%d-%02d-%02d %02d:%02d:%02d UTC (%lld)\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, ...
rtc_time_to_tm(time, tm); return 0; } rtc_time 结构体定义如下: struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; rtc_read_lp_counter 函数,此函数用于读取 RTC 计数值,函数内容如下...
rtc_time64_to_tm(((time64_t)seconds_hi) << 32) | (time64_t)seconds_lo, tm); - +dev_info(dev, "gjw ti_k3_rtc_read_time y%d,m%d,d%d\n",tm->tm_year,tm->tm_mon,tm->tm_mday); return 0; } @@-289,7 +289,7@@static int ti_k3_rtc_set_time(struct device ...
19 int i, fd, retval, irqcount = 0, alarm_time = 5; 20 unsigned long tmp, data; 21 struct rtc_time rtc_tm; 22 const char *rtc = default_rtc; 23 switch (argc) 24 { 25 case 2: 26 rtc = argv[1]; 27 /* FALLTHROUGH */ ...
rtc_dev_ioctl(struct file *file,219unsignedint cmd,unsignedlong arg)220{ 221int err =0;222struct rtc_device *rtc =file->private_data;223conststruct rtc_class_ops *ops =rtc->ops;224struct rtc_time tm;225struct rtc_wkalrm alarm;226void __user *uarg =(void __user *)arg;...
rtc-lib.c:文件提供通用的时间操作函数,如rtc_time_to_tm、rtc_valid_tm等 rtc-dev.c:文件在/dev/目录下创建设备节点供应用层访问,如open、read、ioctl等,访问方式填充到file_operations结构体中 hctosys.c/rtc-sys.c/rtc-proc.c:将硬件时钟写给 wall time ...