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