1 /**
2   ******************************************************************************
3   * @file    stm32wbxx_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) 2019 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 STM32WBxx_HAL_FLASH_EX_H
21 #define STM32WBxx_HAL_FLASH_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32wbxx_hal_def.h"
29 
30 /** @addtogroup STM32WBxx_HAL_Driver
31   * @{
32   */
33 
34 /** @addtogroup FLASHEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /* Exported constants --------------------------------------------------------*/
40 /** @defgroup FLASHEx_Exported_Constants FLASH 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_EMPTY /*!< 1st location in Flash is empty      */
48 /**
49   * @}
50   */
51 
52 /** @defgroup FLASHEx_ECC_CPUID FLASHEx ECC CPU Identification
53   * @{
54   */
55 #define FLASH_ECC_CPUID_1    0x00000000U            /*!< Bus-ID of the CPU1 access causing the ECC failure. */
56 #define FLASH_ECC_CPUID_2    FLASH_ECCR_CPUID_0     /*!< Bus-ID of the CPU2 access causing the ECC failure. */
57 
58 /**
59   * @}
60   */
61 /**
62   * @}
63   */
64 
65 /* Exported macro ------------------------------------------------------------*/
66 /** @defgroup FLASHEx_ECC FLASH ECC Macros
67   *  @brief macros to get Error Code Correction information
68   * @{
69   */
70 
71 /**
72   * @brief Get the Bus-ID of the CPU access causing the ECC failure
73   * @retval CPUID
74   */
75 #define __HAL_FLASH_ECC_CPUID()   READ_BIT(FLASH->ECCR, FLASH_ECCR_CPUID)
76 
77 /**
78   * @}
79   */
80 
81 /* Exported functions --------------------------------------------------------*/
82 /** @addtogroup FLASHEx_Exported_Functions
83   * @{
84   */
85 
86 /* Extended Program operation functions  *************************************/
87 /** @addtogroup FLASHEx_Exported_Functions_Group1
88   * @{
89   */
90 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
91 HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
92 uint32_t          HAL_FLASHEx_FlashEmptyCheck(void);
93 void              HAL_FLASHEx_ForceFlashEmpty(uint32_t FlashEmpty);
94 HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
95 void              HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
96 void              HAL_FLASHEx_SuspendOperation(void);
97 void              HAL_FLASHEx_AllowOperation(void);
98 uint32_t          HAL_FLASHEx_IsOperationSuspended(void);
99 /**
100   * @}
101   */
102 
103 /**
104   * @}
105   */
106 
107 /* Private macros ------------------------------------------------------------*/
108 /** @defgroup FLASHEx_Private_Macros FLASHEx Private Macros
109   *  @{
110   */
111 #define IS_FLASH_EMPTY_CHECK(__VALUE__)     (((__VALUE__) == FLASH_PROG_EMPTY) || ((__VALUE__) == FLASH_PROG_NOT_EMPTY))
112 /**
113   * @}
114   */
115 
116 /* Private Functions ---------------------------------------------------------*/
117 /** @defgroup FLASHEx_Private_Functions FLASHEx Private Functions
118   * @{
119   */
120 void              FLASH_PageErase(uint32_t Page);
121 /**
122   * @}
123   */
124 
125 /**
126   * @}
127   */
128 
129 /**
130   * @}
131   */
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* STM32WBxx_HAL_FLASH_EX_H */
138