my fork
Fork of mbed by
TARGET_NUCLEO_F401RE/stm32f4xx_hal_flash.h@81:7d30d6019079, 2014-03-19 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Mar 19 18:28:32 2014 +0000
- Revision:
- 81:7d30d6019079
- Parent:
- 77:869cf507173a
- Child:
- 85:024bf7f99721
Release 81 of the mbed library
Main changes:
- Updates and fixes for many targets
- LPC1768: serial interface code fixes
- nRF51822 targets now output a .hex file
- More exporters
- More flexible GPIO API
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f4xx_hal_flash.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
bogdanm | 81:7d30d6019079 | 5 | * @version V1.0.0 |
bogdanm | 81:7d30d6019079 | 6 | * @date 18-February-2014 |
emilmont | 77:869cf507173a | 7 | * @brief Header file of FLASH HAL module. |
emilmont | 77:869cf507173a | 8 | ****************************************************************************** |
emilmont | 77:869cf507173a | 9 | * @attention |
emilmont | 77:869cf507173a | 10 | * |
emilmont | 77:869cf507173a | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 12 | * |
emilmont | 77:869cf507173a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
emilmont | 77:869cf507173a | 14 | * are permitted provided that the following conditions are met: |
emilmont | 77:869cf507173a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
emilmont | 77:869cf507173a | 16 | * this list of conditions and the following disclaimer. |
emilmont | 77:869cf507173a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
emilmont | 77:869cf507173a | 18 | * this list of conditions and the following disclaimer in the documentation |
emilmont | 77:869cf507173a | 19 | * and/or other materials provided with the distribution. |
emilmont | 77:869cf507173a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
emilmont | 77:869cf507173a | 21 | * may be used to endorse or promote products derived from this software |
emilmont | 77:869cf507173a | 22 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 23 | * |
emilmont | 77:869cf507173a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 77:869cf507173a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 77:869cf507173a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
emilmont | 77:869cf507173a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
emilmont | 77:869cf507173a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
emilmont | 77:869cf507173a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
emilmont | 77:869cf507173a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emilmont | 77:869cf507173a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
emilmont | 77:869cf507173a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
emilmont | 77:869cf507173a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 34 | * |
emilmont | 77:869cf507173a | 35 | ****************************************************************************** |
emilmont | 77:869cf507173a | 36 | */ |
emilmont | 77:869cf507173a | 37 | |
emilmont | 77:869cf507173a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 39 | #ifndef __STM32F4xx_HAL_FLASH_H |
emilmont | 77:869cf507173a | 40 | #define __STM32F4xx_HAL_FLASH_H |
emilmont | 77:869cf507173a | 41 | |
emilmont | 77:869cf507173a | 42 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 43 | extern "C" { |
emilmont | 77:869cf507173a | 44 | #endif |
emilmont | 77:869cf507173a | 45 | |
emilmont | 77:869cf507173a | 46 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 47 | #include "stm32f4xx_hal_def.h" |
emilmont | 77:869cf507173a | 48 | |
emilmont | 77:869cf507173a | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
emilmont | 77:869cf507173a | 50 | * @{ |
emilmont | 77:869cf507173a | 51 | */ |
emilmont | 77:869cf507173a | 52 | |
emilmont | 77:869cf507173a | 53 | /** @addtogroup FLASH |
emilmont | 77:869cf507173a | 54 | * @{ |
emilmont | 77:869cf507173a | 55 | */ |
emilmont | 77:869cf507173a | 56 | |
emilmont | 77:869cf507173a | 57 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 58 | /** |
emilmont | 77:869cf507173a | 59 | * @brief FLASH Error structure definition |
emilmont | 77:869cf507173a | 60 | */ |
emilmont | 77:869cf507173a | 61 | typedef enum |
emilmont | 77:869cf507173a | 62 | { |
emilmont | 77:869cf507173a | 63 | FLASH_ERROR_RD = 0x01, |
emilmont | 77:869cf507173a | 64 | FLASH_ERROR_PGS = 0x02, |
emilmont | 77:869cf507173a | 65 | FLASH_ERROR_PGP = 0x04, |
emilmont | 77:869cf507173a | 66 | FLASH_ERROR_PGA = 0x08, |
emilmont | 77:869cf507173a | 67 | FLASH_ERROR_WRP = 0x10, |
emilmont | 77:869cf507173a | 68 | FLASH_ERROR_OPERATION = 0x20 |
emilmont | 77:869cf507173a | 69 | }FLASH_ErrorTypeDef; |
emilmont | 77:869cf507173a | 70 | |
emilmont | 77:869cf507173a | 71 | /** |
emilmont | 77:869cf507173a | 72 | * @brief FLASH Procedure structure definition |
emilmont | 77:869cf507173a | 73 | */ |
emilmont | 77:869cf507173a | 74 | typedef enum |
emilmont | 77:869cf507173a | 75 | { |
emilmont | 77:869cf507173a | 76 | FLASH_PROC_NONE = 0, |
emilmont | 77:869cf507173a | 77 | FLASH_PROC_SECTERASE, |
emilmont | 77:869cf507173a | 78 | FLASH_PROC_MASSERASE, |
emilmont | 77:869cf507173a | 79 | FLASH_PROC_PROGRAM |
emilmont | 77:869cf507173a | 80 | } FLASH_ProcedureTypeDef; |
emilmont | 77:869cf507173a | 81 | |
emilmont | 77:869cf507173a | 82 | |
emilmont | 77:869cf507173a | 83 | /** |
emilmont | 77:869cf507173a | 84 | * @brief FLASH handle Structure definition |
emilmont | 77:869cf507173a | 85 | */ |
emilmont | 77:869cf507173a | 86 | typedef struct |
emilmont | 77:869cf507173a | 87 | { |
emilmont | 77:869cf507173a | 88 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/ |
emilmont | 77:869cf507173a | 89 | |
emilmont | 77:869cf507173a | 90 | __IO uint32_t NbSectorsToErase; /*Internal variable to save the remaining sectors to erase in IT context*/ |
emilmont | 77:869cf507173a | 91 | |
emilmont | 77:869cf507173a | 92 | __IO uint8_t VoltageForErase; /*Internal variable to provide voltange range selected by user in IT context*/ |
emilmont | 77:869cf507173a | 93 | |
emilmont | 77:869cf507173a | 94 | __IO uint32_t Sector; /*Internal variable to define the current sector which is erasing*/ |
emilmont | 77:869cf507173a | 95 | |
emilmont | 77:869cf507173a | 96 | __IO uint32_t Bank; /*Internal variable to save current bank selected during mass erase*/ |
emilmont | 77:869cf507173a | 97 | |
emilmont | 77:869cf507173a | 98 | __IO uint32_t Address; /*Internal variable to save address selected for program*/ |
emilmont | 77:869cf507173a | 99 | |
emilmont | 77:869cf507173a | 100 | HAL_LockTypeDef Lock; /* FLASH locking object */ |
emilmont | 77:869cf507173a | 101 | |
emilmont | 77:869cf507173a | 102 | __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */ |
emilmont | 77:869cf507173a | 103 | |
emilmont | 77:869cf507173a | 104 | }FLASH_ProcessTypeDef; |
emilmont | 77:869cf507173a | 105 | |
emilmont | 77:869cf507173a | 106 | /** |
emilmont | 77:869cf507173a | 107 | * @brief FLASH Error source |
emilmont | 77:869cf507173a | 108 | */ |
emilmont | 77:869cf507173a | 109 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 110 | |
emilmont | 77:869cf507173a | 111 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
emilmont | 77:869cf507173a | 112 | * @{ |
emilmont | 77:869cf507173a | 113 | */ |
emilmont | 77:869cf507173a | 114 | |
emilmont | 77:869cf507173a | 115 | |
emilmont | 77:869cf507173a | 116 | |
emilmont | 77:869cf507173a | 117 | /** @defgroup FLASH_Type_Program FLASH Type Program |
emilmont | 77:869cf507173a | 118 | * @{ |
emilmont | 77:869cf507173a | 119 | */ |
emilmont | 77:869cf507173a | 120 | #define TYPEPROGRAM_BYTE ((uint32_t)0x00) /*!< Program byte (8-bit) at a specified address */ |
emilmont | 77:869cf507173a | 121 | #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!< Program a half-word (16-bit) at a specified address */ |
emilmont | 77:869cf507173a | 122 | #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!< Program a word (32-bit) at a specified address */ |
emilmont | 77:869cf507173a | 123 | #define TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!< Program a double word (64-bit) at a specified address */ |
emilmont | 77:869cf507173a | 124 | |
emilmont | 77:869cf507173a | 125 | #define IS_TYPEPROGRAM(VALUE)(((VALUE) == TYPEPROGRAM_BYTE) || \ |
emilmont | 77:869cf507173a | 126 | ((VALUE) == TYPEPROGRAM_HALFWORD) || \ |
emilmont | 77:869cf507173a | 127 | ((VALUE) == TYPEPROGRAM_WORD) || \ |
emilmont | 77:869cf507173a | 128 | ((VALUE) == TYPEPROGRAM_DOUBLEWORD)) |
emilmont | 77:869cf507173a | 129 | |
emilmont | 77:869cf507173a | 130 | /** |
emilmont | 77:869cf507173a | 131 | * @} |
emilmont | 77:869cf507173a | 132 | */ |
emilmont | 77:869cf507173a | 133 | |
emilmont | 77:869cf507173a | 134 | /** @defgroup FLASH_Flag_definition FLASH Flag definition |
emilmont | 77:869cf507173a | 135 | * @brief Flag definition |
emilmont | 77:869cf507173a | 136 | * @{ |
emilmont | 77:869cf507173a | 137 | */ |
emilmont | 77:869cf507173a | 138 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */ |
emilmont | 77:869cf507173a | 139 | #define FLASH_FLAG_OPERR FLASH_SR_SOP /*!< FLASH operation Error flag */ |
emilmont | 77:869cf507173a | 140 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
emilmont | 77:869cf507173a | 141 | #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ |
emilmont | 77:869cf507173a | 142 | #define FLASH_FLAG_PGPERR FLASH_SR_PGPERR /*!< FLASH Programming Parallelism error flag */ |
emilmont | 77:869cf507173a | 143 | #define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< FLASH Programming Sequence error flag */ |
emilmont | 77:869cf507173a | 144 | #define FLASH_FLAG_RDERR ((uint32_t)0x00000100) /*!< Read Protection error flag (PCROP) */ |
emilmont | 77:869cf507173a | 145 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
emilmont | 77:869cf507173a | 146 | |
emilmont | 77:869cf507173a | 147 | /** |
emilmont | 77:869cf507173a | 148 | * @} |
emilmont | 77:869cf507173a | 149 | */ |
emilmont | 77:869cf507173a | 150 | |
emilmont | 77:869cf507173a | 151 | /** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition |
emilmont | 77:869cf507173a | 152 | * @brief FLASH Interrupt definition |
emilmont | 77:869cf507173a | 153 | * @{ |
emilmont | 77:869cf507173a | 154 | */ |
emilmont | 77:869cf507173a | 155 | #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */ |
emilmont | 77:869cf507173a | 156 | #define FLASH_IT_ERR ((uint32_t)0x02000000) /*!< Error Interrupt source */ |
emilmont | 77:869cf507173a | 157 | |
emilmont | 77:869cf507173a | 158 | /** |
emilmont | 77:869cf507173a | 159 | * @} |
emilmont | 77:869cf507173a | 160 | */ |
emilmont | 77:869cf507173a | 161 | |
emilmont | 77:869cf507173a | 162 | /** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism |
emilmont | 77:869cf507173a | 163 | * @{ |
emilmont | 77:869cf507173a | 164 | */ |
emilmont | 77:869cf507173a | 165 | #define FLASH_PSIZE_BYTE ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 166 | #define FLASH_PSIZE_HALF_WORD ((uint32_t)0x00000100) |
emilmont | 77:869cf507173a | 167 | #define FLASH_PSIZE_WORD ((uint32_t)0x00000200) |
emilmont | 77:869cf507173a | 168 | #define FLASH_PSIZE_DOUBLE_WORD ((uint32_t)0x00000300) |
emilmont | 77:869cf507173a | 169 | #define CR_PSIZE_MASK ((uint32_t)0xFFFFFCFF) |
emilmont | 77:869cf507173a | 170 | /** |
emilmont | 77:869cf507173a | 171 | * @} |
emilmont | 77:869cf507173a | 172 | */ |
emilmont | 77:869cf507173a | 173 | |
emilmont | 77:869cf507173a | 174 | /** @defgroup FLASH_Keys FLASH Keys |
emilmont | 77:869cf507173a | 175 | * @{ |
emilmont | 77:869cf507173a | 176 | */ |
emilmont | 77:869cf507173a | 177 | #define RDP_KEY ((uint16_t)0x00A5) |
emilmont | 77:869cf507173a | 178 | #define FLASH_KEY1 ((uint32_t)0x45670123) |
emilmont | 77:869cf507173a | 179 | #define FLASH_KEY2 ((uint32_t)0xCDEF89AB) |
emilmont | 77:869cf507173a | 180 | #define FLASH_OPT_KEY1 ((uint32_t)0x08192A3B) |
emilmont | 77:869cf507173a | 181 | #define FLASH_OPT_KEY2 ((uint32_t)0x4C5D6E7F) |
emilmont | 77:869cf507173a | 182 | /** |
emilmont | 77:869cf507173a | 183 | * @} |
emilmont | 77:869cf507173a | 184 | */ |
emilmont | 77:869cf507173a | 185 | |
emilmont | 77:869cf507173a | 186 | /** |
emilmont | 77:869cf507173a | 187 | * @brief ACR register byte 0 (Bits[7:0]) base address |
emilmont | 77:869cf507173a | 188 | */ |
emilmont | 77:869cf507173a | 189 | #define ACR_BYTE0_ADDRESS ((uint32_t)0x40023C00) |
emilmont | 77:869cf507173a | 190 | /** |
emilmont | 77:869cf507173a | 191 | * @brief OPTCR register byte 0 (Bits[7:0]) base address |
emilmont | 77:869cf507173a | 192 | */ |
emilmont | 77:869cf507173a | 193 | #define OPTCR_BYTE0_ADDRESS ((uint32_t)0x40023C14) |
emilmont | 77:869cf507173a | 194 | /** |
emilmont | 77:869cf507173a | 195 | * @brief OPTCR register byte 1 (Bits[15:8]) base address |
emilmont | 77:869cf507173a | 196 | */ |
emilmont | 77:869cf507173a | 197 | #define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15) |
emilmont | 77:869cf507173a | 198 | /** |
emilmont | 77:869cf507173a | 199 | * @brief OPTCR register byte 2 (Bits[23:16]) base address |
emilmont | 77:869cf507173a | 200 | */ |
emilmont | 77:869cf507173a | 201 | #define OPTCR_BYTE2_ADDRESS ((uint32_t)0x40023C16) |
emilmont | 77:869cf507173a | 202 | /** |
emilmont | 77:869cf507173a | 203 | * @brief OPTCR register byte 3 (Bits[31:24]) base address |
emilmont | 77:869cf507173a | 204 | */ |
emilmont | 77:869cf507173a | 205 | #define OPTCR_BYTE3_ADDRESS ((uint32_t)0x40023C17) |
emilmont | 77:869cf507173a | 206 | |
emilmont | 77:869cf507173a | 207 | /** |
emilmont | 77:869cf507173a | 208 | * @} |
emilmont | 77:869cf507173a | 209 | */ |
emilmont | 77:869cf507173a | 210 | |
emilmont | 77:869cf507173a | 211 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 212 | |
emilmont | 77:869cf507173a | 213 | /** |
emilmont | 77:869cf507173a | 214 | * @brief Set the FLASH Latency. |
emilmont | 77:869cf507173a | 215 | * @param __LATENCY__: FLASH Latency |
emilmont | 77:869cf507173a | 216 | * The value of this parameter depend on device used within the same series |
emilmont | 77:869cf507173a | 217 | * @retval none |
emilmont | 77:869cf507173a | 218 | */ |
emilmont | 77:869cf507173a | 219 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (*(__IO uint8_t *)ACR_BYTE0_ADDRESS = (uint8_t)(__LATENCY__)) |
emilmont | 77:869cf507173a | 220 | |
emilmont | 77:869cf507173a | 221 | /** |
emilmont | 77:869cf507173a | 222 | * @brief Enable the FLASH prefetch buffer. |
emilmont | 77:869cf507173a | 223 | * @retval none |
emilmont | 77:869cf507173a | 224 | */ |
emilmont | 77:869cf507173a | 225 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN) |
emilmont | 77:869cf507173a | 226 | |
emilmont | 77:869cf507173a | 227 | /** |
emilmont | 77:869cf507173a | 228 | * @brief Disable the FLASH prefetch buffer. |
emilmont | 77:869cf507173a | 229 | * @retval none |
emilmont | 77:869cf507173a | 230 | */ |
emilmont | 77:869cf507173a | 231 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN)) |
emilmont | 77:869cf507173a | 232 | |
emilmont | 77:869cf507173a | 233 | /** |
emilmont | 77:869cf507173a | 234 | * @brief Enable the FLASH instruction cache. |
emilmont | 77:869cf507173a | 235 | * @retval none |
emilmont | 77:869cf507173a | 236 | */ |
emilmont | 77:869cf507173a | 237 | #define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN) |
emilmont | 77:869cf507173a | 238 | |
emilmont | 77:869cf507173a | 239 | /** |
emilmont | 77:869cf507173a | 240 | * @brief Disable the FLASH instruction cache. |
emilmont | 77:869cf507173a | 241 | * @retval none |
emilmont | 77:869cf507173a | 242 | */ |
emilmont | 77:869cf507173a | 243 | #define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN)) |
emilmont | 77:869cf507173a | 244 | |
emilmont | 77:869cf507173a | 245 | /** |
emilmont | 77:869cf507173a | 246 | * @brief Enable the FLASH data cache. |
emilmont | 77:869cf507173a | 247 | * @retval none |
emilmont | 77:869cf507173a | 248 | */ |
emilmont | 77:869cf507173a | 249 | #define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN) |
emilmont | 77:869cf507173a | 250 | |
emilmont | 77:869cf507173a | 251 | /** |
emilmont | 77:869cf507173a | 252 | * @brief Disable the FLASH data cache. |
emilmont | 77:869cf507173a | 253 | * @retval none |
emilmont | 77:869cf507173a | 254 | */ |
emilmont | 77:869cf507173a | 255 | #define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN)) |
emilmont | 77:869cf507173a | 256 | |
emilmont | 77:869cf507173a | 257 | /** |
emilmont | 77:869cf507173a | 258 | * @brief Resets the FLASH instruction Cache. |
emilmont | 77:869cf507173a | 259 | * @note This function must be used only when the Instruction Cache is disabled. |
emilmont | 77:869cf507173a | 260 | * @retval None |
emilmont | 77:869cf507173a | 261 | */ |
emilmont | 77:869cf507173a | 262 | #define __HAL_FLASH_INSTRUCTION_CACHE_RESET() (FLASH->ACR |= FLASH_ACR_ICRST) |
emilmont | 77:869cf507173a | 263 | |
emilmont | 77:869cf507173a | 264 | /** |
emilmont | 77:869cf507173a | 265 | * @brief Resets the FLASH data Cache. |
emilmont | 77:869cf507173a | 266 | * @note This function must be used only when the data Cache is disabled. |
emilmont | 77:869cf507173a | 267 | * @retval None |
emilmont | 77:869cf507173a | 268 | */ |
emilmont | 77:869cf507173a | 269 | #define __HAL_FLASH_DATA_CACHE_RESET() (FLASH->ACR |= FLASH_ACR_DCRST) |
emilmont | 77:869cf507173a | 270 | |
emilmont | 77:869cf507173a | 271 | /** |
emilmont | 77:869cf507173a | 272 | * @brief Enable the specified FLASH interrupt. |
emilmont | 77:869cf507173a | 273 | * @param __INTERRUPT__ : FLASH interrupt |
emilmont | 77:869cf507173a | 274 | * This parameter can be any combination of the following values: |
emilmont | 77:869cf507173a | 275 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
emilmont | 77:869cf507173a | 276 | * @arg FLASH_IT_ERR: Error Interrupt |
emilmont | 77:869cf507173a | 277 | * @retval none |
emilmont | 77:869cf507173a | 278 | */ |
emilmont | 77:869cf507173a | 279 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
emilmont | 77:869cf507173a | 280 | |
emilmont | 77:869cf507173a | 281 | /** |
emilmont | 77:869cf507173a | 282 | * @brief Disable the specified FLASH interrupt. |
emilmont | 77:869cf507173a | 283 | * @param __INTERRUPT__ : FLASH interrupt |
emilmont | 77:869cf507173a | 284 | * This parameter can be any combination of the following values: |
emilmont | 77:869cf507173a | 285 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
emilmont | 77:869cf507173a | 286 | * @arg FLASH_IT_ERR: Error Interrupt |
emilmont | 77:869cf507173a | 287 | * @retval none |
emilmont | 77:869cf507173a | 288 | */ |
emilmont | 77:869cf507173a | 289 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__)) |
emilmont | 77:869cf507173a | 290 | |
emilmont | 77:869cf507173a | 291 | /** |
emilmont | 77:869cf507173a | 292 | * @brief Get the specified FLASH flag status. |
emilmont | 77:869cf507173a | 293 | * @param __FLAG__: specifies the FLASH flag to check. |
emilmont | 77:869cf507173a | 294 | * This parameter can be one of the following values: |
emilmont | 77:869cf507173a | 295 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
emilmont | 77:869cf507173a | 296 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
emilmont | 77:869cf507173a | 297 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
emilmont | 77:869cf507173a | 298 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
emilmont | 77:869cf507173a | 299 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
emilmont | 77:869cf507173a | 300 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
emilmont | 77:869cf507173a | 301 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
emilmont | 77:869cf507173a | 302 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
emilmont | 77:869cf507173a | 303 | * @retval The new state of __FLAG__ (SET or RESET). |
emilmont | 77:869cf507173a | 304 | */ |
bogdanm | 81:7d30d6019079 | 305 | #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))) |
emilmont | 77:869cf507173a | 306 | |
emilmont | 77:869cf507173a | 307 | /** |
emilmont | 77:869cf507173a | 308 | * @brief Clear the specified FLASH flag. |
emilmont | 77:869cf507173a | 309 | * @param __FLAG__: specifies the FLASH flags to clear. |
emilmont | 77:869cf507173a | 310 | * This parameter can be any combination of the following values: |
emilmont | 77:869cf507173a | 311 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
emilmont | 77:869cf507173a | 312 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
emilmont | 77:869cf507173a | 313 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
emilmont | 77:869cf507173a | 314 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
emilmont | 77:869cf507173a | 315 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
emilmont | 77:869cf507173a | 316 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
emilmont | 77:869cf507173a | 317 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
emilmont | 77:869cf507173a | 318 | * @retval none |
emilmont | 77:869cf507173a | 319 | */ |
emilmont | 77:869cf507173a | 320 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) |
emilmont | 77:869cf507173a | 321 | |
emilmont | 77:869cf507173a | 322 | /* Include FLASH HAL Extension module */ |
emilmont | 77:869cf507173a | 323 | #include "stm32f4xx_hal_flash_ex.h" |
emilmont | 77:869cf507173a | 324 | |
emilmont | 77:869cf507173a | 325 | /* Exported functions --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 326 | /* Program operation functions ***********************************************/ |
emilmont | 77:869cf507173a | 327 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
emilmont | 77:869cf507173a | 328 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
emilmont | 77:869cf507173a | 329 | /* FLASH IRQ handler method */ |
emilmont | 77:869cf507173a | 330 | void HAL_FLASH_IRQHandler(void); |
emilmont | 77:869cf507173a | 331 | /* Callbacks in non blocking modes */ |
bogdanm | 81:7d30d6019079 | 332 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
bogdanm | 81:7d30d6019079 | 333 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
emilmont | 77:869cf507173a | 334 | |
emilmont | 77:869cf507173a | 335 | /* Peripheral Control functions **********************************************/ |
emilmont | 77:869cf507173a | 336 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
emilmont | 77:869cf507173a | 337 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
emilmont | 77:869cf507173a | 338 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
emilmont | 77:869cf507173a | 339 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
emilmont | 77:869cf507173a | 340 | /* Option bytes control */ |
emilmont | 77:869cf507173a | 341 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
emilmont | 77:869cf507173a | 342 | |
emilmont | 77:869cf507173a | 343 | /* Peripheral State functions ************************************************/ |
emilmont | 77:869cf507173a | 344 | FLASH_ErrorTypeDef HAL_FLASH_GetError(void); |
emilmont | 77:869cf507173a | 345 | |
emilmont | 77:869cf507173a | 346 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
emilmont | 77:869cf507173a | 347 | |
emilmont | 77:869cf507173a | 348 | /** |
emilmont | 77:869cf507173a | 349 | * @} |
emilmont | 77:869cf507173a | 350 | */ |
emilmont | 77:869cf507173a | 351 | |
emilmont | 77:869cf507173a | 352 | /** |
emilmont | 77:869cf507173a | 353 | * @} |
emilmont | 77:869cf507173a | 354 | */ |
emilmont | 77:869cf507173a | 355 | |
emilmont | 77:869cf507173a | 356 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 357 | } |
emilmont | 77:869cf507173a | 358 | #endif |
emilmont | 77:869cf507173a | 359 | |
emilmont | 77:869cf507173a | 360 | #endif /* __STM32F4xx_HAL_FLASH_H */ |
emilmont | 77:869cf507173a | 361 | |
emilmont | 77:869cf507173a | 362 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |