Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
112:6f327212ef96
.

Who changed what in which revision?

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