The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

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