1 /**
2   ******************************************************************************
3   * @file    stm32n6xx_hal_rtc_ex.h
4   * @author  GPM Application Team
5   * @brief   Header file of RTC HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2023 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32N6xx_HAL_RTC_EX_H
21 #define STM32N6xx_HAL_RTC_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32n6xx_hal_def.h"
29 
30 /** @addtogroup STM32N6xx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup RTCEx RTCEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
40   * @{
41   */
42 
43 /** @defgroup RTCEx_Tamper_structure_definition RTCEx Tamper structure definition
44   * @{
45   */
46 typedef struct
47 {
48   uint32_t Tamper;                      /*!< Specifies the Tamper Pin.
49                                              This parameter can be a value of @ref RTCEx_Tamper_Pins */
50 
51   uint32_t Trigger;                     /*!< Specifies the Tamper Trigger.
52                                              This parameter can be a value of @ref RTCEx_Tamper_Trigger */
53 
54   uint32_t NoErase;                     /*!< Specifies the Tamper no erase mode.
55                                              This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */
56 
57   uint32_t MaskFlag;                    /*!< Specifies the Tamper Flag masking.
58                                              This parameter can be a value of @ref RTCEx_Tamper_MaskFlag */
59 
60   uint32_t Filter;                      /*!< Specifies the TAMP Filter Tamper.
61                                              This parameter can be a value of @ref RTCEx_Tamper_Filter */
62 
63   uint32_t SamplingFrequency;           /*!< Specifies the sampling frequency.
64                                              This parameter can be a value of
65                                              @ref RTCEx_Tamper_Sampling_Frequencies */
66 
67   uint32_t PrechargeDuration;           /*!< Specifies the Precharge Duration.
68                                              This parameter can be a value of
69                                              @ref RTCEx_Tamper_Pin_Precharge_Duration */
70 
71   uint32_t TamperPullUp;                /*!< Specifies the Tamper PullUp.
72                                              This parameter can be a value of @ref RTCEx_Tamper_Pull_UP */
73 
74   uint32_t TimeStampOnTamperDetection;  /*!< Specifies the TimeStampOnTamperDetection.
75                                              This parameter can be a value of
76                                               @ref RTCEx_Tamper_TimeStampOnTamperDetection */
77 } RTC_TamperTypeDef;
78 /**
79   * @}
80   */
81 
82 
83 /** @defgroup RTCEx_Active_Seed_Size Seed size Definitions
84   * @{
85   */
86 #define RTC_ATAMP_SEED_NB_UINT32        4U
87 /**
88   * @}
89   */
90 
91 
92 /** @defgroup RTCEx_ActiveTamper_structures_definition RTCEx Active Tamper structures definitions
93   * @{
94   */
95 typedef struct
96 {
97   uint32_t Enable;                      /*!< Specifies the Tamper input is active.
98                                              This parameter can be a value of @ref RTCEx_ActiveTamper_Enable */
99 
100   uint32_t Interrupt;                    /*!< Specifies the interrupt mode.
101                                              This parameter can be a value of @ref RTCEx_ActiveTamper_Interrupt */
102 
103   uint32_t Output;                      /*!< Specifies the TAMP output to be compared with.
104                                              The same output can be used for several tamper inputs.
105                                              This parameter can be a value of @ref RTCEx_ActiveTamper_Sel */
106 
107   uint32_t NoErase;                     /*!< Specifies the Tamper no erase mode.
108                                              This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */
109 
110   uint32_t MaskFlag;                    /*!< Specifies the Tamper Flag masking.
111                                              This parameter can be a value of @ref RTCEx_Tamper_MaskFlag */
112 
113 } RTC_ATampInputTypeDef;
114 
115 
116 typedef struct
117 {
118   uint32_t ActiveFilter;                /*!< Specifies the Active tamper filter enable.
119                                              This parameter can be a value of @ref RTCEx_ActiveTamper_Filter */
120 
121   uint32_t ActiveAsyncPrescaler;        /*!< Specifies the Active Tamper asynchronous Prescaler clock.
122                                              This parameter can be a value of
123                                              @ref RTCEx_ActiveTamper_Async_prescaler */
124 
125   uint32_t TimeStampOnTamperDetection;  /*!< Specifies the timeStamp on tamper detection.
126                                              This parameter can be a value of
127                                              @ref RTCEx_Tamper_TimeStampOnTamperDetection */
128 
129   uint32_t ActiveOutputChangePeriod;    /*!< Specifies the Active Tamper output change period.
130                                              This parameter can be a value from 0 to 7 */
131 
132   uint32_t Seed[RTC_ATAMP_SEED_NB_UINT32];
133   /*!< Specifies the RNG Seed value.
134        This parameter is an array of value from 0 to 0xFFFFFFFF */
135 
136   RTC_ATampInputTypeDef TampInput[RTC_TAMP_NB];
137   /*!< Specifies configuration of all active tampers.
138        The index of TampInput[RTC_TAMP_NB] can be a value of RTCEx_ActiveTamper_Sel */
139 } RTC_ActiveTampersTypeDef;
140 /**
141   * @}
142   */
143 
144 /** @defgroup RTCEx_Internal_Tamper_structure_definition RTCEx Internal Tamper structure definition
145   * @{
146   */
147 typedef struct
148 {
149   uint32_t IntTamper;                   /*!< Specifies the Internal Tamper Pin.
150                                              This parameter can be a value of @ref RTCEx_Internal_Tamper_Pins */
151 
152   uint32_t TimeStampOnTamperDetection;  /*!< Specifies the TimeStampOnTamperDetection.
153                                              This parameter can be a value of
154                                              @ref RTCEx_Tamper_TimeStampOnTamperDetection */
155 
156   uint32_t NoErase;                     /*!< Specifies the internal Tamper no erase mode.
157                                              This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp */
158 
159 } RTC_InternalTamperTypeDef;
160 /**
161   * @}
162   */
163 
164 /** @defgroup RTCEx_Secure_State_structure_definition RTCEx Secure structure definition
165   * @{
166   */
167 typedef struct
168 {
169   uint32_t rtcSecureFull;               /*!< Specifies If the RTC is fully secure or not.
170                                              This parameter can be a value of @ref RTCEx_RTC_Secure_Full */
171 
172   uint32_t rtcNonSecureFeatures;        /*!< Specifies the non-secure features.
173                                              This parameter is only relevant if RTC is not fully secure
174                                              (rtcSecureFull == RTC_SECURE_FULL_NO).
175                                              This parameter can be a combination of
176                                              @ref RTCEx_RTC_NonSecure_Features */
177 
178   uint32_t tampSecureFull;              /*!< Specifies If the TAMP is fully secure or not execpt monotonic counters
179                                              and BackUp registers.
180                                              This parameter can be a value of @ref RTCEx_TAMP_Secure_Full */
181 
182   uint32_t backupRegisterStartZone2;    /*!< Specifies the backup register start zone 2.
183                                              Zone 1 : read secure write secure.
184                                              Zone 2 : read non-secure  write secure.
185                                              This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to specify
186                                              the register.
187                                              Warning : this parameter is shared with RTC_PrivilegeStateTypeDef */
188 
189   uint32_t backupRegisterStartZone3;    /*!< Specifies the backup register start zone 3.
190                                              Zone 3 : read non-secure  write non-secure.
191                                              This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to
192                                              specify the register.
193                                              Warning : this parameter is shared with RTC_PrivilegeStateTypeDef */
194 
195   uint32_t MonotonicCounterSecure;      /*!< Specifies If the monotonic counter is secure or not.
196                                              This parameter can be a value of
197                                              @ref RTCEx_TAMP_Monotonic_Counter_Secure */
198 } RTC_SecureStateTypeDef;
199 /**
200   * @}
201   */
202 
203 /** @defgroup RTCEx_Privilege_State_structure_definition RTCEx Privilege structure definition
204   * @{
205   */
206 typedef struct
207 {
208   uint32_t rtcPrivilegeFull;            /*!< Specifies If the RTC is fully privileged or not.
209                                              This parameter can be a value of @ref RTCEx_RTC_Privilege_Full */
210 
211   uint32_t rtcPrivilegeFeatures;        /*!< Specifies the privileged features.
212                                              This parameter is only relevant if RTC is not fully privileged
213                                              (rtcPrivilegeFull == RTC_PRIVILEGE_FULL_NO).
214                                              This parameter can be a combination of
215                                              @ref RTCEx_RTC_Privilege_Features */
216 
217   uint32_t tampPrivilegeFull;           /*!< Specifies If the TAMP is fully privileged or not execpt monotonic
218                                              counters and BackUp registers.
219                                              This parameter can be a value of @ref RTCEx_TAMP_Privilege_Full */
220 
221   uint32_t backupRegisterPrivZone;      /*!< Specifies backup register zone to be privileged.
222                                              This parameter can be a combination of
223                                              @ref RTCEx_Backup_Reg_Privilege_zone.
224                                              Warning : this parameter is writable in secure mode or if trustzone is
225                                              disabled */
226 
227   uint32_t backupRegisterStartZone2;    /*!< Specifies the backup register start zone 2.
228                                              Zone 1 : read secure, write secure.
229                                              Zone 2 : read non-secure, write secure.
230                                              This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to specify
231                                              the register .
232                                              Warning : this parameter is writable in secure mode or if trustzone is
233                                              disabled.
234                                              Warning : this parameter is shared with RTC_SecureStateTypeDef */
235 
236   uint32_t backupRegisterStartZone3;    /*!< Specifies the backup register start zone 3.
237                                              Zone 3 : read non-secure, write non-secure.
238                                              This parameter can be RTC_BKP_DRx where x can be from 0 to 31 to specify
239                                              the register.
240                                              Warning : this parameter is writable in secure mode or if trustzone is
241                                              disabled.
242                                              Warning : this parameter is shared with RTC_SecureStateTypeDef */
243 
244   uint32_t MonotonicCounterPrivilege;   /*!< Specifies If the monotonic counter is privileged or not.
245                                              This parameter can be a value of
246                                              @ref RTCEx_TAMP_Monotonic_Counter_Privilege */
247 } RTC_PrivilegeStateTypeDef;
248 /**
249   * @}
250   */
251 
252 /**
253   * @}
254   */
255 
256 /* Exported constants --------------------------------------------------------*/
257 /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
258   * @{
259   */
260 
261 /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition
262   * @{
263   */
264 #define RTC_TIMESTAMPEDGE_RISING           0U
265 #define RTC_TIMESTAMPEDGE_FALLING          RTC_CR_TSEDGE
266 /**
267   * @}
268   */
269 
270 /** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection
271   * @{
272   */
273 #define RTC_TIMESTAMPPIN_DEFAULT           0U
274 /**
275   * @}
276   */
277 
278 /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions
279   * @{
280   */
281 #define RTC_WAKEUPCLOCK_RTCCLK_DIV16       0U
282 #define RTC_WAKEUPCLOCK_RTCCLK_DIV8        RTC_CR_WUCKSEL_0
283 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4        RTC_CR_WUCKSEL_1
284 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2        (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1)
285 #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS     RTC_CR_WUCKSEL_2
286 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS     (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2)
287 /**
288   * @}
289   */
290 
291 /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions
292   * @{
293   */
294 #define RTC_SMOOTHCALIB_PERIOD_32SEC       0U                    /*!< If RTCCLK = 32768 Hz, Smooth calibration period
295                                                                       is 32s, else 2exp20 RTCCLK pulses */
296 #define RTC_SMOOTHCALIB_PERIOD_16SEC       RTC_CALR_CALW16       /*!< If RTCCLK = 32768 Hz, Smooth calibration period
297                                                                       is 16s, else 2exp19 RTCCLK pulses */
298 #define RTC_SMOOTHCALIB_PERIOD_8SEC        RTC_CALR_CALW8        /*!< If RTCCLK = 32768 Hz, Smooth calibration period
299                                                                       is 8s, else 2exp18 RTCCLK pulses  */
300 /**
301   * @}
302   */
303 
304 /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions
305   * @{
306   */
307 #define RTC_SMOOTHCALIB_PLUSPULSES_SET     RTC_CALR_CALP         /*!< The number of RTCCLK pulses added
308                                                                       during a X -second window = Y - CALM[8:0]
309                                                                       with Y = 512, 256, 128 when X = 32, 16, 8 */
310 #define RTC_SMOOTHCALIB_PLUSPULSES_RESET   0U                    /*!< The number of RTCCLK pulses subbstited
311                                                                       during a 32-second window = CALM[8:0]     */
312 /**
313   * @}
314   */
315 
316 /** @defgroup RTCEx_Smooth_calib_low_power_Definitions RTCEx Smooth calib Low Power Definitions
317   * @{
318   */
319 #define RTC_LPCAL_SET                      RTC_CALR_LPCAL        /*!< Calibration window is 2exp20 ck_apre, which is the required configuration for ultra-low consumption mode. */
320 #define RTC_LPCAL_RESET                    0U                    /*!< Calibration window is 2exp20 RTCCLK, which is a high-consumption mode.
321                                                                       This mode should be set only when less
322                                                                       than 32s calibration window is required. */
323 /**
324   * @}
325   */
326 
327 /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions
328   * @{
329   */
330 #define RTC_CALIBOUTPUT_512HZ              0U
331 #define RTC_CALIBOUTPUT_1HZ                RTC_CR_COSEL
332 /**
333   * @}
334   */
335 
336 /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definitions
337   * @{
338   */
339 #define RTC_SHIFTADD1S_RESET               0U
340 #define RTC_SHIFTADD1S_SET                 RTC_SHIFTR_ADD1S
341 /**
342   * @}
343   */
344 
345 /** @defgroup RTCEx_Tamper_Pins  RTCEx Tamper Pins Definition
346   * @{
347   */
348 #define RTC_TAMPER_1                       TAMP_CR1_TAMP1E
349 #define RTC_TAMPER_2                       TAMP_CR1_TAMP2E
350 #define RTC_TAMPER_3                       TAMP_CR1_TAMP3E
351 #define RTC_TAMPER_4                       TAMP_CR1_TAMP4E
352 #define RTC_TAMPER_5                       TAMP_CR1_TAMP5E
353 #define RTC_TAMPER_6                       TAMP_CR1_TAMP6E
354 #define RTC_TAMPER_7                       TAMP_CR1_TAMP7E
355 #define RTC_TAMPER_ALL                     (RTC_TAMPER_1 | RTC_TAMPER_2 |\
356                                             RTC_TAMPER_3 | RTC_TAMPER_4 |\
357                                             RTC_TAMPER_5 | RTC_TAMPER_6 |\
358                                             RTC_TAMPER_7)
359 /**
360   * @}
361   */
362 
363 /** @defgroup RTCEx_Internal_Tamper_Pins  RTCEx Internal Tamper Pins Definition
364   * @{
365   */
366 #define RTC_INT_TAMPER_1                   TAMP_CR1_ITAMP1E
367 #define RTC_INT_TAMPER_2                   TAMP_CR1_ITAMP2E
368 #define RTC_INT_TAMPER_3                   TAMP_CR1_ITAMP3E
369 #define RTC_INT_TAMPER_4                   TAMP_CR1_ITAMP4E
370 #define RTC_INT_TAMPER_5                   TAMP_CR1_ITAMP5E
371 #define RTC_INT_TAMPER_6                   TAMP_CR1_ITAMP6E
372 #define RTC_INT_TAMPER_7                   TAMP_CR1_ITAMP7E
373 #define RTC_INT_TAMPER_8                   TAMP_CR1_ITAMP8E
374 #define RTC_INT_TAMPER_9                   TAMP_CR1_ITAMP9E
375 #define RTC_INT_TAMPER_11                  TAMP_CR1_ITAMP11E
376 #define RTC_INT_TAMPER_ALL                 (RTC_INT_TAMPER_1 | RTC_INT_TAMPER_2 |\
377                                             RTC_INT_TAMPER_3 | RTC_INT_TAMPER_4 |\
378                                             RTC_INT_TAMPER_5 | RTC_INT_TAMPER_6 |\
379                                             RTC_INT_TAMPER_7 | RTC_INT_TAMPER_8 |\
380                                             RTC_INT_TAMPER_9 | RTC_INT_TAMPER_11)
381 /**
382   * @}
383   */
384 
385 /** @defgroup RTCEx_Tamper_Trigger  RTCEx Tamper Trigger
386   * @{
387   */
388 #define RTC_TAMPERTRIGGER_RISINGEDGE       0U                    /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
389 #define RTC_TAMPERTRIGGER_FALLINGEDGE      1U                    /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */
390 #define RTC_TAMPERTRIGGER_LOWLEVEL         2U                    /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
391 #define RTC_TAMPERTRIGGER_HIGHLEVEL        3U                    /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */
392 /**
393   * @}
394   */
395 
396 /** @defgroup RTCEx_Tamper_MaskFlag  RTCEx Tamper MaskFlag
397   * @{
398   */
399 #define RTC_TAMPERMASK_FLAG_DISABLE        0U
400 #define RTC_TAMPERMASK_FLAG_ENABLE         1U
401 /**
402   * @}
403   */
404 
405 /** @defgroup RTCEx_Tamper_Maskable_nb  RTCEx Tampers maskable number
406   * @{
407   */
408 #define RTC_TAMPER_MASKABLE_NB             3U
409 /**
410   * @}
411   */
412 
413 /** @defgroup RTCEx_Tamper_EraseBackUp  RTCEx Tamper EraseBackUp
414   * @{
415   */
416 #define RTC_TAMPER_ERASE_BACKUP_ENABLE     0U
417 #define RTC_TAMPER_ERASE_BACKUP_DISABLE    1U
418 /**
419   * @}
420   */
421 
422 /** @defgroup RTCEx_Tamper_Filter  RTCEx Tamper Filter
423   * @{
424   */
425 #define RTC_TAMPERFILTER_DISABLE           0U                    /*!< Tamper filter is disabled */
426 #define RTC_TAMPERFILTER_2SAMPLE           TAMP_FLTCR_TAMPFLT_0  /*!< Tamper is activated after 2 consecutive samples at the active level */
427 #define RTC_TAMPERFILTER_4SAMPLE           TAMP_FLTCR_TAMPFLT_1  /*!< Tamper is activated after 4 consecutive samples at the active level */
428 #define RTC_TAMPERFILTER_8SAMPLE           TAMP_FLTCR_TAMPFLT    /*!< Tamper is activated after 8 consecutive samples at the active level */
429 /**
430   * @}
431   */
432 
433 /** @defgroup RTCEx_Tamper_Sampling_Frequencies  RTCEx Tamper Sampling Frequencies
434   * @{
435   */
436 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768  0U                                                  /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 32768 */
437 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384  TAMP_FLTCR_TAMPFREQ_0                               /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 16384 */
438 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192   TAMP_FLTCR_TAMPFREQ_1                               /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 8192  */
439 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096   (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1)     /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 4096  */
440 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048   TAMP_FLTCR_TAMPFREQ_2                               /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 2048  */
441 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024   (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2)     /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 1024  */
442 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512    (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2)     /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 512   */
443 #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256    (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1 | \
444                                                  TAMP_FLTCR_TAMPFREQ_2)                             /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 256   */
445 /**
446   * @}
447   */
448 
449 /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration  RTCEx Tamper Pin Precharge Duration
450   * @{
451   */
452 #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK  0U                                              /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle  */
453 #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK  TAMP_FLTCR_TAMPPRCH_0                           /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
454 #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK  TAMP_FLTCR_TAMPPRCH_1                           /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
455 #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK  (TAMP_FLTCR_TAMPPRCH_0 | TAMP_FLTCR_TAMPPRCH_1) /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
456 /**
457   * @}
458   */
459 
460 /** @defgroup RTCEx_Tamper_Pull_UP  RTCEx Tamper Pull UP
461   * @{
462   */
463 #define RTC_TAMPER_PULLUP_ENABLE           0U                    /*!< Tamper pins are pre-charged before sampling */
464 #define RTC_TAMPER_PULLUP_DISABLE          TAMP_FLTCR_TAMPPUDIS  /*!< Tamper pins pre-charge is disabled          */
465 /**
466   * @}
467   */
468 
469 /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection RTCEx Tamper TimeStamp On Tamper Detection Definitions
470   * @{
471   */
472 #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE  0U               /*!< TimeStamp on Tamper Detection event is not saved */
473 #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE   RTC_CR_TAMPTS    /*!< TimeStamp on Tamper Detection event saved        */
474 /**
475   * @}
476   */
477 
478 /** @defgroup RTCEx_Tamper_Detection_Output RTCEx Tamper detection output Definitions
479   * @{
480   */
481 #define RTC_TAMPERDETECTIONOUTPUT_DISABLE  0U                    /*!< Tamper detection output disable on TAMPALRM */
482 #define RTC_TAMPERDETECTIONOUTPUT_ENABLE   RTC_CR_TAMPOE         /*!< Tamper detection output enable on TAMPALRM  */
483 /**
484   * @}
485   */
486 
487 
488 /** @defgroup RTCEx_Tamper_Interrupt  RTCEx Tamper Interrupt
489   * @{
490   */
491 #define RTC_IT_TAMP_1                      TAMP_IER_TAMP1IE      /*!< Tamper 1 Interrupt */
492 #define RTC_IT_TAMP_2                      TAMP_IER_TAMP2IE      /*!< Tamper 2 Interrupt */
493 #define RTC_IT_TAMP_3                      TAMP_IER_TAMP3IE      /*!< Tamper 3 Interrupt */
494 #define RTC_IT_TAMP_4                      TAMP_IER_TAMP4IE      /*!< Tamper 4 Interrupt */
495 #define RTC_IT_TAMP_5                      TAMP_IER_TAMP5IE      /*!< Tamper 5 Interrupt */
496 #define RTC_IT_TAMP_6                      TAMP_IER_TAMP6IE      /*!< Tamper 6 Interrupt */
497 #define RTC_IT_TAMP_7                      TAMP_IER_TAMP7IE      /*!< Tamper 7 Interrupt */
498 #define RTC_IT_TAMP_ALL                    (RTC_IT_TAMP_1 | RTC_IT_TAMP_2 |\
499                                             RTC_IT_TAMP_3 | RTC_IT_TAMP_4 |\
500                                             RTC_IT_TAMP_5 | RTC_IT_TAMP_6 |\
501                                             RTC_IT_TAMP_7)
502 /**
503   * @}
504   */
505 
506 /** @defgroup RTCEx_Internal_Tamper_Interrupt  RTCEx Internal Tamper Interrupt
507   * @{
508   */
509 #define RTC_IT_INT_TAMP_1                  TAMP_IER_ITAMP1IE     /*!< Tamper 1 internal Interrupt  */
510 #define RTC_IT_INT_TAMP_2                  TAMP_IER_ITAMP2IE     /*!< Tamper 2 internal Interrupt  */
511 #define RTC_IT_INT_TAMP_3                  TAMP_IER_ITAMP3IE     /*!< Tamper 3 internal Interrupt  */
512 #define RTC_IT_INT_TAMP_4                  TAMP_IER_ITAMP4IE     /*!< Tamper 4 internal Interrupt  */
513 #define RTC_IT_INT_TAMP_5                  TAMP_IER_ITAMP5IE     /*!< Tamper 5 internal Interrupt  */
514 #define RTC_IT_INT_TAMP_6                  TAMP_IER_ITAMP6IE     /*!< Tamper 6 internal Interrupt  */
515 #define RTC_IT_INT_TAMP_7                  TAMP_IER_ITAMP7IE     /*!< Tamper 7 internal Interrupt  */
516 #define RTC_IT_INT_TAMP_8                  TAMP_IER_ITAMP8IE     /*!< Tamper 8 internal Interrupt  */
517 #define RTC_IT_INT_TAMP_9                  TAMP_IER_ITAMP9IE     /*!< Tamper 9 internal Interrupt  */
518 #define RTC_IT_INT_TAMP_11                 TAMP_IER_ITAMP11IE    /*!< Tamper 11 internal Interrupt */
519 #define RTC_IT_INT_TAMP_ALL                (RTC_IT_INT_TAMP_1 | RTC_IT_INT_TAMP_2 |\
520                                             RTC_IT_INT_TAMP_3 | RTC_IT_INT_TAMP_4 |\
521                                             RTC_IT_INT_TAMP_5 | RTC_IT_INT_TAMP_6 |\
522                                             RTC_IT_INT_TAMP_7 | RTC_IT_INT_TAMP_8 |\
523                                             RTC_IT_INT_TAMP_9 | RTC_IT_INT_TAMP_11)
524 /**
525   * @}
526   */
527 
528 /** @defgroup RTCEx_Flags  RTCEx Flags
529   * @{
530   */
531 #define RTC_FLAG_TAMP_1                    TAMP_SR_TAMP1F
532 #define RTC_FLAG_TAMP_2                    TAMP_SR_TAMP2F
533 #define RTC_FLAG_TAMP_3                    TAMP_SR_TAMP3F
534 #define RTC_FLAG_TAMP_4                    TAMP_SR_TAMP4F
535 #define RTC_FLAG_TAMP_5                    TAMP_SR_TAMP5F
536 #define RTC_FLAG_TAMP_6                    TAMP_SR_TAMP6F
537 #define RTC_FLAG_TAMP_7                    TAMP_SR_TAMP7F
538 #define RTC_FLAG_TAMP_ALL                  (RTC_FLAG_TAMP_1 | RTC_FLAG_TAMP_2 | RTC_FLAG_TAMP_3 |\
539                                             RTC_FLAG_TAMP_4 | RTC_FLAG_TAMP_5 | RTC_FLAG_TAMP_6 |\
540                                             RTC_FLAG_TAMP_7)
541 
542 #define RTC_FLAG_INT_TAMP_1                TAMP_SR_ITAMP1F
543 #define RTC_FLAG_INT_TAMP_2                TAMP_SR_ITAMP2F
544 #define RTC_FLAG_INT_TAMP_3                TAMP_SR_ITAMP3F
545 #define RTC_FLAG_INT_TAMP_4                TAMP_SR_ITAMP4F
546 #define RTC_FLAG_INT_TAMP_5                TAMP_SR_ITAMP5F
547 #define RTC_FLAG_INT_TAMP_6                TAMP_SR_ITAMP6F
548 #define RTC_FLAG_INT_TAMP_7                TAMP_SR_ITAMP7F
549 #define RTC_FLAG_INT_TAMP_8                TAMP_SR_ITAMP8F
550 #define RTC_FLAG_INT_TAMP_9                TAMP_SR_ITAMP9F
551 #define RTC_FLAG_INT_TAMP_11               TAMP_SR_ITAMP11F
552 #define RTC_FLAG_INT_TAMP_ALL              (RTC_FLAG_INT_TAMP_1  | RTC_FLAG_INT_TAMP_2  |\
553                                             RTC_FLAG_INT_TAMP_3  | RTC_FLAG_INT_TAMP_4  |\
554                                             RTC_FLAG_INT_TAMP_5  | RTC_FLAG_INT_TAMP_6  |\
555                                             RTC_FLAG_INT_TAMP_7  | RTC_FLAG_INT_TAMP_8  |\
556                                             RTC_FLAG_INT_TAMP_9  | RTC_FLAG_INT_TAMP_11)
557 /**
558   * @}
559   */
560 
561 
562 /** @defgroup RTCEx_ActiveTamper_Enable RTCEx_ActiveTamper_Enable Definitions
563   * @{
564   */
565 #define RTC_ATAMP_ENABLE                   1U
566 #define RTC_ATAMP_DISABLE                  0U
567 /**
568   * @}
569   */
570 
571 /** @defgroup RTCEx_ActiveTamper_Interrupt RTCEx_ActiveTamper_Interrupt Definitions
572   * @{
573   */
574 #define RTC_ATAMP_INTERRUPT_ENABLE         1U
575 #define RTC_ATAMP_INTERRUPT_DISABLE        0U
576 /**
577   * @}
578   */
579 
580 /** @defgroup RTCEx_ActiveTamper_Filter RTCEx_ActiveTamper_Filter Definitions
581   * @{
582   */
583 #define RTC_ATAMP_FILTER_ENABLE            TAMP_ATCR1_FLTEN
584 #define RTC_ATAMP_FILTER_DISABLE           0U
585 /**
586   * @}
587   */
588 
589 /** @defgroup RTCEx_ActiveTamper_Async_prescaler RTCEx Active_Tamper_Asynchronous_Prescaler clock Definitions
590   * @{
591   */
592 #define RTC_ATAMP_ASYNCPRES_RTCCLK         0U                                                                     /*!< RTCCLK       */
593 #define RTC_ATAMP_ASYNCPRES_RTCCLK_2       TAMP_ATCR1_ATCKSEL_0                                                   /*!< RTCCLK/2     */
594 #define RTC_ATAMP_ASYNCPRES_RTCCLK_4       TAMP_ATCR1_ATCKSEL_1                                                   /*!< RTCCLK/4     */
595 #define RTC_ATAMP_ASYNCPRES_RTCCLK_8       (TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0)                          /*!< RTCCLK/8     */
596 #define RTC_ATAMP_ASYNCPRES_RTCCLK_16      TAMP_ATCR1_ATCKSEL_2                                                   /*!< RTCCLK/16    */
597 #define RTC_ATAMP_ASYNCPRES_RTCCLK_32      (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0)                          /*!< RTCCLK/32    */
598 #define RTC_ATAMP_ASYNCPRES_RTCCLK_64      (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1)                          /*!< RTCCLK/64    */
599 #define RTC_ATAMP_ASYNCPRES_RTCCLK_128     (TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0)   /*!< RTCCLK/128   */
600 #define RTC_ATAMP_ASYNCPRES_RTCCLK_256     TAMP_ATCR1_ATCKSEL_3                                                   /*!< RTCCLK/256   */
601 #define RTC_ATAMP_ASYNCPRES_RTCCLK_512     (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_0)                          /*!< RTCCLK/512   */
602 #define RTC_ATAMP_ASYNCPRES_RTCCLK_1024    (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_1)                          /*!< RTCCLK/1024  */
603 #define RTC_ATAMP_ASYNCPRES_RTCCLK_2048    (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_1 | TAMP_ATCR1_ATCKSEL_0)   /*!< RTCCLK/2048  */
604 #define RTC_ATAMP_ASYNCPRES_RTCCLK_4096    (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_2)                          /*!< RTCCLK/4096  */
605 #define RTC_ATAMP_ASYNCPRES_RTCCLK_8192    (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_0)   /*!< RTCCLK/8192  */
606 #define RTC_ATAMP_ASYNCPRES_RTCCLK_16384   (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1)   /*!< RTCCLK/16384 */
607 #define RTC_ATAMP_ASYNCPRES_RTCCLK_32768   (TAMP_ATCR1_ATCKSEL_3 | TAMP_ATCR1_ATCKSEL_2 | TAMP_ATCR1_ATCKSEL_1 |\
608                                             TAMP_ATCR1_ATCKSEL_0)                                                 /*!< RTCCLK/32768 */
609 
610 
611 
612 /**
613   * @}
614   */
615 
616 /** @defgroup RTCEx_ActiveTamper_Sel  RTCEx Active Tamper selection Definition
617   * @{
618   */
619 #define RTC_ATAMP_1                        0U                    /*!< Tamper 1 */
620 #define RTC_ATAMP_2                        1U                    /*!< Tamper 2 */
621 #define RTC_ATAMP_3                        2U                    /*!< Tamper 3 */
622 #define RTC_ATAMP_4                        3U                    /*!< Tamper 4 */
623 #define RTC_ATAMP_5                        4U                    /*!< Tamper 5 */
624 #define RTC_ATAMP_6                        5U                    /*!< Tamper 6 */
625 #define RTC_ATAMP_7                        6U                    /*!< Tamper 7 */
626 #define RTC_ATAMP_8                        7U                    /*!< Tamper 8 */
627 /**
628   * @}
629   */
630 
631 /** @defgroup RTCEx_MonotonicCounter_Instance  RTCEx Monotonic Counter Instance Definition
632   * @{
633   */
634 #define RTC_MONOTONIC_COUNTER_1            0U                    /*!< Monotonic counter 1 */
635 /**
636   * @}
637   */
638 
639 /** @defgroup RTCEx_Backup_Registers  RTCEx Backup Registers Definition
640   * @{
641   */
642 #define RTC_BKP_NUMBER                     RTC_BKP_NB
643 #define RTC_BKP_DR0                        0x00U
644 #define RTC_BKP_DR1                        0x01U
645 #define RTC_BKP_DR2                        0x02U
646 #define RTC_BKP_DR3                        0x03U
647 #define RTC_BKP_DR4                        0x04U
648 #define RTC_BKP_DR5                        0x05U
649 #define RTC_BKP_DR6                        0x06U
650 #define RTC_BKP_DR7                        0x07U
651 #define RTC_BKP_DR8                        0x08U
652 #define RTC_BKP_DR9                        0x09U
653 #define RTC_BKP_DR10                       0x0AU
654 #define RTC_BKP_DR11                       0x0BU
655 #define RTC_BKP_DR12                       0x0CU
656 #define RTC_BKP_DR13                       0x0DU
657 #define RTC_BKP_DR14                       0x0EU
658 #define RTC_BKP_DR15                       0x0FU
659 #define RTC_BKP_DR16                       0x10U
660 #define RTC_BKP_DR17                       0x11U
661 #define RTC_BKP_DR18                       0x12U
662 #define RTC_BKP_DR19                       0x13U
663 #define RTC_BKP_DR20                       0x14U
664 #define RTC_BKP_DR21                       0x15U
665 #define RTC_BKP_DR22                       0x16U
666 #define RTC_BKP_DR23                       0x17U
667 #define RTC_BKP_DR24                       0x18U
668 #define RTC_BKP_DR25                       0x19U
669 #define RTC_BKP_DR26                       0x1AU
670 #define RTC_BKP_DR27                       0x1BU
671 #define RTC_BKP_DR28                       0x1CU
672 #define RTC_BKP_DR29                       0x1DU
673 #define RTC_BKP_DR30                       0x1EU
674 #define RTC_BKP_DR31                       0x1FU
675 /**
676   * @}
677   */
678 
679 /** @defgroup RTCEx_Binary_Mode RTC Binary Mode (32-bit free-running counter configuration).
680   *           Warning : It Should not be confused with the Binary format @ref RTC_Input_parameter_format_definitions.
681   * @{
682   */
683 #define RTC_BINARY_NONE                    0U                    /*!< Free running BCD calendar mode (Binary mode disabled) */
684 #define RTC_BINARY_ONLY                    RTC_ICSR_BIN_0        /*!< Free running Binary mode (BCD mode disabled)          */
685 #define RTC_BINARY_MIX                     RTC_ICSR_BIN_1        /*!< Free running BCD calendar and Binary modes            */
686 /**
687   * @}
688   */
689 
690 /** @defgroup RTCEx_Binary_mix_BCDU If Binary mode is RTC_BINARY_MIX, the BCD calendar second is incremented
691   *           using the SSR Least Significant Bits.
692   * @{
693   */
694 #define RTC_BINARY_MIX_BCDU_0              0U                           /*!<  The 1s BCD calendar increment is generated each time SS[7:0] = 0  */
695 #define RTC_BINARY_MIX_BCDU_1              (0x1UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[8:0] = 0  */
696 #define RTC_BINARY_MIX_BCDU_2              (0x2UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[9:0] = 0  */
697 #define RTC_BINARY_MIX_BCDU_3              (0x3UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[10:0] = 0 */
698 #define RTC_BINARY_MIX_BCDU_4              (0x4UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[11:0] = 0 */
699 #define RTC_BINARY_MIX_BCDU_5              (0x5UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[12:0] = 0 */
700 #define RTC_BINARY_MIX_BCDU_6              (0x6UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[13:0] = 0 */
701 #define RTC_BINARY_MIX_BCDU_7              (0x7UL << RTC_ICSR_BCDU_Pos) /*!<  The 1s BCD calendar increment is generated each time SS[14:0] = 0 */
702 /**
703   * @}
704   */
705 
706 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Masks_Definitions RTC Alarm Sub Seconds with binary or mix mode
707   *           Masks Definitions.
708   * @{
709   */
710 #define RTC_ALARMSUBSECONDBINMASK_ALL      0U                                /*!< All Alarm SS fields are masked.There is no comparison on sub seconds for Alarm */
711 #define RTC_ALARMSUBSECONDBINMASK_SS31_1   (1UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:1] are don't care in Alarm comparison. Only SS[0] is compared            */
712 #define RTC_ALARMSUBSECONDBINMASK_SS31_2   (2UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:2] are don't care in Alarm comparison. Only SS[1:0] are compared         */
713 #define RTC_ALARMSUBSECONDBINMASK_SS31_3   (3UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:3] are don't care in Alarm comparison. Only SS[2:0] are compared         */
714 #define RTC_ALARMSUBSECONDBINMASK_SS31_4   (4UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:4] are don't care in Alarm comparison. Only SS[3:0] are compared         */
715 #define RTC_ALARMSUBSECONDBINMASK_SS31_5   (5UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:5] are don't care in Alarm comparison. Only SS[4:0] are compared         */
716 #define RTC_ALARMSUBSECONDBINMASK_SS31_6   (6UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:6] are don't care in Alarm comparison. Only SS[5:0] are compared         */
717 #define RTC_ALARMSUBSECONDBINMASK_SS31_7   (7UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:7] are don't care in Alarm comparison. Only SS[6:0] are compared         */
718 #define RTC_ALARMSUBSECONDBINMASK_SS31_8   (8UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:8] are don't care in Alarm comparison. Only SS[7:0] are compared         */
719 #define RTC_ALARMSUBSECONDBINMASK_SS31_9   (9UL << RTC_ALRMASSR_MASKSS_Pos)  /*!< SS[31:9] are don't care in Alarm comparison. Only SS[8:0] are compared         */
720 #define RTC_ALARMSUBSECONDBINMASK_SS31_10  (10UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:10] are don't care in Alarm comparison. Only SS[9:0] are compared        */
721 #define RTC_ALARMSUBSECONDBINMASK_SS31_11  (11UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:11] are don't care in Alarm comparison. Only SS[10:0] are compared       */
722 #define RTC_ALARMSUBSECONDBINMASK_SS31_12  (12UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:12] are don't care in Alarm comparison.Only SS[11:0] are compared        */
723 #define RTC_ALARMSUBSECONDBINMASK_SS31_13  (13UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:13] are don't care in Alarm comparison. Only SS[12:0] are compared       */
724 #define RTC_ALARMSUBSECONDBINMASK_SS31_14  (14UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:14] are don't care in Alarm comparison. Only SS[13:0] are compared       */
725 #define RTC_ALARMSUBSECONDBINMASK_SS31_15  (15UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:15] are don't care in Alarm comparison. Only SS[14:0] are compared       */
726 #define RTC_ALARMSUBSECONDBINMASK_SS31_16  (16UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:16] are don't care in Alarm comparison. Only SS[15:0] are compared       */
727 #define RTC_ALARMSUBSECONDBINMASK_SS31_17  (17UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:17] are don't care in Alarm comparison. Only SS[16:0] are compared       */
728 #define RTC_ALARMSUBSECONDBINMASK_SS31_18  (18UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:18] are don't care in Alarm comparison. Only SS[17:0] are compared       */
729 #define RTC_ALARMSUBSECONDBINMASK_SS31_19  (19UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:19] are don't care in Alarm comparison. Only SS[18:0] are compared       */
730 #define RTC_ALARMSUBSECONDBINMASK_SS31_20  (20UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:20] are don't care in Alarm comparison. Only SS[19:0] are compared       */
731 #define RTC_ALARMSUBSECONDBINMASK_SS31_21  (21UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:21] are don't care in Alarm comparison. Only SS[20:0] are compared       */
732 #define RTC_ALARMSUBSECONDBINMASK_SS31_22  (22UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:22] are don't care in Alarm comparison. Only SS[21:0] are compared       */
733 #define RTC_ALARMSUBSECONDBINMASK_SS31_23  (23UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:23] are don't care in Alarm comparison. Only SS[22:0] are compared       */
734 #define RTC_ALARMSUBSECONDBINMASK_SS31_24  (24UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:24] are don't care in Alarm comparison. Only SS[23:0] are compared       */
735 #define RTC_ALARMSUBSECONDBINMASK_SS31_25  (25UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:25] are don't care in Alarm comparison. Only SS[24:0] are compared       */
736 #define RTC_ALARMSUBSECONDBINMASK_SS31_26  (26UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:26] are don't care in Alarm comparison. Only SS[25:0] are compared       */
737 #define RTC_ALARMSUBSECONDBINMASK_SS31_27  (27UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:27] are don't care in Alarm comparison. Only SS[26:0] are compared       */
738 #define RTC_ALARMSUBSECONDBINMASK_SS31_28  (28UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:28] are don't care in Alarm comparison. Only SS[27:0] are compared       */
739 #define RTC_ALARMSUBSECONDBINMASK_SS31_29  (29UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:29] are don't care in Alarm comparison. Only SS[28:0] are compared       */
740 #define RTC_ALARMSUBSECONDBINMASK_SS31_30  (30UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31:30] are don't care in Alarm comparison. Only SS[29:0] are compared       */
741 #define RTC_ALARMSUBSECONDBINMASK_SS31     (31UL << RTC_ALRMASSR_MASKSS_Pos) /*!< SS[31] is don't care in Alarm comparison. Only SS[30:0] are compared           */
742 #define RTC_ALARMSUBSECONDBINMASK_NONE     RTC_ALRMASSR_MASKSS               /*!< SS[31:0] are compared and must match to activate alarm                         */
743 /**
744   * @}
745   */
746 
747 /** @defgroup RTCEx_Alarm_Sub_Seconds_binary_Clear_Definitions RTC Alarm Sub Seconds
748   *           with binary mode auto clear Definitions
749   * @{
750   */
751 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_NO   0UL                   /*!< The synchronous Binary counter(SS[31:0] in RTC_SSR) is free-running */
752 #define RTC_ALARMSUBSECONDBIN_AUTOCLR_YES  RTC_ALRMASSR_SSCLR
753 /*!< The synchronous Binary counter (SS[31:0] in RTC_SSR) is running from 0xFFFF FFFF to RTC_ALRMABINR -> SS[31:0]
754      value and is automatically reloaded with 0xFFFF FFFF whenreaching RTC_ALRMABINR -> SS[31:0]. */
755 /**
756   * @}
757   */
758 
759 /** @defgroup RTCEx_RTC_Secure_Full  RTCEx Secure Definition
760   * @{
761   */
762 #define RTC_SECURE_FULL_YES                RTC_SECCFGR_SEC       /*!< RTC full secure */
763 #define RTC_SECURE_FULL_NO                 0U                    /*!< RTC is not full secure, features can be unsecure. See RTCEx_RTC_NonSecure_Features */
764 /**
765   * @}
766   */
767 
768 /** @defgroup RTCEx_RTC_NonSecure_Features  RTCEx Secure Features Definition
769   * @{
770   */
771 #define RTC_NONSECURE_FEATURE_NONE         0U
772 #define RTC_NONSECURE_FEATURE_INIT         RTC_SECCFGR_INITSEC   /*!< Initialization */
773 #define RTC_NONSECURE_FEATURE_CAL          RTC_SECCFGR_CALSEC    /*!< Calibration    */
774 #define RTC_NONSECURE_FEATURE_TS           RTC_SECCFGR_TSSEC     /*!< Time stamp     */
775 #define RTC_NONSECURE_FEATURE_WUT          RTC_SECCFGR_WUTSEC    /*!< Wake up timer  */
776 #define RTC_NONSECURE_FEATURE_ALRA         RTC_SECCFGR_ALRASEC   /*!< Alarm A        */
777 #define RTC_NONSECURE_FEATURE_ALRB         RTC_SECCFGR_ALRBSEC   /*!< Alarm B        */
778 
779 #define RTC_NONSECURE_FEATURE_ALL          (RTC_SECCFGR_INITSEC |  RTC_SECCFGR_CALSEC | \
780                                             RTC_SECCFGR_TSSEC | RTC_SECCFGR_WUTSEC | \
781                                             RTC_SECCFGR_ALRASEC | RTC_SECCFGR_ALRBSEC)
782 /**
783   * @}
784   */
785 
786 /** @defgroup RTCEx_TAMP_Secure_Full  RTCEx TAMP Secure Definition
787   * @{
788   */
789 #define TAMP_SECURE_FULL_YES               TAMP_SECCFGR_TAMPSEC  /*!< TAMPER full secure   */
790 #define TAMP_SECURE_FULL_NO                0U                    /*!< TAMPER is not secure */
791 /**
792   * @}
793   */
794 
795 /** @defgroup RTCEx_TAMP_Monotonic_Counter_Secure  RTCEx TAMP Monotonic Counter Secure Definition
796   * @{
797   */
798 #define TAMP_MONOTONIC_CNT_SECURE_YES      TAMP_SECCFGR_CNT1SEC  /*!< TAMPER Monotonic Counter secure        */
799 #define TAMP_MONOTONIC_CNT_SECURE_NO       0U                    /*!< TAMPER Monotonic Counter is not secure */
800 /**
801   * @}
802   */
803 
804 /** @defgroup RTCEx_RTC_Privilege_Full  RTCEx Privilege Full Definition
805   * @{
806   */
807 #define RTC_PRIVILEGE_FULL_YES             RTC_PRIVCFGR_PRIV
808 #define RTC_PRIVILEGE_FULL_NO              0U
809 /**
810   * @}
811   */
812 
813 /** @defgroup RTCEx_RTC_Privilege_Features  RTCEx Privilege Features Definition
814   * @{
815   */
816 #define RTC_PRIVILEGE_FEATURE_NONE         0U
817 #define RTC_PRIVILEGE_FEATURE_INIT         RTC_PRIVCFGR_INITPRIV /*!< Initialization */
818 #define RTC_PRIVILEGE_FEATURE_CAL          RTC_PRIVCFGR_CALPRIV  /*!< Calibration    */
819 #define RTC_PRIVILEGE_FEATURE_TS           RTC_PRIVCFGR_TSPRIV   /*!< Time stamp     */
820 #define RTC_PRIVILEGE_FEATURE_WUT          RTC_PRIVCFGR_WUTPRIV  /*!< Wake up timer  */
821 #define RTC_PRIVILEGE_FEATURE_ALRA         RTC_PRIVCFGR_ALRAPRIV /*!< Alarm A        */
822 #define RTC_PRIVILEGE_FEATURE_ALRB         RTC_PRIVCFGR_ALRBPRIV /*!< Alarm B        */
823 
824 #define RTC_PRIVILEGE_FEATURE_ALL          (RTC_PRIVCFGR_INITPRIV |  RTC_PRIVCFGR_CALPRIV | \
825                                             RTC_PRIVCFGR_TSPRIV | RTC_PRIVCFGR_WUTPRIV | \
826                                             RTC_PRIVCFGR_ALRAPRIV | RTC_PRIVCFGR_ALRBPRIV)
827 /**
828   * @}
829   */
830 
831 /** @defgroup RTCEx_TAMP_Privilege_Full  RTCEx TAMP security Definition
832   * @{
833   */
834 #define TAMP_PRIVILEGE_FULL_YES            TAMP_PRIVCFGR_TAMPPRIV
835 #define TAMP_PRIVILEGE_FULL_NO             0U
836 /**
837   * @}
838   */
839 
840 /** @defgroup RTCEx_TAMP_Device_Secrets_Erase_Conf  RTCEx TAMP Device Secrets Erase Configuration Definition
841   * @{
842   */
843 #define TAMP_DEVICESECRETS_ERASE_NONE      0U                   /*!< No Erase    */
844 #define TAMP_DEVICESECRETS_ERASE_BKPSRAM   TAMP_RPCFGR_RPCFG0   /*!< Backup SRAM */
845 /**
846   * @}
847   */
848 
849 /** @defgroup RTCEx_TAMP_Monotonic_Counter_Privilege  RTCEx TAMP Monotonic Counter Privilege Definition
850   * @{
851   */
852 #define TAMP_MONOTONIC_CNT_PRIVILEGE_YES   TAMP_PRIVCFGR_CNT1PRIV
853 #define TAMP_MONOTONIC_CNT_PRIVILEGE_NO    0U
854 /**
855   * @}
856   */
857 
858 /** @defgroup RTCEx_Backup_Reg_Privilege_zone  RTCEx Privilege Backup register privilege zone Definition
859   * @{
860   */
861 #define RTC_PRIVILEGE_BKUP_ZONE_NONE       0U
862 #define RTC_PRIVILEGE_BKUP_ZONE_1          TAMP_PRIVCFGR_BKPRWPRIV
863 #define RTC_PRIVILEGE_BKUP_ZONE_2          TAMP_PRIVCFGR_BKPWPRIV
864 #define RTC_PRIVILEGE_BKUP_ZONE_ALL        (RTC_PRIVILEGE_BKUP_ZONE_1 | RTC_PRIVILEGE_BKUP_ZONE_2)
865 /**
866   * @}
867   */
868 
869 /**
870   * @}
871   */
872 
873 /* Exported macros -----------------------------------------------------------*/
874 /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
875   * @{
876   */
877 
878 /** @brief  Clear the specified RTC pending flag.
879   * @param  __HANDLE__ specifies the RTC Handle.
880   * @param  __FLAG__ specifies the flag to check.
881   *          This parameter can be any combination of the following values:
882   *            @arg @ref RTC_CLEAR_SSRUF              Clear SSR underflow flag
883   *            @arg @ref RTC_CLEAR_ITSF               Clear Internal Time-stamp flag
884   *            @arg @ref RTC_CLEAR_TSOVF              Clear Time-stamp overflow flag
885   *            @arg @ref RTC_CLEAR_TSF                Clear Time-stamp flag
886   *            @arg @ref RTC_CLEAR_WUTF               Clear Wakeup timer flag
887   *            @arg @ref RTC_CLEAR_ALRBF              Clear Alarm B flag
888   *            @arg @ref RTC_CLEAR_ALRAF              Clear Alarm A flag
889   * @retval None
890   */
891 #define __HAL_RTC_CLEAR_FLAG(__HANDLE__, __FLAG__)   (RTC->SCR = (__FLAG__))
892 
893 /** @brief  Check whether the specified RTC flag is set or not.
894   * @param  __HANDLE__ specifies the RTC Handle.
895   * @param  __FLAG__ specifies the flag to check.
896   *          This parameter can be any combination of the following values:
897   *            @arg @ref RTC_FLAG_RECALPF             Recalibration pending Flag
898   *            @arg @ref RTC_FLAG_INITF               Initialization flag
899   *            @arg @ref RTC_FLAG_RSF                 Registers synchronization flag
900   *            @arg @ref RTC_FLAG_INITS               Initialization status flag
901   *            @arg @ref RTC_FLAG_SHPF                Shift operation pending flag
902   *            @arg @ref RTC_FLAG_WUTWF               Wakeup timer write flag
903   *            @arg @ref RTC_FLAG_ITSF                Internal Time-stamp flag
904   *            @arg @ref RTC_FLAG_TSOVF               Time-stamp overflow flag
905   *            @arg @ref RTC_FLAG_TSF                 Time-stamp flag
906   *            @arg @ref RTC_FLAG_WUTF                Wakeup timer flag
907   *            @arg @ref RTC_FLAG_ALRBF               Alarm B flag
908   *            @arg @ref RTC_FLAG_ALRAF               Alarm A flag
909   * @retval The state of __FLAG__ (TRUE or FALSE).
910   */
911 #define __HAL_RTC_GET_FLAG(__HANDLE__, __FLAG__)( \
912                                ((__FLAG__) == RTC_FLAG_RECALPF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_RECALPF) == \
913                                                                 RTC_ICSR_RECALPF) : \
914                                ((__FLAG__) == RTC_FLAG_INITF)   ? (READ_BIT(RTC->ICSR, RTC_ICSR_INITF) == \
915                                                                 RTC_ICSR_INITF) : \
916                                ((__FLAG__) == RTC_FLAG_RSF)     ? (READ_BIT(RTC->ICSR, RTC_ICSR_RSF) == \
917                                                                 RTC_ICSR_RSF) : \
918                                ((__FLAG__) == RTC_FLAG_INITS)   ? (READ_BIT(RTC->ICSR, RTC_ICSR_INITS) == \
919                                                                 RTC_ICSR_INITS) : \
920                                ((__FLAG__) == RTC_FLAG_SHPF)    ? (READ_BIT(RTC->ICSR, RTC_ICSR_SHPF) == \
921                                                                 RTC_ICSR_SHPF) : \
922                                ((__FLAG__) == RTC_FLAG_WUTWF)   ? (READ_BIT(RTC->ICSR, RTC_ICSR_WUTWF) == \
923                                                                 RTC_ICSR_WUTWF) : \
924                                ((__FLAG__) == RTC_FLAG_SSRUF)   ? (READ_BIT(RTC->SR, RTC_SR_SSRUF) == \
925                                                                 RTC_SR_SSRUF) : \
926                                ((__FLAG__) == RTC_FLAG_ITSF)    ? (READ_BIT(RTC->SR, RTC_SR_ITSF) == \
927                                                                 RTC_SR_ITSF) : \
928                                ((__FLAG__) == RTC_FLAG_TSOVF)   ? (READ_BIT(RTC->SR, RTC_SR_TSOVF) == \
929                                                                 RTC_SR_TSOVF) : \
930                                ((__FLAG__) == RTC_FLAG_TSF)     ? (READ_BIT(RTC->SR, RTC_SR_TSF) == \
931                                                                 RTC_SR_TSF): \
932                                ((__FLAG__) == RTC_FLAG_WUTF)    ? (READ_BIT(RTC->SR, RTC_SR_WUTF) == \
933                                                                 RTC_SR_WUTF): \
934                                ((__FLAG__) == RTC_FLAG_ALRBF)   ? (READ_BIT(RTC->SR, RTC_SR_ALRBF) == \
935                                                                 RTC_SR_ALRBF) : \
936                                ((__FLAG__) == RTC_FLAG_ALRAF)   ? (READ_BIT(RTC->SR, RTC_SR_ALRAF) == \
937                                                                 RTC_SR_ALRAF) : \
938                                (0U)) /* Return 0 because it is an invalid parameter value */
939 
940 /* ---------------------------------WAKEUPTIMER---------------------------------*/
941 /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer
942   * @{
943   */
944 
945 /**
946   * @brief  Enable the RTC WakeUp Timer peripheral.
947   * @param  __HANDLE__ specifies the RTC handle.
948   * @retval None
949   */
950 #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__)                      (RTC->CR |= (RTC_CR_WUTE))
951 
952 /**
953   * @brief  Disable the RTC WakeUp Timer peripheral.
954   * @param  __HANDLE__ specifies the RTC handle.
955   * @retval None
956   */
957 #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__)                     (RTC->CR &= ~(RTC_CR_WUTE))
958 
959 /**
960   * @brief  Enable the RTC WakeUpTimer interrupt.
961   * @param  __HANDLE__ specifies the RTC handle.
962   * @param  __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled.
963   *         This parameter can be:
964   *            @arg @ref RTC_IT_WUT WakeUpTimer interrupt
965   * @retval None
966   */
967 #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__)    (RTC->CR |= (RTC_CR_WUTIE))
968 
969 /**
970   * @brief  Disable the RTC WakeUpTimer interrupt.
971   * @param  __HANDLE__ specifies the RTC handle.
972   * @param  __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled.
973   *         This parameter can be:
974   *            @arg @ref RTC_IT_WUT WakeUpTimer interrupt
975   * @retval None
976   */
977 #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__)   (RTC->CR &= ~(RTC_CR_WUTIE))
978 
979 /**
980   * @brief  Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
981   * @param  __HANDLE__ specifies the RTC handle.
982   * @param  __INTERRUPT__ specifies the RTC WakeUpTimer interrupt to check.
983   *         This parameter can be:
984   *            @arg @ref RTC_IT_WUT  WakeUpTimer interrupt
985   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
986   */
987 #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__)       (((RTC->MISR) & (RTC_MISR_WUTMF)) != 0U)
988 
989 /**
990   * @brief  Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
991   * @param  __HANDLE__ specifies the RTC handle.
992   * @param  __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check.
993   *         This parameter can be:
994   *            @arg @ref RTC_IT_WUT  WakeUpTimer interrupt
995   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
996   */
997 #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   (((RTC->CR) & (RTC_CR_WUTIE)) != 0U)
998 
999 /**
1000   * @brief  Get the selected RTC WakeUpTimers flag status.
1001   * @param  __HANDLE__ specifies the RTC handle.
1002   * @param  __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not.
1003   *          This parameter can be:
1004   *             @arg @ref RTC_FLAG_WUTF
1005   *             @arg @ref RTC_FLAG_WUTWF
1006   * @retval The state of __FLAG__ (TRUE or FALSE).
1007   */
1008 #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)( \
1009                             ((__FLAG__) == RTC_FLAG_WUTF)  ? (READ_BIT(RTC->SR, RTC_SR_WUTF) == RTC_SR_WUTF):\
1010                             ((__FLAG__) == RTC_FLAG_WUTWF) ? (READ_BIT(RTC->ICSR, RTC_ICSR_WUTWF) == RTC_ICSR_WUTWF):\
1011                             (0U)) /* Return 0 because it is an invalid parameter value */
1012 
1013 /**
1014   * @brief  Clear the RTC Wake Up timers pending flags.
1015   * @param  __HANDLE__ specifies the RTC handle.
1016   * @param  __FLAG__ specifies the RTC WakeUpTimer Flag to clear.
1017   *         This parameter can be:
1018   *            @arg @ref RTC_FLAG_WUTF
1019   * @retval None
1020   */
1021 #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__)  (WRITE_REG(RTC->SCR, RTC_SCR_CWUTF))
1022 
1023 /**
1024   * @}
1025   */
1026 
1027 /* ---------------------------------TIMESTAMP---------------------------------*/
1028 /** @defgroup RTCEx_Timestamp RTC Timestamp
1029   * @{
1030   */
1031 
1032 /**
1033   * @brief  Enable the RTC TimeStamp peripheral.
1034   * @param  __HANDLE__ specifies the RTC handle.
1035   * @retval None
1036   */
1037 #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__)                       (RTC->CR |= (RTC_CR_TSE))
1038 
1039 /**
1040   * @brief  Disable the RTC TimeStamp peripheral.
1041   * @param  __HANDLE__ specifies the RTC handle.
1042   * @retval None
1043   */
1044 #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__)                      (RTC->CR &= ~(RTC_CR_TSE))
1045 
1046 /**
1047   * @brief  Enable the RTC TimeStamp interrupt.
1048   * @param  __HANDLE__ specifies the RTC handle.
1049   * @param  __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled.
1050   *         This parameter can be:
1051   *            @arg @ref RTC_IT_TS TimeStamp interrupt
1052   * @retval None
1053   */
1054 #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__)     (RTC->CR |= (RTC_CR_TSIE))
1055 
1056 /**
1057   * @brief  Disable the RTC TimeStamp interrupt.
1058   * @param  __HANDLE__ specifies the RTC handle.
1059   * @param  __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled.
1060   *         This parameter can be:
1061   *            @arg @ref RTC_IT_TS TimeStamp interrupt
1062   * @retval None
1063   */
1064 #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__)    (RTC->CR &= ~(RTC_CR_TSIE))
1065 
1066 /**
1067   * @brief  Check whether the specified RTC TimeStamp interrupt has occurred or not.
1068   * @param  __HANDLE__ specifies the RTC handle.
1069   * @param  __INTERRUPT__ specifies the RTC TimeStamp interrupt to check.
1070   *         This parameter can be:
1071   *            @arg @ref RTC_IT_TS TimeStamp interrupt
1072   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
1073   */
1074 #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__)        (((RTC->MISR) & (RTC_MISR_TSMF)) != 0U)
1075 
1076 /**
1077   * @brief  Check whether the specified RTC Time Stamp interrupt has been enabled or not.
1078   * @param  __HANDLE__ specifies the RTC handle.
1079   * @param  __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check.
1080   *         This parameter can be:
1081   *            @arg @ref RTC_IT_TS TimeStamp interrupt
1082   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
1083   */
1084 #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)  (((RTC->CR) & (RTC_CR_TSIE)) != 0U)
1085 
1086 /**
1087   * @brief  Get the selected RTC TimeStamps flag status.
1088   * @param  __HANDLE__ specifies the RTC handle.
1089   * @param  __FLAG__ specifies the RTC TimeStamp Flag is pending or not.
1090   *         This parameter can be:
1091   *            @arg @ref RTC_FLAG_TSF
1092   *            @arg @ref RTC_FLAG_TSOVF
1093   * @retval The state of __FLAG__ (TRUE or FALSE) or 255 if invalid parameter.
1094   */
1095 #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__)( \
1096                                 ((__FLAG__) == RTC_FLAG_TSF)   ? (READ_BIT(RTC->SR, RTC_SR_TSF) == RTC_SR_TSF):\
1097                                 ((__FLAG__) == RTC_FLAG_TSOVF) ? (READ_BIT(RTC->SR, RTC_SR_TSOVF) == RTC_SR_TSOVF):\
1098                                 (0U)) /* Return 0 because it is an invalid parameter value */
1099 
1100 /**
1101   * @brief  Clear the RTC Time Stamps pending flags.
1102   * @param  __HANDLE__ specifies the RTC handle.
1103   * @param  __FLAG__ specifies the RTC TimeStamp Flag to clear.
1104   *          This parameter can be:
1105   *             @arg @ref RTC_FLAG_TSF
1106   *             @arg @ref RTC_FLAG_TSOVF
1107   * @retval None
1108   */
1109 #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__)( \
1110                                 ((__FLAG__) == RTC_FLAG_TSF)   ? (WRITE_REG(RTC->SCR, RTC_SCR_CTSF)):\
1111                                 ((__FLAG__) == RTC_FLAG_TSOVF) ? (WRITE_REG(RTC->SCR, RTC_SCR_CTSOVF)):\
1112                                 (0U)) /* Dummy action because is an invalid parameter value */
1113 
1114 /**
1115   * @brief  Enable the RTC internal TimeStamp peripheral.
1116   * @param  __HANDLE__ specifies the RTC handle.
1117   * @retval None
1118   */
1119 #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__)                (RTC->CR |= (RTC_CR_ITSE))
1120 
1121 /**
1122   * @brief  Disable the RTC internal TimeStamp peripheral.
1123   * @param  __HANDLE__ specifies the RTC handle.
1124   * @retval None
1125   */
1126 #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__)               (RTC->CR &= ~(RTC_CR_ITSE))
1127 
1128 /**
1129   * @brief  Get the selected RTC Internal Time Stamps flag status.
1130   * @param  __HANDLE__ specifies the RTC handle.
1131   * @param  __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not.
1132   *         This parameter can be:
1133   *            @arg @ref RTC_FLAG_ITSF
1134   * @retval None
1135   */
1136 #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__)   ((READ_BIT(RTC->SR, RTC_SR_ITSF) == RTC_SR_ITSF))
1137 
1138 /**
1139   * @brief  Clear the RTC Internal Time Stamps pending flags.
1140   * @param  __HANDLE__ specifies the RTC handle.
1141   * @param  __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear.
1142   * This parameter can be:
1143   *             @arg @ref RTC_FLAG_ITSF
1144   * @retval None
1145   */
1146 #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__)   (WRITE_REG(RTC->SCR, RTC_SCR_CITSF))
1147 
1148 /**
1149   * @brief  Enable the RTC TimeStamp on Tamper detection.
1150   * @param  __HANDLE__ specifies the RTC handle.
1151   * @retval None
1152   */
1153 #define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__)                       (RTC->CR |= (RTC_CR_TAMPTS))
1154 
1155 /**
1156   * @brief  Disable the RTC TimeStamp on Tamper detection.
1157   * @param  __HANDLE__ specifies the RTC handle.
1158   * @retval None
1159   */
1160 #define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__)                      (RTC->CR &= ~(RTC_CR_TAMPTS))
1161 
1162 /**
1163   * @brief  Enable the RTC Tamper detection output.
1164   * @param  __HANDLE__ specifies the RTC handle.
1165   * @retval None
1166   */
1167 #define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__)                       (RTC->CR |= (RTC_CR_TAMPOE))
1168 
1169 /**
1170   * @brief  Disable the RTC Tamper detection output.
1171   * @param  __HANDLE__ specifies the RTC handle.
1172   * @retval None
1173   */
1174 #define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__)                      (RTC->CR &= ~(RTC_CR_TAMPOE))
1175 
1176 /**
1177   * @}
1178   */
1179 
1180 
1181 /* ------------------------------Calibration----------------------------------*/
1182 /** @defgroup RTCEx_Calibration RTC Calibration
1183   * @{
1184   */
1185 
1186 /**
1187   * @brief  Enable the RTC calibration output.
1188   * @param  __HANDLE__ specifies the RTC handle.
1189   * @retval None
1190   */
1191 #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__)               (RTC->CR |= (RTC_CR_COE))
1192 
1193 /**
1194   * @brief  Disable the calibration output.
1195   * @param  __HANDLE__ specifies the RTC handle.
1196   * @retval None
1197   */
1198 #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__)              (RTC->CR &= ~(RTC_CR_COE))
1199 
1200 /**
1201   * @brief  Enable the clock reference detection.
1202   * @param  __HANDLE__ specifies the RTC handle.
1203   * @retval None
1204   */
1205 #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__)               (RTC->CR |= (RTC_CR_REFCKON))
1206 
1207 /**
1208   * @brief  Disable the clock reference detection.
1209   * @param  __HANDLE__ specifies the RTC handle.
1210   * @retval None
1211   */
1212 #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__)              (RTC->CR &= ~(RTC_CR_REFCKON))
1213 
1214 /**
1215   * @brief  Get the selected RTC shift operations flag status.
1216   * @param  __HANDLE__ specifies the RTC handle.
1217   * @param  __FLAG__ specifies the RTC shift operation Flag is pending or not.
1218   *          This parameter can be:
1219   *             @arg @ref RTC_FLAG_SHPF
1220   * @retval The state of __FLAG__ (TRUE or FALSE)
1221   */
1222 #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__)  ((READ_BIT(RTC->ICSR, RTC_ICSR_SHPF) == RTC_ICSR_SHPF))
1223 /**
1224   * @}
1225   */
1226 
1227 /* ------------------------------Tamper----------------------------------*/
1228 /** @defgroup RTCEx_Tamper RTCEx tamper
1229   * @{
1230   */
1231 
1232 /**
1233   * @brief  Enable the TAMP Tamper input detection.
1234   * @param  __HANDLE__ specifies the RTC handle.
1235   * @param  __TAMPER__ specifies the RTC Tamper source to be enabled.
1236   *         This parameter can be any combination of the following values:
1237   *            @arg  RTC_TAMPER_ALL: All tampers
1238   *            @arg  RTC_TAMPER_1: Tamper1
1239   *            @arg  RTC_TAMPER_2: Tamper2
1240   *            @arg  RTC_TAMPER_3: Tamper3
1241   *            @arg  RTC_TAMPER_4: Tamper4
1242   *            @arg  RTC_TAMPER_5: Tamper5
1243   *            @arg  RTC_TAMPER_6: Tamper6
1244   *            @arg  RTC_TAMPER_7: Tamper7
1245   *            @arg  RTC_TAMPER_8: Tamper8
1246   * @retval None
1247   */
1248 #define __HAL_RTC_TAMPER_ENABLE(__HANDLE__, __TAMPER__)           (TAMP->CR1 |= (__TAMPER__))
1249 
1250 /**
1251   * @brief  Disable the TAMP Tamper input detection.
1252   * @param  __HANDLE__ specifies the RTC handle.
1253   * @param  __TAMPER__ specifies the RTC Tamper sources to be enabled.
1254   *         This parameter can be any combination of the following values:
1255   *            @arg  RTC_TAMPER_ALL: All tampers
1256   *            @arg  RTC_TAMPER_1: Tamper1
1257   *            @arg  RTC_TAMPER_2: Tamper2
1258   *            @arg  RTC_TAMPER_3: Tamper3
1259   *            @arg  RTC_TAMPER_4: Tamper4
1260   *            @arg  RTC_TAMPER_5: Tamper5
1261   *            @arg  RTC_TAMPER_6: Tamper6
1262   *            @arg  RTC_TAMPER_7: Tamper7
1263   *            @arg  RTC_TAMPER_8: Tamper8
1264   */
1265 #define __HAL_RTC_TAMPER_DISABLE(__HANDLE__, __TAMPER__)           (TAMP->CR1 &= ~(__TAMPER__))
1266 
1267 
1268 /**************************************************************************************************/
1269 /**
1270   * @brief  Enable the TAMP Tamper interrupt.
1271   * @param  __HANDLE__ specifies the RTC handle.
1272   * @param  __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled.
1273   *          This parameter can be any combination of the following values:
1274   *            @arg  RTC_IT_TAMP_ALL: All tampers interrupts
1275   *            @arg  RTC_IT_TAMP_1: Tamper1 interrupt
1276   *            @arg  RTC_IT_TAMP_2: Tamper2 interrupt
1277   *            @arg  RTC_IT_TAMP_3: Tamper3 interrupt
1278   *            @arg  RTC_IT_TAMP_4: Tamper4 interrupt
1279   *            @arg  RTC_IT_TAMP_5: Tamper5 interrupt
1280   *            @arg  RTC_IT_TAMP_6: Tamper6 interrupt
1281   *            @arg  RTC_IT_TAMP_7: Tamper7 interrupt
1282   *            @arg  RTC_IT_TAMP_8: Tamper8 interrupt
1283   * @retval None
1284   */
1285 #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__)        (TAMP->IER |= (__INTERRUPT__))
1286 
1287 /**
1288   * @brief  Disable the TAMP Tamper interrupt.
1289   * @param  __HANDLE__ specifies the RTC handle.
1290   * @param  __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled.
1291   *         This parameter can be any combination of the following values:
1292   *            @arg  RTC_IT_TAMP_ALL: All tampers interrupts
1293   *            @arg  RTC_IT_TAMP_1: Tamper1 interrupt
1294   *            @arg  RTC_IT_TAMP_2: Tamper2 interrupt
1295   *            @arg  RTC_IT_TAMP_3: Tamper3 interrupt
1296   *            @arg  RTC_IT_TAMP_4: Tamper4 interrupt
1297   *            @arg  RTC_IT_TAMP_5: Tamper5 interrupt
1298   *            @arg  RTC_IT_TAMP_6: Tamper6 interrupt
1299   *            @arg  RTC_IT_TAMP_7: Tamper7 interrupt
1300   *            @arg  RTC_IT_TAMP_8: Tamper8 interrupt
1301   * @retval None
1302   */
1303 #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__)       (TAMP->IER &= ~(__INTERRUPT__))
1304 
1305 
1306 /**************************************************************************************************/
1307 /**
1308   * @brief  Check whether the specified RTC Tamper interrupt has occurred or not.
1309   * @param  __HANDLE__ specifies the RTC handle.
1310   * @param  __INTERRUPT__ specifies the RTC Tamper interrupt to check.
1311   *         This parameter can be:
1312   *            @arg  RTC_IT_TAMP_ALL: All tampers interrupts
1313   *            @arg  RTC_IT_TAMP_1: Tamper1 interrupt
1314   *            @arg  RTC_IT_TAMP_2: Tamper2 interrupt
1315   *            @arg  RTC_IT_TAMP_3: Tamper3 interrupt
1316   *            @arg  RTC_IT_TAMP_4: Tamper4 interrupt
1317   *            @arg  RTC_IT_TAMP_5: Tamper5 interrupt
1318   *            @arg  RTC_IT_TAMP_6: Tamper6 interrupt
1319   *            @arg  RTC_IT_TAMP_7: Tamper7 interrupt
1320   *            @arg  RTC_IT_TAMP_8: Tamper8 interrupt
1321   *            @arg  RTC_IT_INT_TAMP_ALL: All Internal Tamper interrupts
1322   *            @arg  RTC_IT_INT_TAMP_1: Internal Tamper1 interrupt
1323   *            @arg  RTC_IT_INT_TAMP_2: Internal Tamper2 interrupt
1324   *            @arg  RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt
1325   *            @arg  RTC_IT_INT_TAMP_4: Internal Tamper4 interrupt
1326   *            @arg  RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt
1327   *            @arg  RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt
1328   *            @arg  RTC_IT_INT_TAMP_7: Internal Tamper7 interrupt
1329   *            @arg  RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt
1330   *            @arg  RTC_IT_INT_TAMP_9: Internal Tamper9 interrupt
1331   *            @arg  RTC_IT_INT_TAMP_11: Internal Tamper11 interrupt
1332   * @retval The state of __INTERRUPT__ (TRUE or FALSE)
1333   */
1334 #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__)    (((TAMP->MISR) & (__INTERRUPT__)) != 0U)
1335 
1336 /**
1337   * @brief  Check whether the specified RTC Tamper interrupt has been enabled or not.
1338   * @param  __HANDLE__ specifies the RTC handle.
1339   * @param  __INTERRUPT__ specifies the RTC Tamper interrupt source to check.
1340   *         This parameter can be:
1341   *            @arg  RTC_IT_TAMP_ALL: All tampers interrupts
1342   *            @arg  RTC_IT_TAMP_1: Tamper1 interrupt
1343   *            @arg  RTC_IT_TAMP_2: Tamper2 interrupt
1344   *            @arg  RTC_IT_TAMP_3: Tamper3 interrupt
1345   *            @arg  RTC_IT_TAMP_4: Tamper4 interrupt
1346   *            @arg  RTC_IT_TAMP_5: Tamper5 interrupt
1347   *            @arg  RTC_IT_TAMP_6: Tamper6 interrupt
1348   *            @arg  RTC_IT_TAMP_7: Tamper7 interrupt
1349   *            @arg  RTC_IT_TAMP_8: Tamper8 interrupt
1350   *            @arg  RTC_IT_INT_TAMP_ALL: All internal tampers interrupts
1351   *            @arg  RTC_IT_INT_TAMP_1: Internal Tamper1 interrupt
1352   *            @arg  RTC_IT_INT_TAMP_2: Internal Tamper2 interrupt
1353   *            @arg  RTC_IT_INT_TAMP_3: Internal Tamper3 interrupt
1354   *            @arg  RTC_IT_INT_TAMP_4: Internal Tamper4 interrupt
1355   *            @arg  RTC_IT_INT_TAMP_5: Internal Tamper5 interrupt
1356   *            @arg  RTC_IT_INT_TAMP_6: Internal Tamper6 interrupt
1357   *            @arg  RTC_IT_INT_TAMP_7: Internal Tamper7 interrupt
1358   *            @arg  RTC_IT_INT_TAMP_8: Internal Tamper8 interrupt
1359   *            @arg  RTC_IT_INT_TAMP_9: Internal Tamper9 interrupt
1360   *            @arg  RTC_IT_INT_TAMP_11: Internal Tamper11 interrupt
1361   * @retval The state of __INTERRUPT__ (TRUE or FALSE)
1362   */
1363 #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   (((TAMP->IER) & (__INTERRUPT__)) != 0U)
1364 
1365 /**
1366   * @brief  Get the selected RTC Tampers flag status.
1367   * @param  __HANDLE__ specifies the RTC handle.
1368   * @param  __FLAG__ specifies the RTC Tamper Flag is pending or not.
1369   *          This parameter can be:
1370   *             @arg RTC_FLAG_TAMP_ALL: All tampers flag
1371   *             @arg RTC_FLAG_TAMP_1: Tamper1 flag
1372   *             @arg RTC_FLAG_TAMP_2: Tamper2 flag
1373   *             @arg RTC_FLAG_TAMP_3: Tamper3 flag
1374   *             @arg RTC_FLAG_TAMP_4: Tamper4 flag
1375   *             @arg RTC_FLAG_TAMP_5: Tamper5 flag
1376   *             @arg RTC_FLAG_TAMP_6: Tamper6 flag
1377   *             @arg RTC_FLAG_TAMP_7: Tamper7 flag
1378   *             @arg RTC_FLAG_TAMP_8: Tamper8 flag
1379   *             @arg RTC_FLAG_INT_TAMP_1: Internal Tamper1 flag
1380   *             @arg RTC_FLAG_INT_TAMP_2: Internal Tamper2 flag
1381   *             @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 flag
1382   *             @arg RTC_FLAG_INT_TAMP_4: Internal Tamper4 flag
1383   *             @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 flag
1384   *             @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 flag
1385   *             @arg RTC_FLAG_INT_TAMP_7: Internal Tamper7 flag
1386   *             @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 flag
1387   *             @arg RTC_FLAG_INT_TAMP_9: Internal Tamper9 flag
1388   *             @arg RTC_FLAG_INT_TAMP_11: Internal Tamper11 flag
1389   * @retval The state of __FLAG__ (TRUE or FALSE)
1390   */
1391 #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__)        (((TAMP->SR) & (__FLAG__)) != 0U)
1392 
1393 /**
1394   * @brief  Clear the RTC Tamper's pending flags.
1395   * @param  __HANDLE__ specifies the RTC handle.
1396   * @param  __FLAG__ specifies the RTC Tamper Flag to clear.
1397   *          This parameter can be:
1398   *             @arg RTC_FLAG_TAMP_ALL: All tampers flag
1399   *             @arg RTC_FLAG_TAMP_1: Tamper1 flag
1400   *             @arg RTC_FLAG_TAMP_2: Tamper2 flag
1401   *             @arg RTC_FLAG_TAMP_3: Tamper3 flag
1402   *             @arg RTC_FLAG_TAMP_4: Tamper4 flag
1403   *             @arg RTC_FLAG_TAMP_5: Tamper5 flag
1404   *             @arg RTC_FLAG_TAMP_6: Tamper6 flag
1405   *             @arg RTC_FLAG_TAMP_7: Tamper7 flag
1406   *             @arg RTC_FLAG_TAMP_8: Tamper8 flag
1407   *             @arg RTC_FLAG_INT_TAMP_ALL: All Internal Tamper flags
1408   *             @arg RTC_FLAG_INT_TAMP_1: Internal Tamper1 flag
1409   *             @arg RTC_FLAG_INT_TAMP_2: Internal Tamper2 flag
1410   *             @arg RTC_FLAG_INT_TAMP_3: Internal Tamper3 flag
1411   *             @arg RTC_FLAG_INT_TAMP_4: Internal Tamper4 flag
1412   *             @arg RTC_FLAG_INT_TAMP_5: Internal Tamper5 flag
1413   *             @arg RTC_FLAG_INT_TAMP_6: Internal Tamper6 flag
1414   *             @arg RTC_FLAG_INT_TAMP_7: Internal Tamper7 flag
1415   *             @arg RTC_FLAG_INT_TAMP_8: Internal Tamper8 flag
1416   *             @arg RTC_FLAG_INT_TAMP_9: Internal Tamper9 flag
1417   *             @arg RTC_FLAG_INT_TAMP_11: Internal Tamper11 flag
1418   * @retval None
1419   */
1420 #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__)      ((TAMP->SCR) = (__FLAG__))
1421 /**
1422   * @}
1423   */
1424 
1425 /* --------------------------------- SSR Underflow ---------------------------------*/
1426 /** @defgroup RTCEx_SSR_Underflow RTC SSR Underflow
1427   * @{
1428   */
1429 
1430 /**
1431   * @brief  Enable the RTC SSRU interrupt.
1432   * @param  __HANDLE__ specifies the RTC handle.
1433   * @param  __INTERRUPT__ specifies the RTC SSRU interrupt sources to be enabled.
1434   *         This parameter can be:
1435   *            @arg @ref RTC_IT_SSRU SSRU interrupt
1436   * @retval None
1437   */
1438 #define __HAL_RTC_SSRU_ENABLE_IT(__HANDLE__, __INTERRUPT__)    (RTC->CR |= (RTC_CR_SSRUIE))
1439 
1440 /**
1441   * @brief  Disable the RTC SSRU interrupt.
1442   * @param  __HANDLE__ specifies the RTC handle.
1443   * @param  __INTERRUPT__ specifies the RTC SSRU interrupt sources to be disabled.
1444   *         This parameter can be:
1445   *            @arg @ref RTC_IT_SSRU SSRU interrupt
1446   * @retval None
1447   */
1448 #define __HAL_RTC_SSRU_DISABLE_IT(__HANDLE__, __INTERRUPT__)   (RTC->CR &= ~(RTC_CR_SSRUIE))
1449 
1450 
1451 /**
1452   * @brief  Check whether the specified RTC SSRU interrupt has occurred or not.
1453   * @param  __HANDLE__ specifies the RTC handle.
1454   * @param  __INTERRUPT__ specifies the RTC SSRU interrupt to check.
1455   *         This parameter can be:
1456   *            @arg @ref RTC_IT_SSRU  SSRU interrupt
1457   * @retval The state of __INTERRUPT__ (TRUE or FALSE)
1458   */
1459 #define __HAL_RTC_SSRU_GET_IT(__HANDLE__, __INTERRUPT__)       (((RTC->MISR) & (RTC_MISR_SSRUMF)) != 0U)
1460 /**
1461   * @brief  Check whether the specified RTC SSRU interrupt has been enabled or not.
1462   * @param  __HANDLE__ specifies the RTC handle.
1463   * @param  __INTERRUPT__ specifies the RTC SSRU interrupt sources to check.
1464   *         This parameter can be:
1465   *            @arg @ref RTC_IT_SSRU  SSRU interrupt
1466   * @retval The state of __INTERRUPT__ (TRUE or FALSE)
1467   */
1468 #define __HAL_RTC_SSRU_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   (((RTC->CR) & (RTC_CR_SSRUIE)) != 0U)
1469 
1470 /**
1471   * @brief  Get the selected RTC SSRU's flag status.
1472   * @param  __HANDLE__ specifies the RTC handle.
1473   * @param  __FLAG__ specifies the RTC SSRU Flag is pending or not.
1474   *          This parameter can be:
1475   *             @arg @ref RTC_FLAG_SSRUF
1476   * @retval The state of __FLAG__ (TRUE or FALSE)
1477   */
1478 #define __HAL_RTC_SSRU_GET_FLAG(__HANDLE__, __FLAG__)       ((READ_BIT(RTC->SR, RTC_SR_SSRUF) == RTC_SR_SSRUF))
1479 
1480 /**
1481   * @brief  Clear the RTC SSRU's pending flags.
1482   * @param  __HANDLE__ specifies the RTC handle.
1483   * @param  __FLAG__ specifies the RTC SSRU Flag to clear.
1484   *         This parameter can be:
1485   *            @arg @ref RTC_FLAG_SSRUF
1486   * @retval None
1487   */
1488 #define __HAL_RTC_SSRU_CLEAR_FLAG(__HANDLE__, __FLAG__)     (WRITE_REG(RTC->SCR, RTC_SCR_CSSRUF))
1489 /**
1490   * @}
1491   */
1492 
1493 /**
1494   * @}
1495   */
1496 
1497 /* Exported functions --------------------------------------------------------*/
1498 /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
1499   * @{
1500   */
1501 
1502 /* RTC TimeStamp functions *****************************************/
1503 /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions
1504   * @{
1505   */
1506 
1507 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
1508 HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
1509 HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
1510 HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc);
1511 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc);
1512 HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(const RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp,
1513                                          RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
1514 void              HAL_RTCEx_TimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
1515 HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout);
1516 void              HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
1517 /**
1518   * @}
1519   */
1520 
1521 
1522 /* RTC Wake-up functions ******************************************************/
1523 /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions
1524   * @{
1525   */
1526 
1527 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
1528 HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock,
1529                                               uint32_t WakeUpAutoClr);
1530 HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
1531 uint32_t          HAL_RTCEx_GetWakeUpTimer(const RTC_HandleTypeDef *hrtc);
1532 void              HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
1533 void              HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
1534 HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout);
1535 /**
1536   * @}
1537   */
1538 
1539 /* Extended Control functions ************************************************/
1540 /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
1541   * @{
1542   */
1543 
1544 HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod,
1545                                            uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue);
1546 HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc, uint32_t LowPowerCalib);
1547 HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
1548 HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
1549 HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
1550 HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
1551 HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
1552 HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
1553 HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
1554 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterIncrement(const RTC_HandleTypeDef *hrtc, uint32_t Instance);
1555 HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterGet(const RTC_HandleTypeDef *hrtc, uint32_t Instance, uint32_t *pValue);
1556 HAL_StatusTypeDef HAL_RTCEx_SetSSRU_IT(RTC_HandleTypeDef *hrtc);
1557 HAL_StatusTypeDef HAL_RTCEx_DeactivateSSRU(RTC_HandleTypeDef *hrtc);
1558 void              HAL_RTCEx_SSRUIRQHandler(RTC_HandleTypeDef *hrtc);
1559 void              HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc);
1560 
1561 /**
1562   * @}
1563   */
1564 
1565 /* Extended RTC features functions *******************************************/
1566 /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions
1567   * @{
1568   */
1569 
1570 void              HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
1571 HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(const RTC_HandleTypeDef *hrtc, uint32_t Timeout);
1572 /**
1573   * @}
1574   */
1575 
1576 /** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions
1577   * @{
1578   */
1579 HAL_StatusTypeDef HAL_RTCEx_SetTamper(const RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper);
1580 HAL_StatusTypeDef HAL_RTCEx_SetActiveTampers(RTC_HandleTypeDef *hrtc, const RTC_ActiveTampersTypeDef *sAllTamper);
1581 HAL_StatusTypeDef HAL_RTCEx_SetActiveSeed(RTC_HandleTypeDef *hrtc, const uint32_t *pSeed);
1582 HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(const RTC_HandleTypeDef *hrtc, const RTC_TamperTypeDef *sTamper);
1583 HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(const RTC_HandleTypeDef *hrtc, uint32_t Tamper);
1584 HAL_StatusTypeDef HAL_RTCEx_DeactivateActiveTampers(const RTC_HandleTypeDef *hrtc);
1585 HAL_StatusTypeDef HAL_RTCEx_PollForTamperEvent(const RTC_HandleTypeDef *hrtc, uint32_t Tamper, uint32_t Timeout);
1586 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper(const RTC_HandleTypeDef *hrtc,
1587                                               const RTC_InternalTamperTypeDef *sIntTamper);
1588 HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper_IT(const RTC_HandleTypeDef *hrtc,
1589                                                  const RTC_InternalTamperTypeDef *sIntTamper);
1590 HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTamper(const RTC_HandleTypeDef *hrtc, uint32_t IntTamper);
1591 HAL_StatusTypeDef HAL_RTCEx_PollForInternalTamperEvent(const RTC_HandleTypeDef *hrtc, uint32_t IntTamper,
1592                                                        uint32_t Timeout);
1593 HAL_StatusTypeDef HAL_RTCEx_LockBootHardwareKey(const RTC_HandleTypeDef *hrtc);
1594 void              HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc);
1595 void              HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
1596 void              HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
1597 void              HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
1598 void              HAL_RTCEx_Tamper4EventCallback(RTC_HandleTypeDef *hrtc);
1599 void              HAL_RTCEx_Tamper5EventCallback(RTC_HandleTypeDef *hrtc);
1600 void              HAL_RTCEx_Tamper6EventCallback(RTC_HandleTypeDef *hrtc);
1601 void              HAL_RTCEx_Tamper7EventCallback(RTC_HandleTypeDef *hrtc);
1602 void              HAL_RTCEx_Tamper8EventCallback(RTC_HandleTypeDef *hrtc);
1603 void              HAL_RTCEx_InternalTamper1EventCallback(RTC_HandleTypeDef *hrtc);
1604 void              HAL_RTCEx_InternalTamper2EventCallback(RTC_HandleTypeDef *hrtc);
1605 void              HAL_RTCEx_InternalTamper3EventCallback(RTC_HandleTypeDef *hrtc);
1606 void              HAL_RTCEx_InternalTamper4EventCallback(RTC_HandleTypeDef *hrtc);
1607 void              HAL_RTCEx_InternalTamper5EventCallback(RTC_HandleTypeDef *hrtc);
1608 void              HAL_RTCEx_InternalTamper6EventCallback(RTC_HandleTypeDef *hrtc);
1609 void              HAL_RTCEx_InternalTamper7EventCallback(RTC_HandleTypeDef *hrtc);
1610 void              HAL_RTCEx_InternalTamper8EventCallback(RTC_HandleTypeDef *hrtc);
1611 void              HAL_RTCEx_InternalTamper9EventCallback(RTC_HandleTypeDef *hrtc);
1612 void              HAL_RTCEx_InternalTamper11EventCallback(RTC_HandleTypeDef *hrtc);
1613 /**
1614   * @}
1615   */
1616 
1617 /** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions
1618   * @{
1619   */
1620 void              HAL_RTCEx_BKUPWrite(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
1621 uint32_t          HAL_RTCEx_BKUPRead(const RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
1622 void              HAL_RTCEx_BKUPErase(const RTC_HandleTypeDef *hrtc);
1623 void              HAL_RTCEx_BKUPBlock(const RTC_HandleTypeDef *hrtc);
1624 void              HAL_RTCEx_BKUPUnblock(const RTC_HandleTypeDef *hrtc);
1625 #ifdef TAMP_RPCFGR_RPCFG0
1626 void              HAL_RTCEx_ConfigEraseDeviceSecrets(const RTC_HandleTypeDef *hrtc, uint32_t DeviceSecretConf);
1627 #endif /* TAMP_RPCFGR_RPCFG0 */
1628 /**
1629   * @}
1630   */
1631 
1632 /** @defgroup RTCEx_Exported_Functions_Group7 Extended RTC secure functions
1633   * @{
1634   */
1635 HAL_StatusTypeDef HAL_RTCEx_SecureModeGet(const RTC_HandleTypeDef *hrtc, RTC_SecureStateTypeDef  *secureState);
1636 #if defined (CPU_IN_SECURE_STATE)
1637 HAL_StatusTypeDef HAL_RTCEx_SecureModeSet(const RTC_HandleTypeDef *hrtc, const RTC_SecureStateTypeDef  *secureState);
1638 #endif /* defined (CPU_IN_SECURE_STATE) */
1639 /**
1640   * @}
1641   */
1642 
1643 /** @defgroup RTCEx_Exported_Functions_Group8 Extended RTC privilege functions
1644   * @{
1645   */
1646 HAL_StatusTypeDef HAL_RTCEx_PrivilegeModeSet(const RTC_HandleTypeDef *hrtc,
1647                                              const RTC_PrivilegeStateTypeDef *privilegeState);
1648 HAL_StatusTypeDef HAL_RTCEx_PrivilegeModeGet(const RTC_HandleTypeDef *hrtc, RTC_PrivilegeStateTypeDef *privilegeState);
1649 /**
1650   * @}
1651   */
1652 
1653 /**
1654   * @}
1655   */
1656 
1657 /* Private types -------------------------------------------------------------*/
1658 /* Private variables ---------------------------------------------------------*/
1659 /* Private constants ---------------------------------------------------------*/
1660 /* Private macros ------------------------------------------------------------*/
1661 /** @defgroup RTCEx_Private_Macros RTCEx Private Macros
1662   * @{
1663   */
1664 
1665 /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
1666   * @{
1667   */
1668 #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
1669                                  ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
1670 
1671 #define IS_RTC_TIMESTAMP_PIN(PIN)  (((PIN) == RTC_TIMESTAMPPIN_DEFAULT))
1672 
1673 #define IS_RTC_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
1674                                                        ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
1675 
1676 #define IS_RTC_TAMPER_TAMPERDETECTIONOUTPUT(MODE)    (((MODE) == RTC_TAMPERDETECTIONOUTPUT_ENABLE) || \
1677                                                       ((MODE) == RTC_TAMPERDETECTIONOUTPUT_DISABLE))
1678 
1679 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16)   || \
1680                                     ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8)    || \
1681                                     ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4)    || \
1682                                     ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2)    || \
1683                                     ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
1684                                     ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
1685 
1686 #define IS_RTC_WAKEUP_COUNTER(COUNTER)  ((COUNTER) <= RTC_WUTR_WUT)
1687 
1688 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
1689                                             ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
1690                                             ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC))
1691 
1692 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
1693                                         ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
1694 
1695 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM)
1696 
1697 #define IS_RTC_LOW_POWER_CALIB(LPCAL) (((LPCAL) == RTC_LPCAL_SET) || \
1698                                        ((LPCAL) == RTC_LPCAL_RESET))
1699 
1700 
1701 #define IS_RTC_TAMPER(__TAMPER__)                ((((__TAMPER__) & RTC_TAMPER_ALL) != 0U) && \
1702                                                   (((__TAMPER__) & ~RTC_TAMPER_ALL) == 0U))
1703 
1704 #define IS_RTC_INTERNAL_TAMPER(__INT_TAMPER__)   ((((__INT_TAMPER__) & RTC_INT_TAMPER_ALL) != 0U) && \
1705                                                   (((__INT_TAMPER__) & ~RTC_INT_TAMPER_ALL) == 0U))
1706 
1707 #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__)       (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE)  || \
1708                                                   ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
1709                                                   ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL)    || \
1710                                                   ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
1711 
1712 #define IS_RTC_TAMPER_ERASE_MODE(__MODE__)       (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
1713                                                   ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
1714 
1715 #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__)  (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \
1716                                                   ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE))
1717 
1718 #define IS_RTC_TAMPER_FILTER(__FILTER__)         (((__FILTER__) == RTC_TAMPERFILTER_DISABLE)  || \
1719                                                   ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \
1720                                                   ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \
1721                                                   ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE))
1722 
1723 #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__)    (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
1724                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
1725                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
1726                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
1727                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
1728                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
1729                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512)  || \
1730                                                   ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
1731 
1732 #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__)   (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
1733                                                           ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
1734                                                           ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
1735                                                           ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
1736 
1737 #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__)    (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \
1738                                                   ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE))
1739 
1740 #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION)  \
1741   (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
1742    ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
1743 
1744 #define IS_RTC_ATAMPER_FILTER(__FILTER__)                    (((__FILTER__) == RTC_ATAMP_FILTER_ENABLE) || \
1745                                                               ((__FILTER__) == RTC_ATAMP_FILTER_DISABLE))
1746 
1747 #define IS_RTC_ATAMPER_OUTPUT_CHANGE_PERIOD(__PERIOD__)      ((__PERIOD__) <= 7U)
1748 
1749 #define IS_RTC_ATAMPER_ASYNCPRES_RTCCLK(__PRESCALER__)       (((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK)       || \
1750                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_2)     || \
1751                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_4)     || \
1752                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_8)     || \
1753                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_16)    || \
1754                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_32)    || \
1755                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_64)    || \
1756                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_128)   || \
1757                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_256)   || \
1758                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_512)   || \
1759                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_1024)  || \
1760                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_2048)  || \
1761                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_4096)  || \
1762                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_8192)  || \
1763                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_16384) || \
1764                                                               ((__PRESCALER__) == RTC_ATAMP_ASYNCPRES_RTCCLK_32768))
1765 
1766 
1767 #define IS_RTC_BKP(__BKP__)   ((__BKP__) < RTC_BKP_NUMBER)
1768 
1769 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \
1770                                  ((SEL) == RTC_SHIFTADD1S_SET))
1771 
1772 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS)
1773 
1774 #define IS_RTC_CALIB_OUTPUT(OUTPUT)  (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \
1775                                       ((OUTPUT) == RTC_CALIBOUTPUT_1HZ))
1776 
1777 #define IS_RTC_SECURE_FULL(__STATE__) (((__STATE__) == RTC_SECURE_FULL_YES) || \
1778                                        ((__STATE__) == RTC_SECURE_FULL_NO))
1779 
1780 #define IS_RTC_NONSECURE_FEATURES(__FEATURES__) (((__FEATURES__) & ~RTC_NONSECURE_FEATURE_ALL) == 0U)
1781 
1782 #define IS_TAMP_SECURE_FULL(__STATE__) (((__STATE__) == TAMP_SECURE_FULL_YES) || \
1783                                         ((__STATE__) == TAMP_SECURE_FULL_NO))
1784 
1785 #define IS_TAMP_MONOTONIC_CNT_SECURE(__STATE__) (((__STATE__) == TAMP_MONOTONIC_CNT_SECURE_YES) || \
1786                                                  ((__STATE__) == TAMP_MONOTONIC_CNT_SECURE_NO))
1787 
1788 #define IS_RTC_PRIVILEGE_FULL(__STATE__) (((__STATE__) == RTC_PRIVILEGE_FULL_YES) || \
1789                                           ((__STATE__) == RTC_PRIVILEGE_FULL_NO))
1790 
1791 #define IS_RTC_PRIVILEGE_FEATURES(__FEATURES__) (((__FEATURES__) & ~RTC_PRIVILEGE_FEATURE_ALL) == 0U)
1792 
1793 #define IS_TAMP_PRIVILEGE_FULL(__STATE__) (((__STATE__) == TAMP_PRIVILEGE_FULL_YES) || \
1794                                            ((__STATE__) == TAMP_PRIVILEGE_FULL_NO))
1795 
1796 #define IS_TAMP_MONOTONIC_CNT_PRIVILEGE(__STATE__) (((__STATE__) == TAMP_MONOTONIC_CNT_PRIVILEGE_YES) || \
1797                                                     ((__STATE__) == TAMP_MONOTONIC_CNT_PRIVILEGE_NO))
1798 
1799 #define IS_RTC_PRIVILEGE_BKUP_ZONE(__ZONES__) (((__ZONES__) & ~RTC_PRIVILEGE_BKUP_ZONE_ALL) == 0U)
1800 
1801 #define IS_RTC_BINARY_MODE(MODE) (((MODE) == RTC_BINARY_NONE) || \
1802                                   ((MODE) == RTC_BINARY_ONLY) || \
1803                                   ((MODE) == RTC_BINARY_MIX ))
1804 
1805 #define IS_RTC_BINARY_MIX_BCDU(BDCU) (((BDCU) == RTC_BINARY_MIX_BCDU_0) || \
1806                                       ((BDCU) == RTC_BINARY_MIX_BCDU_1) || \
1807                                       ((BDCU) == RTC_BINARY_MIX_BCDU_2) || \
1808                                       ((BDCU) == RTC_BINARY_MIX_BCDU_3) || \
1809                                       ((BDCU) == RTC_BINARY_MIX_BCDU_4) || \
1810                                       ((BDCU) == RTC_BINARY_MIX_BCDU_5) || \
1811                                       ((BDCU) == RTC_BINARY_MIX_BCDU_6) || \
1812                                       ((BDCU) == RTC_BINARY_MIX_BCDU_7))
1813 
1814 #define IS_RTC_ALARM_SUB_SECOND_BINARY_MASK(MASK)   (((MASK) == 0U) || \
1815                                                      (((MASK) >= RTC_ALARMSUBSECONDBINMASK_SS31_1) &&\
1816                                                       ((MASK) <= RTC_ALARMSUBSECONDBINMASK_NONE)))
1817 
1818 #define IS_RTC_ALARMSUBSECONDBIN_AUTOCLR(SEL) (((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_NO) || \
1819                                                ((SEL) == RTC_ALARMSUBSECONDBIN_AUTOCLR_YES))
1820 /**
1821   * @}
1822   */
1823 
1824 /**
1825   * @}
1826   */
1827 
1828 /**
1829   * @}
1830   */
1831 
1832 /**
1833   * @}
1834   */
1835 
1836 /**
1837   * @}
1838   */
1839 
1840 /**
1841   * @}
1842   */
1843 
1844 #ifdef __cplusplus
1845 }
1846 #endif
1847 
1848 #endif /* STM32N6xx_HAL_RTC_EX_H */
1849 
1850