Lines Matching full:rtc

8  * Source file for the STM32 RTC driver
108 static inline ErrorStatus ll_func_init_alarm(RTC_TypeDef *rtc, uint32_t format, in ll_func_init_alarm() argument
112 return LL_RTC_ALARM_Init(rtc, format, alarmStruct); in ll_func_init_alarm()
114 return LL_RTC_ALMA_Init(rtc, format, alarmStruct); in ll_func_init_alarm()
118 static inline void ll_func_clear_alarm_flag(RTC_TypeDef *rtc) in ll_func_clear_alarm_flag() argument
121 LL_RTC_ClearFlag_ALR(rtc); in ll_func_clear_alarm_flag()
123 LL_RTC_ClearFlag_ALRA(rtc); in ll_func_clear_alarm_flag()
127 static inline uint32_t ll_func_is_active_alarm(RTC_TypeDef *rtc) in ll_func_is_active_alarm() argument
130 return LL_RTC_IsActiveFlag_ALR(rtc); in ll_func_is_active_alarm()
132 return LL_RTC_IsActiveFlag_ALRA(rtc); in ll_func_is_active_alarm()
136 static inline void ll_func_enable_interrupt_alarm(RTC_TypeDef *rtc) in ll_func_enable_interrupt_alarm() argument
139 LL_RTC_EnableIT_ALR(rtc); in ll_func_enable_interrupt_alarm()
141 LL_RTC_EnableIT_ALRA(rtc); in ll_func_enable_interrupt_alarm()
145 static inline void ll_func_disable_interrupt_alarm(RTC_TypeDef *rtc) in ll_func_disable_interrupt_alarm() argument
148 LL_RTC_DisableIT_ALR(rtc); in ll_func_disable_interrupt_alarm()
150 LL_RTC_DisableIT_ALRA(rtc); in ll_func_disable_interrupt_alarm()
155 static inline uint32_t ll_func_isenabled_interrupt_alarm(RTC_TypeDef *rtc) in ll_func_isenabled_interrupt_alarm() argument
158 return LL_RTC_IsEnabledIT_ALR(rtc); in ll_func_isenabled_interrupt_alarm()
160 return LL_RTC_IsEnabledIT_ALRA(rtc); in ll_func_isenabled_interrupt_alarm()
165 static inline void ll_func_enable_alarm(RTC_TypeDef *rtc) in ll_func_enable_alarm() argument
168 ARG_UNUSED(rtc); in ll_func_enable_alarm()
170 LL_RTC_ALMA_Enable(rtc); in ll_func_enable_alarm()
174 static inline void ll_func_disable_alarm(RTC_TypeDef *rtc) in ll_func_disable_alarm() argument
177 ARG_UNUSED(rtc); in ll_func_disable_alarm()
179 LL_RTC_ALMA_Disable(rtc); in ll_func_disable_alarm()
192 /* Enable RTC bus clock */ in rtc_stm32_start()
194 LOG_ERR("RTC clock enabling failed\n"); in rtc_stm32_start()
215 /* Disable RTC bus clock */ in rtc_stm32_stop()
217 LOG_ERR("RTC clock disabling failed\n"); in rtc_stm32_stop()
253 rtc_date = LL_RTC_DATE_Get(RTC); in rtc_stm32_read()
257 rtc_time = LL_RTC_TIME_Get(RTC); in rtc_stm32_read()
258 rtc_subseconds = LL_RTC_TIME_GetSubSecond(RTC); in rtc_stm32_read()
259 } while (rtc_time != LL_RTC_TIME_Get(RTC)); in rtc_stm32_read()
261 rtc_time = LL_RTC_TIME_Get(RTC); in rtc_stm32_read()
264 } while (rtc_date != LL_RTC_DATE_Get(RTC)); in rtc_stm32_read()
267 /* RTC start time: 1st, Jan, 2000 */ in rtc_stm32_read()
281 /* Return number of seconds since RTC init */ in rtc_stm32_read()
288 /* The RTC counts up, except for the subsecond register which counts in rtc_stm32_read()
310 rtc_time = LL_RTC_TIME_Get(RTC); in rtc_stm32_read()
421 LL_RTC_DisableWriteProtection(RTC); in rtc_stm32_set_alarm()
422 ll_func_disable_alarm(RTC); in rtc_stm32_set_alarm()
423 LL_RTC_EnableWriteProtection(RTC); in rtc_stm32_set_alarm()
425 if (ll_func_init_alarm(RTC, LL_RTC_FORMAT_BIN, &rtc_alarm) != SUCCESS) { in rtc_stm32_set_alarm()
429 LL_RTC_DisableWriteProtection(RTC); in rtc_stm32_set_alarm()
432 LL_RTC_ALMA_SetSubSecondMask(RTC, 0xF); in rtc_stm32_set_alarm()
433 LL_RTC_ALMA_SetSubSecond(RTC, RTC_SYNCPRE - alarm_val_ss); in rtc_stm32_set_alarm()
435 ll_func_enable_alarm(RTC); in rtc_stm32_set_alarm()
436 ll_func_clear_alarm_flag(RTC); in rtc_stm32_set_alarm()
437 ll_func_enable_interrupt_alarm(RTC); in rtc_stm32_set_alarm()
438 LL_RTC_EnableWriteProtection(RTC); in rtc_stm32_set_alarm()
466 LL_RTC_DisableWriteProtection(RTC); in rtc_stm32_cancel_alarm()
467 ll_func_clear_alarm_flag(RTC); in rtc_stm32_cancel_alarm()
468 ll_func_disable_interrupt_alarm(RTC); in rtc_stm32_cancel_alarm()
469 ll_func_disable_alarm(RTC); in rtc_stm32_cancel_alarm()
470 LL_RTC_EnableWriteProtection(RTC); in rtc_stm32_cancel_alarm()
480 return ll_func_is_active_alarm(RTC) != 0; in rtc_stm32_get_pending_int()
514 if (ll_func_is_active_alarm(RTC) != 0 in rtc_stm32_isr()
516 || (data->irq_on_late && ll_func_isenabled_interrupt_alarm(RTC)) in rtc_stm32_isr()
520 LL_RTC_DisableWriteProtection(RTC); in rtc_stm32_isr()
521 ll_func_clear_alarm_flag(RTC); in rtc_stm32_isr()
522 ll_func_disable_interrupt_alarm(RTC); in rtc_stm32_isr()
523 ll_func_disable_alarm(RTC); in rtc_stm32_isr()
524 LL_RTC_EnableWriteProtection(RTC); in rtc_stm32_isr()
543 /* in STM32U5 family RTC is not connected to EXTI */ in rtc_stm32_isr()
563 /* Enable RTC bus clock */ in rtc_stm32_init()
576 /* Enable RTC clock source */ in rtc_stm32_init()
591 if (LL_RTC_DeInit(RTC) != SUCCESS) { in rtc_stm32_init()
596 if (LL_RTC_Init(RTC, ((LL_RTC_InitTypeDef *) in rtc_stm32_init()
602 LL_RTC_DisableWriteProtection(RTC); in rtc_stm32_init()
603 LL_RTC_EnableShadowRegBypass(RTC); in rtc_stm32_init()
604 LL_RTC_EnableWriteProtection(RTC); in rtc_stm32_init()
611 /* in STM32U5 family RTC is not connected to EXTI */ in rtc_stm32_init()
659 /* Enable RTC bus clock */ in rtc_stm32_pm_action()