Lines Matching refs:atm

43 static void rtc_time_to_ambiq_time_set(const struct rtc_time *tm, am_hal_rtc_time_t *atm)  in rtc_time_to_ambiq_time_set()  argument
46 atm->ui32Century = ((tm->tm_year <= 99) || (tm->tm_year >= 200)); in rtc_time_to_ambiq_time_set()
48 atm->ui32CenturyBit = ((tm->tm_year > 99) && (tm->tm_year < 200)); in rtc_time_to_ambiq_time_set()
50 atm->ui32Year = tm->tm_year; in rtc_time_to_ambiq_time_set()
52 atm->ui32Year = tm->tm_year % 100; in rtc_time_to_ambiq_time_set()
54 atm->ui32Weekday = tm->tm_wday; in rtc_time_to_ambiq_time_set()
55 atm->ui32Month = tm->tm_mon + 1; in rtc_time_to_ambiq_time_set()
56 atm->ui32DayOfMonth = tm->tm_mday; in rtc_time_to_ambiq_time_set()
57 atm->ui32Hour = tm->tm_hour; in rtc_time_to_ambiq_time_set()
58 atm->ui32Minute = tm->tm_min; in rtc_time_to_ambiq_time_set()
59 atm->ui32Second = tm->tm_sec; in rtc_time_to_ambiq_time_set()
62 atm->ui32Hundredths = tm->tm_nsec / 10000000; in rtc_time_to_ambiq_time_set()
63 if (atm->ui32Hundredths > 99) { in rtc_time_to_ambiq_time_set()
64 uint16_t value = atm->ui32Hundredths / 100; in rtc_time_to_ambiq_time_set()
66 atm->ui32Second += value; in rtc_time_to_ambiq_time_set()
67 atm->ui32Hundredths -= value*100; in rtc_time_to_ambiq_time_set()
72 static void ambiq_time_to_rtc_time_set(const am_hal_rtc_time_t *atm, struct rtc_time *tm) in ambiq_time_to_rtc_time_set() argument
74 tm->tm_year = atm->ui32Year; in ambiq_time_to_rtc_time_set()
76 if (atm->ui32Century == 0) { in ambiq_time_to_rtc_time_set()
82 if (atm->ui32CenturyBit == 0) { in ambiq_time_to_rtc_time_set()
88 tm->tm_wday = atm->ui32Weekday; in ambiq_time_to_rtc_time_set()
89 tm->tm_mon = atm->ui32Month - 1; in ambiq_time_to_rtc_time_set()
90 tm->tm_mday = atm->ui32DayOfMonth; in ambiq_time_to_rtc_time_set()
91 tm->tm_hour = atm->ui32Hour; in ambiq_time_to_rtc_time_set()
92 tm->tm_min = atm->ui32Minute; in ambiq_time_to_rtc_time_set()
93 tm->tm_sec = atm->ui32Second; in ambiq_time_to_rtc_time_set()
96 tm->tm_nsec = atm->ui32Hundredths * 10000000; in ambiq_time_to_rtc_time_set()
99 static int test_for_rollover(am_hal_rtc_time_t *atm) in test_for_rollover() argument
101 if ((atm->ui32Year == 99) && in test_for_rollover()
102 (atm->ui32Month == 12) && in test_for_rollover()
103 (atm->ui32DayOfMonth == 31)) { in test_for_rollover()