RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_hal_otfdec.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_OTFDEC_H
21#define STM32H7xx_HAL_OTFDEC_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
34#if defined(OTFDEC1)
35
40/* Exported types ------------------------------------------------------------*/
41
55typedef struct
56{
57 uint32_t Nonce[2];
59 uint32_t StartAddress;
61 uint32_t EndAddress;
63 uint16_t Version;
65} OTFDEC_RegionConfigTypeDef;
66
79typedef enum
80{
81 HAL_OTFDEC_STATE_RESET = 0x00U,
82 HAL_OTFDEC_STATE_READY = 0x01U,
83 HAL_OTFDEC_STATE_BUSY = 0x02U,
84} HAL_OTFDEC_StateTypeDef;
85
89#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
90typedef struct __OTFDEC_HandleTypeDef
91#else
92typedef struct
93#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
94{
95 OTFDEC_TypeDef *Instance;
97 HAL_OTFDEC_StateTypeDef State;
99 HAL_LockTypeDef Lock;
101 __IO uint32_t ErrorCode;
103#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
104 void (* ErrorCallback)(struct __OTFDEC_HandleTypeDef *hotfdec);
106 void (* MspInitCallback)(struct __OTFDEC_HandleTypeDef *hotfdec);
108 void (* MspDeInitCallback)(struct __OTFDEC_HandleTypeDef *hotfdec);
109#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
110
111} OTFDEC_HandleTypeDef;
112
113#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
117typedef enum
118{
119 HAL_OTFDEC_ERROR_CB_ID = 0x00U,
120 HAL_OTFDEC_MSPINIT_CB_ID = 0x01U,
121 HAL_OTFDEC_MSPDEINIT_CB_ID = 0x02U
122} HAL_OTFDEC_CallbackIDTypeDef;
123
127typedef void (*pOTFDEC_CallbackTypeDef)(OTFDEC_HandleTypeDef *hotfdec);
129#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
130
139/* Exported constants --------------------------------------------------------*/
149#define OTFDEC_SEC_ERROR_INT (OTFDEC_IER_SEIE )
150#define OTFDEC_EXE_ERROR_INT ( OTFDEC_IER_XONEIE )
151#define OTFDEC_KEY_ERROR_INT ( OTFDEC_IER_KEIE)
152#define OTFDEC_SEC_EXE_ERROR_INT (OTFDEC_IER_SEIE|OTFDEC_IER_XONEIE )
153#define OTFDEC_SEC_KEY_ERROR_INT (OTFDEC_IER_SEIE| OTFDEC_IER_KEIE)
154#define OTFDEC_EXE_KEY_ERROR_INT ( OTFDEC_IER_XONEIE|OTFDEC_IER_KEIE)
155#define OTFDEC_ALL_INT (OTFDEC_IER_SEIE|OTFDEC_IER_XONEIE|OTFDEC_IER_KEIE)
164#define OTFDEC_REG_CONFIGR_REG_DISABLE 0x00000000U
165#define OTFDEC_REG_CONFIGR_REG_ENABLE OTFDEC_REG_CONFIGR_REG_EN
174#define OTFDEC_REG_CONFIGR_LOCK_DISABLE 0x00000000U
175#define OTFDEC_REG_CONFIGR_LOCK_ENABLE OTFDEC_REG_CONFIGR_CONFIGLOCK
184#define OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY 0x00000000U
185#define OTFDEC_REG_MODE_DATA_ACCESSES_ONLY OTFDEC_REG_CONFIGR_MODE_0
186#define OTFDEC_REG_MODE_INSTRUCTION_OR_DATA_ACCESSES OTFDEC_REG_CONFIGR_MODE_1
187#define OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY_WITH_CIPHER OTFDEC_REG_CONFIGR_MODE
196#define HAL_OTFDEC_ERROR_NONE ((uint32_t)0x00000000U)
197#define HAL_OTFDEC_SECURITY_ERROR ((uint32_t)0x00000001U)
198#define HAL_OTFDEC_EXECUTE_ERROR ((uint32_t)0x00000002U)
199#define HAL_OTFDEC_KEY_ERROR ((uint32_t)0x00000004U)
200#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
201#define HAL_OTFDEC_ERROR_INVALID_CALLBACK ((uint32_t)0x00000008U)
202#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
211#define OTFDEC_REGION1 ((uint32_t)0x00000000U)
212#define OTFDEC_REGION2 ((uint32_t)0x00000001U)
213#define OTFDEC_REGION3 ((uint32_t)0x00000002U)
214#define OTFDEC_REGION4 ((uint32_t)0x00000003U)
223/* Exported macro ------------------------------------------------------------*/
234#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
235#define __HAL_OTFDEC_RESET_HANDLE_STATE(__HANDLE__) \
236 do{ \
237 (__HANDLE__)->State = HAL_OTFDEC_STATE_RESET; \
238 (__HANDLE__)->MspInitCallback = NULL; \
239 (__HANDLE__)->MspDeInitCallback = NULL; \
240 } while(0)
241#else
242#define __HAL_OTFDEC_RESET_HANDLE_STATE(__HANDLE__) \
243 ((__HANDLE__)->State = HAL_OTFDEC_STATE_RESET)
244#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
245
261#define __HAL_OTFDEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT(((__HANDLE__)->Instance->IER), (__INTERRUPT__))
262
278#define __HAL_OTFDEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT(((__HANDLE__)->Instance->IER), (__INTERRUPT__))
279
294#define __HAL_OTFDEC_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
295
310#define __HAL_OTFDEC_CLEAR_FLAG(__HANDLE__, __FLAG__) SET_BIT((__HANDLE__)->Instance->ICR, (__FLAG__))
311
316/* Exported functions --------------------------------------------------------*/
325HAL_StatusTypeDef HAL_OTFDEC_Init(OTFDEC_HandleTypeDef *hotfdec);
326HAL_StatusTypeDef HAL_OTFDEC_DeInit(OTFDEC_HandleTypeDef *hotfdec);
327void HAL_OTFDEC_MspInit(OTFDEC_HandleTypeDef *hotfdec);
328void HAL_OTFDEC_MspDeInit(OTFDEC_HandleTypeDef *hotfdec);
329
330#if (USE_HAL_OTFDEC_REGISTER_CALLBACKS == 1)
331/* Callbacks Register/UnRegister functions ***********************************/
332HAL_StatusTypeDef HAL_OTFDEC_RegisterCallback(OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID,
333 pOTFDEC_CallbackTypeDef pCallback);
334HAL_StatusTypeDef HAL_OTFDEC_UnRegisterCallback(OTFDEC_HandleTypeDef *hotfdec, HAL_OTFDEC_CallbackIDTypeDef CallbackID);
335#endif /* USE_HAL_OTFDEC_REGISTER_CALLBACKS */
344void HAL_OTFDEC_IRQHandler(OTFDEC_HandleTypeDef *hotfdec);
345void HAL_OTFDEC_ErrorCallback(OTFDEC_HandleTypeDef *hotfdec);
353HAL_StatusTypeDef HAL_OTFDEC_RegionKeyLock(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
354HAL_StatusTypeDef HAL_OTFDEC_RegionSetKey(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t *pKey);
355HAL_StatusTypeDef HAL_OTFDEC_RegionSetMode(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex, uint32_t mode);
356HAL_StatusTypeDef HAL_OTFDEC_RegionConfig(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex,
357 OTFDEC_RegionConfigTypeDef *Config, uint32_t lock);
358uint32_t HAL_OTFDEC_KeyCRCComputation(uint32_t *pKey);
359HAL_StatusTypeDef HAL_OTFDEC_RegionEnable(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
360HAL_StatusTypeDef HAL_OTFDEC_RegionDisable(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
368HAL_OTFDEC_StateTypeDef HAL_OTFDEC_GetState(OTFDEC_HandleTypeDef *hotfdec);
369uint32_t HAL_OTFDEC_RegionGetKeyCRC(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex);
370HAL_StatusTypeDef HAL_OTFDEC_RegionGetConfig(OTFDEC_HandleTypeDef *hotfdec, uint32_t RegionIndex,
371 OTFDEC_RegionConfigTypeDef *Config);
380/* Private types -------------------------------------------------------------*/
390/* Private variables ---------------------------------------------------------*/
400/* Private constants ---------------------------------------------------------*/
409/* Private macros ------------------------------------------------------------*/
420#define IS_OTFDEC_INTERRUPTS(__INT__) (((__INT__) == OTFDEC_SEC_ERROR_INT) || \
421 ((__INT__) == OTFDEC_EXE_ERROR_INT) || \
422 ((__INT__) == OTFDEC_KEY_ERROR_INT) || \
423 ((__INT__) == OTFDEC_SEC_EXE_ERROR_INT) || \
424 ((__INT__) == OTFDEC_SEC_KEY_ERROR_INT) || \
425 ((__INT__) == OTFDEC_EXE_KEY_ERROR_INT) || \
426 ((__INT__) == OTFDEC_ALL_INT) )
427
433#define IS_OTFDEC_REGION_CONFIG_LOCK(__LOCK__) (((__LOCK__) == OTFDEC_REG_CONFIGR_LOCK_DISABLE) || \
434 ((__LOCK__) == OTFDEC_REG_CONFIGR_LOCK_ENABLE) )
435
441#define IS_OTFDEC_REGION_OPERATING_MODE(__MODE__) \
442 (((__MODE__)== OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY) || \
443 ((__MODE__) == OTFDEC_REG_MODE_DATA_ACCESSES_ONLY) || \
444 ((__MODE__) == OTFDEC_REG_MODE_INSTRUCTION_OR_DATA_ACCESSES) || \
445 ((__MODE__) == OTFDEC_REG_MODE_INSTRUCTION_ACCESSES_ONLY_WITH_CIPHER))
446
452#define IS_OTFDEC_REGIONINDEX(__INDEX__) (((__INDEX__) == OTFDEC_REGION1) || \
453 ((__INDEX__) == OTFDEC_REGION2) || \
454 ((__INDEX__) == OTFDEC_REGION3) || \
455 ((__INDEX__) == OTFDEC_REGION4) )
456
462#define IS_OTFDEC_ATTRIBUTE(__ATTRIBUTE__) (((__ATTRIBUTE__) == OTFDEC_ATTRIBUTE_PRIV) || \
463 ((__ATTRIBUTE__) == OTFDEC_ATTRIBUTE_NPRIV) )
464
469/* Private functions ---------------------------------------------------------*/
483#endif /* OTFDEC1 */
484
489#ifdef __cplusplus
490}
491#endif
492
493#endif /* STM32H7xx_HAL_OTFDEC_H */
#define __IO
Definition: core_cm4.h:239
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Definition: stm32h730xx.h:2050