mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Aug 20 10:45:13 2015 +0100
Revision:
613:bc40b8d2aec4
Parent:
532:fe11edbda85c
Synchronized with git revision 92ca8c7b60a283b6bb60eb65b183dac1599f0ade

Full URL: https://github.com/mbedmicro/mbed/commit/92ca8c7b60a283b6bb60eb65b183dac1599f0ade/

Nordic: update application start address in GCC linker script

Who changed what in which revision?

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