mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_flash.h@532:fe11edbda85c, 2015-04-30 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Apr 30 13:45:11 2015 +0100
- Revision:
- 532:fe11edbda85c
- Parent:
- 380:510f0c3515e3
- Child:
- 613:bc40b8d2aec4
Synchronized with git revision 8c95d60d0a0c337e8161211fd1eded577e79e00b
Full URL: https://github.com/mbedmicro/mbed/commit/8c95d60d0a0c337e8161211fd1eded577e79e00b/
Stm32cubef4 update
Who changed what in which revision?
User | Revision | Line number | New 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 | 532:fe11edbda85c | 5 | * @version V1.3.0 |
mbed_official | 532:fe11edbda85c | 6 | * @date 09-March-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>© 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 | 87:085cde657901 | 197 | * @brief Enable the FLASH prefetch buffer. |
mbed_official | 87:085cde657901 | 198 | * @retval none |
mbed_official | 87:085cde657901 | 199 | */ |
mbed_official | 87:085cde657901 | 200 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN) |
mbed_official | 87:085cde657901 | 201 | |
mbed_official | 87:085cde657901 | 202 | /** |
mbed_official | 87:085cde657901 | 203 | * @brief Disable the FLASH prefetch buffer. |
mbed_official | 87:085cde657901 | 204 | * @retval none |
mbed_official | 87:085cde657901 | 205 | */ |
mbed_official | 87:085cde657901 | 206 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN)) |
mbed_official | 87:085cde657901 | 207 | |
mbed_official | 87:085cde657901 | 208 | /** |
mbed_official | 87:085cde657901 | 209 | * @brief Enable the FLASH instruction cache. |
mbed_official | 87:085cde657901 | 210 | * @retval none |
mbed_official | 87:085cde657901 | 211 | */ |
mbed_official | 87:085cde657901 | 212 | #define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN) |
mbed_official | 87:085cde657901 | 213 | |
mbed_official | 87:085cde657901 | 214 | /** |
mbed_official | 87:085cde657901 | 215 | * @brief Disable the FLASH instruction cache. |
mbed_official | 87:085cde657901 | 216 | * @retval none |
mbed_official | 87:085cde657901 | 217 | */ |
mbed_official | 87:085cde657901 | 218 | #define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN)) |
mbed_official | 87:085cde657901 | 219 | |
mbed_official | 87:085cde657901 | 220 | /** |
mbed_official | 87:085cde657901 | 221 | * @brief Enable the FLASH data cache. |
mbed_official | 87:085cde657901 | 222 | * @retval none |
mbed_official | 87:085cde657901 | 223 | */ |
mbed_official | 87:085cde657901 | 224 | #define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN) |
mbed_official | 87:085cde657901 | 225 | |
mbed_official | 87:085cde657901 | 226 | /** |
mbed_official | 87:085cde657901 | 227 | * @brief Disable the FLASH data cache. |
mbed_official | 87:085cde657901 | 228 | * @retval none |
mbed_official | 87:085cde657901 | 229 | */ |
mbed_official | 87:085cde657901 | 230 | #define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN)) |
mbed_official | 87:085cde657901 | 231 | |
mbed_official | 87:085cde657901 | 232 | /** |
mbed_official | 87:085cde657901 | 233 | * @brief Resets the FLASH instruction Cache. |
mbed_official | 87:085cde657901 | 234 | * @note This function must be used only when the Instruction Cache is disabled. |
mbed_official | 87:085cde657901 | 235 | * @retval None |
mbed_official | 87:085cde657901 | 236 | */ |
mbed_official | 532:fe11edbda85c | 237 | #define __HAL_FLASH_INSTRUCTION_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_ICRST; \ |
mbed_official | 532:fe11edbda85c | 238 | FLASH->ACR &= ~FLASH_ACR_ICRST; \ |
mbed_official | 532:fe11edbda85c | 239 | }while(0) |
mbed_official | 87:085cde657901 | 240 | |
mbed_official | 87:085cde657901 | 241 | /** |
mbed_official | 87:085cde657901 | 242 | * @brief Resets the FLASH data Cache. |
mbed_official | 87:085cde657901 | 243 | * @note This function must be used only when the data Cache is disabled. |
mbed_official | 87:085cde657901 | 244 | * @retval None |
mbed_official | 87:085cde657901 | 245 | */ |
mbed_official | 532:fe11edbda85c | 246 | #define __HAL_FLASH_DATA_CACHE_RESET() do {FLASH->ACR |= FLASH_ACR_DCRST; \ |
mbed_official | 532:fe11edbda85c | 247 | FLASH->ACR &= ~FLASH_ACR_DCRST; \ |
mbed_official | 532:fe11edbda85c | 248 | }while(0) |
mbed_official | 87:085cde657901 | 249 | /** |
mbed_official | 87:085cde657901 | 250 | * @brief Enable the specified FLASH interrupt. |
mbed_official | 87:085cde657901 | 251 | * @param __INTERRUPT__ : FLASH interrupt |
mbed_official | 87:085cde657901 | 252 | * This parameter can be any combination of the following values: |
mbed_official | 87:085cde657901 | 253 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
mbed_official | 87:085cde657901 | 254 | * @arg FLASH_IT_ERR: Error Interrupt |
mbed_official | 87:085cde657901 | 255 | * @retval none |
mbed_official | 87:085cde657901 | 256 | */ |
mbed_official | 87:085cde657901 | 257 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
mbed_official | 87:085cde657901 | 258 | |
mbed_official | 87:085cde657901 | 259 | /** |
mbed_official | 87:085cde657901 | 260 | * @brief Disable the specified FLASH interrupt. |
mbed_official | 87:085cde657901 | 261 | * @param __INTERRUPT__ : FLASH interrupt |
mbed_official | 87:085cde657901 | 262 | * This parameter can be any combination of the following values: |
mbed_official | 87:085cde657901 | 263 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
mbed_official | 87:085cde657901 | 264 | * @arg FLASH_IT_ERR: Error Interrupt |
mbed_official | 87:085cde657901 | 265 | * @retval none |
mbed_official | 87:085cde657901 | 266 | */ |
mbed_official | 87:085cde657901 | 267 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__)) |
mbed_official | 87:085cde657901 | 268 | |
mbed_official | 87:085cde657901 | 269 | /** |
mbed_official | 87:085cde657901 | 270 | * @brief Get the specified FLASH flag status. |
mbed_official | 87:085cde657901 | 271 | * @param __FLAG__: specifies the FLASH flag to check. |
mbed_official | 87:085cde657901 | 272 | * This parameter can be one of the following values: |
mbed_official | 87:085cde657901 | 273 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
mbed_official | 87:085cde657901 | 274 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
mbed_official | 87:085cde657901 | 275 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
mbed_official | 87:085cde657901 | 276 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
mbed_official | 87:085cde657901 | 277 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
mbed_official | 87:085cde657901 | 278 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
mbed_official | 87:085cde657901 | 279 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
mbed_official | 87:085cde657901 | 280 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
mbed_official | 87:085cde657901 | 281 | * @retval The new state of __FLAG__ (SET or RESET). |
mbed_official | 87:085cde657901 | 282 | */ |
mbed_official | 106:ced8cbb51063 | 283 | #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))) |
mbed_official | 87:085cde657901 | 284 | |
mbed_official | 87:085cde657901 | 285 | /** |
mbed_official | 87:085cde657901 | 286 | * @brief Clear the specified FLASH flag. |
mbed_official | 87:085cde657901 | 287 | * @param __FLAG__: specifies the FLASH flags to clear. |
mbed_official | 87:085cde657901 | 288 | * This parameter can be any combination of the following values: |
mbed_official | 87:085cde657901 | 289 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
mbed_official | 87:085cde657901 | 290 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
mbed_official | 87:085cde657901 | 291 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
mbed_official | 87:085cde657901 | 292 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
mbed_official | 87:085cde657901 | 293 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
mbed_official | 87:085cde657901 | 294 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
mbed_official | 87:085cde657901 | 295 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
mbed_official | 87:085cde657901 | 296 | * @retval none |
mbed_official | 87:085cde657901 | 297 | */ |
mbed_official | 87:085cde657901 | 298 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) |
mbed_official | 532:fe11edbda85c | 299 | /** |
mbed_official | 532:fe11edbda85c | 300 | * @} |
mbed_official | 532:fe11edbda85c | 301 | */ |
mbed_official | 87:085cde657901 | 302 | |
mbed_official | 87:085cde657901 | 303 | /* Include FLASH HAL Extension module */ |
mbed_official | 87:085cde657901 | 304 | #include "stm32f4xx_hal_flash_ex.h" |
mbed_official | 369:2e96f1b71984 | 305 | #include "stm32f4xx_hal_flash_ramfunc.h" |
mbed_official | 87:085cde657901 | 306 | |
mbed_official | 87:085cde657901 | 307 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 308 | /** @addtogroup FLASH_Exported_Functions |
mbed_official | 532:fe11edbda85c | 309 | * @{ |
mbed_official | 532:fe11edbda85c | 310 | */ |
mbed_official | 532:fe11edbda85c | 311 | /** @addtogroup FLASH_Exported_Functions_Group1 |
mbed_official | 532:fe11edbda85c | 312 | * @{ |
mbed_official | 532:fe11edbda85c | 313 | */ |
mbed_official | 87:085cde657901 | 314 | /* Program operation functions ***********************************************/ |
mbed_official | 532:fe11edbda85c | 315 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
mbed_official | 532:fe11edbda85c | 316 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
mbed_official | 87:085cde657901 | 317 | /* FLASH IRQ handler method */ |
mbed_official | 532:fe11edbda85c | 318 | void HAL_FLASH_IRQHandler(void); |
mbed_official | 87:085cde657901 | 319 | /* Callbacks in non blocking modes */ |
mbed_official | 532:fe11edbda85c | 320 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
mbed_official | 532:fe11edbda85c | 321 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
mbed_official | 532:fe11edbda85c | 322 | /** |
mbed_official | 532:fe11edbda85c | 323 | * @} |
mbed_official | 532:fe11edbda85c | 324 | */ |
mbed_official | 87:085cde657901 | 325 | |
mbed_official | 532:fe11edbda85c | 326 | /** @addtogroup FLASH_Exported_Functions_Group2 |
mbed_official | 532:fe11edbda85c | 327 | * @{ |
mbed_official | 532:fe11edbda85c | 328 | */ |
mbed_official | 87:085cde657901 | 329 | /* Peripheral Control functions **********************************************/ |
mbed_official | 532:fe11edbda85c | 330 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
mbed_official | 532:fe11edbda85c | 331 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
mbed_official | 532:fe11edbda85c | 332 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
mbed_official | 532:fe11edbda85c | 333 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
mbed_official | 87:085cde657901 | 334 | /* Option bytes control */ |
mbed_official | 532:fe11edbda85c | 335 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
mbed_official | 532:fe11edbda85c | 336 | /** |
mbed_official | 532:fe11edbda85c | 337 | * @} |
mbed_official | 532:fe11edbda85c | 338 | */ |
mbed_official | 87:085cde657901 | 339 | |
mbed_official | 532:fe11edbda85c | 340 | /** @addtogroup FLASH_Exported_Functions_Group3 |
mbed_official | 532:fe11edbda85c | 341 | * @{ |
mbed_official | 532:fe11edbda85c | 342 | */ |
mbed_official | 87:085cde657901 | 343 | /* Peripheral State functions ************************************************/ |
mbed_official | 532:fe11edbda85c | 344 | uint32_t HAL_FLASH_GetError(void); |
mbed_official | 532:fe11edbda85c | 345 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
mbed_official | 532:fe11edbda85c | 346 | /** |
mbed_official | 532:fe11edbda85c | 347 | * @} |
mbed_official | 532:fe11edbda85c | 348 | */ |
mbed_official | 532:fe11edbda85c | 349 | |
mbed_official | 532:fe11edbda85c | 350 | /** |
mbed_official | 532:fe11edbda85c | 351 | * @} |
mbed_official | 532:fe11edbda85c | 352 | */ |
mbed_official | 532:fe11edbda85c | 353 | /* Private types -------------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 354 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 355 | /** @defgroup FLASH_Private_Variables FLASH Private Variables |
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 | * @} |
mbed_official | 532:fe11edbda85c | 361 | */ |
mbed_official | 532:fe11edbda85c | 362 | /* Private constants ---------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 363 | /** @defgroup FLASH_Private_Constants FLASH Private Constants |
mbed_official | 532:fe11edbda85c | 364 | * @{ |
mbed_official | 532:fe11edbda85c | 365 | */ |
mbed_official | 87:085cde657901 | 366 | |
mbed_official | 532:fe11edbda85c | 367 | /** |
mbed_official | 532:fe11edbda85c | 368 | * @brief ACR register byte 0 (Bits[7:0]) base address |
mbed_official | 532:fe11edbda85c | 369 | */ |
mbed_official | 532:fe11edbda85c | 370 | #define ACR_BYTE0_ADDRESS ((uint32_t)0x40023C00) |
mbed_official | 532:fe11edbda85c | 371 | /** |
mbed_official | 532:fe11edbda85c | 372 | * @brief OPTCR register byte 0 (Bits[7:0]) base address |
mbed_official | 532:fe11edbda85c | 373 | */ |
mbed_official | 532:fe11edbda85c | 374 | #define OPTCR_BYTE0_ADDRESS ((uint32_t)0x40023C14) |
mbed_official | 532:fe11edbda85c | 375 | /** |
mbed_official | 532:fe11edbda85c | 376 | * @brief OPTCR register byte 1 (Bits[15:8]) base address |
mbed_official | 532:fe11edbda85c | 377 | */ |
mbed_official | 532:fe11edbda85c | 378 | #define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15) |
mbed_official | 532:fe11edbda85c | 379 | /** |
mbed_official | 532:fe11edbda85c | 380 | * @brief OPTCR register byte 2 (Bits[23:16]) base address |
mbed_official | 532:fe11edbda85c | 381 | */ |
mbed_official | 532:fe11edbda85c | 382 | #define OPTCR_BYTE2_ADDRESS ((uint32_t)0x40023C16) |
mbed_official | 532:fe11edbda85c | 383 | /** |
mbed_official | 532:fe11edbda85c | 384 | * @brief OPTCR register byte 3 (Bits[31:24]) base address |
mbed_official | 532:fe11edbda85c | 385 | */ |
mbed_official | 532:fe11edbda85c | 386 | #define OPTCR_BYTE3_ADDRESS ((uint32_t)0x40023C17) |
mbed_official | 532:fe11edbda85c | 387 | |
mbed_official | 532:fe11edbda85c | 388 | /** |
mbed_official | 532:fe11edbda85c | 389 | * @} |
mbed_official | 532:fe11edbda85c | 390 | */ |
mbed_official | 532:fe11edbda85c | 391 | |
mbed_official | 532:fe11edbda85c | 392 | /* Private macros ------------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 393 | /** @defgroup FLASH_Private_Macros FLASH Private Macros |
mbed_official | 532:fe11edbda85c | 394 | * @{ |
mbed_official | 532:fe11edbda85c | 395 | */ |
mbed_official | 532:fe11edbda85c | 396 | |
mbed_official | 532:fe11edbda85c | 397 | /** @defgroup FLASH_IS_FLASH_Definitions FLASH Private macros to check input parameters |
mbed_official | 532:fe11edbda85c | 398 | * @{ |
mbed_official | 532:fe11edbda85c | 399 | */ |
mbed_official | 532:fe11edbda85c | 400 | #define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \ |
mbed_official | 532:fe11edbda85c | 401 | ((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \ |
mbed_official | 532:fe11edbda85c | 402 | ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \ |
mbed_official | 532:fe11edbda85c | 403 | ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD)) |
mbed_official | 532:fe11edbda85c | 404 | /** |
mbed_official | 532:fe11edbda85c | 405 | * @} |
mbed_official | 532:fe11edbda85c | 406 | */ |
mbed_official | 532:fe11edbda85c | 407 | |
mbed_official | 532:fe11edbda85c | 408 | /** |
mbed_official | 532:fe11edbda85c | 409 | * @} |
mbed_official | 532:fe11edbda85c | 410 | */ |
mbed_official | 532:fe11edbda85c | 411 | |
mbed_official | 532:fe11edbda85c | 412 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 413 | /** @defgroup FLASH_Private_Functions FLASH Private Functions |
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 | */ |
mbed_official | 87:085cde657901 | 420 | |
mbed_official | 87:085cde657901 | 421 | /** |
mbed_official | 87:085cde657901 | 422 | * @} |
mbed_official | 87:085cde657901 | 423 | */ |
mbed_official | 87:085cde657901 | 424 | |
mbed_official | 87:085cde657901 | 425 | /** |
mbed_official | 87:085cde657901 | 426 | * @} |
mbed_official | 87:085cde657901 | 427 | */ |
mbed_official | 87:085cde657901 | 428 | |
mbed_official | 87:085cde657901 | 429 | #ifdef __cplusplus |
mbed_official | 87:085cde657901 | 430 | } |
mbed_official | 87:085cde657901 | 431 | #endif |
mbed_official | 87:085cde657901 | 432 | |
mbed_official | 87:085cde657901 | 433 | #endif /* __STM32F4xx_HAL_FLASH_H */ |
mbed_official | 87:085cde657901 | 434 | |
mbed_official | 87:085cde657901 | 435 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |