mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

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