1 /**
2   ******************************************************************************
3   * @file    stm32c0xx_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
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 STM32C0xx_HAL_FLASH_EX_H
21 #define STM32C0xx_HAL_FLASH_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32c0xx_hal_def.h"
29 
30 /** @addtogroup STM32C0xx_HAL_Driver
31   * @{
32   */
33 
34 /** @addtogroup FLASHEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /* Exported constants --------------------------------------------------------*/
40 /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
41   * @{
42   */
43 /** @defgroup FLASHEx_Empty_Check FLASHEx Empty Check
44   * @{
45   */
46 #define FLASH_PROG_NOT_EMPTY                0x00000000u          /*!< 1st location in Flash is programmed */
47 #define FLASH_PROG_EMPTY                    FLASH_ACR_PROGEMPTY  /*!< 1st location in Flash is empty */
48 /**
49   * @}
50   */
51 /**
52   * @}
53   */
54 
55 /* Exported macro ------------------------------------------------------------*/
56 /* Exported functions --------------------------------------------------------*/
57 /** @addtogroup FLASHEx_Exported_Functions
58   * @{
59   */
60 
61 /* Extended Program operation functions  *************************************/
62 /** @addtogroup FLASHEx_Exported_Functions_Group1
63   * @{
64   */
65 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
66 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
67 void              HAL_FLASHEx_EnableDebugger(void);
68 void              HAL_FLASHEx_DisableDebugger(void);
69 uint32_t          HAL_FLASHEx_FlashEmptyCheck(void);
70 void              HAL_FLASHEx_ForceFlashEmpty(uint32_t FlashEmpty);
71 void              HAL_FLASHEx_EnableSecMemProtection(uint32_t Bank);
72 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
73 void              HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
74 /**
75   * @}
76   */
77 
78 /**
79   * @}
80   */
81 
82 /* Private macros ------------------------------------------------------------*/
83 /** @defgroup FLASHEx_Private_Constants FLASHEx Private Constants
84   * @{
85   */
86 #define FLASH_PCROP_GRANULARITY_OFFSET    9u                                       /*!< FLASH Code Readout
87                                                                                         Protection granularity offset */
88 #define FLASH_PCROP_GRANULARITY           (1UL << FLASH_PCROP_GRANULARITY_OFFSET)  /*!< FLASH Code Readout
89                                                                                     Protection granularity, 512 Bytes */
90 /**
91   * @}
92   */
93 
94 
95 /** @defgroup FLASHEx_Private_Macros FLASHEx Private Macros
96   *  @{
97   */
98 #define IS_FLASH_EMPTY_CHECK(__VALUE__)     (((__VALUE__) == FLASH_PROG_EMPTY) || ((__VALUE__) == FLASH_PROG_NOT_EMPTY))
99 void              FLASH_PageErase(uint32_t Page);
100 /**
101   * @}
102   */
103 
104 /**
105   * @}
106   */
107 
108 /**
109   * @}
110   */
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* STM32C0xx_HAL_FLASH_EX_H */
117