1 /**
2   ******************************************************************************
3   * @file    stm32u0xx_hal_flash_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of FLASH HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2022 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file in
13   * 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 /* Define to prevent recursive inclusion -------------------------------------*/
19 #ifndef STM32U0xx_HAL_FLASH_EX_H
20 #define STM32U0xx_HAL_FLASH_EX_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* Includes ------------------------------------------------------------------*/
27 #include "stm32u0xx_hal_def.h"
28 
29 /** @addtogroup STM32U0xx_HAL_Driver
30   * @{
31   */
32 
33 /** @addtogroup FLASHEx
34   * @{
35   */
36 
37 /* Exported types ------------------------------------------------------------*/
38 /* Exported constants --------------------------------------------------------*/
39 /** @defgroup FLASHEx_Exported_Constants FLASH Exported Constants
40   * @{
41   */
42 /** @defgroup FLASHEx_Empty_Check FLASHEx Empty Check
43   * @{
44   */
45 #define FLASH_NOT_EMPTY                0x00000000U          /*!< 1st location in Flash is programmed */
46 #define FLASH_EMPTY                    FLASH_ACR_EMPTY      /*!< 1st location in Flash is empty */
47 /**
48   * @}
49   */
50 
51 /** @defgroup FLASHEx_HDPEXT_Access FLASHEx HDPEXT access
52   * @{
53   */
54 #define FLASH_HDPEXT_ACCESS_GRANTED        (0xA3UL << FLASH_HDPCR_HDP1EXT_ACCDIS_Pos)             /*!< Access to HDP extension area granted */
55 #define FLASH_HDPEXT_ACCESS_DENIED         (0x5CUL << FLASH_HDPCR_HDP1EXT_ACCDIS_Pos)             /*!< Access to HDP extension area denied but HDP_EXT size increment allowed at any time */
56 #define FLASH_HDPEXT_ACCESS_LOCKED         (0x3AUL << FLASH_HDPCR_HDP1EXT_ACCDIS_Pos)             /*!< Access to HDP extension area denied and HDP_EXT size update not possible */
57 /**
58   * @}
59   */
60 
61 /**
62   * @}
63   */
64 /* Exported macro ------------------------------------------------------------*/
65 /* Exported functions --------------------------------------------------------*/
66 /** @addtogroup FLASHEx_Exported_Functions
67   * @{
68   */
69 
70 /* Extended Program operation functions  *************************************/
71 /** @addtogroup FLASHEx_Exported_Functions_Group1
72   * @{
73   */
74 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
75 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
76 void              HAL_FLASHEx_EnableDebugger(void);
77 void              HAL_FLASHEx_DisableDebugger(void);
78 uint32_t          HAL_FLASHEx_FlashEmptyCheck(void);
79 void              HAL_FLASHEx_ForceFlashEmpty(uint32_t FlashEmpty);
80 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
81 void              HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
82 void              HAL_FLASHEx_EnableHDPProtection(uint32_t Banks);
83 uint32_t          HAL_FLASHEx_IsEnabledHDPProtection(void);
84 void              HAL_FLASHEx_ConfigHDPExtension(const FLASH_HDPExtensionTypeDef *pHDPExtension);
85 void              HAL_FLASHEx_GetHDPExtensionConfig(FLASH_HDPExtensionTypeDef *pHDPExtension);
86 void              HAL_FLASH_OB_GetOEMKeyCRC(uint32_t RDPKeyType, uint32_t *OEMKeyCRC);
87 /**
88   * @}
89   */
90 
91 /**
92   * @}
93   */
94 
95 /* Private macros ------------------------------------------------------------*/
96 
97 /** @defgroup FLASHEx_Private_Macros FLASHEx Private Macros
98   *  @{
99   */
100 #define IS_FLASH_EMPTY_CHECK(__VALUE__)     (((__VALUE__) == FLASH_EMPTY) || ((__VALUE__) == FLASH_NOT_EMPTY))
101 void              FLASH_PageErase(uint32_t Page);
102 void              FLASH_FlushCaches(void);
103 /**
104   * @}
105   */
106 
107 /**
108   * @}
109   */
110 
111 /**
112   * @}
113   */
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif /* STM32U0xx_HAL_FLASH_EX_H */
120 
121