/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }
Fork of mbed by
TARGET_MTS_MDOT_F405RG/stm32f4xx_hal_flash.h@93:9dd889aeda0e, 2014-12-05 (annotated)
- Committer:
- fblanc
- Date:
- Fri Dec 05 15:42:32 2014 +0000
- Revision:
- 93:9dd889aeda0e
- Parent:
- 92:4fc01daae5a5
substitute line 894 extern } by }; /TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h
Who changed what in which revision?
User | Revision | Line number | New 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 |
bogdanm | 92:4fc01daae5a5 | 5 | * @version V1.1.0 |
bogdanm | 92:4fc01daae5a5 | 6 | * @date 19-June-2014 |
bogdanm | 92:4fc01daae5a5 | 7 | * @brief Header file of FLASH HAL module. |
bogdanm | 92:4fc01daae5a5 | 8 | ****************************************************************************** |
bogdanm | 92:4fc01daae5a5 | 9 | * @attention |
bogdanm | 92:4fc01daae5a5 | 10 | * |
bogdanm | 92:4fc01daae5a5 | 11 | * <h2><center>© COPYRIGHT(c) 2014 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 | |
bogdanm | 92:4fc01daae5a5 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 58 | /** |
bogdanm | 92:4fc01daae5a5 | 59 | * @brief FLASH Error structure definition |
bogdanm | 92:4fc01daae5a5 | 60 | */ |
bogdanm | 92:4fc01daae5a5 | 61 | typedef enum |
bogdanm | 92:4fc01daae5a5 | 62 | { |
bogdanm | 92:4fc01daae5a5 | 63 | FLASH_ERROR_RD = 0x01, |
bogdanm | 92:4fc01daae5a5 | 64 | FLASH_ERROR_PGS = 0x02, |
bogdanm | 92:4fc01daae5a5 | 65 | FLASH_ERROR_PGP = 0x04, |
bogdanm | 92:4fc01daae5a5 | 66 | FLASH_ERROR_PGA = 0x08, |
bogdanm | 92:4fc01daae5a5 | 67 | FLASH_ERROR_WRP = 0x10, |
bogdanm | 92:4fc01daae5a5 | 68 | FLASH_ERROR_OPERATION = 0x20 |
bogdanm | 92:4fc01daae5a5 | 69 | }FLASH_ErrorTypeDef; |
bogdanm | 92:4fc01daae5a5 | 70 | |
bogdanm | 92:4fc01daae5a5 | 71 | /** |
bogdanm | 92:4fc01daae5a5 | 72 | * @brief FLASH Procedure structure definition |
bogdanm | 92:4fc01daae5a5 | 73 | */ |
bogdanm | 92:4fc01daae5a5 | 74 | typedef enum |
bogdanm | 92:4fc01daae5a5 | 75 | { |
bogdanm | 92:4fc01daae5a5 | 76 | FLASH_PROC_NONE = 0, |
bogdanm | 92:4fc01daae5a5 | 77 | FLASH_PROC_SECTERASE, |
bogdanm | 92:4fc01daae5a5 | 78 | FLASH_PROC_MASSERASE, |
bogdanm | 92:4fc01daae5a5 | 79 | FLASH_PROC_PROGRAM |
bogdanm | 92:4fc01daae5a5 | 80 | } FLASH_ProcedureTypeDef; |
bogdanm | 92:4fc01daae5a5 | 81 | |
bogdanm | 92:4fc01daae5a5 | 82 | |
bogdanm | 92:4fc01daae5a5 | 83 | /** |
bogdanm | 92:4fc01daae5a5 | 84 | * @brief FLASH handle Structure definition |
bogdanm | 92:4fc01daae5a5 | 85 | */ |
bogdanm | 92:4fc01daae5a5 | 86 | typedef struct |
bogdanm | 92:4fc01daae5a5 | 87 | { |
bogdanm | 92:4fc01daae5a5 | 88 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/ |
bogdanm | 92:4fc01daae5a5 | 89 | |
bogdanm | 92:4fc01daae5a5 | 90 | __IO uint32_t NbSectorsToErase; /*Internal variable to save the remaining sectors to erase in IT context*/ |
bogdanm | 92:4fc01daae5a5 | 91 | |
bogdanm | 92:4fc01daae5a5 | 92 | __IO uint8_t VoltageForErase; /*Internal variable to provide voltange range selected by user in IT context*/ |
bogdanm | 92:4fc01daae5a5 | 93 | |
bogdanm | 92:4fc01daae5a5 | 94 | __IO uint32_t Sector; /*Internal variable to define the current sector which is erasing*/ |
bogdanm | 92:4fc01daae5a5 | 95 | |
bogdanm | 92:4fc01daae5a5 | 96 | __IO uint32_t Bank; /*Internal variable to save current bank selected during mass erase*/ |
bogdanm | 92:4fc01daae5a5 | 97 | |
bogdanm | 92:4fc01daae5a5 | 98 | __IO uint32_t Address; /*Internal variable to save address selected for program*/ |
bogdanm | 92:4fc01daae5a5 | 99 | |
bogdanm | 92:4fc01daae5a5 | 100 | HAL_LockTypeDef Lock; /* FLASH locking object */ |
bogdanm | 92:4fc01daae5a5 | 101 | |
bogdanm | 92:4fc01daae5a5 | 102 | __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */ |
bogdanm | 92:4fc01daae5a5 | 103 | |
bogdanm | 92:4fc01daae5a5 | 104 | }FLASH_ProcessTypeDef; |
bogdanm | 92:4fc01daae5a5 | 105 | |
bogdanm | 92:4fc01daae5a5 | 106 | /** |
bogdanm | 92:4fc01daae5a5 | 107 | * @brief FLASH Error source |
bogdanm | 92:4fc01daae5a5 | 108 | */ |
bogdanm | 92:4fc01daae5a5 | 109 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 110 | |
bogdanm | 92:4fc01daae5a5 | 111 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
bogdanm | 92:4fc01daae5a5 | 112 | * @{ |
bogdanm | 92:4fc01daae5a5 | 113 | */ |
bogdanm | 92:4fc01daae5a5 | 114 | |
bogdanm | 92:4fc01daae5a5 | 115 | |
bogdanm | 92:4fc01daae5a5 | 116 | |
bogdanm | 92:4fc01daae5a5 | 117 | /** @defgroup FLASH_Type_Program FLASH Type Program |
bogdanm | 92:4fc01daae5a5 | 118 | * @{ |
bogdanm | 92:4fc01daae5a5 | 119 | */ |
bogdanm | 92:4fc01daae5a5 | 120 | #define TYPEPROGRAM_BYTE ((uint32_t)0x00) /*!< Program byte (8-bit) at a specified address */ |
bogdanm | 92:4fc01daae5a5 | 121 | #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!< Program a half-word (16-bit) at a specified address */ |
bogdanm | 92:4fc01daae5a5 | 122 | #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!< Program a word (32-bit) at a specified address */ |
bogdanm | 92:4fc01daae5a5 | 123 | #define TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!< Program a double word (64-bit) at a specified address */ |
bogdanm | 92:4fc01daae5a5 | 124 | |
bogdanm | 92:4fc01daae5a5 | 125 | #define IS_TYPEPROGRAM(VALUE)(((VALUE) == TYPEPROGRAM_BYTE) || \ |
bogdanm | 92:4fc01daae5a5 | 126 | ((VALUE) == TYPEPROGRAM_HALFWORD) || \ |
bogdanm | 92:4fc01daae5a5 | 127 | ((VALUE) == TYPEPROGRAM_WORD) || \ |
bogdanm | 92:4fc01daae5a5 | 128 | ((VALUE) == TYPEPROGRAM_DOUBLEWORD)) |
bogdanm | 92:4fc01daae5a5 | 129 | |
bogdanm | 92:4fc01daae5a5 | 130 | /** |
bogdanm | 92:4fc01daae5a5 | 131 | * @} |
bogdanm | 92:4fc01daae5a5 | 132 | */ |
bogdanm | 92:4fc01daae5a5 | 133 | |
bogdanm | 92:4fc01daae5a5 | 134 | /** @defgroup FLASH_Flag_definition FLASH Flag definition |
bogdanm | 92:4fc01daae5a5 | 135 | * @brief Flag definition |
bogdanm | 92:4fc01daae5a5 | 136 | * @{ |
bogdanm | 92:4fc01daae5a5 | 137 | */ |
bogdanm | 92:4fc01daae5a5 | 138 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */ |
bogdanm | 92:4fc01daae5a5 | 139 | #define FLASH_FLAG_OPERR FLASH_SR_SOP /*!< FLASH operation Error flag */ |
bogdanm | 92:4fc01daae5a5 | 140 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
bogdanm | 92:4fc01daae5a5 | 141 | #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ |
bogdanm | 92:4fc01daae5a5 | 142 | #define FLASH_FLAG_PGPERR FLASH_SR_PGPERR /*!< FLASH Programming Parallelism error flag */ |
bogdanm | 92:4fc01daae5a5 | 143 | #define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< FLASH Programming Sequence error flag */ |
bogdanm | 92:4fc01daae5a5 | 144 | #define FLASH_FLAG_RDERR ((uint32_t)0x00000100) /*!< Read Protection error flag (PCROP) */ |
bogdanm | 92:4fc01daae5a5 | 145 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
bogdanm | 92:4fc01daae5a5 | 146 | |
bogdanm | 92:4fc01daae5a5 | 147 | /** |
bogdanm | 92:4fc01daae5a5 | 148 | * @} |
bogdanm | 92:4fc01daae5a5 | 149 | */ |
bogdanm | 92:4fc01daae5a5 | 150 | |
bogdanm | 92:4fc01daae5a5 | 151 | /** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition |
bogdanm | 92:4fc01daae5a5 | 152 | * @brief FLASH Interrupt definition |
bogdanm | 92:4fc01daae5a5 | 153 | * @{ |
bogdanm | 92:4fc01daae5a5 | 154 | */ |
bogdanm | 92:4fc01daae5a5 | 155 | #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */ |
bogdanm | 92:4fc01daae5a5 | 156 | #define FLASH_IT_ERR ((uint32_t)0x02000000) /*!< Error Interrupt source */ |
bogdanm | 92:4fc01daae5a5 | 157 | |
bogdanm | 92:4fc01daae5a5 | 158 | /** |
bogdanm | 92:4fc01daae5a5 | 159 | * @} |
bogdanm | 92:4fc01daae5a5 | 160 | */ |
bogdanm | 92:4fc01daae5a5 | 161 | |
bogdanm | 92:4fc01daae5a5 | 162 | /** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism |
bogdanm | 92:4fc01daae5a5 | 163 | * @{ |
bogdanm | 92:4fc01daae5a5 | 164 | */ |
bogdanm | 92:4fc01daae5a5 | 165 | #define FLASH_PSIZE_BYTE ((uint32_t)0x00000000) |
bogdanm | 92:4fc01daae5a5 | 166 | #define FLASH_PSIZE_HALF_WORD ((uint32_t)0x00000100) |
bogdanm | 92:4fc01daae5a5 | 167 | #define FLASH_PSIZE_WORD ((uint32_t)0x00000200) |
bogdanm | 92:4fc01daae5a5 | 168 | #define FLASH_PSIZE_DOUBLE_WORD ((uint32_t)0x00000300) |
bogdanm | 92:4fc01daae5a5 | 169 | #define CR_PSIZE_MASK ((uint32_t)0xFFFFFCFF) |
bogdanm | 92:4fc01daae5a5 | 170 | /** |
bogdanm | 92:4fc01daae5a5 | 171 | * @} |
bogdanm | 92:4fc01daae5a5 | 172 | */ |
bogdanm | 92:4fc01daae5a5 | 173 | |
bogdanm | 92:4fc01daae5a5 | 174 | /** @defgroup FLASH_Keys FLASH Keys |
bogdanm | 92:4fc01daae5a5 | 175 | * @{ |
bogdanm | 92:4fc01daae5a5 | 176 | */ |
bogdanm | 92:4fc01daae5a5 | 177 | #define RDP_KEY ((uint16_t)0x00A5) |
bogdanm | 92:4fc01daae5a5 | 178 | #define FLASH_KEY1 ((uint32_t)0x45670123) |
bogdanm | 92:4fc01daae5a5 | 179 | #define FLASH_KEY2 ((uint32_t)0xCDEF89AB) |
bogdanm | 92:4fc01daae5a5 | 180 | #define FLASH_OPT_KEY1 ((uint32_t)0x08192A3B) |
bogdanm | 92:4fc01daae5a5 | 181 | #define FLASH_OPT_KEY2 ((uint32_t)0x4C5D6E7F) |
bogdanm | 92:4fc01daae5a5 | 182 | /** |
bogdanm | 92:4fc01daae5a5 | 183 | * @} |
bogdanm | 92:4fc01daae5a5 | 184 | */ |
bogdanm | 92:4fc01daae5a5 | 185 | |
bogdanm | 92:4fc01daae5a5 | 186 | /** |
bogdanm | 92:4fc01daae5a5 | 187 | * @brief ACR register byte 0 (Bits[7:0]) base address |
bogdanm | 92:4fc01daae5a5 | 188 | */ |
bogdanm | 92:4fc01daae5a5 | 189 | #define ACR_BYTE0_ADDRESS ((uint32_t)0x40023C00) |
bogdanm | 92:4fc01daae5a5 | 190 | /** |
bogdanm | 92:4fc01daae5a5 | 191 | * @brief OPTCR register byte 0 (Bits[7:0]) base address |
bogdanm | 92:4fc01daae5a5 | 192 | */ |
bogdanm | 92:4fc01daae5a5 | 193 | #define OPTCR_BYTE0_ADDRESS ((uint32_t)0x40023C14) |
bogdanm | 92:4fc01daae5a5 | 194 | /** |
bogdanm | 92:4fc01daae5a5 | 195 | * @brief OPTCR register byte 1 (Bits[15:8]) base address |
bogdanm | 92:4fc01daae5a5 | 196 | */ |
bogdanm | 92:4fc01daae5a5 | 197 | #define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15) |
bogdanm | 92:4fc01daae5a5 | 198 | /** |
bogdanm | 92:4fc01daae5a5 | 199 | * @brief OPTCR register byte 2 (Bits[23:16]) base address |
bogdanm | 92:4fc01daae5a5 | 200 | */ |
bogdanm | 92:4fc01daae5a5 | 201 | #define OPTCR_BYTE2_ADDRESS ((uint32_t)0x40023C16) |
bogdanm | 92:4fc01daae5a5 | 202 | /** |
bogdanm | 92:4fc01daae5a5 | 203 | * @brief OPTCR register byte 3 (Bits[31:24]) base address |
bogdanm | 92:4fc01daae5a5 | 204 | */ |
bogdanm | 92:4fc01daae5a5 | 205 | #define OPTCR_BYTE3_ADDRESS ((uint32_t)0x40023C17) |
bogdanm | 92:4fc01daae5a5 | 206 | |
bogdanm | 92:4fc01daae5a5 | 207 | /** |
bogdanm | 92:4fc01daae5a5 | 208 | * @} |
bogdanm | 92:4fc01daae5a5 | 209 | */ |
bogdanm | 92:4fc01daae5a5 | 210 | |
bogdanm | 92:4fc01daae5a5 | 211 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 212 | |
bogdanm | 92:4fc01daae5a5 | 213 | /** |
bogdanm | 92:4fc01daae5a5 | 214 | * @brief Set the FLASH Latency. |
bogdanm | 92:4fc01daae5a5 | 215 | * @param __LATENCY__: FLASH Latency |
bogdanm | 92:4fc01daae5a5 | 216 | * The value of this parameter depend on device used within the same series |
bogdanm | 92:4fc01daae5a5 | 217 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 218 | */ |
bogdanm | 92:4fc01daae5a5 | 219 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (*(__IO uint8_t *)ACR_BYTE0_ADDRESS = (uint8_t)(__LATENCY__)) |
bogdanm | 92:4fc01daae5a5 | 220 | |
bogdanm | 92:4fc01daae5a5 | 221 | /** |
bogdanm | 92:4fc01daae5a5 | 222 | * @brief Enable the FLASH prefetch buffer. |
bogdanm | 92:4fc01daae5a5 | 223 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 224 | */ |
bogdanm | 92:4fc01daae5a5 | 225 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN) |
bogdanm | 92:4fc01daae5a5 | 226 | |
bogdanm | 92:4fc01daae5a5 | 227 | /** |
bogdanm | 92:4fc01daae5a5 | 228 | * @brief Disable the FLASH prefetch buffer. |
bogdanm | 92:4fc01daae5a5 | 229 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 230 | */ |
bogdanm | 92:4fc01daae5a5 | 231 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN)) |
bogdanm | 92:4fc01daae5a5 | 232 | |
bogdanm | 92:4fc01daae5a5 | 233 | /** |
bogdanm | 92:4fc01daae5a5 | 234 | * @brief Enable the FLASH instruction cache. |
bogdanm | 92:4fc01daae5a5 | 235 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 236 | */ |
bogdanm | 92:4fc01daae5a5 | 237 | #define __HAL_FLASH_INSTRUCTION_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_ICEN) |
bogdanm | 92:4fc01daae5a5 | 238 | |
bogdanm | 92:4fc01daae5a5 | 239 | /** |
bogdanm | 92:4fc01daae5a5 | 240 | * @brief Disable the FLASH instruction cache. |
bogdanm | 92:4fc01daae5a5 | 241 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 242 | */ |
bogdanm | 92:4fc01daae5a5 | 243 | #define __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_ICEN)) |
bogdanm | 92:4fc01daae5a5 | 244 | |
bogdanm | 92:4fc01daae5a5 | 245 | /** |
bogdanm | 92:4fc01daae5a5 | 246 | * @brief Enable the FLASH data cache. |
bogdanm | 92:4fc01daae5a5 | 247 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 248 | */ |
bogdanm | 92:4fc01daae5a5 | 249 | #define __HAL_FLASH_DATA_CACHE_ENABLE() (FLASH->ACR |= FLASH_ACR_DCEN) |
bogdanm | 92:4fc01daae5a5 | 250 | |
bogdanm | 92:4fc01daae5a5 | 251 | /** |
bogdanm | 92:4fc01daae5a5 | 252 | * @brief Disable the FLASH data cache. |
bogdanm | 92:4fc01daae5a5 | 253 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 254 | */ |
bogdanm | 92:4fc01daae5a5 | 255 | #define __HAL_FLASH_DATA_CACHE_DISABLE() (FLASH->ACR &= (~FLASH_ACR_DCEN)) |
bogdanm | 92:4fc01daae5a5 | 256 | |
bogdanm | 92:4fc01daae5a5 | 257 | /** |
bogdanm | 92:4fc01daae5a5 | 258 | * @brief Resets the FLASH instruction Cache. |
bogdanm | 92:4fc01daae5a5 | 259 | * @note This function must be used only when the Instruction Cache is disabled. |
bogdanm | 92:4fc01daae5a5 | 260 | * @retval None |
bogdanm | 92:4fc01daae5a5 | 261 | */ |
bogdanm | 92:4fc01daae5a5 | 262 | #define __HAL_FLASH_INSTRUCTION_CACHE_RESET() (FLASH->ACR |= FLASH_ACR_ICRST) |
bogdanm | 92:4fc01daae5a5 | 263 | |
bogdanm | 92:4fc01daae5a5 | 264 | /** |
bogdanm | 92:4fc01daae5a5 | 265 | * @brief Resets the FLASH data Cache. |
bogdanm | 92:4fc01daae5a5 | 266 | * @note This function must be used only when the data Cache is disabled. |
bogdanm | 92:4fc01daae5a5 | 267 | * @retval None |
bogdanm | 92:4fc01daae5a5 | 268 | */ |
bogdanm | 92:4fc01daae5a5 | 269 | #define __HAL_FLASH_DATA_CACHE_RESET() (FLASH->ACR |= FLASH_ACR_DCRST) |
bogdanm | 92:4fc01daae5a5 | 270 | |
bogdanm | 92:4fc01daae5a5 | 271 | /** |
bogdanm | 92:4fc01daae5a5 | 272 | * @brief Enable the specified FLASH interrupt. |
bogdanm | 92:4fc01daae5a5 | 273 | * @param __INTERRUPT__ : FLASH interrupt |
bogdanm | 92:4fc01daae5a5 | 274 | * This parameter can be any combination of the following values: |
bogdanm | 92:4fc01daae5a5 | 275 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
bogdanm | 92:4fc01daae5a5 | 276 | * @arg FLASH_IT_ERR: Error Interrupt |
bogdanm | 92:4fc01daae5a5 | 277 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 278 | */ |
bogdanm | 92:4fc01daae5a5 | 279 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
bogdanm | 92:4fc01daae5a5 | 280 | |
bogdanm | 92:4fc01daae5a5 | 281 | /** |
bogdanm | 92:4fc01daae5a5 | 282 | * @brief Disable the specified FLASH interrupt. |
bogdanm | 92:4fc01daae5a5 | 283 | * @param __INTERRUPT__ : FLASH interrupt |
bogdanm | 92:4fc01daae5a5 | 284 | * This parameter can be any combination of the following values: |
bogdanm | 92:4fc01daae5a5 | 285 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
bogdanm | 92:4fc01daae5a5 | 286 | * @arg FLASH_IT_ERR: Error Interrupt |
bogdanm | 92:4fc01daae5a5 | 287 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 288 | */ |
bogdanm | 92:4fc01daae5a5 | 289 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__)) |
bogdanm | 92:4fc01daae5a5 | 290 | |
bogdanm | 92:4fc01daae5a5 | 291 | /** |
bogdanm | 92:4fc01daae5a5 | 292 | * @brief Get the specified FLASH flag status. |
bogdanm | 92:4fc01daae5a5 | 293 | * @param __FLAG__: specifies the FLASH flag to check. |
bogdanm | 92:4fc01daae5a5 | 294 | * This parameter can be one of the following values: |
bogdanm | 92:4fc01daae5a5 | 295 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
bogdanm | 92:4fc01daae5a5 | 296 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
bogdanm | 92:4fc01daae5a5 | 297 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 92:4fc01daae5a5 | 298 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
bogdanm | 92:4fc01daae5a5 | 299 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
bogdanm | 92:4fc01daae5a5 | 300 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
bogdanm | 92:4fc01daae5a5 | 301 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
bogdanm | 92:4fc01daae5a5 | 302 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
bogdanm | 92:4fc01daae5a5 | 303 | * @retval The new state of __FLAG__ (SET or RESET). |
bogdanm | 92:4fc01daae5a5 | 304 | */ |
bogdanm | 92:4fc01daae5a5 | 305 | #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))) |
bogdanm | 92:4fc01daae5a5 | 306 | |
bogdanm | 92:4fc01daae5a5 | 307 | /** |
bogdanm | 92:4fc01daae5a5 | 308 | * @brief Clear the specified FLASH flag. |
bogdanm | 92:4fc01daae5a5 | 309 | * @param __FLAG__: specifies the FLASH flags to clear. |
bogdanm | 92:4fc01daae5a5 | 310 | * This parameter can be any combination of the following values: |
bogdanm | 92:4fc01daae5a5 | 311 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
bogdanm | 92:4fc01daae5a5 | 312 | * @arg FLASH_FLAG_OPERR : FLASH operation Error flag |
bogdanm | 92:4fc01daae5a5 | 313 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 92:4fc01daae5a5 | 314 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
bogdanm | 92:4fc01daae5a5 | 315 | * @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag |
bogdanm | 92:4fc01daae5a5 | 316 | * @arg FLASH_FLAG_PGSERR: FLASH Programming Sequence error flag |
bogdanm | 92:4fc01daae5a5 | 317 | * @arg FLASH_FLAG_RDERR : FLASH Read Protection error flag (PCROP) |
bogdanm | 92:4fc01daae5a5 | 318 | * @retval none |
bogdanm | 92:4fc01daae5a5 | 319 | */ |
bogdanm | 92:4fc01daae5a5 | 320 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) |
bogdanm | 92:4fc01daae5a5 | 321 | |
bogdanm | 92:4fc01daae5a5 | 322 | /* Include FLASH HAL Extension module */ |
bogdanm | 92:4fc01daae5a5 | 323 | #include "stm32f4xx_hal_flash_ex.h" |
bogdanm | 92:4fc01daae5a5 | 324 | #include "stm32f4xx_hal_flash_ramfunc.h" |
bogdanm | 92:4fc01daae5a5 | 325 | |
bogdanm | 92:4fc01daae5a5 | 326 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 327 | /* Program operation functions ***********************************************/ |
bogdanm | 92:4fc01daae5a5 | 328 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 92:4fc01daae5a5 | 329 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 92:4fc01daae5a5 | 330 | /* FLASH IRQ handler method */ |
bogdanm | 92:4fc01daae5a5 | 331 | void HAL_FLASH_IRQHandler(void); |
bogdanm | 92:4fc01daae5a5 | 332 | /* Callbacks in non blocking modes */ |
bogdanm | 92:4fc01daae5a5 | 333 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
bogdanm | 92:4fc01daae5a5 | 334 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
bogdanm | 92:4fc01daae5a5 | 335 | |
bogdanm | 92:4fc01daae5a5 | 336 | /* Peripheral Control functions **********************************************/ |
bogdanm | 92:4fc01daae5a5 | 337 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
bogdanm | 92:4fc01daae5a5 | 338 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
bogdanm | 92:4fc01daae5a5 | 339 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
bogdanm | 92:4fc01daae5a5 | 340 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
bogdanm | 92:4fc01daae5a5 | 341 | /* Option bytes control */ |
bogdanm | 92:4fc01daae5a5 | 342 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
bogdanm | 92:4fc01daae5a5 | 343 | |
bogdanm | 92:4fc01daae5a5 | 344 | /* Peripheral State functions ************************************************/ |
bogdanm | 92:4fc01daae5a5 | 345 | FLASH_ErrorTypeDef HAL_FLASH_GetError(void); |
bogdanm | 92:4fc01daae5a5 | 346 | |
bogdanm | 92:4fc01daae5a5 | 347 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
bogdanm | 92:4fc01daae5a5 | 348 | |
bogdanm | 92:4fc01daae5a5 | 349 | /** |
bogdanm | 92:4fc01daae5a5 | 350 | * @} |
bogdanm | 92:4fc01daae5a5 | 351 | */ |
bogdanm | 92:4fc01daae5a5 | 352 | |
bogdanm | 92:4fc01daae5a5 | 353 | /** |
bogdanm | 92:4fc01daae5a5 | 354 | * @} |
bogdanm | 92:4fc01daae5a5 | 355 | */ |
bogdanm | 92:4fc01daae5a5 | 356 | |
bogdanm | 92:4fc01daae5a5 | 357 | #ifdef __cplusplus |
bogdanm | 92:4fc01daae5a5 | 358 | } |
bogdanm | 92:4fc01daae5a5 | 359 | #endif |
bogdanm | 92:4fc01daae5a5 | 360 | |
bogdanm | 92:4fc01daae5a5 | 361 | #endif /* __STM32F4xx_HAL_FLASH_H */ |
bogdanm | 92:4fc01daae5a5 | 362 | |
bogdanm | 92:4fc01daae5a5 | 363 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |