meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 13 08:08:21 2015 +0200
Revision:
99:dbbf35b96557
Parent:
92:4fc01daae5a5
Child:
106:ba1f97679dad
Release 99 of the mbed library

Changes:
- new targets - MAXWSNENV, DISCO_L053C8
- STM32F4xx - ST Cube driver
- KSDK mcu - SPI timing fix
- Nordic - update to softdevice s130

Who changed what in which revision?

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