Lines Matching refs:tm
212 static int ds1307_rtc_set(struct udevice *dev, const struct rtc_time *tm) in ds1307_rtc_set() argument
219 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in ds1307_rtc_set()
220 tm->tm_hour, tm->tm_min, tm->tm_sec); in ds1307_rtc_set()
222 if (tm->tm_year < 1970 || tm->tm_year > 2069) in ds1307_rtc_set()
225 buf[RTC_YR_REG_ADDR] = bin2bcd(tm->tm_year % 100); in ds1307_rtc_set()
226 buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon); in ds1307_rtc_set()
227 buf[RTC_DAY_REG_ADDR] = bin2bcd(tm->tm_wday + 1); in ds1307_rtc_set()
228 buf[RTC_DATE_REG_ADDR] = bin2bcd(tm->tm_mday); in ds1307_rtc_set()
229 buf[RTC_HR_REG_ADDR] = bin2bcd(tm->tm_hour); in ds1307_rtc_set()
230 buf[RTC_MIN_REG_ADDR] = bin2bcd(tm->tm_min); in ds1307_rtc_set()
231 buf[RTC_SEC_REG_ADDR] = bin2bcd(tm->tm_sec); in ds1307_rtc_set()
245 static int ds1307_rtc_get(struct udevice *dev, struct rtc_time *tm) in ds1307_rtc_get() argument
284 tm->tm_sec = bcd2bin(buf[RTC_SEC_REG_ADDR] & 0x7F); in ds1307_rtc_get()
285 tm->tm_min = bcd2bin(buf[RTC_MIN_REG_ADDR] & 0x7F); in ds1307_rtc_get()
286 tm->tm_hour = bcd2bin(buf[RTC_HR_REG_ADDR] & 0x3F); in ds1307_rtc_get()
287 tm->tm_mday = bcd2bin(buf[RTC_DATE_REG_ADDR] & 0x3F); in ds1307_rtc_get()
288 tm->tm_mon = bcd2bin(buf[RTC_MON_REG_ADDR] & 0x1F); in ds1307_rtc_get()
289 tm->tm_year = bcd2bin(buf[RTC_YR_REG_ADDR]) + in ds1307_rtc_get()
292 tm->tm_wday = bcd2bin((buf[RTC_DAY_REG_ADDR] - 1) & 0x07); in ds1307_rtc_get()
293 tm->tm_yday = 0; in ds1307_rtc_get()
294 tm->tm_isdst = 0; in ds1307_rtc_get()
297 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in ds1307_rtc_get()
298 tm->tm_hour, tm->tm_min, tm->tm_sec); in ds1307_rtc_get()