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