Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_NUCLEO_L152RE/stm32l1xx_hal_flash.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
- Parent:
- 90:cb3d968589d8
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Kojto | 90:cb3d968589d8 | 1 | /** |
| Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
| Kojto | 90:cb3d968589d8 | 3 | * @file stm32l1xx_hal_flash.h |
| Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
| Kojto | 122:f9eeca106725 | 5 | * @version V1.1.3 |
| Kojto | 122:f9eeca106725 | 6 | * @date 04-March-2016 |
| Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of Flash HAL module. |
| Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
| Kojto | 90:cb3d968589d8 | 9 | * @attention |
| Kojto | 122:f9eeca106725 | 10 | * |
| Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| Kojto | 90:cb3d968589d8 | 12 | * |
| Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
| Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
| Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
| Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
| Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
| Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
| Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
| Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
| Kojto | 90:cb3d968589d8 | 23 | * |
| Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Kojto | 90:cb3d968589d8 | 34 | * |
| Kojto | 122:f9eeca106725 | 35 | ****************************************************************************** |
| Kojto | 122:f9eeca106725 | 36 | */ |
| Kojto | 90:cb3d968589d8 | 37 | |
| Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32L1xx_HAL_FLASH_H |
| Kojto | 90:cb3d968589d8 | 40 | #define __STM32L1xx_HAL_FLASH_H |
| Kojto | 90:cb3d968589d8 | 41 | |
| Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
| Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
| Kojto | 90:cb3d968589d8 | 44 | #endif |
| Kojto | 90:cb3d968589d8 | 45 | |
| Kojto | 90:cb3d968589d8 | 46 | /* Includes ------------------------------------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 47 | #include "stm32l1xx_hal_def.h" |
| Kojto | 122:f9eeca106725 | 48 | |
| Kojto | 90:cb3d968589d8 | 49 | /** @addtogroup STM32L1xx_HAL_Driver |
| Kojto | 90:cb3d968589d8 | 50 | * @{ |
| Kojto | 90:cb3d968589d8 | 51 | */ |
| Kojto | 90:cb3d968589d8 | 52 | |
| Kojto | 90:cb3d968589d8 | 53 | /** @addtogroup FLASH |
| Kojto | 90:cb3d968589d8 | 54 | * @{ |
| Kojto | 122:f9eeca106725 | 55 | */ |
| Kojto | 122:f9eeca106725 | 56 | |
| Kojto | 122:f9eeca106725 | 57 | /** @addtogroup FLASH_Private_Constants |
| Kojto | 122:f9eeca106725 | 58 | * @{ |
| Kojto | 122:f9eeca106725 | 59 | */ |
| Kojto | 122:f9eeca106725 | 60 | #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */ |
| Kojto | 122:f9eeca106725 | 61 | /** |
| Kojto | 122:f9eeca106725 | 62 | * @} |
| Kojto | 122:f9eeca106725 | 63 | */ |
| Kojto | 122:f9eeca106725 | 64 | |
| Kojto | 122:f9eeca106725 | 65 | /** @addtogroup FLASH_Private_Macros |
| Kojto | 122:f9eeca106725 | 66 | * @{ |
| Kojto | 122:f9eeca106725 | 67 | */ |
| Kojto | 122:f9eeca106725 | 68 | |
| Kojto | 122:f9eeca106725 | 69 | #define IS_FLASH_TYPEPROGRAM(_VALUE_) (((_VALUE_) == FLASH_TYPEPROGRAM_WORD)) |
| Kojto | 122:f9eeca106725 | 70 | |
| Kojto | 122:f9eeca106725 | 71 | #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \ |
| Kojto | 122:f9eeca106725 | 72 | ((__LATENCY__) == FLASH_LATENCY_1)) |
| Kojto | 122:f9eeca106725 | 73 | |
| Kojto | 122:f9eeca106725 | 74 | /** |
| Kojto | 122:f9eeca106725 | 75 | * @} |
| Kojto | 122:f9eeca106725 | 76 | */ |
| Kojto | 90:cb3d968589d8 | 77 | |
| Kojto | 90:cb3d968589d8 | 78 | /* Exported types ------------------------------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 79 | /** @defgroup FLASH_Exported_Types FLASH Exported Types |
| Kojto | 90:cb3d968589d8 | 80 | * @{ |
| Kojto | 90:cb3d968589d8 | 81 | */ |
| Kojto | 90:cb3d968589d8 | 82 | |
| Kojto | 90:cb3d968589d8 | 83 | |
| Kojto | 90:cb3d968589d8 | 84 | /** |
| Kojto | 90:cb3d968589d8 | 85 | * @brief FLASH Procedure structure definition |
| Kojto | 90:cb3d968589d8 | 86 | */ |
| Kojto | 90:cb3d968589d8 | 87 | typedef enum |
| Kojto | 90:cb3d968589d8 | 88 | { |
| Kojto | 122:f9eeca106725 | 89 | FLASH_PROC_NONE = 0, |
| Kojto | 122:f9eeca106725 | 90 | FLASH_PROC_PAGEERASE = 1, |
| Kojto | 122:f9eeca106725 | 91 | FLASH_PROC_PROGRAM = 2, |
| Kojto | 90:cb3d968589d8 | 92 | } FLASH_ProcedureTypeDef; |
| Kojto | 90:cb3d968589d8 | 93 | |
| Kojto | 90:cb3d968589d8 | 94 | /** |
| Kojto | 90:cb3d968589d8 | 95 | * @brief FLASH handle Structure definition |
| Kojto | 90:cb3d968589d8 | 96 | */ |
| Kojto | 90:cb3d968589d8 | 97 | typedef struct |
| Kojto | 90:cb3d968589d8 | 98 | { |
| Kojto | 122:f9eeca106725 | 99 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */ |
| Kojto | 90:cb3d968589d8 | 100 | |
| Kojto | 122:f9eeca106725 | 101 | __IO uint32_t NbPagesToErase; /*!< Internal variable to save the remaining sectors to erase in IT context*/ |
| Kojto | 122:f9eeca106725 | 102 | |
| Kojto | 122:f9eeca106725 | 103 | __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */ |
| Kojto | 122:f9eeca106725 | 104 | |
| Kojto | 122:f9eeca106725 | 105 | __IO uint32_t Page; /*!< Internal variable to define the current page which is erasing */ |
| Kojto | 90:cb3d968589d8 | 106 | |
| Kojto | 122:f9eeca106725 | 107 | HAL_LockTypeDef Lock; /*!< FLASH locking object */ |
| Kojto | 90:cb3d968589d8 | 108 | |
| Kojto | 122:f9eeca106725 | 109 | __IO uint32_t ErrorCode; /*!< FLASH error code |
| Kojto | 122:f9eeca106725 | 110 | This parameter can be a value of @ref FLASH_Error_Codes */ |
| Kojto | 122:f9eeca106725 | 111 | } FLASH_ProcessTypeDef; |
| Kojto | 90:cb3d968589d8 | 112 | |
| Kojto | 90:cb3d968589d8 | 113 | /** |
| Kojto | 90:cb3d968589d8 | 114 | * @} |
| Kojto | 90:cb3d968589d8 | 115 | */ |
| Kojto | 90:cb3d968589d8 | 116 | |
| Kojto | 90:cb3d968589d8 | 117 | /* Exported constants --------------------------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 118 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
| Kojto | 90:cb3d968589d8 | 119 | * @{ |
| Kojto | 90:cb3d968589d8 | 120 | */ |
| Kojto | 90:cb3d968589d8 | 121 | |
| Kojto | 122:f9eeca106725 | 122 | /** @defgroup FLASH_Error_Codes FLASH Error Codes |
| Kojto | 122:f9eeca106725 | 123 | * @{ |
| Kojto | 122:f9eeca106725 | 124 | */ |
| Kojto | 90:cb3d968589d8 | 125 | |
| Kojto | 122:f9eeca106725 | 126 | #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00) /*!< No error */ |
| Kojto | 122:f9eeca106725 | 127 | #define HAL_FLASH_ERROR_PGA ((uint32_t)0x01) /*!< Programming alignment error */ |
| Kojto | 122:f9eeca106725 | 128 | #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02) /*!< Write protection error */ |
| Kojto | 122:f9eeca106725 | 129 | #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x04) /*!< Option validity error */ |
| Kojto | 122:f9eeca106725 | 130 | #define HAL_FLASH_ERROR_SIZE ((uint32_t)0x08) /*!< */ |
| Kojto | 122:f9eeca106725 | 131 | #define HAL_FLASH_ERROR_OPTVUSR ((uint32_t)0x10) /*!< Option UserValidity Error. */ |
| Kojto | 122:f9eeca106725 | 132 | #define HAL_FLASH_ERROR_RD ((uint32_t)0x20) /*!< Read protected error */ |
| Kojto | 122:f9eeca106725 | 133 | #define HAL_FLASH_ERROR_OPERATION ((uint32_t)0x40) /*!< Not used */ |
| Kojto | 90:cb3d968589d8 | 134 | |
| Kojto | 90:cb3d968589d8 | 135 | /** |
| Kojto | 90:cb3d968589d8 | 136 | * @} |
| Kojto | 90:cb3d968589d8 | 137 | */ |
| Kojto | 122:f9eeca106725 | 138 | |
| Kojto | 122:f9eeca106725 | 139 | /** @defgroup FLASH_Page_Size FLASH Page Size |
| Kojto | 122:f9eeca106725 | 140 | * @{ |
| Kojto | 122:f9eeca106725 | 141 | */ |
| Kojto | 122:f9eeca106725 | 142 | |
| Kojto | 122:f9eeca106725 | 143 | #define FLASH_PAGE_SIZE ((uint32_t)256) |
| Kojto | 122:f9eeca106725 | 144 | |
| Kojto | 122:f9eeca106725 | 145 | /** |
| Kojto | 122:f9eeca106725 | 146 | * @} |
| Kojto | 122:f9eeca106725 | 147 | */ |
| Kojto | 122:f9eeca106725 | 148 | |
| Kojto | 122:f9eeca106725 | 149 | /** @defgroup FLASH_Type_Program FLASH Type Program |
| Kojto | 90:cb3d968589d8 | 150 | * @{ |
| Kojto | 90:cb3d968589d8 | 151 | */ |
| Kojto | 122:f9eeca106725 | 152 | #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/ |
| Kojto | 90:cb3d968589d8 | 153 | |
| Kojto | 90:cb3d968589d8 | 154 | /** |
| Kojto | 90:cb3d968589d8 | 155 | * @} |
| Kojto | 122:f9eeca106725 | 156 | */ |
| Kojto | 122:f9eeca106725 | 157 | |
| Kojto | 122:f9eeca106725 | 158 | /** @defgroup FLASH_Latency FLASH Latency |
| Kojto | 122:f9eeca106725 | 159 | * @{ |
| Kojto | 90:cb3d968589d8 | 160 | */ |
| Kojto | 122:f9eeca106725 | 161 | #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */ |
| Kojto | 122:f9eeca106725 | 162 | #define FLASH_LATENCY_1 FLASH_ACR_LATENCY /*!< FLASH One Latency cycle */ |
| Kojto | 122:f9eeca106725 | 163 | |
| Kojto | 122:f9eeca106725 | 164 | /** |
| Kojto | 122:f9eeca106725 | 165 | * @} |
| Kojto | 122:f9eeca106725 | 166 | */ |
| Kojto | 90:cb3d968589d8 | 167 | |
| Kojto | 90:cb3d968589d8 | 168 | /** @defgroup FLASH_Interrupts FLASH Interrupts |
| Kojto | 90:cb3d968589d8 | 169 | * @{ |
| Kojto | 90:cb3d968589d8 | 170 | */ |
| Kojto | 90:cb3d968589d8 | 171 | |
| Kojto | 90:cb3d968589d8 | 172 | #define FLASH_IT_EOP FLASH_PECR_EOPIE /*!< End of programming interrupt source */ |
| Kojto | 90:cb3d968589d8 | 173 | #define FLASH_IT_ERR FLASH_PECR_ERRIE /*!< Error interrupt source */ |
| Kojto | 90:cb3d968589d8 | 174 | /** |
| Kojto | 90:cb3d968589d8 | 175 | * @} |
| Kojto | 90:cb3d968589d8 | 176 | */ |
| Kojto | 90:cb3d968589d8 | 177 | |
| Kojto | 90:cb3d968589d8 | 178 | /** @defgroup FLASH_Flags FLASH Flags |
| Kojto | 90:cb3d968589d8 | 179 | * @{ |
| Kojto | 90:cb3d968589d8 | 180 | */ |
| Kojto | 90:cb3d968589d8 | 181 | |
| Kojto | 90:cb3d968589d8 | 182 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
| Kojto | 90:cb3d968589d8 | 183 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Programming flag */ |
| Kojto | 90:cb3d968589d8 | 184 | #define FLASH_FLAG_ENDHV FLASH_SR_ENDHV /*!< FLASH End of High Voltage flag */ |
| Kojto | 90:cb3d968589d8 | 185 | #define FLASH_FLAG_READY FLASH_SR_READY /*!< FLASH Ready flag after low power mode */ |
| Kojto | 90:cb3d968589d8 | 186 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
| Kojto | 90:cb3d968589d8 | 187 | #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ |
| Kojto | 90:cb3d968589d8 | 188 | #define FLASH_FLAG_SIZERR FLASH_SR_SIZERR /*!< FLASH Size error flag */ |
| Kojto | 90:cb3d968589d8 | 189 | #define FLASH_FLAG_OPTVERR FLASH_SR_OPTVERR /*!< FLASH Option Validity error flag */ |
| Kojto | 90:cb3d968589d8 | 190 | |
| Kojto | 90:cb3d968589d8 | 191 | /** |
| Kojto | 90:cb3d968589d8 | 192 | * @} |
| Kojto | 90:cb3d968589d8 | 193 | */ |
| Kojto | 90:cb3d968589d8 | 194 | |
| Kojto | 90:cb3d968589d8 | 195 | /** @defgroup FLASH_Keys FLASH Keys |
| Kojto | 90:cb3d968589d8 | 196 | * @{ |
| Kojto | 90:cb3d968589d8 | 197 | */ |
| Kojto | 90:cb3d968589d8 | 198 | |
| Kojto | 90:cb3d968589d8 | 199 | #define FLASH_PDKEY1 ((uint32_t)0x04152637) /*!< Flash power down key1 */ |
| Kojto | 90:cb3d968589d8 | 200 | #define FLASH_PDKEY2 ((uint32_t)0xFAFBFCFD) /*!< Flash power down key2: used with FLASH_PDKEY1 |
| Kojto | 90:cb3d968589d8 | 201 | to unlock the RUN_PD bit in FLASH_ACR */ |
| Kojto | 90:cb3d968589d8 | 202 | |
| Kojto | 90:cb3d968589d8 | 203 | #define FLASH_PEKEY1 ((uint32_t)0x89ABCDEF) /*!< Flash program erase key1 */ |
| Kojto | 90:cb3d968589d8 | 204 | #define FLASH_PEKEY2 ((uint32_t)0x02030405) /*!< Flash program erase key: used with FLASH_PEKEY2 |
| Kojto | 90:cb3d968589d8 | 205 | to unlock the write access to the FLASH_PECR register and |
| Kojto | 90:cb3d968589d8 | 206 | data EEPROM */ |
| Kojto | 90:cb3d968589d8 | 207 | |
| Kojto | 90:cb3d968589d8 | 208 | #define FLASH_PRGKEY1 ((uint32_t)0x8C9DAEBF) /*!< Flash program memory key1 */ |
| Kojto | 90:cb3d968589d8 | 209 | #define FLASH_PRGKEY2 ((uint32_t)0x13141516) /*!< Flash program memory key2: used with FLASH_PRGKEY2 |
| Kojto | 90:cb3d968589d8 | 210 | to unlock the program memory */ |
| Kojto | 90:cb3d968589d8 | 211 | |
| Kojto | 90:cb3d968589d8 | 212 | #define FLASH_OPTKEY1 ((uint32_t)0xFBEAD9C8) /*!< Flash option key1 */ |
| Kojto | 90:cb3d968589d8 | 213 | #define FLASH_OPTKEY2 ((uint32_t)0x24252627) /*!< Flash option key2: used with FLASH_OPTKEY1 to |
| Kojto | 90:cb3d968589d8 | 214 | unlock the write access to the option byte block */ |
| Kojto | 90:cb3d968589d8 | 215 | /** |
| Kojto | 90:cb3d968589d8 | 216 | * @} |
| Kojto | 90:cb3d968589d8 | 217 | */ |
| Kojto | 90:cb3d968589d8 | 218 | /** |
| Kojto | 90:cb3d968589d8 | 219 | * @} |
| Kojto | 122:f9eeca106725 | 220 | */ |
| Kojto | 122:f9eeca106725 | 221 | |
| Kojto | 90:cb3d968589d8 | 222 | /* Exported macro ------------------------------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 223 | |
| Kojto | 90:cb3d968589d8 | 224 | /** @defgroup FLASH_Exported_Macros FLASH Exported Macros |
| Kojto | 122:f9eeca106725 | 225 | * @brief macros to control FLASH features |
| Kojto | 122:f9eeca106725 | 226 | * @{ |
| Kojto | 122:f9eeca106725 | 227 | */ |
| Kojto | 122:f9eeca106725 | 228 | |
| Kojto | 90:cb3d968589d8 | 229 | |
| Kojto | 90:cb3d968589d8 | 230 | /** @defgroup FLASH_Interrupt FLASH Interrupts |
| Kojto | 90:cb3d968589d8 | 231 | * @brief macros to handle FLASH interrupts |
| Kojto | 90:cb3d968589d8 | 232 | * @{ |
| Kojto | 90:cb3d968589d8 | 233 | */ |
| Kojto | 90:cb3d968589d8 | 234 | |
| Kojto | 90:cb3d968589d8 | 235 | /** |
| Kojto | 90:cb3d968589d8 | 236 | * @brief Enable the specified FLASH interrupt. |
| Kojto | 122:f9eeca106725 | 237 | * @param __INTERRUPT__ FLASH interrupt |
| Kojto | 90:cb3d968589d8 | 238 | * This parameter can be any combination of the following values: |
| Kojto | 122:f9eeca106725 | 239 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
| Kojto | 122:f9eeca106725 | 240 | * @arg @ref FLASH_IT_ERR Error Interrupt |
| Kojto | 90:cb3d968589d8 | 241 | * @retval none |
| Kojto | 90:cb3d968589d8 | 242 | */ |
| Kojto | 122:f9eeca106725 | 243 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) SET_BIT((FLASH->PECR), (__INTERRUPT__)) |
| Kojto | 90:cb3d968589d8 | 244 | |
| Kojto | 90:cb3d968589d8 | 245 | /** |
| Kojto | 90:cb3d968589d8 | 246 | * @brief Disable the specified FLASH interrupt. |
| Kojto | 122:f9eeca106725 | 247 | * @param __INTERRUPT__ FLASH interrupt |
| Kojto | 90:cb3d968589d8 | 248 | * This parameter can be any combination of the following values: |
| Kojto | 122:f9eeca106725 | 249 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
| Kojto | 122:f9eeca106725 | 250 | * @arg @ref FLASH_IT_ERR Error Interrupt |
| Kojto | 90:cb3d968589d8 | 251 | * @retval none |
| Kojto | 90:cb3d968589d8 | 252 | */ |
| Kojto | 122:f9eeca106725 | 253 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT((FLASH->PECR), (uint32_t)(__INTERRUPT__)) |
| Kojto | 90:cb3d968589d8 | 254 | |
| Kojto | 90:cb3d968589d8 | 255 | /** |
| Kojto | 90:cb3d968589d8 | 256 | * @brief Get the specified FLASH flag status. |
| Kojto | 122:f9eeca106725 | 257 | * @param __FLAG__ specifies the FLASH flag to check. |
| Kojto | 90:cb3d968589d8 | 258 | * This parameter can be one of the following values: |
| Kojto | 122:f9eeca106725 | 259 | * @arg @ref FLASH_FLAG_BSY FLASH Busy flag |
| Kojto | 122:f9eeca106725 | 260 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
| Kojto | 122:f9eeca106725 | 261 | * @arg @ref FLASH_FLAG_ENDHV FLASH End of High Voltage flag |
| Kojto | 122:f9eeca106725 | 262 | * @arg @ref FLASH_FLAG_READY FLASH Ready flag after low power mode |
| Kojto | 122:f9eeca106725 | 263 | * @arg @ref FLASH_FLAG_PGAERR FLASH Programming Alignment error flag |
| Kojto | 122:f9eeca106725 | 264 | * @arg @ref FLASH_FLAG_SIZERR FLASH Size error flag |
| Kojto | 122:f9eeca106725 | 265 | * @arg @ref FLASH_FLAG_OPTVERR FLASH Option validity error error flag |
| Kojto | 122:f9eeca106725 | 266 | * @arg @ref FLASH_FLAG_OPTVERRUSR FLASH Option UserValidity (available only Cat.3, Cat.4 and Cat.5 devices) |
| Kojto | 122:f9eeca106725 | 267 | * @arg @ref FLASH_FLAG_RDERR FLASH Read Protection error flag (PCROP) (available only Cat.2 and Cat.3 devices) |
| Kojto | 122:f9eeca106725 | 268 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
| Kojto | 90:cb3d968589d8 | 269 | * @retval The new state of __FLAG__ (SET or RESET). |
| Kojto | 90:cb3d968589d8 | 270 | */ |
| Kojto | 90:cb3d968589d8 | 271 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((FLASH->SR) & (__FLAG__)) == (__FLAG__)) |
| Kojto | 90:cb3d968589d8 | 272 | |
| Kojto | 90:cb3d968589d8 | 273 | /** |
| Kojto | 90:cb3d968589d8 | 274 | * @brief Clear the specified FLASH flag. |
| Kojto | 122:f9eeca106725 | 275 | * @param __FLAG__ specifies the FLASH flags to clear. |
| Kojto | 90:cb3d968589d8 | 276 | * This parameter can be any combination of the following values: |
| Kojto | 122:f9eeca106725 | 277 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
| Kojto | 122:f9eeca106725 | 278 | * @arg @ref FLASH_FLAG_ENDHV FLASH End of High Voltage flag |
| Kojto | 122:f9eeca106725 | 279 | * @arg @ref FLASH_FLAG_READY FLASH Ready flag after low power mode |
| Kojto | 122:f9eeca106725 | 280 | * @arg @ref FLASH_FLAG_PGAERR FLASH Programming Alignment error flag |
| Kojto | 122:f9eeca106725 | 281 | * @arg @ref FLASH_FLAG_SIZERR FLASH Size error flag |
| Kojto | 122:f9eeca106725 | 282 | * @arg @ref FLASH_FLAG_OPTVERR FLASH Option validity error error flag |
| Kojto | 122:f9eeca106725 | 283 | * @arg @ref FLASH_FLAG_OPTVERRUSR FLASH Option UserValidity (available only Cat.3, Cat.4 and Cat.5 devices) |
| Kojto | 122:f9eeca106725 | 284 | * @arg @ref FLASH_FLAG_RDERR FLASH Read Protection error flag (PCROP) (available only Cat.2 and Cat.3 devices) |
| Kojto | 122:f9eeca106725 | 285 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
| Kojto | 90:cb3d968589d8 | 286 | * @retval none |
| Kojto | 90:cb3d968589d8 | 287 | */ |
| Kojto | 90:cb3d968589d8 | 288 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) ((FLASH->SR) = (__FLAG__)) |
| Kojto | 90:cb3d968589d8 | 289 | |
| Kojto | 90:cb3d968589d8 | 290 | /** |
| Kojto | 90:cb3d968589d8 | 291 | * @} |
| Kojto | 90:cb3d968589d8 | 292 | */ |
| Kojto | 90:cb3d968589d8 | 293 | |
| Kojto | 90:cb3d968589d8 | 294 | /** |
| Kojto | 90:cb3d968589d8 | 295 | * @} |
| Kojto | 90:cb3d968589d8 | 296 | */ |
| Kojto | 90:cb3d968589d8 | 297 | |
| Kojto | 122:f9eeca106725 | 298 | /* Include FLASH HAL Extended module */ |
| Kojto | 122:f9eeca106725 | 299 | #include "stm32l1xx_hal_flash_ex.h" |
| Kojto | 122:f9eeca106725 | 300 | #include "stm32l1xx_hal_flash_ramfunc.h" |
| Kojto | 90:cb3d968589d8 | 301 | |
| Kojto | 122:f9eeca106725 | 302 | /* Exported functions --------------------------------------------------------*/ |
| Kojto | 90:cb3d968589d8 | 303 | /** @addtogroup FLASH_Exported_Functions |
| Kojto | 90:cb3d968589d8 | 304 | * @{ |
| Kojto | 90:cb3d968589d8 | 305 | */ |
| Kojto | 122:f9eeca106725 | 306 | |
| Kojto | 90:cb3d968589d8 | 307 | /** @addtogroup FLASH_Exported_Functions_Group1 |
| Kojto | 90:cb3d968589d8 | 308 | * @{ |
| Kojto | 90:cb3d968589d8 | 309 | */ |
| Kojto | 122:f9eeca106725 | 310 | /* IO operation functions *****************************************************/ |
| Kojto | 122:f9eeca106725 | 311 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
| Kojto | 122:f9eeca106725 | 312 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
| Kojto | 90:cb3d968589d8 | 313 | |
| Kojto | 90:cb3d968589d8 | 314 | /* FLASH IRQ handler function */ |
| Kojto | 122:f9eeca106725 | 315 | void HAL_FLASH_IRQHandler(void); |
| Kojto | 122:f9eeca106725 | 316 | /* Callbacks in non blocking modes */ |
| Kojto | 122:f9eeca106725 | 317 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
| Kojto | 122:f9eeca106725 | 318 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
| Kojto | 90:cb3d968589d8 | 319 | |
| Kojto | 90:cb3d968589d8 | 320 | /** |
| Kojto | 90:cb3d968589d8 | 321 | * @} |
| Kojto | 122:f9eeca106725 | 322 | */ |
| Kojto | 90:cb3d968589d8 | 323 | |
| Kojto | 90:cb3d968589d8 | 324 | /** @addtogroup FLASH_Exported_Functions_Group2 |
| Kojto | 90:cb3d968589d8 | 325 | * @{ |
| Kojto | 90:cb3d968589d8 | 326 | */ |
| Kojto | 122:f9eeca106725 | 327 | /* Peripheral Control functions ***********************************************/ |
| Kojto | 122:f9eeca106725 | 328 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
| Kojto | 122:f9eeca106725 | 329 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
| Kojto | 122:f9eeca106725 | 330 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
| Kojto | 122:f9eeca106725 | 331 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
| Kojto | 122:f9eeca106725 | 332 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
| Kojto | 90:cb3d968589d8 | 333 | |
| Kojto | 90:cb3d968589d8 | 334 | /** |
| Kojto | 90:cb3d968589d8 | 335 | * @} |
| Kojto | 122:f9eeca106725 | 336 | */ |
| Kojto | 90:cb3d968589d8 | 337 | |
| Kojto | 90:cb3d968589d8 | 338 | /** @addtogroup FLASH_Exported_Functions_Group3 |
| Kojto | 90:cb3d968589d8 | 339 | * @{ |
| Kojto | 90:cb3d968589d8 | 340 | */ |
| Kojto | 122:f9eeca106725 | 341 | /* Peripheral State and Error functions ***************************************/ |
| Kojto | 122:f9eeca106725 | 342 | uint32_t HAL_FLASH_GetError(void); |
| Kojto | 90:cb3d968589d8 | 343 | |
| Kojto | 90:cb3d968589d8 | 344 | /** |
| Kojto | 90:cb3d968589d8 | 345 | * @} |
| Kojto | 122:f9eeca106725 | 346 | */ |
| Kojto | 90:cb3d968589d8 | 347 | |
| Kojto | 90:cb3d968589d8 | 348 | /** |
| Kojto | 90:cb3d968589d8 | 349 | * @} |
| Kojto | 90:cb3d968589d8 | 350 | */ |
| Kojto | 90:cb3d968589d8 | 351 | |
| Kojto | 122:f9eeca106725 | 352 | /* Private function -------------------------------------------------*/ |
| Kojto | 122:f9eeca106725 | 353 | /** @addtogroup FLASH_Private_Functions |
| Kojto | 122:f9eeca106725 | 354 | * @{ |
| Kojto | 122:f9eeca106725 | 355 | */ |
| Kojto | 122:f9eeca106725 | 356 | void FLASH_PageErase(uint32_t PageAddress); |
| Kojto | 122:f9eeca106725 | 357 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
| Kojto | 90:cb3d968589d8 | 358 | |
| Kojto | 90:cb3d968589d8 | 359 | /** |
| Kojto | 90:cb3d968589d8 | 360 | * @} |
| Kojto | 122:f9eeca106725 | 361 | */ |
| Kojto | 90:cb3d968589d8 | 362 | |
| Kojto | 90:cb3d968589d8 | 363 | /** |
| Kojto | 90:cb3d968589d8 | 364 | * @} |
| Kojto | 122:f9eeca106725 | 365 | */ |
| Kojto | 90:cb3d968589d8 | 366 | |
| Kojto | 90:cb3d968589d8 | 367 | /** |
| Kojto | 90:cb3d968589d8 | 368 | * @} |
| Kojto | 90:cb3d968589d8 | 369 | */ |
| Kojto | 90:cb3d968589d8 | 370 | |
| Kojto | 90:cb3d968589d8 | 371 | #ifdef __cplusplus |
| Kojto | 90:cb3d968589d8 | 372 | } |
| Kojto | 90:cb3d968589d8 | 373 | #endif |
| Kojto | 90:cb3d968589d8 | 374 | |
| Kojto | 90:cb3d968589d8 | 375 | #endif /* __STM32L1xx_HAL_FLASH_H */ |
| Kojto | 90:cb3d968589d8 | 376 | |
| Kojto | 122:f9eeca106725 | 377 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| Kojto | 122:f9eeca106725 | 378 |


