1 /* 2 * Copyright (c) 2024 STMicroelectronics 3 * Copyright (c) 2025 Alexander Kozhinov <ak.alexander.kozhinov@gmail.com> 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #ifndef ZEPHYR_DRIVERS_RTC_RTC_LL_STM32_H_ 9 #define ZEPHYR_DRIVERS_RTC_RTC_LL_STM32_H_ 10 11 /** 12 * ES0584 / ES0631 §2.5.2; ES0632 §2.6.2 (both Rev. 2) 13 * """ 14 * RTC interrupts cannot be reliably used for real-time 15 * control functions, since some occurences of RTC 16 * interrupts may be missed. 17 * """ 18 * Since alarm IRQs are unreliable, don't allow RTC alarm 19 * to be used on STM32WB0 series. For this, we have to 20 * create a #define only valid when both the Kconfig is 21 * enabled, and we're on a supported series. This must 22 * be done because the RTC driver has to build properly 23 * on all targets regardless of which Kconfig options have 24 * been enabled. 25 */ 26 #if defined(CONFIG_RTC_ALARM) && !defined(CONFIG_SOC_SERIES_STM32WB0X) 27 #define STM32_RTC_ALARM_ENABLED 1 28 29 /* STM32 RTC alarms, A & B, LL masks are equal */ 30 #define RTC_STM32_ALRM_MASK_ALL LL_RTC_ALMA_MASK_ALL 31 #define RTC_STM32_ALRM_MASK_SECONDS LL_RTC_ALMA_MASK_SECONDS 32 #define RTC_STM32_ALRM_MASK_MINUTES LL_RTC_ALMA_MASK_MINUTES 33 #define RTC_STM32_ALRM_MASK_HOURS LL_RTC_ALMA_MASK_HOURS 34 #define RTC_STM32_ALRM_MASK_DATEWEEKDAY LL_RTC_ALMA_MASK_DATEWEEKDAY 35 36 #define RTC_STM32_ALRM_DATEWEEKDAYSEL_WEEKDAY LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY 37 #define RTC_STM32_ALRM_DATEWEEKDAYSEL_DATE LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 38 39 #endif /* CONFIG_RTC_ALARM && !CONFIG_SOC_SERIES_STM32WB0X */ 40 41 #endif /* ZEPHYR_DRIVERS_RTC_RTC_LL_STM32_H_ */ 42