1 /**
2   ******************************************************************************
3   * @file    stm32h5xx_hal_otfdec.h
4   * @author  MCD Application Team
5   * @brief   Header file of OTFDEC HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2023 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H5xx_HAL_OTFDEC_H
21 #define STM32H5xx_HAL_OTFDEC_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h5xx_hal_def.h"
29 
30 /** @addtogroup STM32H5xx_HAL_Driver
31   * @{
32   */
33 
34 #if defined(OTFDEC1)
35 
36 /** @addtogroup OTFDEC
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 
42 /** @defgroup OTFDEC_Exported_Types OTFDEC Exported Types
43   * @{
44   */
45 
46 /** @defgroup OTFDEC_Exported_Types_Group1 OTFDEC region configuration definitions
47   * @{
48   */
49 
50 /**
51   * @brief OTFDEC region configuration structure definition
52   */
53 typedef struct
54 {
55   uint32_t          Nonce[2];        /*!< OTFDEC region nonce */
56 
57   uint32_t          StartAddress;    /*!< OTFDEC region start address */
58 
59   uint32_t          EndAddress;      /*!< OTFDEC region end address */
60 
61   uint16_t          Version;         /*!< OTFDEC region firmware version */
62 
63 } OTFDEC_RegionConfigTypeDef;
64 
65 /**
66   * @}
67   */
68 
69 /** @defgroup OTFDEC_Exported_Types_Group2 OTFDEC Peripheral handle definitions
70   * @{
71   */
72 
73 /**
74   * @brief OTFDEC states structure definition
75   */
76 typedef enum
77 {
78   HAL_OTFDEC_STATE_RESET             = 0x00U,  /*!< OTFDEC not yet initialized or disabled */
79   HAL_OTFDEC_STATE_READY             = 0x01U,  /*!< OTFDEC initialized and ready for use   */
80   HAL_OTFDEC_STATE_BUSY              = 0x02U,  /*!< OTFDEC internal processing is ongoing  */
81 } HAL_OTFDEC_StateTypeDef;
82 
83 /**
84   * @brief OTFDEC handle structure definition
85   */
86 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
87 typedef struct __OTFDEC_HandleTypeDef
88 #else
89 typedef struct
90 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
91 {
92   OTFDEC_TypeDef             *Instance;  /*!< OTFDEC registers base address */
93 
94   HAL_OTFDEC_StateTypeDef    State;      /*!< OTFDEC state */
95 
96   HAL_LockTypeDef            Lock;       /*!< OTFDEC locking object */
97 
98   __IO uint32_t              ErrorCode;  /*!< OTFDEC error code */
99 
100 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
101   void (* ErrorCallback)(struct __OTFDEC_HandleTypeDef *hotfdec);     /*!< OTFDEC error callback */
102 
103   void (* MspInitCallback)(struct __OTFDEC_HandleTypeDef *hotfdec);   /*!< OTFDEC Msp Init callback */
104 
105   void (* MspDeInitCallback)(struct __OTFDEC_HandleTypeDef *hotfdec); /*!< OTFDEC Msp DeInit callback */
106 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
107 
108 } OTFDEC_HandleTypeDef;
109 
110 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
111 /**
112   * @brief  HAL OTFDEC Callback ID enumeration definition
113   */
114 typedef enum
115 {
116   HAL_OTFDEC_ERROR_CB_ID       = 0x00U,  /*!< OTFDEC error callback ID      */
117   HAL_OTFDEC_MSPINIT_CB_ID     = 0x01U,  /*!< OTFDEC Msp DeInit callback ID */
118   HAL_OTFDEC_MSPDEINIT_CB_ID   = 0x02U   /*!< OTFDEC Msp DeInit callback ID */
119 } HAL_OTFDEC_CallbackIDTypeDef;
120 
121 /**
122   * @brief  HAL OTFDEC Callback pointer definition
123   */
124 typedef  void (*pOTFDEC_CallbackTypeDef)(OTFDEC_HandleTypeDef *hotfdec); /*!< pointer to a OTFDEC callback function */
125 
126 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
127 
128 /**
129   * @}
130   */
131 
132 /**
133   * @}
134   */
135 
136 /* Exported constants --------------------------------------------------------*/
137 /** @defgroup OTFDEC_Exported_Constants OTFDEC Exported Constants
138   * @{
139   */
140 
141 /** @defgroup OTFDEC_Interrupts    OTFDEC Interrupts
142   * @{
143   */
144 #define OTFDEC_SEC_ERROR_INT     (OTFDEC_IER_SEIE                                  )  /*!< OTFDEC security error interrupt                  */
145 #define OTFDEC_EXE_ERROR_INT     (               OTFDEC_IER_XONEIE                 )  /*!< OTFDEC execution error interrupt                 */
146 #define OTFDEC_KEY_ERROR_INT     (                                  OTFDEC_IER_KEIE)  /*!< OTFDEC key error interrupt                       */
147 #define OTFDEC_SEC_EXE_ERROR_INT (OTFDEC_IER_SEIE|OTFDEC_IER_XONEIE                )  /*!< OTFDEC security and execution errors interrupts  */
148 #define OTFDEC_SEC_KEY_ERROR_INT (OTFDEC_IER_SEIE|                  OTFDEC_IER_KEIE)  /*!< OTFDEC security and key errors interrupts        */
149 #define OTFDEC_EXE_KEY_ERROR_INT (                OTFDEC_IER_XONEIE|OTFDEC_IER_KEIE)  /*!< OTFDEC execution and key errors interrupts       */
150 #define OTFDEC_ALL_INT           (OTFDEC_IER_SEIE|OTFDEC_IER_XONEIE|OTFDEC_IER_KEIE)  /*!< OTFDEC all interrupts                            */
151 /**
152   * @}
153   */
154 
155 /** @defgroup OTFDEC_Region_Enable   OTFDEC Region Enable
156   * @{
157   */
158 #define OTFDEC_REG_CONFIGR_REG_DISABLE   0x00000000U                /*!< OTFDEC region encryption or on-the-fly decryption disable */
159 #define OTFDEC_REG_CONFIGR_REG_ENABLE    OTFDEC_REG_CONFIGR_REG_EN  /*!< OTFDEC region encryption or on-the-fly decryption enable  */
160 /**
161   * @}
162   */
163 
164 /** @defgroup OTFDEC_Region_Configuration_Lock    OTFDEC Region Configuration Lock
165   * @{
166   */
167 #define OTFDEC_REG_CONFIGR_LOCK_DISABLE   0x00000000U                     /*!< OTFDEC region configuration lock disable */
168 #define OTFDEC_REG_CONFIGR_LOCK_ENABLE    OTFDEC_REG_CONFIGR_CONFIGLOCK   /*!< OTFDEC region configuration lock enable  */
169 /**
170   * @}
171   */
172 
173 /** @defgroup OTFDEC_Region_Operating_Mode    OTFDEC Region Operating Mode
174   * @{
175   */
176 #define OTFDEC_REG_MODE_INSTRUCTION_OR_DATA_ACCESSES           OTFDEC_REG_CONFIGR_MODE_1  /*!< All read accesses are decrypted                                           */
177 #define OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY_WITH_CIPHER  OTFDEC_REG_CONFIGR_MODE    /*!< Only instruction accesses are decrypted with proprietary cipher activated */
178 /**
179   * @}
180   */
181 
182 /** @defgroup OTFDEC_Error_Definition   OTFDEC Error Definition
183   * @{
184   */
185 #define  HAL_OTFDEC_ERROR_NONE             ((uint32_t)0x00000000U)    /*!< No error                         */
186 #define  HAL_OTFDEC_SECURITY_ERROR         ((uint32_t)0x00000001U)    /*!< Security error                   */
187 #define  HAL_OTFDEC_EXECUTE_ERROR          ((uint32_t)0x00000002U)    /*!< Execute-only Execute-Never error */
188 #define  HAL_OTFDEC_KEY_ERROR              ((uint32_t)0x00000004U)    /*!< Key error                        */
189 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
190 #define HAL_OTFDEC_ERROR_INVALID_CALLBACK  ((uint32_t)0x00000008U)   /*!< Invalid Callback error            */
191 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
192 /**
193   * @}
194   */
195 
196 /** @defgroup OTFDEC_Regions_Index   OTFDEC Regions Index
197   * @{
198   */
199 #define  OTFDEC_REGION1            ((uint32_t)0x00000000U)    /*!< OTFDEC region 1 */
200 #define  OTFDEC_REGION2            ((uint32_t)0x00000001U)    /*!< OTFDEC region 2 */
201 #define  OTFDEC_REGION3            ((uint32_t)0x00000002U)    /*!< OTFDEC region 3 */
202 #define  OTFDEC_REGION4            ((uint32_t)0x00000003U)    /*!< OTFDEC region 4 */
203 /**
204   * @}
205   */
206 
207 /** @defgroup OTFDEC_Configuration_Attributes   OTFDEC Configuration Attributes
208   * @{
209   */
210 #define  OTFDEC_ATTRIBUTE_NPRIV        ((uint32_t)0x00000000U)   /*!< Non-privileged access protection */
211 #define  OTFDEC_ATTRIBUTE_PRIV         OTFDEC_PRIVCFGR_PRIV      /*!< Privileged access protection     */
212 /**
213   * @}
214   */
215 
216 /**
217   * @}
218   */
219 
220 /* Exported macro ------------------------------------------------------------*/
221 /** @defgroup OTFDEC_Exported_Macros OTFDEC Exported Macros
222   * @{
223   */
224 
225 /** @brief  Reset OTFDEC handle state.
226   * @param  __HANDLE__ pointer to an OTFDEC_HandleTypeDef structure that contains
227   *         the configuration information for OTFDEC module
228   * @retval None
229   */
230 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
231 #define __HAL_OTFDEC_RESET_HANDLE_STATE(__HANDLE__)                            \
232   do{                                                                          \
233     (__HANDLE__)->State = HAL_OTFDEC_STATE_RESET;                              \
234     (__HANDLE__)->MspInitCallback = NULL;                                      \
235     (__HANDLE__)->MspDeInitCallback = NULL;                                    \
236   } while(0)
237 #else
238 #define __HAL_OTFDEC_RESET_HANDLE_STATE(__HANDLE__)                            \
239   ((__HANDLE__)->State = HAL_OTFDEC_STATE_RESET)
240 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
241 
242 /**
243   * @brief  Enable OTFDEC peripheral interrupts combination
244   * @param  __HANDLE__ pointer to an OTFDEC_HandleTypeDef structure that contains
245   *         the configuration information for OTFDEC module
246   * @param  __INTERRUPT__ mask on enabled interrupts
247   *          This parameter can be one of the following values:
248   *            @arg @ref OTFDEC_SEC_ERROR_INT        OTFDEC security error interrupt
249   *            @arg @ref OTFDEC_EXE_ERROR_INT        OTFDEC execution error interrupt
250   *            @arg @ref OTFDEC_KEY_ERROR_INT        OTFDEC key error interrupt
251   *            @arg @ref OTFDEC_SEC_EXE_ERROR_INT    OTFDEC security and execution errors interrupts
252   *            @arg @ref OTFDEC_SEC_KEY_ERROR_INT    OTFDEC security and key errors interrupts
253   *            @arg @ref OTFDEC_EXE_KEY_ERROR_INT    OTFDEC execution and key errors interrupts
254   *            @arg @ref OTFDEC_ALL_INT              OTFDEC all interrupts
255   * @retval None
256   */
257 #define __HAL_OTFDEC_ENABLE_IT(__HANDLE__, __INTERRUPT__)  SET_BIT(((__HANDLE__)->Instance->IER), (__INTERRUPT__))
258 
259 /**
260   * @brief  Disable OTFDEC peripheral interrupts combination
261   * @param  __HANDLE__ pointer to an OTFDEC_HandleTypeDef structure that contains
262   *         the configuration information for OTFDEC module
263   * @param  __INTERRUPT__ mask on disabled interrupts
264   *          This parameter can be one of the following values:
265   *            @arg @ref OTFDEC_SEC_ERROR_INT        OTFDEC security error interrupt
266   *            @arg @ref OTFDEC_EXE_ERROR_INT        OTFDEC execution error interrupt
267   *            @arg @ref OTFDEC_KEY_ERROR_INT        OTFDEC key error interrupt
268   *            @arg @ref OTFDEC_SEC_EXE_ERROR_INT    OTFDEC security and execution errors interrupts
269   *            @arg @ref OTFDEC_SEC_KEY_ERROR_INT    OTFDEC security and key errors interrupts
270   *            @arg @ref OTFDEC_EXE_KEY_ERROR_INT    OTFDEC execution and key errors interrupts
271   *            @arg @ref OTFDEC_ALL_INT              OTFDEC all interrupts
272   * @retval None
273   */
274 #define __HAL_OTFDEC_DISABLE_IT(__HANDLE__, __INTERRUPT__)  CLEAR_BIT(((__HANDLE__)->Instance->IER), (__INTERRUPT__))
275 
276 /** @brief  Check whether the specified combination of OTFDEC interrupt flags is set or not.
277   * @param  __HANDLE__ pointer to an OTFDEC_HandleTypeDef structure that contains
278   *         the configuration information for OTFDEC module
279   * @param  __FLAG__ mask on combination of interrupts flags
280   *          This parameter can be one of the following values:
281   *            @arg @ref OTFDEC_SEC_ERROR_INT        OTFDEC security error interrupt flag
282   *            @arg @ref OTFDEC_EXE_ERROR_INT        OTFDEC execution error interrupt flag
283   *            @arg @ref OTFDEC_KEY_ERROR_INT        OTFDEC key error interrupt flag
284   *            @arg @ref OTFDEC_SEC_EXE_ERROR_INT    OTFDEC security and execution errors interrupts flags
285   *            @arg @ref OTFDEC_SEC_KEY_ERROR_INT    OTFDEC security and key errors interrupts flags
286   *            @arg @ref OTFDEC_EXE_KEY_ERROR_INT    OTFDEC execution and key errors interrupts flag
287   *            @arg @ref OTFDEC_ALL_INT              OTFDEC all interrupts flags
288   * @retval The state of __FLAG__ (TRUE or FALSE).
289   */
290 #define __HAL_OTFDEC_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
291 
292 /** @brief  Clear the specified combination of OTFDEC interrupt flags.
293   * @param  __HANDLE__ pointer to an OTFDEC_HandleTypeDef structure that contains
294   *         the configuration information for OTFDEC module
295   * @param  __FLAG__ mask on combination of interrupts flags
296   *          This parameter can be one of the following values:
297   *            @arg @ref OTFDEC_SEC_ERROR_INT        OTFDEC security error interrupt flag
298   *            @arg @ref OTFDEC_EXE_ERROR_INT        OTFDEC execution error interrupt flag
299   *            @arg @ref OTFDEC_KEY_ERROR_INT        OTFDEC key error interrupt flag
300   *            @arg @ref OTFDEC_SEC_EXE_ERROR_INT    OTFDEC security and execution errors interrupts flags
301   *            @arg @ref OTFDEC_SEC_KEY_ERROR_INT    OTFDEC security and key errors interrupts flags
302   *            @arg @ref OTFDEC_EXE_KEY_ERROR_INT    OTFDEC execution and key errors interrupts flag
303   *            @arg @ref OTFDEC_ALL_INT              OTFDEC all interrupts flags
304   * @retval None
305   */
306 #define __HAL_OTFDEC_CLEAR_FLAG(__HANDLE__, __FLAG__) SET_BIT((__HANDLE__)->Instance->ICR, (__FLAG__))
307 
308 /**
309   * @}
310   */
311 
312 /* Exported functions --------------------------------------------------------*/
313 /** @defgroup OTFDEC_Exported_Functions OTFDEC Exported Functions
314   * @{
315   */
316 
317 /** @addtogroup OTFDEC_Exported_Functions_Group1 Initialization and de-initialization functions
318   * @{
319   */
320 HAL_StatusTypeDef HAL_OTFDEC_Init(OTFDEC_HandleTypeDef *hotfdec);
321 HAL_StatusTypeDef HAL_OTFDEC_DeInit(OTFDEC_HandleTypeDef *hotfdec);
322 void HAL_OTFDEC_MspInit(OTFDEC_HandleTypeDef *hotfdec);
323 void HAL_OTFDEC_MspDeInit(OTFDEC_HandleTypeDef *hotfdec);
324 
325 #if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
326 /* Callbacks Register/UnRegister functions  ***********************************/
327 HAL_StatusTypeDef HAL_OTFDEC_RegisterCallback(OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID,
328                                               pOTFDEC_CallbackTypeDef pCallback);
329 HAL_StatusTypeDef HAL_OTFDEC_UnRegisterCallback(OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID);
330 #endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
331 /**
332   * @}
333   */
334 
335 
336 /** @addtogroup OTFDEC_Exported_Functions_Group2 OTFDEC IRQ handler management
337   * @{
338   */
339 void HAL_OTFDEC_IRQHandler(OTFDEC_HandleTypeDef *hotfdec);
340 void HAL_OTFDEC_ErrorCallback(OTFDEC_HandleTypeDef *hotfdec);
341 /**
342   * @}
343   */
344 
345 /** @addtogroup OTFDEC_Exported_Functions_Group3 Peripheral Control functions
346   * @{
347   */
348 HAL_StatusTypeDef HAL_OTFDEC_RegionKeyLock(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
349 HAL_StatusTypeDef HAL_OTFDEC_RegionSetKey(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t *pKey);
350 HAL_StatusTypeDef HAL_OTFDEC_RegionSetMode(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t mode);
351 HAL_StatusTypeDef HAL_OTFDEC_RegionConfig(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex,
352                                           const OTFDEC_RegionConfigTypeDef *Config, uint32_t lock);
353 uint32_t HAL_OTFDEC_KeyCRCComputation(const uint32_t *pKey);
354 HAL_StatusTypeDef HAL_OTFDEC_RegionEnable(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
355 HAL_StatusTypeDef HAL_OTFDEC_RegionDisable(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
356 HAL_StatusTypeDef HAL_OTFDEC_ConfigAttributes(OTFDEC_HandleTypeDef *hotfdec, uint32_t Attributes);
357 HAL_StatusTypeDef HAL_OTFDEC_EnableEnciphering(OTFDEC_HandleTypeDef *hotfdec);
358 HAL_StatusTypeDef HAL_OTFDEC_DisableEnciphering(OTFDEC_HandleTypeDef *hotfdec);
359 HAL_StatusTypeDef HAL_OTFDEC_Cipher(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, const uint32_t *input,
360                                     uint32_t *output, uint32_t size, uint32_t start_address);
361 /**
362   * @}
363   */
364 
365 /** @addtogroup @addtogroup OTFDEC_Exported_Functions_Group4 Peripheral State and Status functions
366   * @{
367   */
368 HAL_OTFDEC_StateTypeDef HAL_OTFDEC_GetState(const OTFDEC_HandleTypeDef *hotfdec);
369 HAL_StatusTypeDef HAL_OTFDEC_GetConfigAttributes(OTFDEC_HandleTypeDef *hotfdec, uint32_t *Attributes);
370 uint32_t HAL_OTFDEC_RegionGetKeyCRC(const OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
371 HAL_StatusTypeDef HAL_OTFDEC_RegionGetConfig(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex,
372                                              OTFDEC_RegionConfigTypeDef *Config);
373 /**
374   * @}
375   */
376 
377 /**
378   * @}
379   */
380 
381 /* Private types -------------------------------------------------------------*/
382 /** @defgroup OTFDEC_Private_Types OTFDEC Private Types
383   * @{
384   */
385 
386 /**
387   * @}
388   */
389 
390 /* Private variables ---------------------------------------------------------*/
391 /** @defgroup OTFDEC_Private_Variables OTFDEC Private Variables
392   * @{
393   */
394 
395 /**
396   * @}
397   */
398 
399 /* Private constants ---------------------------------------------------------*/
400 /** @defgroup OTFDEC_Private_Constants OTFDEC Private Constants
401   * @{
402   */
403 /**
404   * @}
405   */
406 
407 /* Private macros ------------------------------------------------------------*/
408 /** @defgroup OTFDEC_Private_Macros OTFDEC Private Macros
409   * @{
410   */
411 
412 /**
413   * @brief Verify the OTFDEC peripheral interrupts parameter.
414   * @param __INT__ OTFDEC peripheral set of interrupts parameter
415   * @retval SET (__INT__ is valid) or RESET (__INT__ is invalid)
416   */
417 #define IS_OTFDEC_INTERRUPTS(__INT__) (((__INT__) == OTFDEC_SEC_ERROR_INT)     || \
418                                        ((__INT__) == OTFDEC_EXE_ERROR_INT)     || \
419                                        ((__INT__) == OTFDEC_KEY_ERROR_INT)     || \
420                                        ((__INT__) == OTFDEC_SEC_EXE_ERROR_INT) || \
421                                        ((__INT__) == OTFDEC_SEC_KEY_ERROR_INT) || \
422                                        ((__INT__) == OTFDEC_EXE_KEY_ERROR_INT) || \
423                                        ((__INT__) == OTFDEC_ALL_INT)  )
424 
425 /**
426   * @brief Verify the OTFDEC region configuration lock parameter.
427   * @param __LOCK__ OTFDEC region lock parameter.
428   * @retval SET (__LOCK__ is valid) or RESET (__LOCK__ is invalid)
429   */
430 #define IS_OTFDEC_REGION_CONFIG_LOCK(__LOCK__) (((__LOCK__) == OTFDEC_REG_CONFIGR_LOCK_DISABLE) || \
431                                                 ((__LOCK__) == OTFDEC_REG_CONFIGR_LOCK_ENABLE)  )
432 
433 /**
434   * @brief Verify the OTFDEC region operating mode.
435   * @param __MODE__ OTFDEC region operating mode parameter.
436   * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
437   */
438 #define IS_OTFDEC_REGION_OPERATING_MODE(__MODE__) \
439   (((__MODE__)== OTFDEC_REG_MODE_INSTRUCTION_OR_DATA_ACCESSES) || \
440    ((__MODE__) == OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY_WITH_CIPHER))
441 
442 /**
443   * @brief Verify the OTFDEC region index.
444   * @param __INDEX__ OTFDEC region index
445   * @retval SET (__INDEX__ is valid) or RESET (__INDEX__ is invalid)
446   */
447 #define IS_OTFDEC_REGIONINDEX(__INDEX__) (((__INDEX__) == OTFDEC_REGION1)     || \
448                                           ((__INDEX__) == OTFDEC_REGION2)     || \
449                                           ((__INDEX__) == OTFDEC_REGION3)     || \
450                                           ((__INDEX__) == OTFDEC_REGION4)  )
451 
452 /**
453   * @brief Verify the OTFDEC configuration attributes.
454   * @param __ATTRIBUTE__ OTFDEC region index
455   * @retval SET (__ATTRIBUTE__ is valid) or RESET (__ATTRIBUTE__ is invalid)
456   */
457 #define IS_OTFDEC_ATTRIBUTE(__ATTRIBUTE__) (((__ATTRIBUTE__) == OTFDEC_ATTRIBUTE_PRIV)   || \
458                                             ((__ATTRIBUTE__) == OTFDEC_ATTRIBUTE_NPRIV)  )
459 
460 /**
461   * @}
462   */
463 
464 /* Private functions ---------------------------------------------------------*/
465 /** @defgroup OTFDEC_Private_Functions OTFDEC Private Functions
466   * @{
467   */
468 
469 /**
470   * @}
471   */
472 
473 /**
474   * @}
475   */
476 
477 #endif /* OTFDEC1 */
478 
479 /**
480   * @}
481   */
482 
483 #ifdef __cplusplus
484 }
485 #endif
486 
487 #endif /* STM32H5xx_HAL_OTFDEC_H */
488