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:
110:165afa46840b
.

Who changed what in which revision?

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