mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Sep 12 16:41:52 2014 +0100
Revision:
89:552587b429a1
Child:
92:4fc01daae5a5
Release 89 of the mbed library

Main changes:

- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends

Who changed what in which revision?

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