Lines Matching refs:tm
25 static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) in pcf2127_rtc_set() argument
34 buf[i++] = bin2bcd(tm->tm_sec); in pcf2127_rtc_set()
35 buf[i++] = bin2bcd(tm->tm_min); in pcf2127_rtc_set()
36 buf[i++] = bin2bcd(tm->tm_hour); in pcf2127_rtc_set()
37 buf[i++] = bin2bcd(tm->tm_mday); in pcf2127_rtc_set()
38 buf[i++] = tm->tm_wday & 0x07; in pcf2127_rtc_set()
41 buf[i++] = bin2bcd(tm->tm_mon + 1); in pcf2127_rtc_set()
44 buf[i++] = bin2bcd(tm->tm_year % 100); in pcf2127_rtc_set()
52 static int pcf2127_rtc_get(struct udevice *dev, struct rtc_time *tm) in pcf2127_rtc_get() argument
67 tm->tm_sec = bcd2bin(buf[PCF2127_REG_SC] & 0x7F); in pcf2127_rtc_get()
68 tm->tm_min = bcd2bin(buf[PCF2127_REG_MN] & 0x7F); in pcf2127_rtc_get()
69 tm->tm_hour = bcd2bin(buf[PCF2127_REG_HR] & 0x3F); in pcf2127_rtc_get()
70 tm->tm_mday = bcd2bin(buf[PCF2127_REG_DM] & 0x3F); in pcf2127_rtc_get()
71 tm->tm_mon = bcd2bin(buf[PCF2127_REG_MO] & 0x1F) - 1; in pcf2127_rtc_get()
72 tm->tm_year = bcd2bin(buf[PCF2127_REG_YR]) + 1900; in pcf2127_rtc_get()
73 if (tm->tm_year < 1970) in pcf2127_rtc_get()
74 tm->tm_year += 100; /* assume we are in 1970...2069 */ in pcf2127_rtc_get()
75 tm->tm_wday = buf[PCF2127_REG_DW] & 0x07; in pcf2127_rtc_get()
76 tm->tm_yday = 0; in pcf2127_rtc_get()
77 tm->tm_isdst = 0; in pcf2127_rtc_get()
80 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in pcf2127_rtc_get()
81 tm->tm_hour, tm->tm_min, tm->tm_sec); in pcf2127_rtc_get()