Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:38

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_ll_rtc.h
0004   * @author  MCD Application Team
0005   * @brief   Header file of RTC LL module.
0006   ******************************************************************************
0007   * @attention
0008   *
0009   * Copyright (c) 2017 STMicroelectronics.
0010   * All rights reserved.
0011   *
0012   * This software is licensed under terms that can be found in the LICENSE file
0013   * in the root directory of this software component.
0014   * If no LICENSE file comes with this software, it is provided AS-IS.
0015   *
0016   ******************************************************************************
0017   */
0018 
0019 /* Define to prevent recursive inclusion -------------------------------------*/
0020 #ifndef STM32H7xx_LL_RTC_H
0021 #define STM32H7xx_LL_RTC_H
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 /* Includes ------------------------------------------------------------------*/
0028 #include "stm32h7xx.h"
0029 
0030 /** @addtogroup STM32H7xx_LL_Driver
0031   * @{
0032   */
0033 
0034 #if defined(RTC)
0035 
0036 /** @defgroup RTC_LL RTC
0037   * @ingroup RTEMSBSPsARMSTM32H7
0038   * @{
0039   */
0040 
0041 /* Private types -------------------------------------------------------------*/
0042 /* Private variables ---------------------------------------------------------*/
0043 /* Private constants ---------------------------------------------------------*/
0044 /** @defgroup RTC_LL_Private_Constants RTC Private Constants
0045   * @ingroup RTEMSBSPsARMSTM32H7
0046   * @{
0047   */
0048 /* Masks Definition */
0049 #define RTC_LL_INIT_MASK              0xFFFFFFFFU
0050 #define RTC_LL_RSF_MASK               0xFFFFFF5FU
0051 
0052 /* Write protection defines */
0053 #define RTC_WRITE_PROTECTION_DISABLE  0xFFU
0054 #define RTC_WRITE_PROTECTION_ENABLE_1 0xCAU
0055 #define RTC_WRITE_PROTECTION_ENABLE_2 0x53U
0056 
0057 /* Defines used to combine date & time */
0058 #define RTC_OFFSET_WEEKDAY            24U
0059 #define RTC_OFFSET_DAY                16U
0060 #define RTC_OFFSET_MONTH              8U
0061 #define RTC_OFFSET_HOUR               16U
0062 #define RTC_OFFSET_MINUTE             8U
0063 
0064 /**
0065   * @}
0066   */
0067 
0068 /* Private macros ------------------------------------------------------------*/
0069 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
0070 /** @defgroup RTC_LL_Private_Macros RTC Private Macros
0071   * @ingroup RTEMSBSPsARMSTM32H7
0072   * @{
0073   */
0074 /**
0075   * @}
0076   */
0077 #endif /*USE_FULL_LL_DRIVER*/
0078 
0079 /* Exported types ------------------------------------------------------------*/
0080 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
0081 /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
0082   * @ingroup RTEMSBSPsARMSTM32H7
0083   * @{
0084   */
0085 
0086 /**
0087   * @brief  RTC Init structures definition
0088   */
0089 typedef struct
0090 {
0091   uint32_t HourFormat;   /*!< Specifies the RTC Hours Format.
0092                               This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
0093 
0094                               This feature can be modified afterwards using unitary function
0095                               @ref LL_RTC_SetHourFormat(). */
0096 
0097   uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
0098                               This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
0099 
0100                               This feature can be modified afterwards using unitary function
0101                               @ref LL_RTC_SetAsynchPrescaler(). */
0102 
0103   uint32_t SynchPrescaler;  /*!< Specifies the RTC Synchronous Predivider value.
0104                               This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
0105 
0106                               This feature can be modified afterwards using unitary function
0107                               @ref LL_RTC_SetSynchPrescaler(). */
0108 } LL_RTC_InitTypeDef;
0109 
0110 /**
0111   * @brief  RTC Time structure definition
0112   */
0113 typedef struct
0114 {
0115   uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
0116                             This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
0117 
0118                             This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
0119 
0120   uint8_t Hours;       /*!< Specifies the RTC Time Hours.
0121                             This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
0122                             This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
0123 
0124                             This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
0125 
0126   uint8_t Minutes;     /*!< Specifies the RTC Time Minutes.
0127                             This parameter must be a number between Min_Data = 0 and Max_Data = 59
0128 
0129                             This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
0130 
0131   uint8_t Seconds;     /*!< Specifies the RTC Time Seconds.
0132                             This parameter must be a number between Min_Data = 0 and Max_Data = 59
0133 
0134                             This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
0135 } LL_RTC_TimeTypeDef;
0136 
0137 /**
0138   * @brief  RTC Date structure definition
0139   */
0140 typedef struct
0141 {
0142   uint8_t WeekDay;  /*!< Specifies the RTC Date WeekDay.
0143                          This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
0144 
0145                          This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
0146 
0147   uint8_t Month;    /*!< Specifies the RTC Date Month.
0148                          This parameter can be a value of @ref RTC_LL_EC_MONTH
0149 
0150                          This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
0151 
0152   uint8_t Day;      /*!< Specifies the RTC Date Day.
0153                          This parameter must be a number between Min_Data = 1 and Max_Data = 31
0154 
0155                          This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
0156 
0157   uint8_t Year;     /*!< Specifies the RTC Date Year.
0158                          This parameter must be a number between Min_Data = 0 and Max_Data = 99
0159 
0160                          This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
0161 } LL_RTC_DateTypeDef;
0162 
0163 /**
0164   * @brief  RTC Alarm structure definition
0165   */
0166 typedef struct
0167 {
0168   LL_RTC_TimeTypeDef AlarmTime;  /*!< Specifies the RTC Alarm Time members. */
0169 
0170   uint32_t AlarmMask;            /*!< Specifies the RTC Alarm Masks.
0171                                       This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
0172 
0173                                       This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
0174                                       or @ref LL_RTC_ALMB_SetMask() for ALARM B
0175                                  */
0176 
0177   uint32_t AlarmDateWeekDaySel;  /*!< Specifies the RTC Alarm is on day or WeekDay.
0178                                       This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
0179 
0180                                       This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
0181                                       for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
0182                                  */
0183 
0184   uint8_t AlarmDateWeekDay;      /*!< Specifies the RTC Alarm Day/WeekDay.
0185                                       If AlarmDateWeekDaySel set to day, this parameter  must be a number between Min_Data = 1 and Max_Data = 31.
0186 
0187                                       This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
0188                                       for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
0189 
0190                                       If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
0191 
0192                                       This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
0193                                       for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
0194                                  */
0195 } LL_RTC_AlarmTypeDef;
0196 
0197 /**
0198   * @}
0199   */
0200 #endif /* USE_FULL_LL_DRIVER */
0201 
0202 /* Exported constants --------------------------------------------------------*/
0203 /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
0204   * @ingroup RTEMSBSPsARMSTM32H7
0205   * @{
0206   */
0207 
0208 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
0209 /** @defgroup RTC_LL_EC_FORMAT FORMAT
0210   * @ingroup RTEMSBSPsARMSTM32H7
0211   * @{
0212   */
0213 #define LL_RTC_FORMAT_BIN                  0x00000000U /*!< Binary data format */
0214 #define LL_RTC_FORMAT_BCD                  0x00000001U /*!< BCD data format */
0215 /**
0216   * @}
0217   */
0218 
0219 /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
0220   * @ingroup RTEMSBSPsARMSTM32H7
0221   * @{
0222   */
0223 #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm A Date is selected */
0224 #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL        /*!< Alarm A WeekDay is selected */
0225 /**
0226   * @}
0227   */
0228 
0229 /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
0230   * @ingroup RTEMSBSPsARMSTM32H7
0231   * @{
0232   */
0233 #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm B Date is selected */
0234 #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL        /*!< Alarm B WeekDay is selected */
0235 /**
0236   * @}
0237   */
0238 
0239 #endif /* USE_FULL_LL_DRIVER */
0240 
0241 /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
0242   * @ingroup RTEMSBSPsARMSTM32H7
0243   * @brief    Flags defines which can be used with LL_RTC_ReadReg function
0244   * @{
0245   */
0246 #if defined(TAMP)
0247 #define LL_RTC_SCR_ITSF                    RTC_SCR_CITSF
0248 #define LL_RTC_SCR_TSOVF                   RTC_SCR_CTSOVF
0249 #define LL_RTC_SCR_TSF                     RTC_SCR_CTSF
0250 #define LL_RTC_SCR_WUTF                    RTC_SCR_CWUTF
0251 #define LL_RTC_SCR_ALRBF                   RTC_SCR_CALRBF
0252 #define LL_RTC_SCR_ALRAF                   RTC_SCR_CALRAF
0253 
0254 #define LL_RTC_ICSR_RECALPF                RTC_ICSR_RECALPF
0255 #define LL_RTC_ICSR_INITF                  RTC_ICSR_INITF
0256 #define LL_RTC_ICSR_RSF                    RTC_ICSR_RSF
0257 #define LL_RTC_ICSR_INITS                  RTC_ICSR_INITS
0258 #define LL_RTC_ICSR_SHPF                   RTC_ICSR_SHPF
0259 #define LL_RTC_ICSR_WUTWF                  RTC_ICSR_WUTWF
0260 #else
0261 #define LL_RTC_ISR_ITSF                    RTC_ISR_ITSF
0262 #define LL_RTC_ISR_RECALPF                 RTC_ISR_RECALPF
0263 #define LL_RTC_ISR_TAMP3F                  RTC_ISR_TAMP3F
0264 #define LL_RTC_ISR_TAMP2F                  RTC_ISR_TAMP2F
0265 #define LL_RTC_ISR_TAMP1F                  RTC_ISR_TAMP1F
0266 #define LL_RTC_ISR_TSOVF                   RTC_ISR_TSOVF
0267 #define LL_RTC_ISR_TSF                     RTC_ISR_TSF
0268 #define LL_RTC_ISR_WUTF                    RTC_ISR_WUTF
0269 #define LL_RTC_ISR_ALRBF                   RTC_ISR_ALRBF
0270 #define LL_RTC_ISR_ALRAF                   RTC_ISR_ALRAF
0271 #define LL_RTC_ISR_INITF                   RTC_ISR_INITF
0272 #define LL_RTC_ISR_RSF                     RTC_ISR_RSF
0273 #define LL_RTC_ISR_INITS                   RTC_ISR_INITS
0274 #define LL_RTC_ISR_SHPF                    RTC_ISR_SHPF
0275 #define LL_RTC_ISR_WUTWF                   RTC_ISR_WUTWF
0276 #define LL_RTC_ISR_ALRBWF                  RTC_ISR_ALRBWF
0277 #define LL_RTC_ISR_ALRAWF                  RTC_ISR_ALRAWF
0278 #endif /* TAMP */
0279 /**
0280   * @}
0281   */
0282 
0283 /** @defgroup RTC_LL_EC_IT IT Defines
0284   * @ingroup RTEMSBSPsARMSTM32H7
0285   * @brief    IT defines which can be used with LL_RTC_ReadReg and  LL_RTC_WriteReg functions
0286   * @{
0287   */
0288 #define LL_RTC_CR_TSIE                     RTC_CR_TSIE
0289 #define LL_RTC_CR_WUTIE                    RTC_CR_WUTIE
0290 #define LL_RTC_CR_ALRBIE                   RTC_CR_ALRBIE
0291 #define LL_RTC_CR_ALRAIE                   RTC_CR_ALRAIE
0292 #if !defined(TAMP)
0293 #define LL_RTC_TAMPCR_TAMP3IE              RTC_TAMPCR_TAMP3IE
0294 #define LL_RTC_TAMPCR_TAMP2IE              RTC_TAMPCR_TAMP2IE
0295 #define LL_RTC_TAMPCR_TAMP1IE              RTC_TAMPCR_TAMP1IE
0296 #define LL_RTC_TAMPCR_TAMPIE               RTC_TAMPCR_TAMPIE
0297 #endif /* !TAMP */
0298 /**
0299   * @}
0300   */
0301 
0302 /** @defgroup RTC_LL_EC_WEEKDAY  WEEK DAY
0303   * @ingroup RTEMSBSPsARMSTM32H7
0304   * @{
0305   */
0306 #define LL_RTC_WEEKDAY_MONDAY              (uint8_t)0x01 /*!< Monday    */
0307 #define LL_RTC_WEEKDAY_TUESDAY             (uint8_t)0x02 /*!< Tuesday   */
0308 #define LL_RTC_WEEKDAY_WEDNESDAY           (uint8_t)0x03 /*!< Wednesday */
0309 #define LL_RTC_WEEKDAY_THURSDAY            (uint8_t)0x04 /*!< Thrusday  */
0310 #define LL_RTC_WEEKDAY_FRIDAY              (uint8_t)0x05 /*!< Friday    */
0311 #define LL_RTC_WEEKDAY_SATURDAY            (uint8_t)0x06 /*!< Saturday  */
0312 #define LL_RTC_WEEKDAY_SUNDAY              (uint8_t)0x07 /*!< Sunday    */
0313 /**
0314   * @}
0315   */
0316 
0317 /** @defgroup RTC_LL_EC_MONTH  MONTH
0318   * @ingroup RTEMSBSPsARMSTM32H7
0319   * @{
0320   */
0321 #define LL_RTC_MONTH_JANUARY               (uint8_t)0x01  /*!< January   */
0322 #define LL_RTC_MONTH_FEBRUARY              (uint8_t)0x02  /*!< February  */
0323 #define LL_RTC_MONTH_MARCH                 (uint8_t)0x03  /*!< March     */
0324 #define LL_RTC_MONTH_APRIL                 (uint8_t)0x04  /*!< April     */
0325 #define LL_RTC_MONTH_MAY                   (uint8_t)0x05  /*!< May       */
0326 #define LL_RTC_MONTH_JUNE                  (uint8_t)0x06  /*!< June      */
0327 #define LL_RTC_MONTH_JULY                  (uint8_t)0x07  /*!< July      */
0328 #define LL_RTC_MONTH_AUGUST                (uint8_t)0x08  /*!< August    */
0329 #define LL_RTC_MONTH_SEPTEMBER             (uint8_t)0x09  /*!< September */
0330 #define LL_RTC_MONTH_OCTOBER               (uint8_t)0x10  /*!< October   */
0331 #define LL_RTC_MONTH_NOVEMBER              (uint8_t)0x11  /*!< November  */
0332 #define LL_RTC_MONTH_DECEMBER              (uint8_t)0x12  /*!< December  */
0333 /**
0334   * @}
0335   */
0336 
0337 /** @defgroup RTC_LL_EC_HOURFORMAT  HOUR FORMAT
0338   * @ingroup RTEMSBSPsARMSTM32H7
0339   * @{
0340   */
0341 #define LL_RTC_HOURFORMAT_24HOUR           0x00000000U           /*!< 24 hour/day format */
0342 #define LL_RTC_HOURFORMAT_AMPM             RTC_CR_FMT            /*!< AM/PM hour format */
0343 /**
0344   * @}
0345   */
0346 
0347 /** @defgroup RTC_LL_EC_ALARMOUT  ALARM OUTPUT
0348   * @ingroup RTEMSBSPsARMSTM32H7
0349   * @{
0350   */
0351 #define LL_RTC_ALARMOUT_DISABLE            0x00000000U             /*!< Output disabled */
0352 #define LL_RTC_ALARMOUT_ALMA               RTC_CR_OSEL_0           /*!< Alarm A output enabled */
0353 #define LL_RTC_ALARMOUT_ALMB               RTC_CR_OSEL_1           /*!< Alarm B output enabled */
0354 #define LL_RTC_ALARMOUT_WAKEUP             RTC_CR_OSEL             /*!< Wakeup output enabled */
0355 /**
0356   * @}
0357   */
0358 
0359 /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE  ALARM OUTPUT TYPE
0360   * @ingroup RTEMSBSPsARMSTM32H7
0361   * @{
0362   */
0363 #if defined(TAMP)
0364 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN  RTC_CR_TAMPALRM_TYPE   /*!< RTC_ALARM is open-drain output */
0365 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL   0x00000000U            /*!< RTC_ALARM is push-pull output */
0366 #else
0367 #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN  0x00000000U            /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
0368 #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL   RTC_OR_ALARMOUTTYPE    /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
0369 #endif /* TAMP */
0370 /**
0371   * @}
0372   */
0373 
0374 /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN  OUTPUT POLARITY PIN
0375   * @ingroup RTEMSBSPsARMSTM32H7
0376   * @{
0377   */
0378 #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH     0x00000000U           /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
0379 #define LL_RTC_OUTPUTPOLARITY_PIN_LOW      RTC_CR_POL            /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
0380 /**
0381   * @}
0382   */
0383 
0384 /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
0385   * @ingroup RTEMSBSPsARMSTM32H7
0386   * @{
0387   */
0388 #define LL_RTC_TIME_FORMAT_AM_OR_24        0x00000000U           /*!< AM or 24-hour format */
0389 #define LL_RTC_TIME_FORMAT_PM              RTC_TR_PM             /*!< PM */
0390 /**
0391   * @}
0392   */
0393 
0394 /** @defgroup RTC_LL_EC_SHIFT_SECOND  SHIFT SECOND
0395   * @ingroup RTEMSBSPsARMSTM32H7
0396   * @{
0397   */
0398 #define LL_RTC_SHIFT_SECOND_DELAY          0x00000000U           /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
0399 #define LL_RTC_SHIFT_SECOND_ADVANCE        RTC_SHIFTR_ADD1S      /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
0400 /**
0401   * @}
0402   */
0403 
0404 /** @defgroup RTC_LL_EC_ALMA_MASK  ALARMA MASK
0405   * @ingroup RTEMSBSPsARMSTM32H7
0406   * @{
0407   */
0408 #define LL_RTC_ALMA_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm A*/
0409 #define LL_RTC_ALMA_MASK_DATEWEEKDAY       RTC_ALRMAR_MSK4         /*!< Date/day do not care in Alarm A comparison */
0410 #define LL_RTC_ALMA_MASK_HOURS             RTC_ALRMAR_MSK3         /*!< Hours do not care in Alarm A comparison */
0411 #define LL_RTC_ALMA_MASK_MINUTES           RTC_ALRMAR_MSK2         /*!< Minutes do not care in Alarm A comparison */
0412 #define LL_RTC_ALMA_MASK_SECONDS           RTC_ALRMAR_MSK1         /*!< Seconds do not care in Alarm A comparison */
0413 #define LL_RTC_ALMA_MASK_ALL               (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
0414 /**
0415   * @}
0416   */
0417 
0418 /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT  ALARMA TIME FORMAT
0419   * @ingroup RTEMSBSPsARMSTM32H7
0420   * @{
0421   */
0422 #define LL_RTC_ALMA_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
0423 #define LL_RTC_ALMA_TIME_FORMAT_PM         RTC_ALRMAR_PM         /*!< PM */
0424 /**
0425   * @}
0426   */
0427 
0428 /** @defgroup RTC_LL_EC_ALMB_MASK  ALARMB MASK
0429   * @ingroup RTEMSBSPsARMSTM32H7
0430   * @{
0431   */
0432 #define LL_RTC_ALMB_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm B*/
0433 #define LL_RTC_ALMB_MASK_DATEWEEKDAY       RTC_ALRMBR_MSK4         /*!< Date/day do not care in Alarm B comparison */
0434 #define LL_RTC_ALMB_MASK_HOURS             RTC_ALRMBR_MSK3         /*!< Hours do not care in Alarm B comparison */
0435 #define LL_RTC_ALMB_MASK_MINUTES           RTC_ALRMBR_MSK2         /*!< Minutes do not care in Alarm B comparison */
0436 #define LL_RTC_ALMB_MASK_SECONDS           RTC_ALRMBR_MSK1         /*!< Seconds do not care in Alarm B comparison */
0437 #define LL_RTC_ALMB_MASK_ALL               (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
0438 /**
0439   * @}
0440   */
0441 
0442 /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT  ALARMB TIME FORMAT
0443   * @ingroup RTEMSBSPsARMSTM32H7
0444   * @{
0445   */
0446 #define LL_RTC_ALMB_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
0447 #define LL_RTC_ALMB_TIME_FORMAT_PM         RTC_ALRMBR_PM         /*!< PM */
0448 /**
0449   * @}
0450   */
0451 
0452 /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE  TIMESTAMP EDGE
0453   * @ingroup RTEMSBSPsARMSTM32H7
0454   * @{
0455   */
0456 #define LL_RTC_TIMESTAMP_EDGE_RISING       0x00000000U           /*!< RTC_TS input rising edge generates a time-stamp event */
0457 #define LL_RTC_TIMESTAMP_EDGE_FALLING      RTC_CR_TSEDGE         /*!< RTC_TS input falling edge generates a time-stamp even */
0458 /**
0459   * @}
0460   */
0461 
0462 /** @defgroup RTC_LL_EC_TS_TIME_FORMAT  TIMESTAMP TIME FORMAT
0463   * @ingroup RTEMSBSPsARMSTM32H7
0464   * @{
0465   */
0466 #define LL_RTC_TS_TIME_FORMAT_AM           0x00000000U           /*!< AM or 24-hour format */
0467 #define LL_RTC_TS_TIME_FORMAT_PM           RTC_TSTR_PM           /*!< PM */
0468 /**
0469   * @}
0470   */
0471 
0472 #if defined(TAMP)
0473 /** @defgroup RTC_LL_EC_TAMPER  TAMPER
0474   * @ingroup RTEMSBSPsARMSTM32H7
0475   * @{
0476   */
0477 #define LL_RTC_TAMPER_1                    TAMP_CR1_TAMP1E /*!< Tamper 1 input detection */
0478 #define LL_RTC_TAMPER_2                    TAMP_CR1_TAMP2E /*!< Tamper 2 input detection */
0479 #define LL_RTC_TAMPER_3                    TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */
0480 /**
0481   * @}
0482   */
0483 
0484 /** @defgroup RTC_LL_EC_TAMPER_MASK  TAMPER MASK
0485   * @ingroup RTEMSBSPsARMSTM32H7
0486   * @{
0487   */
0488 #define LL_RTC_TAMPER_MASK_TAMPER1         TAMP_CR2_TAMP1MSK /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware. The backup registers are not erased */
0489 #define LL_RTC_TAMPER_MASK_TAMPER2         TAMP_CR2_TAMP2MSK /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
0490 #define LL_RTC_TAMPER_MASK_TAMPER3         TAMP_CR2_TAMP3MSK /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased. */
0491 /**
0492   * @}
0493   */
0494 
0495 /** @defgroup RTC_LL_EC_TAMPER_NOERASE  TAMPER NO ERASE
0496   * @ingroup RTEMSBSPsARMSTM32H7
0497   * @{
0498   */
0499 #define LL_RTC_TAMPER_NOERASE_TAMPER1      TAMP_CR2_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
0500 #define LL_RTC_TAMPER_NOERASE_TAMPER2      TAMP_CR2_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
0501 #define LL_RTC_TAMPER_NOERASE_TAMPER3      TAMP_CR2_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
0502 /**
0503   * @}
0504   */
0505 
0506 /** @defgroup RTC_LL_EC_TAMPER_DURATION  TAMPER DURATION
0507   * @ingroup RTEMSBSPsARMSTM32H7
0508   * @{
0509   */
0510 #define LL_RTC_TAMPER_DURATION_1RTCCLK     0x00000000U            /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle  */
0511 #define LL_RTC_TAMPER_DURATION_2RTCCLK     TAMP_FLTCR_TAMPPRCH_0  /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
0512 #define LL_RTC_TAMPER_DURATION_4RTCCLK     TAMP_FLTCR_TAMPPRCH_1  /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
0513 #define LL_RTC_TAMPER_DURATION_8RTCCLK     TAMP_FLTCR_TAMPPRCH    /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
0514 /**
0515   * @}
0516   */
0517 
0518 /** @defgroup RTC_LL_EC_TAMPER_FILTER  TAMPER FILTER
0519   * @ingroup RTEMSBSPsARMSTM32H7
0520   * @{
0521   */
0522 #define LL_RTC_TAMPER_FILTER_DISABLE       0x00000000U             /*!< Tamper filter is disabled */
0523 #define LL_RTC_TAMPER_FILTER_2SAMPLE       TAMP_FLTCR_TAMPFLT_0    /*!< Tamper is activated after 2 consecutive samples at the active level */
0524 #define LL_RTC_TAMPER_FILTER_4SAMPLE       TAMP_FLTCR_TAMPFLT_1    /*!< Tamper is activated after 4 consecutive samples at the active level */
0525 #define LL_RTC_TAMPER_FILTER_8SAMPLE       TAMP_FLTCR_TAMPFLT      /*!< Tamper is activated after 8 consecutive samples at the active level. */
0526 /**
0527   * @}
0528   */
0529 
0530 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV  TAMPER SAMPLING FREQUENCY DIVIDER
0531   * @ingroup RTEMSBSPsARMSTM32H7
0532   * @{
0533   */
0534 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768   0x00000000U                                     /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 32768 */
0535 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384   TAMP_FLTCR_TAMPFREQ_0                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 16384 */
0536 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192    TAMP_FLTCR_TAMPFREQ_1                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 8192 */
0537 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096    (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 4096 */
0538 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048    TAMP_FLTCR_TAMPFREQ_2                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 2048 */
0539 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024    (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 1024 */
0540 #define LL_RTC_TAMPER_SAMPLFREQDIV_512     (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 512 */
0541 #define LL_RTC_TAMPER_SAMPLFREQDIV_256     TAMP_FLTCR_TAMPFREQ                             /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 256 */
0542 /**
0543   * @}
0544   */
0545 
0546 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL  TAMPER ACTIVE LEVEL
0547   * @ingroup RTEMSBSPsARMSTM32H7
0548   * @{
0549   */
0550 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1    TAMP_CR2_TAMP1TRG /*!< Tamper 1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
0551 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2    TAMP_CR2_TAMP2TRG /*!< Tamper 2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
0552 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3    TAMP_CR2_TAMP3TRG /*!< Tamper 3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
0553 /**
0554   * @}
0555   */
0556 #else
0557 /** @defgroup RTC_LL_EC_TAMPER  TAMPER
0558   * @ingroup RTEMSBSPsARMSTM32H7
0559   * @{
0560   */
0561 #define LL_RTC_TAMPER_1                    RTC_TAMPCR_TAMP1E /*!< RTC_TAMP1 input detection */
0562 #define LL_RTC_TAMPER_2                    RTC_TAMPCR_TAMP2E /*!< RTC_TAMP2 input detection */
0563 #define LL_RTC_TAMPER_3                    RTC_TAMPCR_TAMP3E /*!< RTC_TAMP3 input detection */
0564 /**
0565   * @}
0566   */
0567 
0568 /** @defgroup RTC_LL_EC_TAMPER_MASK  TAMPER MASK
0569   * @ingroup RTEMSBSPsARMSTM32H7
0570   * @{
0571   */
0572 #define LL_RTC_TAMPER_MASK_TAMPER1         RTC_TAMPCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
0573 #define LL_RTC_TAMPER_MASK_TAMPER2         RTC_TAMPCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
0574 #define LL_RTC_TAMPER_MASK_TAMPER3         RTC_TAMPCR_TAMP3MF /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
0575 /**
0576   * @}
0577   */
0578 
0579 /** @defgroup RTC_LL_EC_TAMPER_NOERASE  TAMPER NO ERASE
0580   * @ingroup RTEMSBSPsARMSTM32H7
0581   * @{
0582   */
0583 #define LL_RTC_TAMPER_NOERASE_TAMPER1      RTC_TAMPCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
0584 #define LL_RTC_TAMPER_NOERASE_TAMPER2      RTC_TAMPCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
0585 #define LL_RTC_TAMPER_NOERASE_TAMPER3      RTC_TAMPCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
0586 /**
0587   * @}
0588   */
0589 
0590 /** @defgroup RTC_LL_EC_TAMPER_DURATION  TAMPER DURATION
0591   * @ingroup RTEMSBSPsARMSTM32H7
0592   * @{
0593   */
0594 #define LL_RTC_TAMPER_DURATION_1RTCCLK     0x00000000U                             /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle  */
0595 #define LL_RTC_TAMPER_DURATION_2RTCCLK     RTC_TAMPCR_TAMPPRCH_0  /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
0596 #define LL_RTC_TAMPER_DURATION_4RTCCLK     RTC_TAMPCR_TAMPPRCH_1  /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
0597 #define LL_RTC_TAMPER_DURATION_8RTCCLK     RTC_TAMPCR_TAMPPRCH    /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
0598 /**
0599   * @}
0600   */
0601 
0602 /** @defgroup RTC_LL_EC_TAMPER_FILTER  TAMPER FILTER
0603   * @ingroup RTEMSBSPsARMSTM32H7
0604   * @{
0605   */
0606 #define LL_RTC_TAMPER_FILTER_DISABLE       0x00000000U                              /*!< Tamper filter is disabled */
0607 #define LL_RTC_TAMPER_FILTER_2SAMPLE       RTC_TAMPCR_TAMPFLT_0    /*!< Tamper is activated after 2 consecutive samples at the active level */
0608 #define LL_RTC_TAMPER_FILTER_4SAMPLE       RTC_TAMPCR_TAMPFLT_1    /*!< Tamper is activated after 4 consecutive samples at the active level */
0609 #define LL_RTC_TAMPER_FILTER_8SAMPLE       RTC_TAMPCR_TAMPFLT      /*!< Tamper is activated after 8 consecutive samples at the active level. */
0610 /**
0611   * @}
0612   */
0613 
0614 /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV  TAMPER SAMPLING FREQUENCY DIVIDER
0615   * @ingroup RTEMSBSPsARMSTM32H7
0616   * @{
0617   */
0618 #define LL_RTC_TAMPER_SAMPLFREQDIV_32768   0x00000000U                                                      /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 32768 */
0619 #define LL_RTC_TAMPER_SAMPLFREQDIV_16384   RTC_TAMPCR_TAMPFREQ_0                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 16384 */
0620 #define LL_RTC_TAMPER_SAMPLFREQDIV_8192    RTC_TAMPCR_TAMPFREQ_1                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 8192 */
0621 #define LL_RTC_TAMPER_SAMPLFREQDIV_4096    (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 4096 */
0622 #define LL_RTC_TAMPER_SAMPLFREQDIV_2048    RTC_TAMPCR_TAMPFREQ_2                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 2048 */
0623 #define LL_RTC_TAMPER_SAMPLFREQDIV_1024    (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 1024 */
0624 #define LL_RTC_TAMPER_SAMPLFREQDIV_512     (RTC_TAMPCR_TAMPFREQ_2 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 512 */
0625 #define LL_RTC_TAMPER_SAMPLFREQDIV_256     RTC_TAMPCR_TAMPFREQ                             /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 256 */
0626 /**
0627   * @}
0628   */
0629 
0630 /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL  TAMPER ACTIVE LEVEL
0631   * @ingroup RTEMSBSPsARMSTM32H7
0632   * @{
0633   */
0634 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1    RTC_TAMPCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
0635 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2    RTC_TAMPCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
0636 #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3    RTC_TAMPCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
0637 /**
0638   * @}
0639   */
0640 #endif /* TAMP */
0641 
0642 #if defined(TAMP)
0643 /** @defgroup RTC_LL_EC_ACTIVE_MODE   ACTIVE TAMPER MODE
0644   * @ingroup RTEMSBSPsARMSTM32H7
0645   * @{
0646   */
0647 #define LL_RTC_TAMPER_ATAMP_TAMP1AM               TAMP_ATCR1_TAMP1AM /*!< tamper 1 is active */
0648 #define LL_RTC_TAMPER_ATAMP_TAMP2AM               TAMP_ATCR1_TAMP2AM /*!< tamper 2 is active */
0649 #define LL_RTC_TAMPER_ATAMP_TAMP3AM               TAMP_ATCR1_TAMP3AM /*!< tamper 3 is active */
0650 /**
0651   * @}
0652   */
0653 
0654 /** @defgroup RTC_LL_EC_ACTIVE_ASYNC_PRESCALER   ACTIVE TAMPER ASYNCHRONOUS PRESCALER CLOCK
0655   * @ingroup RTEMSBSPsARMSTM32H7
0656   * @{
0657   */
0658 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK      0U                                                                      /*!< RTCCLK */
0659 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_2    TAMP_ATCR1_ATCKSEL_0                                                    /*!< RTCCLK/2 */
0660 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_4    TAMP_ATCR1_ATCKSEL_1                                                    /*!< RTCCLK/4 */
0661 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_8    (TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0)                           /*!< RTCCLK/8 */
0662 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_16   TAMP_ATCR1_ATCKSEL_2                                                    /*!< RTCCLK/16 */
0663 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_32   (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0)                           /*!< RTCCLK/32 */
0664 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_64   (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1)                           /*!< RTCCLK/64 */
0665 #define LL_RTC_TAMPER_ATAMP_ASYNCPRES_RTCCLK_128  (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0)    /*!< RTCCLK/128 */
0666 /**
0667   * @}
0668   */
0669 
0670 /** @defgroup RTC_LL_EC_ACTIVE_OUTPUT_SELECTION   ACTIVE TAMPER OUTPUT SELECTION
0671   * @ingroup RTEMSBSPsARMSTM32H7
0672   * @{
0673   */
0674 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP1OUT  (0UL << TAMP_ATCR2_ATOSEL1_Pos)
0675 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP2OUT  (1UL << TAMP_ATCR2_ATOSEL1_Pos)
0676 #define LL_RTC_TAMPER_ATAMP1IN_ATAMP3OUT  (2UL << TAMP_ATCR2_ATOSEL1_Pos)
0677 
0678 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP1OUT  (0UL << TAMP_ATCR2_ATOSEL2_Pos)
0679 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP2OUT  (1UL << TAMP_ATCR2_ATOSEL2_Pos)
0680 #define LL_RTC_TAMPER_ATAMP2IN_ATAMP3OUT  (2UL << TAMP_ATCR2_ATOSEL2_Pos)
0681 
0682 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP1OUT  (0UL << TAMP_ATCR2_ATOSEL3_Pos)
0683 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP2OUT  (1UL << TAMP_ATCR2_ATOSEL3_Pos)
0684 #define LL_RTC_TAMPER_ATAMP3IN_ATAMP3OUT  (2UL << TAMP_ATCR2_ATOSEL3_Pos)
0685 /**
0686   * @}
0687   */
0688 #endif /* TAMP */
0689 
0690 /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV  WAKEUP CLOCK DIV
0691   * @ingroup RTEMSBSPsARMSTM32H7
0692   * @{
0693   */
0694 #define LL_RTC_WAKEUPCLOCK_DIV_16          0x00000000U                           /*!< RTC/16 clock is selected */
0695 #define LL_RTC_WAKEUPCLOCK_DIV_8           RTC_CR_WUCKSEL_0                      /*!< RTC/8 clock is selected */
0696 #define LL_RTC_WAKEUPCLOCK_DIV_4           RTC_CR_WUCKSEL_1                      /*!< RTC/4 clock is selected */
0697 #define LL_RTC_WAKEUPCLOCK_DIV_2           (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
0698 #define LL_RTC_WAKEUPCLOCK_CKSPRE          RTC_CR_WUCKSEL_2                      /*!< ck_spre (usually 1 Hz) clock is selected */
0699 #define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT      (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/
0700 /**
0701   * @}
0702   */
0703 
0704 /** @defgroup RTC_LL_EC_BKP  BACKUP
0705   * @ingroup RTEMSBSPsARMSTM32H7
0706   * @{
0707   */
0708 #define LL_RTC_BKP_DR0                     0x00000000U
0709 #define LL_RTC_BKP_DR1                     0x00000001U
0710 #define LL_RTC_BKP_DR2                     0x00000002U
0711 #define LL_RTC_BKP_DR3                     0x00000003U
0712 #define LL_RTC_BKP_DR4                     0x00000004U
0713 #define LL_RTC_BKP_DR5                     0x00000005U
0714 #define LL_RTC_BKP_DR6                     0x00000006U
0715 #define LL_RTC_BKP_DR7                     0x00000007U
0716 #define LL_RTC_BKP_DR8                     0x00000008U
0717 #define LL_RTC_BKP_DR9                     0x00000009U
0718 #define LL_RTC_BKP_DR10                    0x0000000AU
0719 #define LL_RTC_BKP_DR11                    0x0000000BU
0720 #define LL_RTC_BKP_DR12                    0x0000000CU
0721 #define LL_RTC_BKP_DR13                    0x0000000DU
0722 #define LL_RTC_BKP_DR14                    0x0000000EU
0723 #define LL_RTC_BKP_DR15                    0x0000000FU
0724 #define LL_RTC_BKP_DR16                    0x00000010U
0725 #define LL_RTC_BKP_DR17                    0x00000011U
0726 #define LL_RTC_BKP_DR18                    0x00000012U
0727 #define LL_RTC_BKP_DR19                    0x00000013U
0728 #define LL_RTC_BKP_DR20                    0x00000014U
0729 #define LL_RTC_BKP_DR21                    0x00000015U
0730 #define LL_RTC_BKP_DR22                    0x00000016U
0731 #define LL_RTC_BKP_DR23                    0x00000017U
0732 #define LL_RTC_BKP_DR24                    0x00000018U
0733 #define LL_RTC_BKP_DR25                    0x00000019U
0734 #define LL_RTC_BKP_DR26                    0x0000001AU
0735 #define LL_RTC_BKP_DR27                    0x0000001BU
0736 #define LL_RTC_BKP_DR28                    0x0000001CU
0737 #define LL_RTC_BKP_DR29                    0x0000001DU
0738 #define LL_RTC_BKP_DR30                    0x0000001EU
0739 #define LL_RTC_BKP_DR31                    0x0000001FU
0740 /**
0741   * @}
0742   */
0743 
0744 /** @defgroup RTC_LL_EC_CALIB_OUTPUT  Calibration output
0745   * @ingroup RTEMSBSPsARMSTM32H7
0746   * @{
0747   */
0748 #define LL_RTC_CALIB_OUTPUT_NONE           0x00000000U                 /*!< Calibration output disabled */
0749 #define LL_RTC_CALIB_OUTPUT_1HZ            (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
0750 #define LL_RTC_CALIB_OUTPUT_512HZ           RTC_CR_COE                 /*!< Calibration output is 512 Hz */
0751 /**
0752   * @}
0753   */
0754 
0755 /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE  Calibration pulse insertion
0756   * @ingroup RTEMSBSPsARMSTM32H7
0757   * @{
0758   */
0759 #define LL_RTC_CALIB_INSERTPULSE_NONE      0x00000000U           /*!< No RTCCLK pulses are added */
0760 #define LL_RTC_CALIB_INSERTPULSE_SET       RTC_CALR_CALP         /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
0761 /**
0762   * @}
0763   */
0764 
0765 /** @defgroup RTC_LL_EC_CALIB_PERIOD  Calibration period
0766   * @ingroup RTEMSBSPsARMSTM32H7
0767   * @{
0768   */
0769 #define LL_RTC_CALIB_PERIOD_32SEC          0x00000000U           /*!< Use a 32-second calibration cycle period */
0770 #define LL_RTC_CALIB_PERIOD_16SEC          RTC_CALR_CALW16       /*!< Use a 16-second calibration cycle period */
0771 #define LL_RTC_CALIB_PERIOD_8SEC           RTC_CALR_CALW8        /*!< Use a 8-second calibration cycle period */
0772 /**
0773   * @}
0774   */
0775 
0776 /**
0777   * @}
0778   */
0779 
0780 /* Exported macro ------------------------------------------------------------*/
0781 /** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
0782   * @ingroup RTEMSBSPsARMSTM32H7
0783   * @{
0784   */
0785 
0786 /** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
0787   * @ingroup RTEMSBSPsARMSTM32H7
0788   * @{
0789   */
0790 
0791 /**
0792   * @brief  Write a value in RTC register
0793   * @param  __INSTANCE__ RTC Instance
0794   * @param  __REG__ Register to be written
0795   * @param  __VALUE__ Value to be written in the register
0796   * @retval None
0797   */
0798 #define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, __VALUE__)
0799 
0800 /**
0801   * @brief  Read a value in RTC register
0802   * @param  __INSTANCE__ RTC Instance
0803   * @param  __REG__ Register to be read
0804   * @retval Register value
0805   */
0806 #define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
0807 /**
0808   * @}
0809   */
0810 
0811 /** @defgroup RTC_LL_EM_Convert Convert helper Macros
0812   * @ingroup RTEMSBSPsARMSTM32H7
0813   * @{
0814   */
0815 
0816 /**
0817   * @brief  Helper macro to convert a value from 2 digit decimal format to BCD format
0818   * @param  __VALUE__ Byte to be converted
0819   * @retval Converted byte
0820   */
0821 #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
0822 
0823 /**
0824   * @brief  Helper macro to convert a value from BCD format to 2 digit decimal format
0825   * @param  __VALUE__ BCD value to be converted
0826   * @retval Converted byte
0827   */
0828 #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) ((uint8_t)((((uint8_t)((__VALUE__) & (uint8_t)0xF0) >> (uint8_t)0x4) * 10U) + ((__VALUE__) & (uint8_t)0x0F)))
0829 
0830 /**
0831   * @}
0832   */
0833 
0834 /** @defgroup RTC_LL_EM_Date Date helper Macros
0835   * @ingroup RTEMSBSPsARMSTM32H7
0836   * @{
0837   */
0838 
0839 /**
0840   * @brief  Helper macro to retrieve weekday.
0841   * @param  __RTC_DATE__ Date returned by @ref  LL_RTC_DATE_Get function.
0842   * @retval Returned value can be one of the following values:
0843   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
0844   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
0845   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
0846   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
0847   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
0848   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
0849   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
0850   */
0851 #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
0852 
0853 /**
0854   * @brief  Helper macro to retrieve Year in BCD format
0855   * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
0856   * @retval Year in BCD format (0x00 . . . 0x99)
0857   */
0858 #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
0859 
0860 /**
0861   * @brief  Helper macro to retrieve Month in BCD format
0862   * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
0863   * @retval Returned value can be one of the following values:
0864   *         @arg @ref LL_RTC_MONTH_JANUARY
0865   *         @arg @ref LL_RTC_MONTH_FEBRUARY
0866   *         @arg @ref LL_RTC_MONTH_MARCH
0867   *         @arg @ref LL_RTC_MONTH_APRIL
0868   *         @arg @ref LL_RTC_MONTH_MAY
0869   *         @arg @ref LL_RTC_MONTH_JUNE
0870   *         @arg @ref LL_RTC_MONTH_JULY
0871   *         @arg @ref LL_RTC_MONTH_AUGUST
0872   *         @arg @ref LL_RTC_MONTH_SEPTEMBER
0873   *         @arg @ref LL_RTC_MONTH_OCTOBER
0874   *         @arg @ref LL_RTC_MONTH_NOVEMBER
0875   *         @arg @ref LL_RTC_MONTH_DECEMBER
0876   */
0877 #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
0878 
0879 /**
0880   * @brief  Helper macro to retrieve Day in BCD format
0881   * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
0882   * @retval Day in BCD format (0x01 . . . 0x31)
0883   */
0884 #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
0885 
0886 /**
0887   * @}
0888   */
0889 
0890 /** @defgroup RTC_LL_EM_Time Time helper Macros
0891   * @ingroup RTEMSBSPsARMSTM32H7
0892   * @{
0893   */
0894 
0895 /**
0896   * @brief  Helper macro to retrieve hour in BCD format
0897   * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
0898   * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
0899   */
0900 #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
0901 
0902 /**
0903   * @brief  Helper macro to retrieve minute in BCD format
0904   * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
0905   * @retval Minutes in BCD format (0x00. . .0x59)
0906   */
0907 #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
0908 
0909 /**
0910   * @brief  Helper macro to retrieve second in BCD format
0911   * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
0912   * @retval Seconds in  format (0x00. . .0x59)
0913   */
0914 #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
0915 
0916 /**
0917   * @}
0918   */
0919 
0920 /**
0921   * @}
0922   */
0923 
0924 /* Exported functions --------------------------------------------------------*/
0925 /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
0926   * @ingroup RTEMSBSPsARMSTM32H7
0927   * @{
0928   */
0929 
0930 /** @defgroup RTC_LL_EF_Configuration Configuration
0931   * @ingroup RTEMSBSPsARMSTM32H7
0932   * @{
0933   */
0934 
0935 /**
0936   * @brief  Set Hours format (24 hour/day or AM/PM hour format)
0937   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
0938   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
0939   * @rmtoll RTC_CR           FMT           LL_RTC_SetHourFormat
0940   * @param  RTCx RTC Instance
0941   * @param  HourFormat This parameter can be one of the following values:
0942   *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
0943   *         @arg @ref LL_RTC_HOURFORMAT_AMPM
0944   * @retval None
0945   */
0946 __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
0947 {
0948   MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
0949 }
0950 
0951 /**
0952   * @brief  Get Hours format (24 hour/day or AM/PM hour format)
0953   * @rmtoll RTC_CR           FMT           LL_RTC_GetHourFormat
0954   * @param  RTCx RTC Instance
0955   * @retval Returned value can be one of the following values:
0956   *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
0957   *         @arg @ref LL_RTC_HOURFORMAT_AMPM
0958   */
0959 __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
0960 {
0961   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
0962 }
0963 
0964 /**
0965   * @brief  Select the flag to be routed to RTC_ALARM output
0966   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
0967   * @rmtoll RTC_CR           OSEL          LL_RTC_SetAlarmOutEvent
0968   * @param  RTCx RTC Instance
0969   * @param  AlarmOutput This parameter can be one of the following values:
0970   *         @arg @ref LL_RTC_ALARMOUT_DISABLE
0971   *         @arg @ref LL_RTC_ALARMOUT_ALMA
0972   *         @arg @ref LL_RTC_ALARMOUT_ALMB
0973   *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
0974   * @retval None
0975   */
0976 __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
0977 {
0978   MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
0979 }
0980 
0981 /**
0982   * @brief  Get the flag to be routed to RTC_ALARM output
0983   * @rmtoll RTC_CR           OSEL          LL_RTC_GetAlarmOutEvent
0984   * @param  RTCx RTC Instance
0985   * @retval Returned value can be one of the following values:
0986   *         @arg @ref LL_RTC_ALARMOUT_DISABLE
0987   *         @arg @ref LL_RTC_ALARMOUT_ALMA
0988   *         @arg @ref LL_RTC_ALARMOUT_ALMB
0989   *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
0990   */
0991 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
0992 {
0993   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
0994 }
0995 
0996 #if defined(TAMP)
0997 /**
0998   * @brief  Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
0999   * @rmtoll RTC_CR           TAMPALRM_TYPE          LL_RTC_SetAlarmOutputType
1000   * @param  RTCx RTC Instance
1001   * @param  Output This parameter can be one of the following values:
1002   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1003   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1004   * @retval None
1005   */
1006 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
1007 {
1008   MODIFY_REG(RTCx->CR, RTC_CR_TAMPALRM_TYPE, Output);
1009 }
1010 
1011 /**
1012   * @brief  Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
1013   * @rmtoll RTC_CR           TAMPALRM_TYPE          LL_RTC_SetAlarmOutputType
1014   * @param  RTCx RTC Instance
1015   * @retval Returned value can be one of the following values:
1016   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1017   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1018   */
1019 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
1020 {
1021   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_TYPE));
1022 }
1023 #else
1024 /**
1025   * @brief  Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
1026   * @note   Used only when RTC_ALARM is mapped on PC13
1027   * @rmtoll OR        ALARMOUTTYPE  LL_RTC_SetAlarmOutputType
1028   * @param  RTCx RTC Instance
1029   * @param  Output This parameter can be one of the following values:
1030   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1031   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1032   * @retval None
1033   */
1034 __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
1035 {
1036   MODIFY_REG(RTCx->OR, RTC_OR_ALARMOUTTYPE, Output);
1037 }
1038 
1039 /**
1040   * @brief  Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
1041   * @note   used only when RTC_ALARM is mapped on PC13
1042   * @rmtoll OR        ALARMOUTTYPE  LL_RTC_GetAlarmOutputType
1043   * @param  RTCx RTC Instance
1044   * @retval Returned value can be one of the following values:
1045   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
1046   *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
1047   */
1048 __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
1049 {
1050   return (uint32_t)(READ_BIT(RTCx->OR, RTC_OR_ALARMOUTTYPE));
1051 }
1052 #endif /* TAMP */
1053 
1054 #if defined(TAMP)
1055 /**
1056   * @brief  Enable initialization mode
1057   * @note   Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
1058   *         and prescaler register (RTC_PRER).
1059   *         Counters are stopped and start counting from the new value when INIT is reset.
1060   * @rmtoll RTC_ICSR          INIT          LL_RTC_EnableInitMode
1061   * @param  RTCx RTC Instance
1062   * @retval None
1063   */
1064 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
1065 {
1066   /* Set the Initialization mode */
1067   WRITE_REG(RTCx->ICSR, RTC_LL_INIT_MASK);
1068 }
1069 
1070 /**
1071   * @brief  Disable initialization mode (Free running mode)
1072   * @rmtoll RTC_ICSR          INIT          LL_RTC_DisableInitMode
1073   * @param  RTCx RTC Instance
1074   * @retval None
1075   */
1076 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
1077 {
1078   /* Exit Initialization mode */
1079   WRITE_REG(RTCx->ICSR, (uint32_t)~RTC_ICSR_INIT);
1080 }
1081 
1082 #else
1083 /**
1084   * @brief  Enable initialization mode
1085   * @note   Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
1086   *         and prescaler register (RTC_PRER).
1087   *         Counters are stopped and start counting from the new value when INIT is reset.
1088   * @rmtoll ISR          INIT          LL_RTC_EnableInitMode
1089   * @param  RTCx RTC Instance
1090   * @retval None
1091   */
1092 __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
1093 {
1094   /* Set the Initialization mode */
1095   WRITE_REG(RTCx->ISR, RTC_LL_INIT_MASK);
1096 }
1097 
1098 /**
1099   * @brief  Disable initialization mode (Free running mode)
1100   * @rmtoll ISR          INIT          LL_RTC_DisableInitMode
1101   * @param  RTCx RTC Instance
1102   * @retval None
1103   */
1104 __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
1105 {
1106   /* Exit Initialization mode */
1107   WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
1108 }
1109 #endif /* TAMP */
1110 
1111 /**
1112   * @brief  Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
1113   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1114   * @rmtoll RTC_CR           POL           LL_RTC_SetOutputPolarity
1115   * @param  RTCx RTC Instance
1116   * @param  Polarity This parameter can be one of the following values:
1117   *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
1118   *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
1119   * @retval None
1120   */
1121 __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
1122 {
1123   MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
1124 }
1125 
1126 /**
1127   * @brief  Get Output polarity
1128   * @rmtoll RTC_CR           POL           LL_RTC_GetOutputPolarity
1129   * @param  RTCx RTC Instance
1130   * @retval Returned value can be one of the following values:
1131   *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
1132   *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
1133   */
1134 __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
1135 {
1136   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
1137 }
1138 
1139 /**
1140   * @brief  Enable Bypass the shadow registers
1141   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1142   * @rmtoll RTC_CR           BYPSHAD       LL_RTC_EnableShadowRegBypass
1143   * @param  RTCx RTC Instance
1144   * @retval None
1145   */
1146 __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
1147 {
1148   SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1149 }
1150 
1151 /**
1152   * @brief  Disable Bypass the shadow registers
1153   * @rmtoll RTC_CR           BYPSHAD       LL_RTC_DisableShadowRegBypass
1154   * @param  RTCx RTC Instance
1155   * @retval None
1156   */
1157 __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
1158 {
1159   CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
1160 }
1161 
1162 /**
1163   * @brief  Check if Shadow registers bypass is enabled or not.
1164   * @rmtoll RTC_CR           BYPSHAD       LL_RTC_IsShadowRegBypassEnabled
1165   * @param  RTCx RTC Instance
1166   * @retval State of bit (1 or 0).
1167   */
1168 __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
1169 {
1170   return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1UL : 0UL);
1171 }
1172 
1173 /**
1174   * @brief  Enable RTC_REFIN reference clock detection (50 or 60 Hz)
1175   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1176   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1177   * @rmtoll RTC_CR           REFCKON       LL_RTC_EnableRefClock
1178   * @param  RTCx RTC Instance
1179   * @retval None
1180   */
1181 __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
1182 {
1183   SET_BIT(RTCx->CR, RTC_CR_REFCKON);
1184 }
1185 
1186 /**
1187   * @brief  Disable RTC_REFIN reference clock detection (50 or 60 Hz)
1188   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1189   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1190   * @rmtoll RTC_CR           REFCKON       LL_RTC_DisableRefClock
1191   * @param  RTCx RTC Instance
1192   * @retval None
1193   */
1194 __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
1195 {
1196   CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
1197 }
1198 
1199 /**
1200   * @brief  Set Asynchronous prescaler factor
1201   * @rmtoll RTC_PRER         PREDIV_A      LL_RTC_SetAsynchPrescaler
1202   * @param  RTCx RTC Instance
1203   * @param  AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
1204   * @retval None
1205   */
1206 __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
1207 {
1208   MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
1209 }
1210 
1211 /**
1212   * @brief  Set Synchronous prescaler factor
1213   * @rmtoll RTC_PRER         PREDIV_S      LL_RTC_SetSynchPrescaler
1214   * @param  RTCx RTC Instance
1215   * @param  SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
1216   * @retval None
1217   */
1218 __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
1219 {
1220   MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
1221 }
1222 
1223 /**
1224   * @brief  Get Asynchronous prescaler factor
1225   * @rmtoll RTC_PRER         PREDIV_A      LL_RTC_GetAsynchPrescaler
1226   * @param  RTCx RTC Instance
1227   * @retval Value between Min_Data = 0 and Max_Data = 0x7F
1228   */
1229 __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
1230 {
1231   return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
1232 }
1233 
1234 /**
1235   * @brief  Get Synchronous prescaler factor
1236   * @rmtoll RTC_PRER         PREDIV_S      LL_RTC_GetSynchPrescaler
1237   * @param  RTCx RTC Instance
1238   * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
1239   */
1240 __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
1241 {
1242   return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
1243 }
1244 
1245 /**
1246   * @brief  Enable the write protection for RTC registers.
1247   * @rmtoll RTC_WPR          KEY           LL_RTC_EnableWriteProtection
1248   * @param  RTCx RTC Instance
1249   * @retval None
1250   */
1251 __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
1252 {
1253   WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
1254 }
1255 
1256 /**
1257   * @brief  Disable the write protection for RTC registers.
1258   * @rmtoll RTC_WPR          KEY           LL_RTC_DisableWriteProtection
1259   * @param  RTCx RTC Instance
1260   * @retval None
1261   */
1262 __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1263 {
1264   WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1265   WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1266 }
1267 
1268 #if defined(TAMP)
1269 /**
1270   * @brief  Enable tamper output.
1271   * @note When the tamper output is enabled, all external and internal tamper flags
1272   *       are ORed and routed to the TAMPALRM output.
1273   * @rmtoll RTC_CR           TAMPOE       LL_RTC_EnableTamperOutput
1274   * @param  RTCx RTC Instance
1275   * @retval None
1276   */
1277 __STATIC_INLINE void LL_RTC_EnableTamperOutput(RTC_TypeDef *RTCx)
1278 {
1279   SET_BIT(RTCx->CR, RTC_CR_TAMPOE);
1280 }
1281 
1282 /**
1283   * @brief  Disable tamper output.
1284   * @rmtoll RTC_CR           TAMPOE       LL_RTC_DisableTamperOutput
1285   * @param  RTCx RTC Instance
1286   * @retval None
1287   */
1288 __STATIC_INLINE void LL_RTC_DisableTamperOutput(RTC_TypeDef *RTCx)
1289 {
1290   CLEAR_BIT(RTCx->CR, RTC_CR_TAMPOE);
1291 }
1292 
1293 /**
1294   * @brief  Check if tamper output is enabled or not.
1295   * @rmtoll RTC_CR           TAMPOE       LL_RTC_IsTamperOutputEnabled
1296   * @param  RTCx RTC Instance
1297   * @retval State of bit (1 or 0).
1298   */
1299 __STATIC_INLINE uint32_t LL_RTC_IsTamperOutputEnabled(RTC_TypeDef *RTCx)
1300 {
1301   return ((READ_BIT(RTCx->CR, RTC_CR_TAMPOE) == (RTC_CR_TAMPOE)) ? 1UL : 0UL);
1302 }
1303 
1304 /**
1305   * @brief  Enable internal pull-up in output mode.
1306   * @rmtoll RTC_CR           TAMPALRM_PU       LL_RTC_EnableAlarmPullUp
1307   * @param  RTCx RTC Instance
1308   * @retval None
1309   */
1310 __STATIC_INLINE void LL_RTC_EnableAlarmPullUp(RTC_TypeDef *RTCx)
1311 {
1312   SET_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
1313 }
1314 
1315 /**
1316   * @brief  Disable internal pull-up in output mode.
1317   * @rmtoll RTC_CR           TAMPALRM_PU       LL_RTC_EnableAlarmPullUp
1318   * @param  RTCx RTC Instance
1319   * @retval None
1320   */
1321 __STATIC_INLINE void LL_RTC_DisableAlarmPullUp(RTC_TypeDef *RTCx)
1322 {
1323   CLEAR_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
1324 }
1325 
1326 /**
1327   * @brief  Check if internal pull-up in output mode is enabled or not.
1328   * @rmtoll RTC_CR           TAMPALRM_PU       LL_RTC_IsAlarmPullUpEnabled
1329   * @param  RTCx RTC Instance
1330   * @retval State of bit (1 or 0).
1331   */
1332 __STATIC_INLINE uint32_t LL_RTC_IsAlarmPullUpEnabled(RTC_TypeDef *RTCx)
1333 {
1334   return ((READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU) == (RTC_CR_TAMPALRM_PU)) ? 1UL : 0UL);
1335 }
1336 
1337 /**
1338   * @brief  Enable RTC_OUT2 output
1339   * @note RTC_OUT2 mapping depends on both OSEL (@ref LL_RTC_SetAlarmOutEvent)
1340   *       and COE (@ref LL_RTC_CAL_SetOutputFreq) settings.
1341   * @note RTC_OUT2 isn't available ins VBAT mode.
1342   * @rmtoll RTC_CR           OUT2EN       LL_RTC_EnableOutput2
1343   * @param  RTCx RTC Instance
1344   * @retval None
1345   */
1346 __STATIC_INLINE void LL_RTC_EnableOutput2(RTC_TypeDef *RTCx)
1347 {
1348   SET_BIT(RTCx->CR, RTC_CR_OUT2EN);
1349 }
1350 
1351 /**
1352   * @brief  Disable RTC_OUT2 output
1353   * @rmtoll RTC_CR           OUT2EN       LL_RTC_DisableOutput2
1354   * @param  RTCx RTC Instance
1355   * @retval None
1356   */
1357 __STATIC_INLINE void LL_RTC_DisableOutput2(RTC_TypeDef *RTCx)
1358 {
1359   CLEAR_BIT(RTCx->CR, RTC_CR_OUT2EN);
1360 }
1361 
1362 /**
1363   * @brief  Check if RTC_OUT2 output is enabled or not.
1364   * @rmtoll RTC_CR           OUT2EN       LL_RTC_IsOutput2Enabled
1365   * @param  RTCx RTC Instance
1366   * @retval State of bit (1 or 0).
1367   */
1368 __STATIC_INLINE uint32_t LL_RTC_IsOutput2Enabled(RTC_TypeDef *RTCx)
1369 {
1370   return ((READ_BIT(RTCx->CR, RTC_CR_OUT2EN) == (RTC_CR_OUT2EN)) ? 1UL : 0UL);
1371 }
1372 #else
1373 /**
1374   * @brief  Enable RTC_OUT remap
1375   * @rmtoll OR           OUT_RMP       LL_RTC_EnableOutRemap
1376   * @param  RTCx RTC Instance
1377   * @retval None
1378   */
1379 __STATIC_INLINE void LL_RTC_EnableOutRemap(RTC_TypeDef *RTCx)
1380 {
1381   SET_BIT(RTCx->OR, RTC_OR_OUT_RMP);
1382 }
1383 
1384 /**
1385   * @brief  Disable RTC_OUT remap
1386   * @rmtoll OR           OUT_RMP       LL_RTC_DisableOutRemap
1387   * @param  RTCx RTC Instance
1388   * @retval None
1389   */
1390 __STATIC_INLINE void LL_RTC_DisableOutRemap(RTC_TypeDef *RTCx)
1391 {
1392   CLEAR_BIT(RTCx->OR, RTC_OR_OUT_RMP);
1393 }
1394 #endif /* TAMP */
1395 
1396 /**
1397   * @}
1398   */
1399 
1400 /** @defgroup RTC_LL_EF_Time Time
1401   * @ingroup RTEMSBSPsARMSTM32H7
1402   * @{
1403   */
1404 
1405 /**
1406   * @brief  Set time format (AM/24-hour or PM notation)
1407   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1408   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1409   * @rmtoll RTC_TR           PM            LL_RTC_TIME_SetFormat
1410   * @param  RTCx RTC Instance
1411   * @param  TimeFormat This parameter can be one of the following values:
1412   *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1413   *         @arg @ref LL_RTC_TIME_FORMAT_PM
1414   * @retval None
1415   */
1416 __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1417 {
1418   MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1419 }
1420 
1421 /**
1422   * @brief  Get time format (AM or PM notation)
1423   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1424   *       before reading this bit
1425   * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1426   *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1427   * @rmtoll RTC_TR           PM            LL_RTC_TIME_GetFormat
1428   * @param  RTCx RTC Instance
1429   * @retval Returned value can be one of the following values:
1430   *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1431   *         @arg @ref LL_RTC_TIME_FORMAT_PM
1432   */
1433 __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
1434 {
1435   return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1436 }
1437 
1438 /**
1439   * @brief  Set Hours in BCD format
1440   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1441   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1442   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1443   * @rmtoll RTC_TR           HT            LL_RTC_TIME_SetHour
1444   *         RTC_TR           HU            LL_RTC_TIME_SetHour
1445   * @param  RTCx RTC Instance
1446   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1447   * @retval None
1448   */
1449 __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1450 {
1451   MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1452              (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1453 }
1454 
1455 /**
1456   * @brief  Get Hours in BCD format
1457   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1458   *       before reading this bit
1459   * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1460   *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1461   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1462   *       Binary format
1463   * @rmtoll RTC_TR           HT            LL_RTC_TIME_GetHour
1464   *         RTC_TR           HU            LL_RTC_TIME_GetHour
1465   * @param  RTCx RTC Instance
1466   * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1467   */
1468 __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
1469 {
1470   return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
1471 }
1472 
1473 /**
1474   * @brief  Set Minutes in BCD format
1475   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1476   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1477   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1478   * @rmtoll RTC_TR           MNT           LL_RTC_TIME_SetMinute
1479   *         RTC_TR           MNU           LL_RTC_TIME_SetMinute
1480   * @param  RTCx RTC Instance
1481   * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1482   * @retval None
1483   */
1484 __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1485 {
1486   MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1487              (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1488 }
1489 
1490 /**
1491   * @brief  Get Minutes in BCD format
1492   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1493   *       before reading this bit
1494   * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1495   *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1496   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1497   *       to Binary format
1498   * @rmtoll RTC_TR           MNT           LL_RTC_TIME_GetMinute
1499   *         RTC_TR           MNU           LL_RTC_TIME_GetMinute
1500   * @param  RTCx RTC Instance
1501   * @retval Value between Min_Data=0x00 and Max_Data=0x59
1502   */
1503 __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
1504 {
1505   return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
1506 }
1507 
1508 /**
1509   * @brief  Set Seconds in BCD format
1510   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1511   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1512   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1513   * @rmtoll RTC_TR           ST            LL_RTC_TIME_SetSecond
1514   *         RTC_TR           SU            LL_RTC_TIME_SetSecond
1515   * @param  RTCx RTC Instance
1516   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1517   * @retval None
1518   */
1519 __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1520 {
1521   MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1522              (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1523 }
1524 
1525 /**
1526   * @brief  Get Seconds in BCD format
1527   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1528   *       before reading this bit
1529   * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1530   *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1531   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1532   *       to Binary format
1533   * @rmtoll RTC_TR           ST            LL_RTC_TIME_GetSecond
1534   *         RTC_TR           SU            LL_RTC_TIME_GetSecond
1535   * @param  RTCx RTC Instance
1536   * @retval Value between Min_Data=0x00 and Max_Data=0x59
1537   */
1538 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
1539 {
1540   return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
1541 }
1542 
1543 /**
1544   * @brief  Set time (hour, minute and second) in BCD format
1545   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1546   * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1547   * @note TimeFormat and Hours should follow the same format
1548   * @rmtoll RTC_TR           PM            LL_RTC_TIME_Config
1549   *         RTC_TR           HT            LL_RTC_TIME_Config
1550   *         RTC_TR           HU            LL_RTC_TIME_Config
1551   *         RTC_TR           MNT           LL_RTC_TIME_Config
1552   *         RTC_TR           MNU           LL_RTC_TIME_Config
1553   *         RTC_TR           ST            LL_RTC_TIME_Config
1554   *         RTC_TR           SU            LL_RTC_TIME_Config
1555   * @param  RTCx RTC Instance
1556   * @param  Format12_24 This parameter can be one of the following values:
1557   *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1558   *         @arg @ref LL_RTC_TIME_FORMAT_PM
1559   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1560   * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1561   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1562   * @retval None
1563   */
1564 __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1565 {
1566   uint32_t temp;
1567 
1568   temp = Format12_24                                                                                    | \
1569          (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))     | \
1570          (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1571          (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1572   MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp);
1573 }
1574 
1575 /**
1576   * @brief  Get time (hour, minute and second) in BCD format
1577   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1578   *       before reading this bit
1579   * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1580   *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1581   * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1582   *       are available to get independently each parameter.
1583   * @rmtoll RTC_TR           HT            LL_RTC_TIME_Get
1584   *         RTC_TR           HU            LL_RTC_TIME_Get
1585   *         RTC_TR           MNT           LL_RTC_TIME_Get
1586   *         RTC_TR           MNU           LL_RTC_TIME_Get
1587   *         RTC_TR           ST            LL_RTC_TIME_Get
1588   *         RTC_TR           SU            LL_RTC_TIME_Get
1589   * @param  RTCx RTC Instance
1590   * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1591   */
1592 __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
1593 {
1594   uint32_t temp;
1595 
1596   temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU));
1597   return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR)       |  \
1598                     (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \
1599                     ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)));
1600 }
1601 
1602 /**
1603   * @brief  Memorize whether the daylight saving time change has been performed
1604   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1605   * @rmtoll RTC_CR           BKP           LL_RTC_TIME_EnableDayLightStore
1606   * @param  RTCx RTC Instance
1607   * @retval None
1608   */
1609 __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1610 {
1611   SET_BIT(RTCx->CR, RTC_CR_BKP);
1612 }
1613 
1614 /**
1615   * @brief  Disable memorization whether the daylight saving time change has been performed.
1616   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1617   * @rmtoll RTC_CR           BKP           LL_RTC_TIME_DisableDayLightStore
1618   * @param  RTCx RTC Instance
1619   * @retval None
1620   */
1621 __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1622 {
1623   CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1624 }
1625 
1626 /**
1627   * @brief  Check if RTC Day Light Saving stored operation has been enabled or not
1628   * @rmtoll RTC_CR           BKP           LL_RTC_TIME_IsDayLightStoreEnabled
1629   * @param  RTCx RTC Instance
1630   * @retval State of bit (1 or 0).
1631   */
1632 __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
1633 {
1634   return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1UL : 0UL);
1635 }
1636 
1637 /**
1638   * @brief  Subtract 1 hour (winter time change)
1639   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1640   * @rmtoll RTC_CR           SUB1H         LL_RTC_TIME_DecHour
1641   * @param  RTCx RTC Instance
1642   * @retval None
1643   */
1644 __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1645 {
1646   SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1647 }
1648 
1649 /**
1650   * @brief  Add 1 hour (summer time change)
1651   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1652   * @rmtoll RTC_CR           ADD1H         LL_RTC_TIME_IncHour
1653   * @param  RTCx RTC Instance
1654   * @retval None
1655   */
1656 __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1657 {
1658   SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1659 }
1660 
1661 /**
1662   * @brief  Get Sub second value in the synchronous prescaler counter.
1663   * @note  You can use both SubSeconds value and SecondFraction (PREDIV_S through
1664   *        LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1665   *        SubSeconds value in second fraction ratio with time unit following
1666   *        generic formula:
1667   *          ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1668   *        This conversion can be performed only if no shift operation is pending
1669   *        (ie. SHFP=0) when PREDIV_S >= SS.
1670   * @rmtoll RTC_SSR          SS            LL_RTC_TIME_GetSubSecond
1671   * @param  RTCx RTC Instance
1672   * @retval Sub second value (number between 0 and 65535)
1673   */
1674 __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
1675 {
1676   return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1677 }
1678 
1679 /**
1680   * @brief  Synchronize to a remote clock with a high degree of precision.
1681   * @note   This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1682   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1683   * @note   When REFCKON is set, firmware must not write to Shift control register.
1684   * @rmtoll RTC_SHIFTR       ADD1S         LL_RTC_TIME_Synchronize
1685   *         RTC_SHIFTR       SUBFS         LL_RTC_TIME_Synchronize
1686   * @param  RTCx RTC Instance
1687   * @param  ShiftSecond This parameter can be one of the following values:
1688   *         @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1689   *         @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1690   * @param  Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1691   * @retval None
1692   */
1693 __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1694 {
1695   WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1696 }
1697 
1698 /**
1699   * @}
1700   */
1701 
1702 /** @defgroup RTC_LL_EF_Date Date
1703   * @ingroup RTEMSBSPsARMSTM32H7
1704   * @{
1705   */
1706 
1707 /**
1708   * @brief  Set Year in BCD format
1709   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1710   * @rmtoll RTC_DR           YT            LL_RTC_DATE_SetYear
1711   *         RTC_DR           YU            LL_RTC_DATE_SetYear
1712   * @param  RTCx RTC Instance
1713   * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1714   * @retval None
1715   */
1716 __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1717 {
1718   MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1719              (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1720 }
1721 
1722 /**
1723   * @brief  Get Year in BCD format
1724   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1725   *       before reading this bit
1726   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1727   * @rmtoll RTC_DR           YT            LL_RTC_DATE_GetYear
1728   *         RTC_DR           YU            LL_RTC_DATE_GetYear
1729   * @param  RTCx RTC Instance
1730   * @retval Value between Min_Data=0x00 and Max_Data=0x99
1731   */
1732 __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
1733 {
1734   return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
1735 }
1736 
1737 /**
1738   * @brief  Set Week day
1739   * @rmtoll RTC_DR           WDU           LL_RTC_DATE_SetWeekDay
1740   * @param  RTCx RTC Instance
1741   * @param  WeekDay This parameter can be one of the following values:
1742   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1743   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1744   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1745   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1746   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1747   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1748   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1749   * @retval None
1750   */
1751 __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1752 {
1753   MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1754 }
1755 
1756 /**
1757   * @brief  Get Week day
1758   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1759   *       before reading this bit
1760   * @rmtoll RTC_DR           WDU           LL_RTC_DATE_GetWeekDay
1761   * @param  RTCx RTC Instance
1762   * @retval Returned value can be one of the following values:
1763   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1764   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1765   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1766   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1767   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1768   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1769   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1770   */
1771 __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
1772 {
1773   return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1774 }
1775 
1776 /**
1777   * @brief  Set Month in BCD format
1778   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1779   * @rmtoll RTC_DR           MT            LL_RTC_DATE_SetMonth
1780   *         RTC_DR           MU            LL_RTC_DATE_SetMonth
1781   * @param  RTCx RTC Instance
1782   * @param  Month This parameter can be one of the following values:
1783   *         @arg @ref LL_RTC_MONTH_JANUARY
1784   *         @arg @ref LL_RTC_MONTH_FEBRUARY
1785   *         @arg @ref LL_RTC_MONTH_MARCH
1786   *         @arg @ref LL_RTC_MONTH_APRIL
1787   *         @arg @ref LL_RTC_MONTH_MAY
1788   *         @arg @ref LL_RTC_MONTH_JUNE
1789   *         @arg @ref LL_RTC_MONTH_JULY
1790   *         @arg @ref LL_RTC_MONTH_AUGUST
1791   *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1792   *         @arg @ref LL_RTC_MONTH_OCTOBER
1793   *         @arg @ref LL_RTC_MONTH_NOVEMBER
1794   *         @arg @ref LL_RTC_MONTH_DECEMBER
1795   * @retval None
1796   */
1797 __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1798 {
1799   MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1800              (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1801 }
1802 
1803 /**
1804   * @brief  Get Month in BCD format
1805   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1806   *       before reading this bit
1807   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1808   * @rmtoll RTC_DR           MT            LL_RTC_DATE_GetMonth
1809   *         RTC_DR           MU            LL_RTC_DATE_GetMonth
1810   * @param  RTCx RTC Instance
1811   * @retval Returned value can be one of the following values:
1812   *         @arg @ref LL_RTC_MONTH_JANUARY
1813   *         @arg @ref LL_RTC_MONTH_FEBRUARY
1814   *         @arg @ref LL_RTC_MONTH_MARCH
1815   *         @arg @ref LL_RTC_MONTH_APRIL
1816   *         @arg @ref LL_RTC_MONTH_MAY
1817   *         @arg @ref LL_RTC_MONTH_JUNE
1818   *         @arg @ref LL_RTC_MONTH_JULY
1819   *         @arg @ref LL_RTC_MONTH_AUGUST
1820   *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1821   *         @arg @ref LL_RTC_MONTH_OCTOBER
1822   *         @arg @ref LL_RTC_MONTH_NOVEMBER
1823   *         @arg @ref LL_RTC_MONTH_DECEMBER
1824   */
1825 __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
1826 {
1827   return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
1828 }
1829 
1830 /**
1831   * @brief  Set Day in BCD format
1832   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1833   * @rmtoll RTC_DR           DT            LL_RTC_DATE_SetDay
1834   *         RTC_DR           DU            LL_RTC_DATE_SetDay
1835   * @param  RTCx RTC Instance
1836   * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1837   * @retval None
1838   */
1839 __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1840 {
1841   MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1842              (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1843 }
1844 
1845 /**
1846   * @brief  Get Day in BCD format
1847   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1848   *       before reading this bit
1849   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1850   * @rmtoll RTC_DR           DT            LL_RTC_DATE_GetDay
1851   *         RTC_DR           DU            LL_RTC_DATE_GetDay
1852   * @param  RTCx RTC Instance
1853   * @retval Value between Min_Data=0x01 and Max_Data=0x31
1854   */
1855 __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
1856 {
1857   return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
1858 }
1859 
1860 /**
1861   * @brief  Set date (WeekDay, Day, Month and Year) in BCD format
1862   * @rmtoll RTC_DR           WDU           LL_RTC_DATE_Config
1863   *         RTC_DR           MT            LL_RTC_DATE_Config
1864   *         RTC_DR           MU            LL_RTC_DATE_Config
1865   *         RTC_DR           DT            LL_RTC_DATE_Config
1866   *         RTC_DR           DU            LL_RTC_DATE_Config
1867   *         RTC_DR           YT            LL_RTC_DATE_Config
1868   *         RTC_DR           YU            LL_RTC_DATE_Config
1869   * @param  RTCx RTC Instance
1870   * @param  WeekDay This parameter can be one of the following values:
1871   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1872   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1873   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1874   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1875   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1876   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1877   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1878   * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1879   * @param  Month This parameter can be one of the following values:
1880   *         @arg @ref LL_RTC_MONTH_JANUARY
1881   *         @arg @ref LL_RTC_MONTH_FEBRUARY
1882   *         @arg @ref LL_RTC_MONTH_MARCH
1883   *         @arg @ref LL_RTC_MONTH_APRIL
1884   *         @arg @ref LL_RTC_MONTH_MAY
1885   *         @arg @ref LL_RTC_MONTH_JUNE
1886   *         @arg @ref LL_RTC_MONTH_JULY
1887   *         @arg @ref LL_RTC_MONTH_AUGUST
1888   *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1889   *         @arg @ref LL_RTC_MONTH_OCTOBER
1890   *         @arg @ref LL_RTC_MONTH_NOVEMBER
1891   *         @arg @ref LL_RTC_MONTH_DECEMBER
1892   * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1893   * @retval None
1894   */
1895 __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
1896 {
1897   uint32_t temp;
1898 
1899   temp = (WeekDay << RTC_DR_WDU_Pos)                                                        | \
1900          (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos))   | \
1901          (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
1902          (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
1903 
1904   MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp);
1905 }
1906 
1907 /**
1908   * @brief  Get date (WeekDay, Day, Month and Year) in BCD format
1909   * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
1910   *       before reading this bit
1911   * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1912   * and __LL_RTC_GET_DAY are available to get independently each parameter.
1913   * @rmtoll RTC_DR           WDU           LL_RTC_DATE_Get
1914   *         RTC_DR           MT            LL_RTC_DATE_Get
1915   *         RTC_DR           MU            LL_RTC_DATE_Get
1916   *         RTC_DR           DT            LL_RTC_DATE_Get
1917   *         RTC_DR           DU            LL_RTC_DATE_Get
1918   *         RTC_DR           YT            LL_RTC_DATE_Get
1919   *         RTC_DR           YU            LL_RTC_DATE_Get
1920   * @param  RTCx RTC Instance
1921   * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1922   */
1923 __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
1924 {
1925   uint32_t temp;
1926 
1927   temp = READ_BIT(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU));
1928   return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
1929                     (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY)   | \
1930                     (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \
1931                     ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)));
1932 }
1933 
1934 /**
1935   * @}
1936   */
1937 
1938 /** @defgroup RTC_LL_EF_ALARMA ALARMA
1939   * @ingroup RTEMSBSPsARMSTM32H7
1940   * @{
1941   */
1942 
1943 /**
1944   * @brief  Enable Alarm A
1945   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1946   * @rmtoll RTC_CR           ALRAE         LL_RTC_ALMA_Enable
1947   * @param  RTCx RTC Instance
1948   * @retval None
1949   */
1950 __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
1951 {
1952   SET_BIT(RTCx->CR, RTC_CR_ALRAE);
1953 }
1954 
1955 /**
1956   * @brief  Disable Alarm A
1957   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1958   * @rmtoll RTC_CR           ALRAE         LL_RTC_ALMA_Disable
1959   * @param  RTCx RTC Instance
1960   * @retval None
1961   */
1962 __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
1963 {
1964   CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
1965 }
1966 
1967 /**
1968   * @brief  Specify the Alarm A masks.
1969   * @rmtoll RTC_ALRMAR       MSK4          LL_RTC_ALMA_SetMask
1970   *         RTC_ALRMAR       MSK3          LL_RTC_ALMA_SetMask
1971   *         RTC_ALRMAR       MSK2          LL_RTC_ALMA_SetMask
1972   *         RTC_ALRMAR       MSK1          LL_RTC_ALMA_SetMask
1973   * @param  RTCx RTC Instance
1974   * @param  Mask This parameter can be a combination of the following values:
1975   *         @arg @ref LL_RTC_ALMA_MASK_NONE
1976   *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1977   *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1978   *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
1979   *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
1980   *         @arg @ref LL_RTC_ALMA_MASK_ALL
1981   * @retval None
1982   */
1983 __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1984 {
1985   MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
1986 }
1987 
1988 /**
1989   * @brief  Get the Alarm A masks.
1990   * @rmtoll RTC_ALRMAR       MSK4          LL_RTC_ALMA_GetMask
1991   *         RTC_ALRMAR       MSK3          LL_RTC_ALMA_GetMask
1992   *         RTC_ALRMAR       MSK2          LL_RTC_ALMA_GetMask
1993   *         RTC_ALRMAR       MSK1          LL_RTC_ALMA_GetMask
1994   * @param  RTCx RTC Instance
1995   * @retval Returned value can be can be a combination of the following values:
1996   *         @arg @ref LL_RTC_ALMA_MASK_NONE
1997   *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1998   *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1999   *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
2000   *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
2001   *         @arg @ref LL_RTC_ALMA_MASK_ALL
2002   */
2003 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
2004 {
2005   return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
2006 }
2007 
2008 /**
2009   * @brief  Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2010   * @rmtoll RTC_ALRMAR       WDSEL         LL_RTC_ALMA_EnableWeekday
2011   * @param  RTCx RTC Instance
2012   * @retval None
2013   */
2014 __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
2015 {
2016   SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
2017 }
2018 
2019 /**
2020   * @brief  Disable AlarmA Week day selection (DU[3:0] represents the date )
2021   * @rmtoll RTC_ALRMAR       WDSEL         LL_RTC_ALMA_DisableWeekday
2022   * @param  RTCx RTC Instance
2023   * @retval None
2024   */
2025 __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
2026 {
2027   CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
2028 }
2029 
2030 /**
2031   * @brief  Set ALARM A Day in BCD format
2032   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2033   * @rmtoll RTC_ALRMAR       DT            LL_RTC_ALMA_SetDay
2034   *         RTC_ALRMAR       DU            LL_RTC_ALMA_SetDay
2035   * @param  RTCx RTC Instance
2036   * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
2037   * @retval None
2038   */
2039 __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2040 {
2041   MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
2042              (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
2043 }
2044 
2045 /**
2046   * @brief  Get ALARM A Day in BCD format
2047   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2048   * @rmtoll RTC_ALRMAR       DT            LL_RTC_ALMA_GetDay
2049   *         RTC_ALRMAR       DU            LL_RTC_ALMA_GetDay
2050   * @param  RTCx RTC Instance
2051   * @retval Value between Min_Data=0x01 and Max_Data=0x31
2052   */
2053 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
2054 {
2055   return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
2056 }
2057 
2058 /**
2059   * @brief  Set ALARM A Weekday
2060   * @rmtoll RTC_ALRMAR       DU            LL_RTC_ALMA_SetWeekDay
2061   * @param  RTCx RTC Instance
2062   * @param  WeekDay This parameter can be one of the following values:
2063   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2064   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2065   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2066   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2067   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2068   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2069   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2070   * @retval None
2071   */
2072 __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2073 {
2074   MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
2075 }
2076 
2077 /**
2078   * @brief  Get ALARM A Weekday
2079   * @rmtoll RTC_ALRMAR       DU            LL_RTC_ALMA_GetWeekDay
2080   * @param  RTCx RTC Instance
2081   * @retval Returned value can be one of the following values:
2082   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2083   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2084   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2085   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2086   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2087   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2088   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2089   */
2090 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
2091 {
2092   return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
2093 }
2094 
2095 /**
2096   * @brief  Set Alarm A time format (AM/24-hour or PM notation)
2097   * @rmtoll RTC_ALRMAR       PM            LL_RTC_ALMA_SetTimeFormat
2098   * @param  RTCx RTC Instance
2099   * @param  TimeFormat This parameter can be one of the following values:
2100   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2101   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2102   * @retval None
2103   */
2104 __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2105 {
2106   MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
2107 }
2108 
2109 /**
2110   * @brief  Get Alarm A time format (AM or PM notation)
2111   * @rmtoll RTC_ALRMAR       PM            LL_RTC_ALMA_GetTimeFormat
2112   * @param  RTCx RTC Instance
2113   * @retval Returned value can be one of the following values:
2114   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2115   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2116   */
2117 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
2118 {
2119   return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
2120 }
2121 
2122 /**
2123   * @brief  Set ALARM A Hours in BCD format
2124   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2125   * @rmtoll RTC_ALRMAR       HT            LL_RTC_ALMA_SetHour
2126   *         RTC_ALRMAR       HU            LL_RTC_ALMA_SetHour
2127   * @param  RTCx RTC Instance
2128   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2129   * @retval None
2130   */
2131 __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2132 {
2133   MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
2134              (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
2135 }
2136 
2137 /**
2138   * @brief  Get ALARM A Hours in BCD format
2139   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2140   * @rmtoll RTC_ALRMAR       HT            LL_RTC_ALMA_GetHour
2141   *         RTC_ALRMAR       HU            LL_RTC_ALMA_GetHour
2142   * @param  RTCx RTC Instance
2143   * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2144   */
2145 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
2146 {
2147   return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
2148 }
2149 
2150 /**
2151   * @brief  Set ALARM A Minutes in BCD format
2152   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2153   * @rmtoll RTC_ALRMAR       MNT           LL_RTC_ALMA_SetMinute
2154   *         RTC_ALRMAR       MNU           LL_RTC_ALMA_SetMinute
2155   * @param  RTCx RTC Instance
2156   * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
2157   * @retval None
2158   */
2159 __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2160 {
2161   MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
2162              (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
2163 }
2164 
2165 /**
2166   * @brief  Get ALARM A Minutes in BCD format
2167   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2168   * @rmtoll RTC_ALRMAR       MNT           LL_RTC_ALMA_GetMinute
2169   *         RTC_ALRMAR       MNU           LL_RTC_ALMA_GetMinute
2170   * @param  RTCx RTC Instance
2171   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2172   */
2173 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
2174 {
2175   return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
2176 }
2177 
2178 /**
2179   * @brief  Set ALARM A Seconds in BCD format
2180   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2181   * @rmtoll RTC_ALRMAR       ST            LL_RTC_ALMA_SetSecond
2182   *         RTC_ALRMAR       SU            LL_RTC_ALMA_SetSecond
2183   * @param  RTCx RTC Instance
2184   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2185   * @retval None
2186   */
2187 __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2188 {
2189   MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
2190              (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
2191 }
2192 
2193 /**
2194   * @brief  Get ALARM A Seconds in BCD format
2195   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2196   * @rmtoll RTC_ALRMAR       ST            LL_RTC_ALMA_GetSecond
2197   *         RTC_ALRMAR       SU            LL_RTC_ALMA_GetSecond
2198   * @param  RTCx RTC Instance
2199   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2200   */
2201 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
2202 {
2203   return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
2204 }
2205 
2206 /**
2207   * @brief  Set Alarm A Time (hour, minute and second) in BCD format
2208   * @rmtoll RTC_ALRMAR       PM            LL_RTC_ALMA_ConfigTime
2209   *         RTC_ALRMAR       HT            LL_RTC_ALMA_ConfigTime
2210   *         RTC_ALRMAR       HU            LL_RTC_ALMA_ConfigTime
2211   *         RTC_ALRMAR       MNT           LL_RTC_ALMA_ConfigTime
2212   *         RTC_ALRMAR       MNU           LL_RTC_ALMA_ConfigTime
2213   *         RTC_ALRMAR       ST            LL_RTC_ALMA_ConfigTime
2214   *         RTC_ALRMAR       SU            LL_RTC_ALMA_ConfigTime
2215   * @param  RTCx RTC Instance
2216   * @param  Format12_24 This parameter can be one of the following values:
2217   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
2218   *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
2219   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2220   * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
2221   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2222   * @retval None
2223   */
2224 __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2225 {
2226   uint32_t temp;
2227 
2228   temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos))    | \
2229          (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
2230          (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
2231 
2232   MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
2233 }
2234 
2235 /**
2236   * @brief  Get Alarm B Time (hour, minute and second) in BCD format
2237   * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2238   * are available to get independently each parameter.
2239   * @rmtoll RTC_ALRMAR       HT            LL_RTC_ALMA_GetTime
2240   *         RTC_ALRMAR       HU            LL_RTC_ALMA_GetTime
2241   *         RTC_ALRMAR       MNT           LL_RTC_ALMA_GetTime
2242   *         RTC_ALRMAR       MNU           LL_RTC_ALMA_GetTime
2243   *         RTC_ALRMAR       ST            LL_RTC_ALMA_GetTime
2244   *         RTC_ALRMAR       SU            LL_RTC_ALMA_GetTime
2245   * @param  RTCx RTC Instance
2246   * @retval Combination of hours, minutes and seconds.
2247   */
2248 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
2249 {
2250   return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
2251 }
2252 
2253 /**
2254   * @brief  Set Alarm A Mask the most-significant bits starting at this bit
2255   * @note This register can be written only when ALRAE is reset in RTC_CR register,
2256   *       or in initialization mode.
2257   * @rmtoll RTC_ALRMASSR     MASKSS        LL_RTC_ALMA_SetSubSecondMask
2258   * @param  RTCx RTC Instance
2259   * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
2260   * @retval None
2261   */
2262 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2263 {
2264   MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
2265 }
2266 
2267 /**
2268   * @brief  Get Alarm A Mask the most-significant bits starting at this bit
2269   * @rmtoll RTC_ALRMASSR     MASKSS        LL_RTC_ALMA_GetSubSecondMask
2270   * @param  RTCx RTC Instance
2271   * @retval Value between Min_Data=0x00 and Max_Data=0xF
2272   */
2273 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
2274 {
2275   return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
2276 }
2277 
2278 /**
2279   * @brief  Set Alarm A Sub seconds value
2280   * @rmtoll RCT_ALRMASSR     SS            LL_RTC_ALMA_SetSubSecond
2281   * @param  RTCx RTC Instance
2282   * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2283   * @retval None
2284   */
2285 __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2286 {
2287   MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
2288 }
2289 
2290 /**
2291   * @brief  Get Alarm A Sub seconds value
2292   * @rmtoll RCT_ALRMASSR     SS            LL_RTC_ALMA_GetSubSecond
2293   * @param  RTCx RTC Instance
2294   * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2295   */
2296 __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
2297 {
2298   return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
2299 }
2300 
2301 /**
2302   * @}
2303   */
2304 
2305 /** @defgroup RTC_LL_EF_ALARMB ALARMB
2306   * @ingroup RTEMSBSPsARMSTM32H7
2307   * @{
2308   */
2309 
2310 /**
2311   * @brief  Enable Alarm B
2312   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2313   * @rmtoll RTC_CR           ALRBE         LL_RTC_ALMB_Enable
2314   * @param  RTCx RTC Instance
2315   * @retval None
2316   */
2317 __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
2318 {
2319   SET_BIT(RTCx->CR, RTC_CR_ALRBE);
2320 }
2321 
2322 /**
2323   * @brief  Disable Alarm B
2324   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2325   * @rmtoll RTC_CR           ALRBE         LL_RTC_ALMB_Disable
2326   * @param  RTCx RTC Instance
2327   * @retval None
2328   */
2329 __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
2330 {
2331   CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
2332 }
2333 
2334 /**
2335   * @brief  Specify the Alarm B masks.
2336   * @rmtoll RTC_ALRMBR       MSK4          LL_RTC_ALMB_SetMask
2337   *         RTC_ALRMBR       MSK3          LL_RTC_ALMB_SetMask
2338   *         RTC_ALRMBR       MSK2          LL_RTC_ALMB_SetMask
2339   *         RTC_ALRMBR       MSK1          LL_RTC_ALMB_SetMask
2340   * @param  RTCx RTC Instance
2341   * @param  Mask This parameter can be a combination of the following values:
2342   *         @arg @ref LL_RTC_ALMB_MASK_NONE
2343   *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2344   *         @arg @ref LL_RTC_ALMB_MASK_HOURS
2345   *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
2346   *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
2347   *         @arg @ref LL_RTC_ALMB_MASK_ALL
2348   * @retval None
2349   */
2350 __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
2351 {
2352   MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
2353 }
2354 
2355 /**
2356   * @brief  Get the Alarm B masks.
2357   * @rmtoll RTC_ALRMBR       MSK4          LL_RTC_ALMB_GetMask
2358   *         RTC_ALRMBR       MSK3          LL_RTC_ALMB_GetMask
2359   *         RTC_ALRMBR       MSK2          LL_RTC_ALMB_GetMask
2360   *         RTC_ALRMBR       MSK1          LL_RTC_ALMB_GetMask
2361   * @param  RTCx RTC Instance
2362   * @retval Returned value can be can be a combination of the following values:
2363   *         @arg @ref LL_RTC_ALMB_MASK_NONE
2364   *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2365   *         @arg @ref LL_RTC_ALMB_MASK_HOURS
2366   *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
2367   *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
2368   *         @arg @ref LL_RTC_ALMB_MASK_ALL
2369   */
2370 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
2371 {
2372   return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
2373 }
2374 
2375 /**
2376   * @brief  Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2377   * @rmtoll RTC_ALRMBR       WDSEL         LL_RTC_ALMB_EnableWeekday
2378   * @param  RTCx RTC Instance
2379   * @retval None
2380   */
2381 __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2382 {
2383   SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2384 }
2385 
2386 /**
2387   * @brief  Disable AlarmB Week day selection (DU[3:0] represents the date )
2388   * @rmtoll RTC_ALRMBR       WDSEL         LL_RTC_ALMB_DisableWeekday
2389   * @param  RTCx RTC Instance
2390   * @retval None
2391   */
2392 __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2393 {
2394   CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2395 }
2396 
2397 /**
2398   * @brief  Set ALARM B Day in BCD format
2399   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2400   * @rmtoll RTC_ALRMBR       DT            LL_RTC_ALMB_SetDay
2401   *         RTC_ALRMBR       DU            LL_RTC_ALMB_SetDay
2402   * @param  RTCx RTC Instance
2403   * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
2404   * @retval None
2405   */
2406 __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2407 {
2408   MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2409              (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2410 }
2411 
2412 /**
2413   * @brief  Get ALARM B Day in BCD format
2414   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2415   * @rmtoll RTC_ALRMBR       DT            LL_RTC_ALMB_GetDay
2416   *         RTC_ALRMBR       DU            LL_RTC_ALMB_GetDay
2417   * @param  RTCx RTC Instance
2418   * @retval Value between Min_Data=0x01 and Max_Data=0x31
2419   */
2420 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
2421 {
2422   return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
2423 }
2424 
2425 /**
2426   * @brief  Set ALARM B Weekday
2427   * @rmtoll RTC_ALRMBR       DU            LL_RTC_ALMB_SetWeekDay
2428   * @param  RTCx RTC Instance
2429   * @param  WeekDay This parameter can be one of the following values:
2430   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2431   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2432   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2433   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2434   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2435   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2436   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2437   * @retval None
2438   */
2439 __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2440 {
2441   MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2442 }
2443 
2444 /**
2445   * @brief  Get ALARM B Weekday
2446   * @rmtoll RTC_ALRMBR       DU            LL_RTC_ALMB_GetWeekDay
2447   * @param  RTCx RTC Instance
2448   * @retval Returned value can be one of the following values:
2449   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2450   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2451   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2452   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2453   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2454   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2455   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2456   */
2457 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
2458 {
2459   return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2460 }
2461 
2462 /**
2463   * @brief  Set ALARM B time format (AM/24-hour or PM notation)
2464   * @rmtoll RTC_ALRMBR       PM            LL_RTC_ALMB_SetTimeFormat
2465   * @param  RTCx RTC Instance
2466   * @param  TimeFormat This parameter can be one of the following values:
2467   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2468   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2469   * @retval None
2470   */
2471 __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2472 {
2473   MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2474 }
2475 
2476 /**
2477   * @brief  Get ALARM B time format (AM or PM notation)
2478   * @rmtoll RTC_ALRMBR       PM            LL_RTC_ALMB_GetTimeFormat
2479   * @param  RTCx RTC Instance
2480   * @retval Returned value can be one of the following values:
2481   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2482   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2483   */
2484 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
2485 {
2486   return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2487 }
2488 
2489 /**
2490   * @brief  Set ALARM B Hours in BCD format
2491   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2492   * @rmtoll RTC_ALRMBR       HT            LL_RTC_ALMB_SetHour
2493   *         RTC_ALRMBR       HU            LL_RTC_ALMB_SetHour
2494   * @param  RTCx RTC Instance
2495   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2496   * @retval None
2497   */
2498 __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2499 {
2500   MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2501              (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2502 }
2503 
2504 /**
2505   * @brief  Get ALARM B Hours in BCD format
2506   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2507   * @rmtoll RTC_ALRMBR       HT            LL_RTC_ALMB_GetHour
2508   *         RTC_ALRMBR       HU            LL_RTC_ALMB_GetHour
2509   * @param  RTCx RTC Instance
2510   * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2511   */
2512 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
2513 {
2514   return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
2515 }
2516 
2517 /**
2518   * @brief  Set ALARM B Minutes in BCD format
2519   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2520   * @rmtoll RTC_ALRMBR       MNT           LL_RTC_ALMB_SetMinute
2521   *         RTC_ALRMBR       MNU           LL_RTC_ALMB_SetMinute
2522   * @param  RTCx RTC Instance
2523   * @param  Minutes between Min_Data=0x00 and Max_Data=0x59
2524   * @retval None
2525   */
2526 __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2527 {
2528   MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2529              (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2530 }
2531 
2532 /**
2533   * @brief  Get ALARM B Minutes in BCD format
2534   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2535   * @rmtoll RTC_ALRMBR       MNT           LL_RTC_ALMB_GetMinute
2536   *         RTC_ALRMBR       MNU           LL_RTC_ALMB_GetMinute
2537   * @param  RTCx RTC Instance
2538   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2539   */
2540 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
2541 {
2542   return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
2543 }
2544 
2545 /**
2546   * @brief  Set ALARM B Seconds in BCD format
2547   * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2548   * @rmtoll RTC_ALRMBR       ST            LL_RTC_ALMB_SetSecond
2549   *         RTC_ALRMBR       SU            LL_RTC_ALMB_SetSecond
2550   * @param  RTCx RTC Instance
2551   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2552   * @retval None
2553   */
2554 __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2555 {
2556   MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2557              (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2558 }
2559 
2560 /**
2561   * @brief  Get ALARM B Seconds in BCD format
2562   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2563   * @rmtoll RTC_ALRMBR       ST            LL_RTC_ALMB_GetSecond
2564   *         RTC_ALRMBR       SU            LL_RTC_ALMB_GetSecond
2565   * @param  RTCx RTC Instance
2566   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2567   */
2568 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
2569 {
2570   return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
2571 }
2572 
2573 /**
2574   * @brief  Set Alarm B Time (hour, minute and second) in BCD format
2575   * @rmtoll RTC_ALRMBR       PM            LL_RTC_ALMB_ConfigTime
2576   *         RTC_ALRMBR       HT            LL_RTC_ALMB_ConfigTime
2577   *         RTC_ALRMBR       HU            LL_RTC_ALMB_ConfigTime
2578   *         RTC_ALRMBR       MNT           LL_RTC_ALMB_ConfigTime
2579   *         RTC_ALRMBR       MNU           LL_RTC_ALMB_ConfigTime
2580   *         RTC_ALRMBR       ST            LL_RTC_ALMB_ConfigTime
2581   *         RTC_ALRMBR       SU            LL_RTC_ALMB_ConfigTime
2582   * @param  RTCx RTC Instance
2583   * @param  Format12_24 This parameter can be one of the following values:
2584   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2585   *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2586   * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2587   * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
2588   * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2589   * @retval None
2590   */
2591 __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2592 {
2593   uint32_t temp;
2594 
2595   temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos))    | \
2596          (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2597          (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2598 
2599   MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
2600 }
2601 
2602 /**
2603   * @brief  Get Alarm B Time (hour, minute and second) in BCD format
2604   * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2605   * are available to get independently each parameter.
2606   * @rmtoll RTC_ALRMBR       HT            LL_RTC_ALMB_GetTime
2607   *         RTC_ALRMBR       HU            LL_RTC_ALMB_GetTime
2608   *         RTC_ALRMBR       MNT           LL_RTC_ALMB_GetTime
2609   *         RTC_ALRMBR       MNU           LL_RTC_ALMB_GetTime
2610   *         RTC_ALRMBR       ST            LL_RTC_ALMB_GetTime
2611   *         RTC_ALRMBR       SU            LL_RTC_ALMB_GetTime
2612   * @param  RTCx RTC Instance
2613   * @retval Combination of hours, minutes and seconds.
2614   */
2615 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
2616 {
2617   return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2618 }
2619 
2620 /**
2621   * @brief  Set Alarm B Mask the most-significant bits starting at this bit
2622   * @note This register can be written only when ALRBE is reset in RTC_CR register,
2623   *       or in initialization mode.
2624   * @rmtoll RTC_ALRMBSSR     MASKSS        LL_RTC_ALMB_SetSubSecondMask
2625   * @param  RTCx RTC Instance
2626   * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
2627   * @retval None
2628   */
2629 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2630 {
2631   MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2632 }
2633 
2634 /**
2635   * @brief  Get Alarm B Mask the most-significant bits starting at this bit
2636   * @rmtoll RTC_ALRMBSSR     MASKSS        LL_RTC_ALMB_GetSubSecondMask
2637   * @param  RTCx RTC Instance
2638   * @retval Value between Min_Data=0x00 and Max_Data=0xF
2639   */
2640 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
2641 {
2642   return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS)  >> RTC_ALRMBSSR_MASKSS_Pos);
2643 }
2644 
2645 /**
2646   * @brief  Set Alarm B Sub seconds value
2647   * @rmtoll RTC_ALRMBSSR     SS            LL_RTC_ALMB_SetSubSecond
2648   * @param  RTCx RTC Instance
2649   * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2650   * @retval None
2651   */
2652 __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2653 {
2654   MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2655 }
2656 
2657 /**
2658   * @brief  Get Alarm B Sub seconds value
2659   * @rmtoll RTC_ALRMBSSR     SS            LL_RTC_ALMB_GetSubSecond
2660   * @param  RTCx RTC Instance
2661   * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2662   */
2663 __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
2664 {
2665   return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2666 }
2667 
2668 /**
2669   * @}
2670   */
2671 
2672 /** @defgroup RTC_LL_EF_Timestamp Timestamp
2673   * @ingroup RTEMSBSPsARMSTM32H7
2674   * @{
2675   */
2676 
2677 /**
2678   * @brief  Enable internal event timestamp
2679   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2680   * @rmtoll RTC_CR           ITSE          LL_RTC_TS_EnableInternalEvent
2681   * @param  RTCx RTC Instance
2682   * @retval None
2683   */
2684 __STATIC_INLINE void LL_RTC_TS_EnableInternalEvent(RTC_TypeDef *RTCx)
2685 {
2686   SET_BIT(RTCx->CR, RTC_CR_ITSE);
2687 }
2688 
2689 /**
2690   * @brief  Disable internal event timestamp
2691   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2692   * @rmtoll RTC_CR           ITSE          LL_RTC_TS_DisableInternalEvent
2693   * @param  RTCx RTC Instance
2694   * @retval None
2695   */
2696 __STATIC_INLINE void LL_RTC_TS_DisableInternalEvent(RTC_TypeDef *RTCx)
2697 {
2698   CLEAR_BIT(RTCx->CR, RTC_CR_ITSE);
2699 }
2700 
2701 /**
2702   * @brief  Enable Timestamp
2703   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2704   * @rmtoll RTC_CR           TSE           LL_RTC_TS_Enable
2705   * @param  RTCx RTC Instance
2706   * @retval None
2707   */
2708 __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2709 {
2710   SET_BIT(RTCx->CR, RTC_CR_TSE);
2711 }
2712 
2713 /**
2714   * @brief  Disable Timestamp
2715   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2716   * @rmtoll RTC_CR           TSE           LL_RTC_TS_Disable
2717   * @param  RTCx RTC Instance
2718   * @retval None
2719   */
2720 __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2721 {
2722   CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2723 }
2724 
2725 /**
2726   * @brief  Set Time-stamp event active edge
2727   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2728   * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2729   * @rmtoll RTC_CR           TSEDGE        LL_RTC_TS_SetActiveEdge
2730   * @param  RTCx RTC Instance
2731   * @param  Edge This parameter can be one of the following values:
2732   *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2733   *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2734   * @retval None
2735   */
2736 __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2737 {
2738   MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2739 }
2740 
2741 /**
2742   * @brief  Get Time-stamp event active edge
2743   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2744   * @rmtoll RTC_CR           TSEDGE        LL_RTC_TS_GetActiveEdge
2745   * @param  RTCx RTC Instance
2746   * @retval Returned value can be one of the following values:
2747   *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2748   *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2749   */
2750 __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
2751 {
2752   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2753 }
2754 
2755 /**
2756   * @brief  Get Timestamp AM/PM notation (AM or 24-hour format)
2757   * @rmtoll RTC_TSTR         PM            LL_RTC_TS_GetTimeFormat
2758   * @param  RTCx RTC Instance
2759   * @retval Returned value can be one of the following values:
2760   *         @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2761   *         @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2762   */
2763 __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
2764 {
2765   return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2766 }
2767 
2768 /**
2769   * @brief  Get Timestamp Hours in BCD format
2770   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2771   * @rmtoll RTC_TSTR         HT            LL_RTC_TS_GetHour
2772   *         RTC_TSTR         HU            LL_RTC_TS_GetHour
2773   * @param  RTCx RTC Instance
2774   * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2775   */
2776 __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
2777 {
2778   return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2779 }
2780 
2781 /**
2782   * @brief  Get Timestamp Minutes in BCD format
2783   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2784   * @rmtoll RTC_TSTR         MNT           LL_RTC_TS_GetMinute
2785   *         RTC_TSTR         MNU           LL_RTC_TS_GetMinute
2786   * @param  RTCx RTC Instance
2787   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2788   */
2789 __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
2790 {
2791   return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2792 }
2793 
2794 /**
2795   * @brief  Get Timestamp Seconds in BCD format
2796   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2797   * @rmtoll RTC_TSTR         ST            LL_RTC_TS_GetSecond
2798   *         RTC_TSTR         SU            LL_RTC_TS_GetSecond
2799   * @param  RTCx RTC Instance
2800   * @retval Value between Min_Data=0x00 and Max_Data=0x59
2801   */
2802 __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
2803 {
2804   return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2805 }
2806 
2807 /**
2808   * @brief  Get Timestamp time (hour, minute and second) in BCD format
2809   * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2810   * are available to get independently each parameter.
2811   * @rmtoll RTC_TSTR         HT            LL_RTC_TS_GetTime
2812   *         RTC_TSTR         HU            LL_RTC_TS_GetTime
2813   *         RTC_TSTR         MNT           LL_RTC_TS_GetTime
2814   *         RTC_TSTR         MNU           LL_RTC_TS_GetTime
2815   *         RTC_TSTR         ST            LL_RTC_TS_GetTime
2816   *         RTC_TSTR         SU            LL_RTC_TS_GetTime
2817   * @param  RTCx RTC Instance
2818   * @retval Combination of hours, minutes and seconds.
2819   */
2820 __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
2821 {
2822   return (uint32_t)(READ_BIT(RTCx->TSTR,
2823                              RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2824 }
2825 
2826 /**
2827   * @brief  Get Timestamp Week day
2828   * @rmtoll RTC_TSDR         WDU           LL_RTC_TS_GetWeekDay
2829   * @param  RTCx RTC Instance
2830   * @retval Returned value can be one of the following values:
2831   *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2832   *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2833   *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2834   *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2835   *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2836   *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2837   *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2838   */
2839 __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
2840 {
2841   return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
2842 }
2843 
2844 /**
2845   * @brief  Get Timestamp Month in BCD format
2846   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2847   * @rmtoll RTC_TSDR         MT            LL_RTC_TS_GetMonth
2848   *         RTC_TSDR         MU            LL_RTC_TS_GetMonth
2849   * @param  RTCx RTC Instance
2850   * @retval Returned value can be one of the following values:
2851   *         @arg @ref LL_RTC_MONTH_JANUARY
2852   *         @arg @ref LL_RTC_MONTH_FEBRUARY
2853   *         @arg @ref LL_RTC_MONTH_MARCH
2854   *         @arg @ref LL_RTC_MONTH_APRIL
2855   *         @arg @ref LL_RTC_MONTH_MAY
2856   *         @arg @ref LL_RTC_MONTH_JUNE
2857   *         @arg @ref LL_RTC_MONTH_JULY
2858   *         @arg @ref LL_RTC_MONTH_AUGUST
2859   *         @arg @ref LL_RTC_MONTH_SEPTEMBER
2860   *         @arg @ref LL_RTC_MONTH_OCTOBER
2861   *         @arg @ref LL_RTC_MONTH_NOVEMBER
2862   *         @arg @ref LL_RTC_MONTH_DECEMBER
2863   */
2864 __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
2865 {
2866   return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
2867 }
2868 
2869 /**
2870   * @brief  Get Timestamp Day in BCD format
2871   * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2872   * @rmtoll RTC_TSDR         DT            LL_RTC_TS_GetDay
2873   *         RTC_TSDR         DU            LL_RTC_TS_GetDay
2874   * @param  RTCx RTC Instance
2875   * @retval Value between Min_Data=0x01 and Max_Data=0x31
2876   */
2877 __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
2878 {
2879   return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
2880 }
2881 
2882 /**
2883   * @brief  Get Timestamp date (WeekDay, Day and Month) in BCD format
2884   * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2885   * and __LL_RTC_GET_DAY are available to get independently each parameter.
2886   * @rmtoll RTC_TSDR         WDU           LL_RTC_TS_GetDate
2887   *         RTC_TSDR         MT            LL_RTC_TS_GetDate
2888   *         RTC_TSDR         MU            LL_RTC_TS_GetDate
2889   *         RTC_TSDR         DT            LL_RTC_TS_GetDate
2890   *         RTC_TSDR         DU            LL_RTC_TS_GetDate
2891   * @param  RTCx RTC Instance
2892   * @retval Combination of Weekday, Day and Month
2893   */
2894 __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
2895 {
2896   return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
2897 }
2898 
2899 /**
2900   * @brief  Get time-stamp sub second value
2901   * @rmtoll RTC_TSSSR         SS            LL_RTC_TS_GetSubSecond
2902   * @param  RTCx RTC Instance
2903   * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2904   */
2905 __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
2906 {
2907   return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
2908 }
2909 
2910 /**
2911   * @}
2912   */
2913 
2914 /** @defgroup RTC_LL_EF_Tamper_Timestamp Time-stamp on Tamper
2915   * @ingroup RTEMSBSPsARMSTM32H7
2916   * @{
2917   */
2918 
2919 #if !defined(TAMP)
2920 /**
2921   * @brief  Activate timestamp on tamper detection event
2922   * @rmtoll RTC_CR       TAMPTS        LL_RTC_TS_EnableOnTamper
2923   * @param  RTCx RTC Instance
2924   * @retval None
2925   */
2926 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2927 {
2928   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
2929 }
2930 
2931 /**
2932   * @brief  Disable timestamp on tamper detection event
2933   * @rmtoll RTC_CR       TAMPTS        LL_RTC_TS_DisableOnTamper
2934   * @param  RTCx RTC Instance
2935   * @retval None
2936   */
2937 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2938 {
2939   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPTS);
2940 }
2941 #else
2942 /**
2943   * @brief  Activate timestamp on tamper detection event
2944   * @rmtoll RTC_CR       TAMPTS        LL_RTC_TS_EnableOnTamper
2945   * @param  RTCx RTC Instance
2946   * @retval None
2947   */
2948 
2949 __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2950 {
2951   SET_BIT(RTCx->CR, RTC_CR_TAMPTS);
2952 }
2953 
2954 /**
2955   * @brief  Disable timestamp on tamper detection event
2956   * @rmtoll RTC_CR       TAMPTS        LL_RTC_TS_DisableOnTamper
2957   * @param  RTCx RTC Instance
2958   * @retval None
2959   */
2960 __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2961 {
2962   CLEAR_BIT(RTCx->CR, RTC_CR_TAMPTS);
2963 }
2964 #endif /* !TAMP */
2965 
2966 /**
2967   * @}
2968   */
2969 
2970 /** @defgroup RTC_LL_EF_Tamper Tamper
2971   * @ingroup RTEMSBSPsARMSTM32H7
2972   * @{
2973   */
2974 
2975 #if !defined(TAMP)
2976 /**
2977   * @brief  Enable RTC_TAMPx input detection
2978   * @rmtoll TAMPCR       TAMP1E        LL_RTC_TAMPER_Enable
2979   *         TAMPCR       TAMP2E        LL_RTC_TAMPER_Enable
2980   *         TAMPCR       TAMP3E        LL_RTC_TAMPER_Enable
2981   * @param  RTCx RTC Instance
2982   * @param  Tamper This parameter can be a combination of the following values:
2983   *         @arg @ref LL_RTC_TAMPER_1
2984   *         @arg @ref LL_RTC_TAMPER_2
2985   *         @arg @ref LL_RTC_TAMPER_3
2986   *
2987   * @retval None
2988   */
2989 __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
2990 {
2991   SET_BIT(RTCx->TAMPCR, Tamper);
2992 }
2993 
2994 /**
2995   * @brief  Clear RTC_TAMPx input detection
2996   * @rmtoll TAMPCR       TAMP1E        LL_RTC_TAMPER_Disable
2997   *         TAMPCR       TAMP2E        LL_RTC_TAMPER_Disable
2998   *         TAMPCR       TAMP3E        LL_RTC_TAMPER_Disable
2999   * @param  RTCx RTC Instance
3000   * @param  Tamper This parameter can be a combination of the following values:
3001   *         @arg @ref LL_RTC_TAMPER_1
3002   *         @arg @ref LL_RTC_TAMPER_2
3003   *         @arg @ref LL_RTC_TAMPER_3
3004   *
3005   * @retval None
3006   */
3007 __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
3008 {
3009   CLEAR_BIT(RTCx->TAMPCR, Tamper);
3010 }
3011 
3012 /**
3013   * @brief  Enable Tamper mask flag
3014   * @note Associated Tamper IT must not enabled when tamper mask is set.
3015   * @rmtoll TAMPCR       TAMP1MF       LL_RTC_TAMPER_EnableMask
3016   *         TAMPCR       TAMP2MF       LL_RTC_TAMPER_EnableMask
3017   *         TAMPCR       TAMP3MF       LL_RTC_TAMPER_EnableMask
3018   * @param  RTCx RTC Instance
3019   * @param  Mask This parameter can be a combination of the following values:
3020   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
3021   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
3022   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
3023   *
3024   * @retval None
3025   */
3026 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(RTC_TypeDef *RTCx, uint32_t Mask)
3027 {
3028   SET_BIT(RTCx->TAMPCR, Mask);
3029 }
3030 
3031 /**
3032   * @brief  Disable Tamper mask flag
3033   * @rmtoll TAMPCR       TAMP1MF       LL_RTC_TAMPER_DisableMask
3034   *         TAMPCR       TAMP2MF       LL_RTC_TAMPER_DisableMask
3035   *         TAMPCR       TAMP3MF       LL_RTC_TAMPER_DisableMask
3036   * @param  RTCx RTC Instance
3037   * @param  Mask This parameter can be a combination of the following values:
3038   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
3039   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
3040   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
3041   *
3042   * @retval None
3043   */
3044 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(RTC_TypeDef *RTCx, uint32_t Mask)
3045 {
3046   CLEAR_BIT(RTCx->TAMPCR, Mask);
3047 }
3048 
3049 /**
3050   * @brief  Enable backup register erase after Tamper event detection
3051   * @rmtoll TAMPCR       TAMP1NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3052   *         TAMPCR       TAMP2NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3053   *         TAMPCR       TAMP3NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3054   * @param  RTCx RTC Instance
3055   * @param  Tamper This parameter can be a combination of the following values:
3056   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
3057   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
3058   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
3059   *
3060   * @retval None
3061   */
3062 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
3063 {
3064   CLEAR_BIT(RTCx->TAMPCR, Tamper);
3065 }
3066 
3067 /**
3068   * @brief  Disable backup register erase after Tamper event detection
3069   * @rmtoll TAMPCR       TAMP1NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3070   *         TAMPCR       TAMP2NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3071   *         TAMPCR       TAMP3NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3072   * @param  RTCx RTC Instance
3073   * @param  Tamper This parameter can be a combination of the following values:
3074   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
3075   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
3076   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
3077   *
3078   * @retval None
3079   */
3080 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
3081 {
3082   SET_BIT(RTCx->TAMPCR, Tamper);
3083 }
3084 
3085 /**
3086   * @brief  Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
3087   * @rmtoll TAMPCR       TAMPPUDIS     LL_RTC_TAMPER_DisablePullUp
3088   * @param  RTCx RTC Instance
3089   * @retval None
3090   */
3091 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
3092 {
3093   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
3094 }
3095 
3096 /**
3097   * @brief  Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
3098   * @rmtoll TAMPCR       TAMPPUDIS     LL_RTC_TAMPER_EnablePullUp
3099   * @param  RTCx RTC Instance
3100   * @retval None
3101   */
3102 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
3103 {
3104   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPUDIS);
3105 }
3106 
3107 /**
3108   * @brief  Set RTC_TAMPx precharge duration
3109   * @rmtoll TAMPCR       TAMPPRCH      LL_RTC_TAMPER_SetPrecharge
3110   * @param  RTCx RTC Instance
3111   * @param  Duration This parameter can be one of the following values:
3112   *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3113   *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3114   *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3115   *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3116   * @retval None
3117   */
3118 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
3119 {
3120   MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH, Duration);
3121 }
3122 
3123 /**
3124   * @brief  Get RTC_TAMPx precharge duration
3125   * @rmtoll TAMPCR       TAMPPRCH      LL_RTC_TAMPER_GetPrecharge
3126   * @param  RTCx RTC Instance
3127   * @retval Returned value can be one of the following values:
3128   *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3129   *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3130   *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3131   *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3132   */
3133 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
3134 {
3135   return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPPRCH));
3136 }
3137 
3138 /**
3139   * @brief  Set RTC_TAMPx filter count
3140   * @rmtoll TAMPCR       TAMPFLT       LL_RTC_TAMPER_SetFilterCount
3141   * @param  RTCx RTC Instance
3142   * @param  FilterCount This parameter can be one of the following values:
3143   *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3144   *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3145   *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3146   *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3147   * @retval None
3148   */
3149 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
3150 {
3151   MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT, FilterCount);
3152 }
3153 
3154 /**
3155   * @brief  Get RTC_TAMPx filter count
3156   * @rmtoll TAMPCR       TAMPFLT       LL_RTC_TAMPER_GetFilterCount
3157   * @param  RTCx RTC Instance
3158   * @retval Returned value can be one of the following values:
3159   *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3160   *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3161   *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3162   *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3163   */
3164 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
3165 {
3166   return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFLT));
3167 }
3168 
3169 /**
3170   * @brief  Set Tamper sampling frequency
3171   * @rmtoll TAMPCR       TAMPFREQ      LL_RTC_TAMPER_SetSamplingFreq
3172   * @param  RTCx RTC Instance
3173   * @param  SamplingFreq This parameter can be one of the following values:
3174   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3175   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3176   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3177   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3178   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3179   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3180   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3181   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3182   * @retval None
3183   */
3184 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
3185 {
3186   MODIFY_REG(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ, SamplingFreq);
3187 }
3188 
3189 /**
3190   * @brief  Get Tamper sampling frequency
3191   * @rmtoll TAMPCR       TAMPFREQ      LL_RTC_TAMPER_GetSamplingFreq
3192   * @param  RTCx RTC Instance
3193   * @retval Returned value can be one of the following values:
3194   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3195   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3196   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3197   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3198   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3199   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3200   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3201   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3202   */
3203 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
3204 {
3205   return (uint32_t)(READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPFREQ));
3206 }
3207 
3208 /**
3209   * @brief  Enable Active level for Tamper input
3210   * @rmtoll TAMPCR       TAMP1TRG      LL_RTC_TAMPER_EnableActiveLevel
3211   *         TAMPCR       TAMP2TRG      LL_RTC_TAMPER_EnableActiveLevel
3212   *         TAMPCR       TAMP3TRG      LL_RTC_TAMPER_EnableActiveLevel
3213   * @param  RTCx RTC Instance
3214   * @param  Tamper This parameter can be a combination of the following values:
3215   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
3216   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
3217   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
3218   *
3219   * @retval None
3220   */
3221 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
3222 {
3223   SET_BIT(RTCx->TAMPCR, Tamper);
3224 }
3225 
3226 /**
3227   * @brief  Disable Active level for Tamper input
3228   * @rmtoll TAMPCR       TAMP1TRG      LL_RTC_TAMPER_DisableActiveLevel
3229   *         TAMPCR       TAMP2TRG      LL_RTC_TAMPER_DisableActiveLevel
3230   *         TAMPCR       TAMP3TRG      LL_RTC_TAMPER_DisableActiveLevel
3231   * @param  RTCx RTC Instance
3232   * @param  Tamper This parameter can be a combination of the following values:
3233   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
3234   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
3235   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
3236   *
3237   * @retval None
3238   */
3239 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
3240 {
3241   CLEAR_BIT(RTCx->TAMPCR, Tamper);
3242 }
3243 #endif /* !TAMP */
3244 
3245 #if defined(TAMP)
3246 /**
3247   * @brief  Enable TAMPx input detection
3248   * @rmtoll TAMP_CR1       TAMP1E        LL_RTC_TAMPER_Enable
3249   *         TAMP_CR1       TAMP2E        LL_RTC_TAMPER_Enable
3250   *         TAMP_CR1       TAMP3E        LL_RTC_TAMPER_Enable
3251   * @param  TAMPx TAMP Instance
3252   * @param  Tamper This parameter can be a combination of the following values:
3253   *         @arg @ref LL_RTC_TAMPER_1
3254   *         @arg @ref LL_RTC_TAMPER_2
3255   *         @arg @ref LL_RTC_TAMPER_3
3256   *
3257   * @retval None
3258   */
3259 __STATIC_INLINE void LL_RTC_TAMPER_Enable(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3260 {
3261   SET_BIT(TAMPx->CR1, Tamper);
3262 }
3263 
3264 /**
3265   * @brief  Clear TAMPx input detection
3266   * @rmtoll TAMP_CR1       TAMP1E        LL_RTC_TAMPER_Disable
3267   *         TAMP_CR1       TAMP2E        LL_RTC_TAMPER_Disable
3268   *         TAMP_CR1       TAMP3E        LL_RTC_TAMPER_Disable
3269   * @param  TAMPx TAMP Instance
3270   * @param  Tamper This parameter can be a combination of the following values:
3271   *         @arg @ref LL_RTC_TAMPER_1
3272   *         @arg @ref LL_RTC_TAMPER_2
3273   *         @arg @ref LL_RTC_TAMPER_3
3274   *
3275   * @retval None
3276   */
3277 __STATIC_INLINE void LL_RTC_TAMPER_Disable(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3278 {
3279   CLEAR_BIT(TAMPx->CR1, Tamper);
3280 }
3281 
3282 /**
3283   * @brief  Enable Tamper mask flag
3284   * @note Associated Tamper IT must not enabled when tamper mask is set.
3285   * @rmtoll TAMP_CR2       TAMP1MF       LL_RTC_TAMPER_EnableMask
3286   *         TAMP_CR2       TAMP2MF       LL_RTC_TAMPER_EnableMask
3287   *         TAMP_CR2       TAMP3MF       LL_RTC_TAMPER_EnableMask
3288   * @param  TAMPx TAMP Instance
3289   * @param  Mask This parameter can be a combination of the following values:
3290   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
3291   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
3292   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
3293   *
3294   * @retval None
3295   */
3296 __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(TAMP_TypeDef *TAMPx, uint32_t Mask)
3297 {
3298   SET_BIT(TAMPx->CR2, Mask);
3299 }
3300 
3301 /**
3302   * @brief  Disable Tamper mask flag
3303   * @rmtoll TAMP_CR2       TAMP1MF       LL_RTC_TAMPER_DisableMask
3304   *         TAMP_CR2       TAMP2MF       LL_RTC_TAMPER_DisableMask
3305   *         TAMP_CR2       TAMP3MF       LL_RTC_TAMPER_DisableMask
3306   * @param  TAMPx TAMP Instance
3307   * @param  Mask This parameter can be a combination of the following values:
3308   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
3309   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
3310   *         @arg @ref LL_RTC_TAMPER_MASK_TAMPER3
3311   *
3312   * @retval None
3313   */
3314 __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(TAMP_TypeDef *TAMPx, uint32_t Mask)
3315 {
3316   CLEAR_BIT(TAMPx->CR2, Mask);
3317 }
3318 
3319 /**
3320   * @brief  Enable backup register erase after Tamper event detection
3321   * @rmtoll TAMP_CR2       TAMP1NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3322   *         TAMP_CR2       TAMP2NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3323   *         TAMP_CR2       TAMP3NOERASE  LL_RTC_TAMPER_EnableEraseBKP
3324   * @param  TAMPx TAMP Instance
3325   * @param  Tamper This parameter can be a combination of the following values:
3326   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
3327   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
3328   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
3329   *
3330   * @retval None
3331   */
3332 __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3333 {
3334   CLEAR_BIT(TAMPx->CR2, Tamper);
3335 }
3336 
3337 /**
3338   * @brief  Disable backup register erase after Tamper event detection
3339   * @rmtoll TAMP_CR2       TAMP1NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3340   *         TAMP_CR2       TAMP2NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3341   *         TAMP_CR2       TAMP3NOERASE  LL_RTC_TAMPER_DisableEraseBKP
3342   * @param  TAMPx TAMP Instance
3343   * @param  Tamper This parameter can be a combination of the following values:
3344   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
3345   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
3346   *         @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER3
3347   *
3348   * @retval None
3349   */
3350 __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3351 {
3352   SET_BIT(TAMPx->CR2, Tamper);
3353 }
3354 
3355 /**
3356   * @brief  Enable Active level for Tamper input
3357   * @rmtoll TAMP_CR2       TAMP1TRG      LL_RTC_TAMPER_EnableActiveLevel
3358   *         TAMP_CR2       TAMP2TRG      LL_RTC_TAMPER_EnableActiveLevel
3359   *         TAMP_CR2       TAMP3TRG      LL_RTC_TAMPER_EnableActiveLevel
3360   * @param  TAMPx TAMP Instance
3361   * @param  Tamper This parameter can be a combination of the following values:
3362   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
3363   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
3364   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
3365   *
3366   * @retval None
3367   */
3368 __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3369 {
3370   SET_BIT(TAMPx->CR2, Tamper);
3371 }
3372 
3373 /**
3374   * @brief  Disable Active level for Tamper input
3375   * @rmtoll TAMP_CR2       TAMP1TRG      LL_RTC_TAMPER_DisableActiveLevel
3376   *         TAMP_CR2       TAMP2TRG      LL_RTC_TAMPER_DisableActiveLevel
3377   *         TAMP_CR2       TAMP3TRG      LL_RTC_TAMPER_DisableActiveLevel
3378   * @param  TAMPx TAMP Instance
3379   * @param  Tamper This parameter can be a combination of the following values:
3380   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
3381   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
3382   *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3
3383   *
3384   * @retval None
3385   */
3386 __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(TAMP_TypeDef *TAMPx, uint32_t Tamper)
3387 {
3388   CLEAR_BIT(TAMPx->CR2, Tamper);
3389 }
3390 
3391 /**
3392   * @brief  Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
3393   * @rmtoll TAMP_FLTCR       TAMPPUDIS     LL_RTC_TAMPER_DisablePullUp
3394   * @param  TAMPx TAMP Instance
3395   * @retval None
3396   */
3397 __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(TAMP_TypeDef *TAMPx)
3398 {
3399   SET_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPUDIS);
3400 }
3401 
3402 /**
3403   * @brief  Enable RTC_TAMPx pull-up disable (Precharge RTC_TAMPx pins before sampling)
3404   * @rmtoll TAMP_FLTCR       TAMPPUDIS     LL_RTC_TAMPER_EnablePullUp
3405   * @param  TAMPx TAMP Instance
3406   * @retval None
3407   */
3408 __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(TAMP_TypeDef *TAMPx)
3409 {
3410   CLEAR_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPUDIS);
3411 }
3412 
3413 /**
3414   * @brief  Set RTC_TAMPx precharge duration
3415   * @rmtoll TAMP_FLTCR       TAMPPRCH      LL_RTC_TAMPER_SetPrecharge
3416   * @param  TAMPx TAMP Instance
3417   * @param  Duration This parameter can be one of the following values:
3418   *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3419   *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3420   *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3421   *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3422   * @retval None
3423   */
3424 __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(TAMP_TypeDef *TAMPx, uint32_t Duration)
3425 {
3426   MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPPRCH, Duration);
3427 }
3428 
3429 /**
3430   * @brief  Get RTC_TAMPx precharge duration
3431   * @rmtoll TAMP_FLTCR       TAMPPRCH      LL_RTC_TAMPER_GetPrecharge
3432   * @param  TAMPx TAMP Instance
3433   * @retval Returned value can be one of the following values:
3434   *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
3435   *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
3436   *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
3437   *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
3438   */
3439 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(TAMP_TypeDef *TAMPx)
3440 {
3441   return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPPRCH));
3442 }
3443 
3444 /**
3445   * @brief  Set RTC_TAMPx filter count
3446   * @rmtoll TAMP_FLTCR       TAMPFLT       LL_RTC_TAMPER_SetFilterCount
3447   * @param  TAMPx TAMP Instance
3448   * @param  FilterCount This parameter can be one of the following values:
3449   *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3450   *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3451   *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3452   *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3453   * @retval None
3454   */
3455 __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(TAMP_TypeDef *TAMPx, uint32_t FilterCount)
3456 {
3457   MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPFLT, FilterCount);
3458 }
3459 
3460 /**
3461   * @brief  Get RTC_TAMPx filter count
3462   * @rmtoll TAMP_FLTCR       TAMPFLT       LL_RTC_TAMPER_GetFilterCount
3463   * @param  TAMPx TAMP Instance
3464   * @retval Returned value can be one of the following values:
3465   *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
3466   *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
3467   *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
3468   *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
3469   */
3470 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(TAMP_TypeDef *TAMPx)
3471 {
3472   return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPFLT));
3473 }
3474 
3475 /**
3476   * @brief  Set Tamper sampling frequency
3477   * @rmtoll TAMP_FLTCR       TAMPFREQ      LL_RTC_TAMPER_SetSamplingFreq
3478   * @param  TAMPx TAMP Instance
3479   * @param  SamplingFreq This parameter can be one of the following values:
3480   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3481   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3482   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3483   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3484   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3485   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3486   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3487   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3488   * @retval None
3489   */
3490 __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(TAMP_TypeDef *TAMPx, uint32_t SamplingFreq)
3491 {
3492   MODIFY_REG(TAMPx->FLTCR, TAMP_FLTCR_TAMPFREQ, SamplingFreq);
3493 }
3494 
3495 /**
3496   * @brief  Get Tamper sampling frequency
3497   * @rmtoll TAMP_FLTCR       TAMPFREQ      LL_RTC_TAMPER_GetSamplingFreq
3498   * @param  TAMPx TAMP Instance
3499   * @retval Returned value can be one of the following values:
3500   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
3501   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
3502   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
3503   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
3504   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
3505   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
3506   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
3507   *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
3508   */
3509 __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(TAMP_TypeDef *TAMPx)
3510 {
3511   return (uint32_t)(READ_BIT(TAMPx->FLTCR, TAMP_FLTCR_TAMPFREQ));
3512 }
3513 #endif /* TAMP */
3514 
3515 /**
3516   * @}
3517   */
3518 
3519 /** @defgroup RTC_LL_EF_Wakeup Wakeup
3520   * @ingroup RTEMSBSPsARMSTM32H7
3521   * @{
3522   */
3523 
3524 /**
3525   * @brief  Enable Wakeup timer
3526   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3527   * @rmtoll RTC_CR           WUTE          LL_RTC_WAKEUP_Enable
3528   * @param  RTCx RTC Instance
3529   * @retval None
3530   */
3531 __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
3532 {
3533   SET_BIT(RTCx->CR, RTC_CR_WUTE);
3534 }
3535 
3536 /**
3537   * @brief  Disable Wakeup timer
3538   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3539   * @rmtoll RTC_CR           WUTE          LL_RTC_WAKEUP_Disable
3540   * @param  RTCx RTC Instance
3541   * @retval None
3542   */
3543 __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
3544 {
3545   CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
3546 }
3547 
3548 /**
3549   * @brief  Check if Wakeup timer is enabled or not
3550   * @rmtoll RTC_CR           WUTE          LL_RTC_WAKEUP_IsEnabled
3551   * @param  RTCx RTC Instance
3552   * @retval State of bit (1 or 0).
3553   */
3554 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
3555 {
3556   return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1UL : 0UL);
3557 }
3558 
3559 /**
3560   * @brief  Select Wakeup clock
3561   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3562   * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
3563   * @rmtoll RTC_CR           WUCKSEL       LL_RTC_WAKEUP_SetClock
3564   * @param  RTCx RTC Instance
3565   * @param  WakeupClock This parameter can be one of the following values:
3566   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3567   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3568   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3569   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3570   *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3571   *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3572   * @retval None
3573   */
3574 __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
3575 {
3576   MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
3577 }
3578 
3579 /**
3580   * @brief  Get Wakeup clock
3581   * @rmtoll RTC_CR           WUCKSEL       LL_RTC_WAKEUP_GetClock
3582   * @param  RTCx RTC Instance
3583   * @retval Returned value can be one of the following values:
3584   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
3585   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
3586   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
3587   *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
3588   *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
3589   *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
3590   */
3591 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
3592 {
3593   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
3594 }
3595 
3596 /**
3597   * @brief  Set Wakeup auto-reload value
3598   * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
3599   * @rmtoll RTC_WUTR         WUT           LL_RTC_WAKEUP_SetAutoReload
3600   * @param  RTCx RTC Instance
3601   * @param  Value Value between Min_Data=0x00 and Max_Data=0xFFFF
3602   * @retval None
3603   */
3604 __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
3605 {
3606   MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
3607 }
3608 
3609 /**
3610   * @brief  Get Wakeup auto-reload value
3611   * @rmtoll RTC_WUTR         WUT           LL_RTC_WAKEUP_GetAutoReload
3612   * @param  RTCx RTC Instance
3613   * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
3614   */
3615 __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
3616 {
3617   return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
3618 }
3619 
3620 /**
3621   * @}
3622   */
3623 
3624 
3625 /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
3626   * @ingroup RTEMSBSPsARMSTM32H7
3627   * @{
3628   */
3629 
3630 #if !defined(TAMP)
3631 /**
3632   * @brief  Writes a data in a specified RTC Backup data register.
3633   * @rmtoll BKPxR        BKP           LL_RTC_BAK_SetRegister
3634   * @param  RTCx RTC Instance
3635   * @param  BackupRegister This parameter can be one of the following values:
3636   *         @arg @ref LL_RTC_BKP_DR0
3637   *         @arg @ref LL_RTC_BKP_DR1
3638   *         @arg @ref LL_RTC_BKP_DR2
3639   *         @arg @ref LL_RTC_BKP_DR3
3640   *         @arg @ref LL_RTC_BKP_DR4
3641   *         @arg @ref LL_RTC_BKP_DR5
3642   *         @arg @ref LL_RTC_BKP_DR6
3643   *         @arg @ref LL_RTC_BKP_DR7
3644   *         @arg @ref LL_RTC_BKP_DR8
3645   *         @arg @ref LL_RTC_BKP_DR9
3646   *         @arg @ref LL_RTC_BKP_DR10
3647   *         @arg @ref LL_RTC_BKP_DR11
3648   *         @arg @ref LL_RTC_BKP_DR12
3649   *         @arg @ref LL_RTC_BKP_DR13
3650   *         @arg @ref LL_RTC_BKP_DR14
3651   *         @arg @ref LL_RTC_BKP_DR15
3652   *         @arg @ref LL_RTC_BKP_DR16
3653   *         @arg @ref LL_RTC_BKP_DR17
3654   *         @arg @ref LL_RTC_BKP_DR18
3655   *         @arg @ref LL_RTC_BKP_DR19
3656   *         @arg @ref LL_RTC_BKP_DR20
3657   *         @arg @ref LL_RTC_BKP_DR21
3658   *         @arg @ref LL_RTC_BKP_DR22
3659   *         @arg @ref LL_RTC_BKP_DR23
3660   *         @arg @ref LL_RTC_BKP_DR24
3661   *         @arg @ref LL_RTC_BKP_DR25
3662   *         @arg @ref LL_RTC_BKP_DR26
3663   *         @arg @ref LL_RTC_BKP_DR27
3664   *         @arg @ref LL_RTC_BKP_DR28
3665   *         @arg @ref LL_RTC_BKP_DR29
3666   *         @arg @ref LL_RTC_BKP_DR30
3667   *         @arg @ref LL_RTC_BKP_DR31
3668   * @param  Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3669   * @retval None
3670   */
3671 __STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
3672 {
3673   uint32_t tmp;
3674 
3675   tmp = (uint32_t)(&(RTCx->BKP0R));
3676   tmp += (BackupRegister * 4U);
3677 
3678   /* Write the specified register */
3679   *(__IO uint32_t *)tmp = (uint32_t)Data;
3680 }
3681 
3682 /**
3683   * @brief  Reads data from the specified RTC Backup data Register.
3684   * @rmtoll BKPxR        BKP           LL_RTC_BAK_GetRegister
3685   * @param  RTCx RTC Instance
3686   * @param  BackupRegister This parameter can be one of the following values:
3687   *         @arg @ref LL_RTC_BKP_DR0
3688   *         @arg @ref LL_RTC_BKP_DR1
3689   *         @arg @ref LL_RTC_BKP_DR2
3690   *         @arg @ref LL_RTC_BKP_DR3
3691   *         @arg @ref LL_RTC_BKP_DR4
3692   *         @arg @ref LL_RTC_BKP_DR5
3693   *         @arg @ref LL_RTC_BKP_DR6
3694   *         @arg @ref LL_RTC_BKP_DR7
3695   *         @arg @ref LL_RTC_BKP_DR8
3696   *         @arg @ref LL_RTC_BKP_DR9
3697   *         @arg @ref LL_RTC_BKP_DR10
3698   *         @arg @ref LL_RTC_BKP_DR11
3699   *         @arg @ref LL_RTC_BKP_DR12
3700   *         @arg @ref LL_RTC_BKP_DR13
3701   *         @arg @ref LL_RTC_BKP_DR14
3702   *         @arg @ref LL_RTC_BKP_DR15
3703   *         @arg @ref LL_RTC_BKP_DR16
3704   *         @arg @ref LL_RTC_BKP_DR17
3705   *         @arg @ref LL_RTC_BKP_DR18
3706   *         @arg @ref LL_RTC_BKP_DR19
3707   *         @arg @ref LL_RTC_BKP_DR20
3708   *         @arg @ref LL_RTC_BKP_DR21
3709   *         @arg @ref LL_RTC_BKP_DR22
3710   *         @arg @ref LL_RTC_BKP_DR23
3711   *         @arg @ref LL_RTC_BKP_DR24
3712   *         @arg @ref LL_RTC_BKP_DR25
3713   *         @arg @ref LL_RTC_BKP_DR26
3714   *         @arg @ref LL_RTC_BKP_DR27
3715   *         @arg @ref LL_RTC_BKP_DR28
3716   *         @arg @ref LL_RTC_BKP_DR29
3717   *         @arg @ref LL_RTC_BKP_DR30
3718   *         @arg @ref LL_RTC_BKP_DR31
3719   * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3720   */
3721 __STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
3722 {
3723   uint32_t tmp;
3724 
3725   tmp = (uint32_t)(&(RTCx->BKP0R));
3726   tmp += (BackupRegister * 4U);
3727 
3728   /* Read the specified register */
3729   return (*(__IO uint32_t *)tmp);
3730 }
3731 #else
3732 /**
3733   * @brief  Writes a data in a specified Backup data register.
3734   * @rmtoll TAMP_BKPxR        BKP           LL_RTC_BKP_SetRegister
3735   * @param  TAMPx RTC Instance
3736   * @param  BackupRegister This parameter can be one of the following values:
3737   *         @arg @ref LL_RTC_BKP_DR0
3738   *         @arg @ref LL_RTC_BKP_DR1
3739   *         @arg @ref LL_RTC_BKP_DR2
3740   *         @arg @ref LL_RTC_BKP_DR3
3741   *         @arg @ref LL_RTC_BKP_DR4
3742   *         @arg @ref LL_RTC_BKP_DR5
3743   *         @arg @ref LL_RTC_BKP_DR6
3744   *         @arg @ref LL_RTC_BKP_DR7
3745   *         @arg @ref LL_RTC_BKP_DR8
3746   *         @arg @ref LL_RTC_BKP_DR9
3747   *         @arg @ref LL_RTC_BKP_DR10
3748   *         @arg @ref LL_RTC_BKP_DR11
3749   *         @arg @ref LL_RTC_BKP_DR12
3750   *         @arg @ref LL_RTC_BKP_DR13
3751   *         @arg @ref LL_RTC_BKP_DR14
3752   *         @arg @ref LL_RTC_BKP_DR15
3753   *         @arg @ref LL_RTC_BKP_DR16
3754   *         @arg @ref LL_RTC_BKP_DR17
3755   *         @arg @ref LL_RTC_BKP_DR18
3756   *         @arg @ref LL_RTC_BKP_DR19
3757   *         @arg @ref LL_RTC_BKP_DR20
3758   *         @arg @ref LL_RTC_BKP_DR21
3759   *         @arg @ref LL_RTC_BKP_DR22
3760   *         @arg @ref LL_RTC_BKP_DR23
3761   *         @arg @ref LL_RTC_BKP_DR24
3762   *         @arg @ref LL_RTC_BKP_DR25
3763   *         @arg @ref LL_RTC_BKP_DR26
3764   *         @arg @ref LL_RTC_BKP_DR27
3765   *         @arg @ref LL_RTC_BKP_DR28
3766   *         @arg @ref LL_RTC_BKP_DR29
3767   *         @arg @ref LL_RTC_BKP_DR30
3768   *         @arg @ref LL_RTC_BKP_DR31
3769   * @param  Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3770   * @retval None
3771   */
3772 __STATIC_INLINE void LL_RTC_BKP_SetRegister(TAMP_TypeDef *TAMPx, uint32_t BackupRegister, uint32_t Data)
3773 {
3774   uint32_t tmp;
3775 
3776   tmp = (uint32_t)(&(TAMPx->BKP0R));
3777   tmp += (BackupRegister * 4U);
3778 
3779   /* Write the specified register */
3780   *(__IO uint32_t *)tmp = (uint32_t)Data;
3781 }
3782 
3783 /**
3784   * @brief  Reads data from the specified RTC Backup data Register.
3785   * @rmtoll TAMP_BKPxR        BKP           LL_RTC_BKP_GetRegister
3786   * @param  TAMPx RTC Instance
3787   * @param  BackupRegister This parameter can be one of the following values:
3788   *         @arg @ref LL_RTC_BKP_DR0
3789   *         @arg @ref LL_RTC_BKP_DR1
3790   *         @arg @ref LL_RTC_BKP_DR2
3791   *         @arg @ref LL_RTC_BKP_DR3
3792   *         @arg @ref LL_RTC_BKP_DR4
3793   *         @arg @ref LL_RTC_BKP_DR5
3794   *         @arg @ref LL_RTC_BKP_DR6
3795   *         @arg @ref LL_RTC_BKP_DR7
3796   *         @arg @ref LL_RTC_BKP_DR8
3797   *         @arg @ref LL_RTC_BKP_DR9
3798   *         @arg @ref LL_RTC_BKP_DR10
3799   *         @arg @ref LL_RTC_BKP_DR11
3800   *         @arg @ref LL_RTC_BKP_DR12
3801   *         @arg @ref LL_RTC_BKP_DR13
3802   *         @arg @ref LL_RTC_BKP_DR14
3803   *         @arg @ref LL_RTC_BKP_DR15
3804   *         @arg @ref LL_RTC_BKP_DR16
3805   *         @arg @ref LL_RTC_BKP_DR17
3806   *         @arg @ref LL_RTC_BKP_DR18
3807   *         @arg @ref LL_RTC_BKP_DR19
3808   *         @arg @ref LL_RTC_BKP_DR20
3809   *         @arg @ref LL_RTC_BKP_DR21
3810   *         @arg @ref LL_RTC_BKP_DR22
3811   *         @arg @ref LL_RTC_BKP_DR23
3812   *         @arg @ref LL_RTC_BKP_DR24
3813   *         @arg @ref LL_RTC_BKP_DR25
3814   *         @arg @ref LL_RTC_BKP_DR26
3815   *         @arg @ref LL_RTC_BKP_DR27
3816   *         @arg @ref LL_RTC_BKP_DR28
3817   *         @arg @ref LL_RTC_BKP_DR29
3818   *         @arg @ref LL_RTC_BKP_DR30
3819   *         @arg @ref LL_RTC_BKP_DR31
3820   * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3821   */
3822 __STATIC_INLINE uint32_t LL_RTC_BKP_GetRegister(TAMP_TypeDef *TAMPx, uint32_t BackupRegister)
3823 {
3824   uint32_t tmp;
3825 
3826   tmp = (uint32_t)(&(TAMPx->BKP0R));
3827   tmp += (BackupRegister * 4U);
3828 
3829   /* Read the specified register */
3830   return (*(__IO uint32_t *)tmp);
3831 }
3832 #endif /* !TAMP */
3833 
3834 /**
3835   * @}
3836   */
3837 
3838 
3839 /** @defgroup RTC_LL_EF_Calibration Calibration
3840   * @ingroup RTEMSBSPsARMSTM32H7
3841   * @{
3842   */
3843 
3844 /**
3845   * @brief  Set Calibration output frequency (1 Hz or 512 Hz)
3846   * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3847   * @rmtoll RTC_CR           COE           LL_RTC_CAL_SetOutputFreq
3848   *         RTC_CR           COSEL         LL_RTC_CAL_SetOutputFreq
3849   * @param  RTCx RTC Instance
3850   * @param  Frequency This parameter can be one of the following values:
3851   *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3852   *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3853   *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3854   * @retval None
3855   */
3856 __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
3857 {
3858   MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
3859 }
3860 
3861 /**
3862   * @brief  Get Calibration output frequency (1 Hz or 512 Hz)
3863   * @rmtoll RTC_CR           COE           LL_RTC_CAL_GetOutputFreq
3864   *         RTC_CR           COSEL         LL_RTC_CAL_GetOutputFreq
3865   * @param  RTCx RTC Instance
3866   * @retval Returned value can be one of the following values:
3867   *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3868   *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
3869   *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3870   */
3871 __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
3872 {
3873   return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3874 }
3875 
3876 /**
3877   * @brief  Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3878   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3879   * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3880   * @rmtoll RTC_CALR         CALP          LL_RTC_CAL_SetPulse
3881   * @param  RTCx RTC Instance
3882   * @param  Pulse This parameter can be one of the following values:
3883   *         @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3884   *         @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3885   * @retval None
3886   */
3887 __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3888 {
3889   MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3890 }
3891 
3892 /**
3893   * @brief  Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3894   * @rmtoll RTC_CALR         CALP          LL_RTC_CAL_IsPulseInserted
3895   * @param  RTCx RTC Instance
3896   * @retval State of bit (1 or 0).
3897   */
3898 __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
3899 {
3900   return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1UL : 0UL);
3901 }
3902 
3903 /**
3904   * @brief  Set the calibration cycle period
3905   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3906   * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3907   * @rmtoll RTC_CALR         CALW8         LL_RTC_CAL_SetPeriod
3908   *         RTC_CALR         CALW16        LL_RTC_CAL_SetPeriod
3909   * @param  RTCx RTC Instance
3910   * @param  Period This parameter can be one of the following values:
3911   *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3912   *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3913   *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3914   * @retval None
3915   */
3916 __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3917 {
3918   MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3919 }
3920 
3921 /**
3922   * @brief  Get the calibration cycle period
3923   * @rmtoll RTC_CALR         CALW8         LL_RTC_CAL_GetPeriod
3924   *         RTC_CALR         CALW16        LL_RTC_CAL_GetPeriod
3925   * @param  RTCx RTC Instance
3926   * @retval Returned value can be one of the following values:
3927   *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3928   *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3929   *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3930   */
3931 __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
3932 {
3933   return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3934 }
3935 
3936 /**
3937   * @brief  Set Calibration minus
3938   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3939   * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3940   * @rmtoll RTC_CALR         CALM          LL_RTC_CAL_SetMinus
3941   * @param  RTCx RTC Instance
3942   * @param  CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3943   * @retval None
3944   */
3945 __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3946 {
3947   MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3948 }
3949 
3950 /**
3951   * @brief  Get Calibration minus
3952   * @rmtoll RTC_CALR         CALM          LL_RTC_CAL_GetMinus
3953   * @param  RTCx RTC Instance
3954   * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3955   */
3956 __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
3957 {
3958   return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3959 }
3960 
3961 /**
3962   * @}
3963   */
3964 
3965 
3966 /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3967   * @ingroup RTEMSBSPsARMSTM32H7
3968   * @{
3969   */
3970 
3971 #if !defined(TAMP)
3972 /**
3973   * @brief  Get Internal Time-stamp flag
3974   * @rmtoll RTC_ISR          ITSF          LL_RTC_IsActiveFlag_ITS
3975   * @param  RTCx RTC Instance
3976   * @retval State of bit (1 or 0).
3977   */
3978 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx)
3979 {
3980   return ((READ_BIT(RTCx->ISR, RTC_ISR_ITSF) == (RTC_ISR_ITSF)) ? 1UL : 0UL);
3981 }
3982 
3983 /**
3984   * @brief  Get Recalibration pending Flag
3985   * @rmtoll ISR          RECALPF       LL_RTC_IsActiveFlag_RECALP
3986   * @param  RTCx RTC Instance
3987   * @retval State of bit (1 or 0).
3988   */
3989 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
3990 {
3991   return ((READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)) ? 1UL : 0UL);
3992 }
3993 
3994 /**
3995   * @brief  Get RTC_TAMP3 detection flag
3996   * @rmtoll ISR          TAMP3F        LL_RTC_IsActiveFlag_TAMP3
3997   * @param  RTCx RTC Instance
3998   * @retval State of bit (1 or 0).
3999   */
4000 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
4001 {
4002   return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F)) ? 1UL : 0UL);
4003 }
4004 
4005 /**
4006   * @brief  Get RTC_TAMP2 detection flag
4007   * @rmtoll ISR          TAMP2F        LL_RTC_IsActiveFlag_TAMP2
4008   * @param  RTCx RTC Instance
4009   * @retval State of bit (1 or 0).
4010   */
4011 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
4012 {
4013   return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)) ? 1UL : 0UL);
4014 }
4015 
4016 /**
4017   * @brief  Get RTC_TAMP1 detection flag
4018   * @rmtoll ISR          TAMP1F        LL_RTC_IsActiveFlag_TAMP1
4019   * @param  RTCx RTC Instance
4020   * @retval State of bit (1 or 0).
4021   */
4022 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
4023 {
4024   return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)) ? 1UL : 0UL);
4025 }
4026 
4027 /**
4028   * @brief  Get Time-stamp overflow flag
4029   * @rmtoll ISR          TSOVF         LL_RTC_IsActiveFlag_TSOV
4030   * @param  RTCx RTC Instance
4031   * @retval State of bit (1 or 0).
4032   */
4033 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
4034 {
4035   return ((READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)) ? 1UL : 0UL);
4036 }
4037 
4038 /**
4039   * @brief  Get Time-stamp flag
4040   * @rmtoll ISR          TSF           LL_RTC_IsActiveFlag_TS
4041   * @param  RTCx RTC Instance
4042   * @retval State of bit (1 or 0).
4043   */
4044 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
4045 {
4046   return ((READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)) ? 1UL : 0UL);
4047 }
4048 
4049 /**
4050   * @brief  Get Wakeup timer flag
4051   * @rmtoll ISR          WUTF          LL_RTC_IsActiveFlag_WUT
4052   * @param  RTCx RTC Instance
4053   * @retval State of bit (1 or 0).
4054   */
4055 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
4056 {
4057   return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)) ? 1UL : 0UL);
4058 }
4059 
4060 /**
4061   * @brief  Get Alarm B flag
4062   * @rmtoll ISR          ALRBF         LL_RTC_IsActiveFlag_ALRB
4063   * @param  RTCx RTC Instance
4064   * @retval State of bit (1 or 0).
4065   */
4066 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
4067 {
4068   return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)) ? 1UL : 0UL);
4069 }
4070 
4071 /**
4072   * @brief  Get Alarm A flag
4073   * @rmtoll ISR          ALRAF         LL_RTC_IsActiveFlag_ALRA
4074   * @param  RTCx RTC Instance
4075   * @retval State of bit (1 or 0).
4076   */
4077 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
4078 {
4079   return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)) ? 1UL : 0UL);
4080 }
4081 
4082 /**
4083   * @brief  Clear Internal Time-stamp flag
4084   * @rmtoll ISR          ITSF          LL_RTC_ClearFlag_ITS
4085   * @param  RTCx RTC Instance
4086   * @retval None
4087   */
4088 __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx)
4089 {
4090   WRITE_REG(RTCx->ISR, (~((RTC_ISR_ITSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4091 }
4092 
4093 /**
4094   * @brief  Clear RTC_TAMP3 detection flag
4095   * @rmtoll ISR          TAMP3F        LL_RTC_ClearFlag_TAMP3
4096   * @param  RTCx RTC Instance
4097   * @retval None
4098   */
4099 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
4100 {
4101   WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4102 }
4103 
4104 /**
4105   * @brief  Clear RTC_TAMP2 detection flag
4106   * @rmtoll ISR          TAMP2F        LL_RTC_ClearFlag_TAMP2
4107   * @param  RTCx RTC Instance
4108   * @retval None
4109   */
4110 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
4111 {
4112   WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4113 }
4114 
4115 /**
4116   * @brief  Clear RTC_TAMP1 detection flag
4117   * @rmtoll ISR          TAMP1F        LL_RTC_ClearFlag_TAMP1
4118   * @param  RTCx RTC Instance
4119   * @retval None
4120   */
4121 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
4122 {
4123   WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4124 }
4125 
4126 /**
4127   * @brief  Clear Time-stamp overflow flag
4128   * @rmtoll ISR          TSOVF         LL_RTC_ClearFlag_TSOV
4129   * @param  RTCx RTC Instance
4130   * @retval None
4131   */
4132 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
4133 {
4134   WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4135 }
4136 
4137 /**
4138   * @brief  Clear Time-stamp flag
4139   * @rmtoll ISR          TSF           LL_RTC_ClearFlag_TS
4140   * @param  RTCx RTC Instance
4141   * @retval None
4142   */
4143 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
4144 {
4145   WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4146 }
4147 
4148 /**
4149   * @brief  Clear Wakeup timer flag
4150   * @rmtoll ISR          WUTF          LL_RTC_ClearFlag_WUT
4151   * @param  RTCx RTC Instance
4152   * @retval None
4153   */
4154 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
4155 {
4156   WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4157 }
4158 
4159 /**
4160   * @brief  Clear Alarm B flag
4161   * @rmtoll ISR          ALRBF         LL_RTC_ClearFlag_ALRB
4162   * @param  RTCx RTC Instance
4163   * @retval None
4164   */
4165 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
4166 {
4167   WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4168 }
4169 
4170 /**
4171   * @brief  Clear Alarm A flag
4172   * @rmtoll ISR          ALRAF         LL_RTC_ClearFlag_ALRA
4173   * @param  RTCx RTC Instance
4174   * @retval None
4175   */
4176 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
4177 {
4178   WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4179 }
4180 
4181 /**
4182   * @brief  Get Initialization flag
4183   * @rmtoll ISR          INITF         LL_RTC_IsActiveFlag_INIT
4184   * @param  RTCx RTC Instance
4185   * @retval State of bit (1 or 0).
4186   */
4187 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
4188 {
4189   return ((READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)) ? 1UL : 0UL);
4190 }
4191 
4192 /**
4193   * @brief  Get Registers synchronization flag
4194   * @rmtoll ISR          RSF           LL_RTC_IsActiveFlag_RS
4195   * @param  RTCx RTC Instance
4196   * @retval State of bit (1 or 0).
4197   */
4198 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
4199 {
4200   return ((READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)) ? 1UL : 0UL);
4201 }
4202 
4203 /**
4204   * @brief  Clear Registers synchronization flag
4205   * @rmtoll ISR          RSF           LL_RTC_ClearFlag_RS
4206   * @param  RTCx RTC Instance
4207   * @retval None
4208   */
4209 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
4210 {
4211   WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
4212 }
4213 
4214 /**
4215   * @brief  Get Initialization status flag
4216   * @rmtoll ISR          INITS         LL_RTC_IsActiveFlag_INITS
4217   * @param  RTCx RTC Instance
4218   * @retval State of bit (1 or 0).
4219   */
4220 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
4221 {
4222   return ((READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)) ? 1UL : 0UL);
4223 }
4224 
4225 /**
4226   * @brief  Get Shift operation pending flag
4227   * @rmtoll ISR          SHPF          LL_RTC_IsActiveFlag_SHP
4228   * @param  RTCx RTC Instance
4229   * @retval State of bit (1 or 0).
4230   */
4231 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
4232 {
4233   return ((READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)) ? 1UL : 0UL);
4234 }
4235 
4236 /**
4237   * @brief  Get Wakeup timer write flag
4238   * @rmtoll ISR          WUTWF         LL_RTC_IsActiveFlag_WUTW
4239   * @param  RTCx RTC Instance
4240   * @retval State of bit (1 or 0).
4241   */
4242 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
4243 {
4244   return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)) ? 1UL : 0UL);
4245 }
4246 
4247 /**
4248   * @brief  Get Alarm B write flag
4249   * @rmtoll ISR          ALRBWF        LL_RTC_IsActiveFlag_ALRBW
4250   * @param  RTCx RTC Instance
4251   * @retval State of bit (1 or 0).
4252   */
4253 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
4254 {
4255   return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)) ? 1UL : 0UL);
4256 }
4257 
4258 /**
4259   * @brief  Get Alarm A write flag
4260   * @rmtoll ISR          ALRAWF        LL_RTC_IsActiveFlag_ALRAW
4261   * @param  RTCx RTC Instance
4262   * @retval State of bit (1 or 0).
4263   */
4264 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
4265 {
4266   return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)) ? 1UL : 0UL);
4267 }
4268 #endif /* !TAMP */
4269 
4270 #if defined(TAMP)
4271 /**
4272   * @brief  Get Internal Time-stamp flag
4273   * @rmtoll RTC_SR          ITSF          LL_RTC_IsActiveFlag_ITS
4274   * @param  RTCx RTC Instance
4275   * @retval State of bit (1 or 0).
4276   */
4277 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx)
4278 {
4279   return ((READ_BIT(RTCx->SR, RTC_SR_ITSF) == (RTC_SR_ITSF)) ? 1UL : 0UL);
4280 }
4281 
4282 /**
4283   * @brief  Get Time-stamp overflow flag
4284   * @rmtoll RTC_SR          TSOVF         LL_RTC_IsActiveFlag_TSOV
4285   * @param  RTCx RTC Instance
4286   * @retval State of bit (1 or 0).
4287   */
4288 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
4289 {
4290   return ((READ_BIT(RTCx->SR, RTC_SR_TSOVF) == (RTC_SR_TSOVF)) ? 1UL : 0UL);
4291 }
4292 
4293 /**
4294   * @brief  Get Time-stamp flag
4295   * @rmtoll RTC_SR          TSF           LL_RTC_IsActiveFlag_TS
4296   * @param  RTCx RTC Instance
4297   * @retval State of bit (1 or 0).
4298   */
4299 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
4300 {
4301   return ((READ_BIT(RTCx->SR, RTC_SR_TSF) == (RTC_SR_TSF)) ? 1UL : 0UL);
4302 }
4303 
4304 /**
4305   * @brief  Get Wakeup timer flag
4306   * @rmtoll RTC_SR          WUTF          LL_RTC_IsActiveFlag_WUT
4307   * @param  RTCx RTC Instance
4308   * @retval State of bit (1 or 0).
4309   */
4310 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
4311 {
4312   return ((READ_BIT(RTCx->SR, RTC_SR_WUTF) == (RTC_SR_WUTF)) ? 1UL : 0UL);
4313 }
4314 
4315 /**
4316   * @brief  Get Alarm B flag
4317   * @rmtoll RTC_SR          ALRBF         LL_RTC_IsActiveFlag_ALRB
4318   * @param  RTCx RTC Instance
4319   * @retval State of bit (1 or 0).
4320   */
4321 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
4322 {
4323   return ((READ_BIT(RTCx->SR, RTC_SR_ALRBF) == (RTC_SR_ALRBF)) ? 1UL : 0UL);
4324 }
4325 
4326 /**
4327   * @brief  Get Alarm A flag
4328   * @rmtoll RTC_SR          ALRAF         LL_RTC_IsActiveFlag_ALRA
4329   * @param  RTCx RTC Instance
4330   * @retval State of bit (1 or 0).
4331   */
4332 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
4333 {
4334   return ((READ_BIT(RTCx->SR, RTC_SR_ALRAF) == (RTC_SR_ALRAF)) ? 1UL : 0UL);
4335 }
4336 
4337 /**
4338   * @brief  Clear Internal Time-stamp flag
4339   * @rmtoll RTC_SCR          CITSF          LL_RTC_ClearFlag_ITS
4340   * @param  RTCx RTC Instance
4341   * @retval None
4342   */
4343 __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx)
4344 {
4345   SET_BIT(RTCx->SCR, RTC_SCR_CITSF);
4346 }
4347 
4348 /**
4349   * @brief  Clear Time-stamp overflow flag
4350   * @rmtoll RTC_SCR          CTSOVF         LL_RTC_ClearFlag_TSOV
4351   * @param  RTCx RTC Instance
4352   * @retval None
4353   */
4354 __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
4355 {
4356   SET_BIT(RTCx->SCR, RTC_SCR_CTSOVF);
4357 }
4358 
4359 /**
4360   * @brief  Clear Time-stamp flag
4361   * @rmtoll RTC_SCR          CTSF           LL_RTC_ClearFlag_TS
4362   * @param  RTCx RTC Instance
4363   * @retval None
4364   */
4365 __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
4366 {
4367   SET_BIT(RTCx->SCR, RTC_SCR_CTSF);
4368 }
4369 
4370 /**
4371   * @brief  Clear Wakeup timer flag
4372   * @rmtoll RTC_SCR          CWUTF          LL_RTC_ClearFlag_WUT
4373   * @param  RTCx RTC Instance
4374   * @retval None
4375   */
4376 __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
4377 {
4378   SET_BIT(RTCx->SCR, RTC_SCR_CWUTF);
4379 }
4380 
4381 /**
4382   * @brief  Clear Alarm B flag
4383   * @rmtoll RTC_SCR          CALRBF         LL_RTC_ClearFlag_ALRB
4384   * @param  RTCx RTC Instance
4385   * @retval None
4386   */
4387 __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
4388 {
4389   SET_BIT(RTCx->SCR, RTC_SCR_CALRBF);
4390 }
4391 
4392 /**
4393   * @brief  Clear Alarm A flag
4394   * @rmtoll RTC_SCR          CALRAF         LL_RTC_ClearFlag_ALRA
4395   * @param  RTCx RTC Instance
4396   * @retval None
4397   */
4398 __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
4399 {
4400   SET_BIT(RTCx->SCR, RTC_SCR_CALRAF);
4401 }
4402 
4403 /**
4404   * @brief  Get Recalibration pending Flag
4405   * @rmtoll RTC_ICSR          RECALPF       LL_RTC_IsActiveFlag_RECALP
4406   * @param  RTCx RTC Instance
4407   * @retval State of bit (1 or 0).
4408   */
4409 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
4410 {
4411   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RECALPF) == (RTC_ICSR_RECALPF)) ? 1UL : 0UL);
4412 }
4413 
4414 /**
4415   * @brief  Get Initialization flag
4416   * @rmtoll RTC_ICSR          INITF         LL_RTC_IsActiveFlag_INIT
4417   * @param  RTCx RTC Instance
4418   * @retval State of bit (1 or 0).
4419   */
4420 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
4421 {
4422   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITF) == (RTC_ICSR_INITF)) ? 1UL : 0UL);
4423 }
4424 
4425 /**
4426   * @brief  Get Registers synchronization flag
4427   * @rmtoll RTC_ICSR          RSF           LL_RTC_IsActiveFlag_RS
4428   * @param  RTCx RTC Instance
4429   * @retval State of bit (1 or 0).
4430   */
4431 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
4432 {
4433   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RSF) == (RTC_ICSR_RSF)) ? 1UL : 0UL);
4434 }
4435 
4436 /**
4437   * @brief  Clear Registers synchronization flag
4438   * @rmtoll RTC_ICSR          RSF           LL_RTC_ClearFlag_RS
4439   * @param  RTCx RTC Instance
4440   * @retval None
4441   */
4442 __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
4443 {
4444   WRITE_REG(RTCx->ICSR, (~((RTC_ICSR_RSF | RTC_ICSR_INIT) & 0x000000FFU) | (RTCx->ICSR & RTC_ICSR_INIT)));
4445 }
4446 
4447 /**
4448   * @brief  Get Initialization status flag
4449   * @rmtoll RTC_ICSR          INITS         LL_RTC_IsActiveFlag_INITS
4450   * @param  RTCx RTC Instance
4451   * @retval State of bit (1 or 0).
4452   */
4453 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
4454 {
4455   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITS) == (RTC_ICSR_INITS)) ? 1UL : 0UL);
4456 }
4457 
4458 /**
4459   * @brief  Get Shift operation pending flag
4460   * @rmtoll RTC_ICSR          SHPF          LL_RTC_IsActiveFlag_SHP
4461   * @param  RTCx RTC Instance
4462   * @retval State of bit (1 or 0).
4463   */
4464 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
4465 {
4466   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_SHPF) == (RTC_ICSR_SHPF)) ? 1UL : 0UL);
4467 }
4468 
4469 /**
4470   * @brief  Get Wakeup timer write flag
4471   * @rmtoll RTC_ICSR          WUTWF         LL_RTC_IsActiveFlag_WUTW
4472   * @param  RTCx RTC Instance
4473   * @retval State of bit (1 or 0).
4474   */
4475 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
4476 {
4477   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_WUTWF) == (RTC_ICSR_WUTWF)) ? 1UL : 0UL);
4478 }
4479 
4480 /**
4481   * @brief  Get Alarm B write flag
4482   * @rmtoll RTC_ICSR         ALRBWF        LL_RTC_IsActiveFlag_ALRBW
4483   * @param  RTCx RTC Instance
4484   * @retval State of bit (1 or 0).
4485   */
4486 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
4487 {
4488   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_ALRBWF) == (RTC_ICSR_ALRBWF)) ? 1UL : 0UL);
4489 }
4490 
4491 /**
4492   * @brief  Get Alarm A write flag
4493   * @rmtoll RTC_ICSR         ALRAWF        LL_RTC_IsActiveFlag_ALRAW
4494   * @param  RTCx RTC Instance
4495   * @retval State of bit (1 or 0).
4496   */
4497 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
4498 {
4499   return ((READ_BIT(RTCx->ICSR, RTC_ICSR_ALRAWF) == (RTC_ICSR_ALRAWF)) ? 1UL : 0UL);
4500 }
4501 
4502 /**
4503   * @brief  Get Alarm A masked flag.
4504   * @rmtoll RTC_MISR          ALRAMF        LL_RTC_IsActiveFlag_ALRAM
4505   * @param  RTCx RTC Instance
4506   * @retval State of bit (1 or 0).
4507   */
4508 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAM(RTC_TypeDef *RTCx)
4509 {
4510   return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRAMF) == (RTC_MISR_ALRAMF)) ? 1UL : 0UL);
4511 }
4512 
4513 /**
4514   * @brief  Get Alarm B masked flag.
4515   * @rmtoll RTC_MISR          ALRBMF        LL_RTC_IsActiveFlag_ALRBM
4516   * @param  RTCx RTC Instance
4517   * @retval State of bit (1 or 0).
4518   */
4519 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBM(RTC_TypeDef *RTCx)
4520 {
4521   return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRBMF) == (RTC_MISR_ALRBMF)) ? 1UL : 0UL);
4522 }
4523 
4524 /**
4525   * @brief  Get Wakeup timer masked flag.
4526   * @rmtoll RTC_MISR          WUTMF        LL_RTC_IsActiveFlag_WUTM
4527   * @param  RTCx RTC Instance
4528   * @retval State of bit (1 or 0).
4529   */
4530 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTM(RTC_TypeDef *RTCx)
4531 {
4532   return ((READ_BIT(RTCx->MISR, RTC_MISR_WUTMF) == (RTC_MISR_WUTMF)) ? 1UL : 0UL);
4533 }
4534 
4535 /**
4536   * @brief  Get Time-stamp masked flag.
4537   * @rmtoll RTC_MISR          TSMF        LL_RTC_IsActiveFlag_TSM
4538   * @param  RTCx RTC Instance
4539   * @retval State of bit (1 or 0).
4540   */
4541 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSM(RTC_TypeDef *RTCx)
4542 {
4543   return ((READ_BIT(RTCx->MISR, RTC_MISR_TSMF) == (RTC_MISR_TSMF)) ? 1UL : 0UL);
4544 }
4545 
4546 /**
4547   * @brief  Get Time-stamp overflow masked flag.
4548   * @rmtoll RTC_MISR          TSOVMF        LL_RTC_IsActiveFlag_TSOVM
4549   * @param  RTCx RTC Instance
4550   * @retval State of bit (1 or 0).
4551   */
4552 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOVM(RTC_TypeDef *RTCx)
4553 {
4554   return ((READ_BIT(RTCx->MISR, RTC_MISR_TSOVMF) == (RTC_MISR_TSOVMF)) ? 1UL : 0UL);
4555 }
4556 
4557 /**
4558   * @brief  Get Internal Time-stamp masked flag.
4559   * @rmtoll RTC_MISR          ITSMF        LL_RTC_IsActiveFlag_ITSM
4560   * @param  RTCx RTC Instance
4561   * @retval State of bit (1 or 0).
4562   */
4563 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITSM(RTC_TypeDef *RTCx)
4564 {
4565   return ((READ_BIT(RTCx->MISR, RTC_MISR_ITSMF) == (RTC_MISR_ITSMF)) ? 1UL : 0UL);
4566 }
4567 
4568 /**
4569   * @brief  Get tamper 1 detection flag.
4570   * @rmtoll TAMP_SR          TAMP1F        LL_RTC_IsActiveFlag_TAMP1
4571   * @param  TAMPx TAMP Instance
4572   * @retval State of bit (1 or 0).
4573   */
4574 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(TAMP_TypeDef *TAMPx)
4575 {
4576   return ((READ_BIT(TAMPx->SR, TAMP_SR_TAMP1F) == (TAMP_SR_TAMP1F)) ? 1UL : 0UL);
4577 }
4578 
4579 /**
4580   * @brief  Get tamper 2 detection flag.
4581   * @rmtoll TAMP_SR          TAMP2F        LL_RTC_IsActiveFlag_TAMP2
4582   * @param  TAMPx TAMP Instance
4583   * @retval State of bit (1 or 0).
4584   */
4585 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(TAMP_TypeDef *TAMPx)
4586 {
4587   return ((READ_BIT(TAMPx->SR, TAMP_SR_TAMP2F) == (TAMP_SR_TAMP2F)) ? 1UL : 0UL);
4588 }
4589 
4590 /**
4591   * @brief  Get tamper 3 detection flag.
4592   * @rmtoll TAMP_SR          TAMP3F        LL_RTC_IsActiveFlag_TAMP3
4593   * @param  TAMPx TAMP Instance
4594   * @retval State of bit (1 or 0).
4595   */
4596 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(TAMP_TypeDef *TAMPx)
4597 {
4598   return ((READ_BIT(TAMPx->SR, TAMP_SR_TAMP3F) == (TAMP_SR_TAMP3F)) ? 1UL : 0UL);
4599 }
4600 
4601 /**
4602   * @brief  Get tamper 1 interrupt masked flag.
4603   * @rmtoll TAMP_MISR          TAMP1MF        LL_RTC_IsActiveFlag_TAMP1M
4604   * @param  TAMPx TAMP Instance
4605   * @retval State of bit (1 or 0).
4606   */
4607 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1M(TAMP_TypeDef *TAMPx)
4608 {
4609   return ((READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP1MF) == (TAMP_MISR_TAMP1MF)) ? 1UL : 0UL);
4610 }
4611 
4612 /**
4613   * @brief  Get tamper 2 interrupt masked flag.
4614   * @rmtoll TAMP_MISR          TAMP2MF        LL_RTC_IsActiveFlag_TAMP2M
4615   * @param  TAMPx TAMP Instance
4616   * @retval State of bit (1 or 0).
4617   */
4618 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2M(TAMP_TypeDef *TAMPx)
4619 {
4620   return ((READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP2MF) == (TAMP_MISR_TAMP2MF)) ? 1UL : 0UL);
4621 }
4622 
4623 /**
4624   * @brief  Get tamper 3 interrupt masked flag.
4625   * @rmtoll TAMP_MISR          TAMP3MF        LL_RTC_IsActiveFlag_TAMP3M
4626   * @param  TAMPx TAMP Instance
4627   * @retval State of bit (1 or 0).
4628   */
4629 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3M(TAMP_TypeDef *TAMPx)
4630 {
4631   return ((READ_BIT(TAMPx->MISR, TAMP_MISR_TAMP3MF) == (TAMP_MISR_TAMP3MF)) ? 1UL : 0UL);
4632 }
4633 
4634 /**
4635   * @brief  Clear tamper 1 detection flag.
4636   * @rmtoll TAMP_SCR          CTAMP1F         LL_RTC_ClearFlag_TAMP1
4637   * @param  TAMPx TAMP Instance
4638   * @retval None
4639   */
4640 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(TAMP_TypeDef *TAMPx)
4641 {
4642   SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP1F);
4643 }
4644 
4645 /**
4646   * @brief  Clear tamper 2 detection flag.
4647   * @rmtoll TAMP_SCR          CTAMP2F         LL_RTC_ClearFlag_TAMP2
4648   * @param  TAMPx TAMP Instance
4649   * @retval None
4650   */
4651 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(TAMP_TypeDef *TAMPx)
4652 {
4653   SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP2F);
4654 }
4655 
4656 /**
4657   * @brief  Clear tamper 3 detection flag.
4658   * @rmtoll TAMP_SCR          CTAMP3F         LL_RTC_ClearFlag_TAMP3
4659   * @param  TAMPx TAMP Instance
4660   * @retval None
4661   */
4662 __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(TAMP_TypeDef *TAMPx)
4663 {
4664   SET_BIT(TAMPx->SCR, TAMP_SCR_CTAMP3F);
4665 }
4666 #endif /* TAMP */
4667 
4668 /**
4669   * @}
4670   */
4671 
4672 /** @defgroup RTC_LL_EF_IT_Management IT_Management
4673   * @ingroup RTEMSBSPsARMSTM32H7
4674   * @{
4675   */
4676 
4677 /**
4678   * @brief  Enable Time-stamp interrupt
4679   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4680   * @rmtoll RTC_CR          TSIE         LL_RTC_EnableIT_TS
4681   * @param  RTCx RTC Instance
4682   * @retval None
4683   */
4684 __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
4685 {
4686   SET_BIT(RTCx->CR, RTC_CR_TSIE);
4687 }
4688 
4689 /**
4690   * @brief  Disable Time-stamp interrupt
4691   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4692   * @rmtoll RTC_CR          TSIE         LL_RTC_DisableIT_TS
4693   * @param  RTCx RTC Instance
4694   * @retval None
4695   */
4696 __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
4697 {
4698   CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
4699 }
4700 
4701 /**
4702   * @brief  Enable Wakeup timer interrupt
4703   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4704   * @rmtoll RTC_CR          WUTIE         LL_RTC_EnableIT_WUT
4705   * @param  RTCx RTC Instance
4706   * @retval None
4707   */
4708 __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
4709 {
4710   SET_BIT(RTCx->CR, RTC_CR_WUTIE);
4711 }
4712 
4713 /**
4714   * @brief  Disable Wakeup timer interrupt
4715   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4716   * @rmtoll RTC_CR          WUTIE         LL_RTC_DisableIT_WUT
4717   * @param  RTCx RTC Instance
4718   * @retval None
4719   */
4720 __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
4721 {
4722   CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
4723 }
4724 
4725 /**
4726   * @brief  Enable Alarm B interrupt
4727   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4728   * @rmtoll RTC_CR           ALRBIE        LL_RTC_EnableIT_ALRB
4729   * @param  RTCx RTC Instance
4730   * @retval None
4731   */
4732 __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
4733 {
4734   SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
4735 }
4736 
4737 /**
4738   * @brief  Disable Alarm B interrupt
4739   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4740   * @rmtoll RTC_CR           ALRBIE        LL_RTC_DisableIT_ALRB
4741   * @param  RTCx RTC Instance
4742   * @retval None
4743   */
4744 __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
4745 {
4746   CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
4747 }
4748 
4749 /**
4750   * @brief  Enable Alarm A interrupt
4751   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4752   * @rmtoll RTC_CR           ALRAIE        LL_RTC_EnableIT_ALRA
4753   * @param  RTCx RTC Instance
4754   * @retval None
4755   */
4756 __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
4757 {
4758   SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
4759 }
4760 
4761 /**
4762   * @brief  Disable Alarm A interrupt
4763   * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
4764   * @rmtoll RTC_CR           ALRAIE        LL_RTC_DisableIT_ALRA
4765   * @param  RTCx RTC Instance
4766   * @retval None
4767   */
4768 __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
4769 {
4770   CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
4771 }
4772 
4773 #if !defined(TAMP)
4774 /**
4775   * @brief  Enable Tamper 3 interrupt
4776   * @rmtoll TAMPCR       TAMP3IE       LL_RTC_EnableIT_TAMP3
4777   * @param  RTCx RTC Instance
4778   * @retval None
4779   */
4780 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx)
4781 {
4782   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
4783 }
4784 
4785 /**
4786   * @brief  Disable Tamper 3 interrupt
4787   * @rmtoll TAMPCR       TAMP3IE       LL_RTC_DisableIT_TAMP3
4788   * @param  RTCx RTC Instance
4789   * @retval None
4790   */
4791 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx)
4792 {
4793   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE);
4794 }
4795 
4796 /**
4797   * @brief  Enable Tamper 2 interrupt
4798   * @rmtoll TAMPCR       TAMP2IE       LL_RTC_EnableIT_TAMP2
4799   * @param  RTCx RTC Instance
4800   * @retval None
4801   */
4802 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(RTC_TypeDef *RTCx)
4803 {
4804   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
4805 }
4806 
4807 /**
4808   * @brief  Disable Tamper 2 interrupt
4809   * @rmtoll TAMPCR       TAMP2IE       LL_RTC_DisableIT_TAMP2
4810   * @param  RTCx RTC Instance
4811   * @retval None
4812   */
4813 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(RTC_TypeDef *RTCx)
4814 {
4815   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE);
4816 }
4817 
4818 /**
4819   * @brief  Enable Tamper 1 interrupt
4820   * @rmtoll TAMPCR       TAMP1IE       LL_RTC_EnableIT_TAMP1
4821   * @param  RTCx RTC Instance
4822   * @retval None
4823   */
4824 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(RTC_TypeDef *RTCx)
4825 {
4826   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
4827 }
4828 
4829 /**
4830   * @brief  Disable Tamper 1 interrupt
4831   * @rmtoll TAMPCR       TAMP1IE       LL_RTC_DisableIT_TAMP1
4832   * @param  RTCx RTC Instance
4833   * @retval None
4834   */
4835 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(RTC_TypeDef *RTCx)
4836 {
4837   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE);
4838 }
4839 
4840 /**
4841   * @brief  Enable all Tamper Interrupt
4842   * @rmtoll TAMPCR       TAMPIE        LL_RTC_EnableIT_TAMP
4843   * @param  RTCx RTC Instance
4844   * @retval None
4845   */
4846 __STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
4847 {
4848   SET_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
4849 }
4850 
4851 /**
4852   * @brief  Disable all Tamper Interrupt
4853   * @rmtoll TAMPCR       TAMPIE        LL_RTC_DisableIT_TAMP
4854   * @param  RTCx RTC Instance
4855   * @retval None
4856   */
4857 __STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
4858 {
4859   CLEAR_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE);
4860 }
4861 #endif /* !TAMP */
4862 
4863 /**
4864   * @brief  Check if  Time-stamp interrupt is enabled or not
4865   * @rmtoll CR           TSIE          LL_RTC_IsEnabledIT_TS
4866   * @param  RTCx RTC Instance
4867   * @retval State of bit (1 or 0).
4868   */
4869 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
4870 {
4871   return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1UL : 0UL);
4872 }
4873 
4874 /**
4875   * @brief  Check if  Wakeup timer interrupt is enabled or not
4876   * @rmtoll CR           WUTIE         LL_RTC_IsEnabledIT_WUT
4877   * @param  RTCx RTC Instance
4878   * @retval State of bit (1 or 0).
4879   */
4880 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
4881 {
4882   return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1UL : 0UL);
4883 }
4884 
4885 /**
4886   * @brief  Check if  Alarm B interrupt is enabled or not
4887   * @rmtoll CR           ALRBIE        LL_RTC_IsEnabledIT_ALRB
4888   * @param  RTCx RTC Instance
4889   * @retval State of bit (1 or 0).
4890   */
4891 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
4892 {
4893   return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1UL : 0UL);
4894 }
4895 
4896 /**
4897   * @brief  Check if  Alarm A interrupt is enabled or not
4898   * @rmtoll CR           ALRAIE        LL_RTC_IsEnabledIT_ALRA
4899   * @param  RTCx RTC Instance
4900   * @retval State of bit (1 or 0).
4901   */
4902 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
4903 {
4904   return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1UL : 0UL);
4905 }
4906 
4907 #if !defined(TAMP)
4908 /**
4909   * @brief  Check if  Tamper 3 interrupt is enabled or not
4910   * @rmtoll TAMPCR       TAMP3IE       LL_RTC_IsEnabledIT_TAMP3
4911   * @param  RTCx RTC Instance
4912   * @retval State of bit (1 or 0).
4913   */
4914 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx)
4915 {
4916   return ((READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP3IE) == (RTC_TAMPCR_TAMP3IE)) ? 1UL : 0UL);
4917 }
4918 
4919 /**
4920   * @brief  Check if  Tamper 2 interrupt is enabled or not
4921   * @rmtoll TAMPCR       TAMP2IE       LL_RTC_IsEnabledIT_TAMP2
4922   * @param  RTCx RTC Instance
4923   * @retval State of bit (1 or 0).
4924   */
4925 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef *RTCx)
4926 {
4927   return ((READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP2IE) == (RTC_TAMPCR_TAMP2IE)) ? 1UL : 0UL);
4928 
4929 }
4930 
4931 /**
4932   * @brief  Check if  Tamper 1 interrupt is enabled or not
4933   * @rmtoll TAMPCR       TAMP1IE       LL_RTC_IsEnabledIT_TAMP1
4934   * @param  RTCx RTC Instance
4935   * @retval State of bit (1 or 0).
4936   */
4937 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef *RTCx)
4938 {
4939   return ((READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMP1IE) == (RTC_TAMPCR_TAMP1IE)) ? 1UL : 0UL);
4940 }
4941 
4942 /**
4943   * @brief  Check if all the TAMPER interrupts are enabled or not
4944   * @rmtoll TAMPCR       TAMPIE        LL_RTC_IsEnabledIT_TAMP
4945   * @param  RTCx RTC Instance
4946   * @retval State of bit (1 or 0).
4947   */
4948 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
4949 {
4950   return ((READ_BIT(RTCx->TAMPCR, RTC_TAMPCR_TAMPIE) == (RTC_TAMPCR_TAMPIE)) ? 1UL : 0UL);
4951 }
4952 #endif /* !TAMP */
4953 
4954 #if defined(TAMP)
4955 /**
4956   * @brief  Enable tamper 1 interrupt.
4957   * @rmtoll TAMP_IER           TAMP1IE          LL_RTC_EnableIT_TAMP1
4958   * @param  TAMPx TAMP Instance
4959   * @retval None
4960   */
4961 __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(TAMP_TypeDef *TAMPx)
4962 {
4963   SET_BIT(TAMPx->IER, TAMP_IER_TAMP1IE);
4964 }
4965 
4966 /**
4967   * @brief  Disable tamper 1 interrupt.
4968   * @rmtoll TAMP_IER           TAMP1IE          LL_RTC_DisableIT_TAMP1
4969   * @param  TAMPx TAMP Instance
4970   * @retval None
4971   */
4972 __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(TAMP_TypeDef *TAMPx)
4973 {
4974   CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP1IE);
4975 }
4976 
4977 /**
4978   * @brief  Enable tamper 2 interrupt.
4979   * @rmtoll TAMP_IER           TAMP2IE          LL_RTC_EnableIT_TAMP2
4980   * @param  TAMPx TAMP Instance
4981   * @retval None
4982   */
4983 __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(TAMP_TypeDef *TAMPx)
4984 {
4985   SET_BIT(TAMPx->IER, TAMP_IER_TAMP2IE);
4986 }
4987 
4988 /**
4989   * @brief  Disable tamper 2 interrupt.
4990   * @rmtoll TAMP_IER           TAMP2IE          LL_RTC_DisableIT_TAMP2
4991   * @param  TAMPx TAMP Instance
4992   * @retval None
4993   */
4994 __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(TAMP_TypeDef *TAMPx)
4995 {
4996   CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP2IE);
4997 }
4998 
4999 /**
5000   * @brief  Enable tamper 3 interrupt.
5001   * @rmtoll TAMP_IER           TAMP3IE          LL_RTC_EnableIT_TAMP3
5002   * @param  TAMPx TAMP Instance
5003   * @retval None
5004   */
5005 __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(TAMP_TypeDef *TAMPx)
5006 {
5007   SET_BIT(TAMPx->IER, TAMP_IER_TAMP3IE);
5008 }
5009 
5010 /**
5011   * @brief  Disable tamper 3 interrupt.
5012   * @rmtoll TAMP_IER           TAMP3IE          LL_RTC_DisableIT_TAMP3
5013   * @param  TAMPx TAMP Instance
5014   * @retval None
5015   */
5016 __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(TAMP_TypeDef *TAMPx)
5017 {
5018   CLEAR_BIT(TAMPx->IER, TAMP_IER_TAMP3IE);
5019 }
5020 
5021 /**
5022   * @brief  Check if tamper 1 interrupt is enabled or not.
5023   * @rmtoll TAMP_IER           TAMP1IE        LL_RTC_IsEnabledIT_TAMP1
5024   * @param  TAMPx TAMP Instance
5025   * @retval State of bit (1 or 0).
5026   */
5027 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(TAMP_TypeDef *TAMPx)
5028 {
5029   return ((READ_BIT(TAMPx->IER, TAMP_IER_TAMP1IE) == (TAMP_IER_TAMP1IE)) ? 1UL : 0UL);
5030 }
5031 
5032 /**
5033   * @brief  Check if tamper 2 interrupt is enabled or not.
5034   * @rmtoll TAMP_IER           TAMP2IE        LL_RTC_IsEnabledIT_TAMP2
5035   * @param  TAMPx TAMP Instance
5036   * @retval State of bit (1 or 0).
5037   */
5038 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(TAMP_TypeDef *TAMPx)
5039 {
5040   return ((READ_BIT(TAMPx->IER, TAMP_IER_TAMP2IE) == (TAMP_IER_TAMP2IE)) ? 1UL : 0UL);
5041 }
5042 
5043 /**
5044   * @brief  Check if tamper 3 interrupt is enabled or not.
5045   * @rmtoll TAMP_IER           TAMP3IE        LL_RTC_IsEnabledIT_TAMP3
5046   * @param  TAMPx TAMP Instance
5047   * @retval State of bit (1 or 0).
5048   */
5049 __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(TAMP_TypeDef *TAMPx)
5050 {
5051   return ((READ_BIT(TAMPx->IER, TAMP_IER_TAMP3IE) == (TAMP_IER_TAMP3IE)) ? 1UL : 0UL);
5052 }
5053 
5054 /**
5055   * @}
5056   */
5057 
5058 /** @defgroup RTC_LL_EF_Active_Tamper Active Tamper
5059   * @ingroup RTEMSBSPsARMSTM32H7
5060   * @{
5061   */
5062 /**
5063   * @brief  Enable tamper active mode.
5064   * @rmtoll TAMP_ATCR1     TAMP1AM       LL_RTC_TAMPER_ATAMP_EnableActiveMode
5065   * @rmtoll TAMP_ATCR1     TAMP2AM       LL_RTC_TAMPER_ATAMP_EnableActiveMode
5066   * @rmtoll TAMP_ATCR1     TAMPxAM       LL_RTC_TAMPER_ATAMP_EnableActiveMode
5067   * @param  Tamper to configure as active. This parameter can be a combination of the following values:
5068   *         @arg @ref RTC_LL_EC_ACTIVE_MODE
5069   *
5070   * @retval None
5071   */
5072 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableActiveMode(uint32_t Tamper)
5073 {
5074   SET_BIT(TAMP->ATCR1, Tamper);
5075 }
5076 
5077 /**
5078   * @brief  Disable tamper active mode.
5079   * @rmtoll TAMP_ATCR1     TAMP1AM       LL_RTC_TAMPER_ATAMP_DisableActiveMode
5080   * @rmtoll TAMP_ATCR1     TAMP2AM       LL_RTC_TAMPER_ATAMP_DisableActiveMode
5081   * @rmtoll TAMP_ATCR1     TAMPxAM       LL_RTC_TAMPER_ATAMP_DisableActiveMode
5082   * @param  Tamper to configure as active. This parameter can be a combination of the following values:
5083   *         @arg @ref RTC_LL_EC_ACTIVE_MODE
5084   *
5085   * @retval None
5086   */
5087 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableActiveMode(uint32_t Tamper)
5088 {
5089   CLEAR_BIT(TAMP->ATCR1, Tamper);
5090 }
5091 
5092 /**
5093   * @brief  Enable active tamper filter.
5094   * @rmtoll TAMP_ATCR1     FLTEN         LL_RTC_TAMPER_ATAMP_EnableFilter
5095   * @retval None
5096   */
5097 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableFilter(void)
5098 {
5099   SET_BIT(TAMP->ATCR1, TAMP_ATCR1_FLTEN);
5100 }
5101 
5102 /**
5103   * @brief  Disable active tamper filter.
5104   * @rmtoll TAMP_ATCR1     FLTEN         LL_RTC_TAMPER_ATAMP_DisableFilter
5105   * @retval None
5106   */
5107 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableFilter(void)
5108 {
5109   CLEAR_BIT(TAMP->ATCR1, TAMP_ATCR1_FLTEN);
5110 }
5111 
5112 /**
5113   * @brief  Set Active tamper output change period.
5114   * @rmtoll TAMP_ATCR1     ATPER         LL_RTC_TAMPER_ATAMP_SetOutputChangePeriod
5115   * @param  ActiveOutputChangePeriod This parameter can be a value from 0 to 7
5116   * @retval None
5117   */
5118 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetOutputChangePeriod(uint32_t ActiveOutputChangePeriod)
5119 {
5120   MODIFY_REG(TAMP->ATCR1, TAMP_ATCR1_ATPER, (ActiveOutputChangePeriod << TAMP_ATCR1_ATPER_Pos));
5121 }
5122 
5123 /**
5124   * @brief  Get Active tamper output change period.
5125   * @rmtoll TAMP_ATCR1     ATPER         LL_RTC_TAMPER_ATAMP_GetOutputChangePeriod
5126   * @retval Output change period. This parameter can be a value from 0 to 7.
5127   */
5128 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetOutputChangePeriod(void)
5129 {
5130   return (READ_BIT(TAMP->ATCR1, TAMP_ATCR1_ATPER) >> TAMP_ATCR1_ATPER_Pos);
5131 }
5132 
5133 /**
5134   * @brief  Set Active tamper asynchronous prescaler clock selection.
5135   * @rmtoll TAMP_ATCR1     ATCKSEL       LL_RTC_TAMPER_ATAMP_SetAsyncPrescaler
5136   * @param  ActiveAsynvPrescaler Specifies the Active Tamper asynchronous Prescaler clock.
5137             This parameter can be a value of the following values:
5138   *         @arg @ref RTC_LL_EC_ACTIVE_ASYNC_PRESCALER
5139   * @retval None
5140   */
5141 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetAsyncPrescaler(uint32_t ActiveAsynvPrescaler)
5142 {
5143   MODIFY_REG(TAMP->ATCR1, TAMP_ATCR1_ATCKSEL, ActiveAsynvPrescaler);
5144 }
5145 
5146 /**
5147   * @brief  Get Active tamper asynchronous prescaler clock selection.
5148   * @rmtoll TAMP_ATCR1     ATCKSEL       LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler
5149   * @retval One of @arg @ref RTC_LL_EC_ACTIVE_ASYNC_PRESCALER
5150   */
5151 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler(void)
5152 {
5153   return (READ_BIT(TAMP->ATCR1, TAMP_ATCR1_ATCKSEL));
5154 }
5155 
5156 /**
5157   * @brief  Enable active tamper output sharing.
5158   * @rmtoll TAMP_ATCR1     ATOSHARE      LL_RTC_TAMPER_ATAMP_EnableOutputSharing
5159   * @retval None
5160   */
5161 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_EnableOutputSharing(void)
5162 {
5163   SET_BIT(TAMP->ATCR1, TAMP_ATCR1_ATOSHARE);
5164 }
5165 
5166 /**
5167   * @brief  Disable active tamper output sharing.
5168   * @rmtoll TAMP_ATCR1     ATOSHARE      LL_RTC_TAMPER_ATAMP_DisableOutputSharing
5169   * @retval None
5170   */
5171 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_DisableOutputSharing(void)
5172 {
5173   CLEAR_BIT(TAMP->ATCR1, TAMP_ATCR1_ATOSHARE);
5174 }
5175 
5176 /**
5177   * @brief  Set Active tamper output selection.
5178   * @rmtoll TAMP_ATCR1     ATCKSEL       LL_RTC_TAMPER_ATAMP_SetSharedOuputSelection
5179   * @param  OutputSelection Specifies all the output selection of the Active Tamper.
5180             This parameter is a combinasation of the following values:
5181   *         One of @arg @ref RTC_LL_EC_ACTIVE_OUTPUT_SELECTION
5182   * @retval None
5183   */
5184 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_SetSharedOuputSelection(uint32_t OutputSelection)
5185 {
5186   MODIFY_REG(TAMP->ATCR1, (TAMP_ATCR1_ATOSEL1 | TAMP_ATCR1_ATOSEL2 | TAMP_ATCR1_ATOSEL3), \
5187              OutputSelection);
5188 }
5189 
5190 /**
5191   * @brief  Get Active tamper asynchronous prescaler clock selection.
5192   * @rmtoll TAMP_ATCR2     ATCKSEL       LL_RTC_TAMPER_ATAMP_GetAsyncPrescaler
5193   * @retval A combination of @arg @ref RTC_LL_EC_ACTIVE_OUTPUT_SELECTION
5194   */
5195 __STATIC_INLINE uint32_t LL_RTC_TAMPER_ATAMP_GetSharedOuputSelection(void)
5196 {
5197   return (READ_BIT(TAMP->ATCR1, (TAMP_ATCR1_ATOSEL1 | TAMP_ATCR1_ATOSEL2 | TAMP_ATCR1_ATOSEL3)));
5198 }
5199 
5200 /**
5201   * @brief  Write active tamper seed.
5202   * @rmtoll TAMP_ATSEEDR   SEED          LL_RTC_TAMPER_ATAMP_WriteSeed
5203   * @param  Seed
5204   * @retval None
5205   */
5206 __STATIC_INLINE void LL_RTC_TAMPER_ATAMP_WriteSeed(uint32_t Seed)
5207 {
5208   WRITE_REG(TAMP->ATSEEDR, Seed);
5209 }
5210 
5211 /**
5212   * @brief  Get active tamper initialization status flag.
5213   * @rmtoll TAMP_ATOR      INITS         LL_RTC_IsActiveFlag_ATAMP_INITS
5214   * @retval State of bit (1 or 0).
5215   */
5216 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ATAMP_INITS(void)
5217 {
5218   return ((READ_BIT(TAMP->ATOR, TAMP_ATOR_INITS) == (TAMP_ATOR_INITS)) ? 1U : 0U);
5219 }
5220 
5221 /**
5222   * @brief  Get active tamper seed running status flag.
5223   * @rmtoll TAMP_ATOR      INITS         LL_RTC_IsActiveFlag_ATAMP_INITS
5224   * @retval State of bit (1 or 0).
5225   */
5226 __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ATAMP_SEEDF(void)
5227 {
5228   return ((READ_BIT(TAMP->ATOR, TAMP_ATOR_SEEDF) == (TAMP_ATOR_SEEDF)) ? 1U : 0U);
5229 }
5230 #endif /* TAMP */
5231 
5232 /**
5233   * @}
5234   */
5235 
5236 
5237 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
5238 /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
5239   * @ingroup RTEMSBSPsARMSTM32H7
5240   * @{
5241   */
5242 
5243 ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
5244 ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
5245 void        LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
5246 ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
5247 void        LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
5248 ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
5249 void        LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
5250 ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5251 ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5252 void        LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5253 void        LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
5254 ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
5255 ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
5256 ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
5257 
5258 /**
5259   * @}
5260   */
5261 #endif /* USE_FULL_LL_DRIVER */
5262 
5263 /**
5264   * @}
5265   */
5266 
5267 /**
5268   * @}
5269   */
5270 
5271 #endif /* defined(RTC) */
5272 
5273 /**
5274   * @}
5275   */
5276 
5277 #ifdef __cplusplus
5278 }
5279 #endif
5280 
5281 #endif /* STM32H7xx_LL_RTC_H */
5282