mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
235:685d5f11838f
test with CLOCK_SETUP = 0

Who changed what in which revision?

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