• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2020 Unisoc Inc.
4  */
5 
6 #ifndef TST_RTCTIME
7 #define TST_RTCTIME
8 
9 #include <sys/ioctl.h>
10 #include <linux/rtc.h>
11 
12 int tst_rtc_ioctl(const char *rtc_dev, unsigned long request,
13                   struct rtc_time *rtc_tm);
14 
tst_rtc_gettime(const char * rtc_dev,struct rtc_time * rtc_tm)15 static inline int tst_rtc_gettime(const char *rtc_dev, struct rtc_time *rtc_tm)
16 {
17 	return tst_rtc_ioctl(rtc_dev, RTC_RD_TIME, rtc_tm);
18 }
19 
tst_rtc_settime(const char * rtc_dev,struct rtc_time * rtc_tm)20 static inline int tst_rtc_settime(const char *rtc_dev, struct rtc_time *rtc_tm)
21 {
22 	return tst_rtc_ioctl(rtc_dev, RTC_SET_TIME, rtc_tm);
23 }
24 
25 void tst_rtc_time_to_tm(long long time, struct rtc_time *tm);
26 
27 long long tst_rtc_tm_to_time(struct rtc_time *tm);
28 
29 #endif /* TST_RTCTIME */
30