my fork
Fork of mbed by
TARGET_NUCLEO_L053R8/stm32l0xx_hal_flash.h@84:0b3ab51c8877, 2014-05-19 (annotated)
- Committer:
- bogdanm
- Date:
- Mon May 19 18:14:09 2014 +0100
- Revision:
- 84:0b3ab51c8877
- Child:
- 92:4fc01daae5a5
Release 84 of the mbed library
Main changes:
- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 84:0b3ab51c8877 | 1 | /** |
bogdanm | 84:0b3ab51c8877 | 2 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 3 | * @file stm32l0xx_hal_flash.h |
bogdanm | 84:0b3ab51c8877 | 4 | * @author MCD Application Team |
bogdanm | 84:0b3ab51c8877 | 5 | * @version V1.0.0 |
bogdanm | 84:0b3ab51c8877 | 6 | * @date 22-April-2014 |
bogdanm | 84:0b3ab51c8877 | 7 | * @brief This file contains all the functions prototypes for the FLASH |
bogdanm | 84:0b3ab51c8877 | 8 | * firmware library. |
bogdanm | 84:0b3ab51c8877 | 9 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 10 | * @attention |
bogdanm | 84:0b3ab51c8877 | 11 | * |
bogdanm | 84:0b3ab51c8877 | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 84:0b3ab51c8877 | 13 | * |
bogdanm | 84:0b3ab51c8877 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 84:0b3ab51c8877 | 15 | * are permitted provided that the following conditions are met: |
bogdanm | 84:0b3ab51c8877 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 84:0b3ab51c8877 | 17 | * this list of conditions and the following disclaimer. |
bogdanm | 84:0b3ab51c8877 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 84:0b3ab51c8877 | 19 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 84:0b3ab51c8877 | 20 | * and/or other materials provided with the distribution. |
bogdanm | 84:0b3ab51c8877 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 84:0b3ab51c8877 | 22 | * may be used to endorse or promote products derived from this software |
bogdanm | 84:0b3ab51c8877 | 23 | * without specific prior written permission. |
bogdanm | 84:0b3ab51c8877 | 24 | * |
bogdanm | 84:0b3ab51c8877 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 84:0b3ab51c8877 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 84:0b3ab51c8877 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 84:0b3ab51c8877 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 84:0b3ab51c8877 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 84:0b3ab51c8877 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 84:0b3ab51c8877 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 84:0b3ab51c8877 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 84:0b3ab51c8877 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 84:0b3ab51c8877 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 84:0b3ab51c8877 | 35 | * |
bogdanm | 84:0b3ab51c8877 | 36 | ****************************************************************************** |
bogdanm | 84:0b3ab51c8877 | 37 | */ |
bogdanm | 84:0b3ab51c8877 | 38 | |
bogdanm | 84:0b3ab51c8877 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 40 | #ifndef __STM32L0XX_HAL_FLASH_H |
bogdanm | 84:0b3ab51c8877 | 41 | #define __STM32L0XX_HAL_FLASH_H |
bogdanm | 84:0b3ab51c8877 | 42 | |
bogdanm | 84:0b3ab51c8877 | 43 | #ifdef __cplusplus |
bogdanm | 84:0b3ab51c8877 | 44 | extern "C" { |
bogdanm | 84:0b3ab51c8877 | 45 | #endif |
bogdanm | 84:0b3ab51c8877 | 46 | |
bogdanm | 84:0b3ab51c8877 | 47 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 48 | #include "stm32l0xx_hal_def.h" |
bogdanm | 84:0b3ab51c8877 | 49 | |
bogdanm | 84:0b3ab51c8877 | 50 | /** @addtogroup STM32L0xx_HAL_Driver |
bogdanm | 84:0b3ab51c8877 | 51 | * @{ |
bogdanm | 84:0b3ab51c8877 | 52 | */ |
bogdanm | 84:0b3ab51c8877 | 53 | |
bogdanm | 84:0b3ab51c8877 | 54 | /** @addtogroup FLASH |
bogdanm | 84:0b3ab51c8877 | 55 | * @{ |
bogdanm | 84:0b3ab51c8877 | 56 | */ |
bogdanm | 84:0b3ab51c8877 | 57 | |
bogdanm | 84:0b3ab51c8877 | 58 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 59 | /** |
bogdanm | 84:0b3ab51c8877 | 60 | * @brief FLASH Error structure definition |
bogdanm | 84:0b3ab51c8877 | 61 | */ |
bogdanm | 84:0b3ab51c8877 | 62 | typedef enum |
bogdanm | 84:0b3ab51c8877 | 63 | { |
bogdanm | 84:0b3ab51c8877 | 64 | FLASH_ERROR_RD = 0x01, |
bogdanm | 84:0b3ab51c8877 | 65 | FLASH_ERROR_ENDHV = 0x02, |
bogdanm | 84:0b3ab51c8877 | 66 | FLASH_ERROR_SIZE = 0x04, |
bogdanm | 84:0b3ab51c8877 | 67 | FLASH_ERROR_PGA = 0x08, |
bogdanm | 84:0b3ab51c8877 | 68 | FLASH_ERROR_WRP = 0x10, |
bogdanm | 84:0b3ab51c8877 | 69 | FLASH_ERROR_OPTV = 0x20, |
bogdanm | 84:0b3ab51c8877 | 70 | FLASH_ERROR_NOTZERO = 0x40 |
bogdanm | 84:0b3ab51c8877 | 71 | }FLASH_ErrorTypeDef; |
bogdanm | 84:0b3ab51c8877 | 72 | |
bogdanm | 84:0b3ab51c8877 | 73 | /** |
bogdanm | 84:0b3ab51c8877 | 74 | * @brief FLASH Procedure structure definition |
bogdanm | 84:0b3ab51c8877 | 75 | */ |
bogdanm | 84:0b3ab51c8877 | 76 | typedef enum |
bogdanm | 84:0b3ab51c8877 | 77 | { |
bogdanm | 84:0b3ab51c8877 | 78 | FLASH_PROC_NONE = 0, |
bogdanm | 84:0b3ab51c8877 | 79 | FLASH_PROC_PAGEERASE, |
bogdanm | 84:0b3ab51c8877 | 80 | FLASH_PROC_PROGRAM |
bogdanm | 84:0b3ab51c8877 | 81 | } FLASH_ProcedureTypeDef; |
bogdanm | 84:0b3ab51c8877 | 82 | |
bogdanm | 84:0b3ab51c8877 | 83 | /** |
bogdanm | 84:0b3ab51c8877 | 84 | * @brief FLASH Erase structure definition |
bogdanm | 84:0b3ab51c8877 | 85 | */ |
bogdanm | 84:0b3ab51c8877 | 86 | typedef struct |
bogdanm | 84:0b3ab51c8877 | 87 | { |
bogdanm | 84:0b3ab51c8877 | 88 | uint32_t TypeErase; /*!< TypeErase: Mass erase or sector Erase. |
bogdanm | 84:0b3ab51c8877 | 89 | This parameter can be a value of @ref FLASH_Type_Erase */ |
bogdanm | 84:0b3ab51c8877 | 90 | |
bogdanm | 84:0b3ab51c8877 | 91 | uint32_t Page; /*!< Sector: Initial FLASH sector to erase when Mass erase is disabled |
bogdanm | 84:0b3ab51c8877 | 92 | This parameter must be a value of @ref FLASH_Sectors */ |
bogdanm | 84:0b3ab51c8877 | 93 | |
bogdanm | 84:0b3ab51c8877 | 94 | uint32_t NbPages; /*!< NbSectors: Number of sectors to be erased. |
bogdanm | 84:0b3ab51c8877 | 95 | This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/ |
bogdanm | 84:0b3ab51c8877 | 96 | |
bogdanm | 84:0b3ab51c8877 | 97 | } FLASH_EraseInitTypeDef; |
bogdanm | 84:0b3ab51c8877 | 98 | |
bogdanm | 84:0b3ab51c8877 | 99 | /** |
bogdanm | 84:0b3ab51c8877 | 100 | * @brief FLASH Option Bytes PROGRAM structure definition |
bogdanm | 84:0b3ab51c8877 | 101 | */ |
bogdanm | 84:0b3ab51c8877 | 102 | typedef struct |
bogdanm | 84:0b3ab51c8877 | 103 | { |
bogdanm | 84:0b3ab51c8877 | 104 | uint32_t OptionType; /*!< OptionType: Option byte to be configured. |
bogdanm | 84:0b3ab51c8877 | 105 | This parameter can be a value of @ref FLASH_Option_Type */ |
bogdanm | 84:0b3ab51c8877 | 106 | |
bogdanm | 84:0b3ab51c8877 | 107 | uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation. |
bogdanm | 84:0b3ab51c8877 | 108 | This parameter can be a value of @ref FLASH_WRP_State */ |
bogdanm | 84:0b3ab51c8877 | 109 | |
bogdanm | 84:0b3ab51c8877 | 110 | uint32_t WRPSector; /*!< WRPSector: specifies the sector(s) to be write protected |
bogdanm | 84:0b3ab51c8877 | 111 | The value of this parameter depend on device used within the same series */ |
bogdanm | 84:0b3ab51c8877 | 112 | |
bogdanm | 84:0b3ab51c8877 | 113 | uint32_t RDPLevel; /*!< RDPLevel: Set the read protection level.. |
bogdanm | 84:0b3ab51c8877 | 114 | This parameter can be a value of @ref FLASH_Option_Bytes_Read_Protection */ |
bogdanm | 84:0b3ab51c8877 | 115 | |
bogdanm | 84:0b3ab51c8877 | 116 | uint32_t BORLevel; /*!< BORLevel: Set the BOR Level. |
bogdanm | 84:0b3ab51c8877 | 117 | This parameter can be a value of @ref Option_Bytes_BOR_Level */ |
bogdanm | 84:0b3ab51c8877 | 118 | uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. |
bogdanm | 84:0b3ab51c8877 | 119 | This parameter can be a combination of @ref FLASH_Option_Bytes_IWatchdog, @ref FLASH_Option_Bytes_nRST_STOP and @ref FLASH_Option_Bytes_nRST_STDBY*/ |
bogdanm | 84:0b3ab51c8877 | 120 | } FLASH_OBProgramInitTypeDef; |
bogdanm | 84:0b3ab51c8877 | 121 | |
bogdanm | 84:0b3ab51c8877 | 122 | /** |
bogdanm | 84:0b3ab51c8877 | 123 | * @brief FLASH handle Structure definition |
bogdanm | 84:0b3ab51c8877 | 124 | */ |
bogdanm | 84:0b3ab51c8877 | 125 | typedef struct |
bogdanm | 84:0b3ab51c8877 | 126 | { |
bogdanm | 84:0b3ab51c8877 | 127 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*Internal variable to indicate which procedure is ongoing or not in IT context*/ |
bogdanm | 84:0b3ab51c8877 | 128 | |
bogdanm | 84:0b3ab51c8877 | 129 | __IO uint32_t NbPagesToErase; /*Internal variable to save the remaining sectors to erase in IT context*/ |
bogdanm | 84:0b3ab51c8877 | 130 | |
bogdanm | 84:0b3ab51c8877 | 131 | __IO uint32_t Page; /*Internal variable to define the current sector which is erasing*/ |
bogdanm | 84:0b3ab51c8877 | 132 | |
bogdanm | 84:0b3ab51c8877 | 133 | __IO uint32_t Address; /*Internal variable to save address selected for program*/ |
bogdanm | 84:0b3ab51c8877 | 134 | |
bogdanm | 84:0b3ab51c8877 | 135 | HAL_LockTypeDef Lock; /* FLASH locking object */ |
bogdanm | 84:0b3ab51c8877 | 136 | |
bogdanm | 84:0b3ab51c8877 | 137 | __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */ |
bogdanm | 84:0b3ab51c8877 | 138 | |
bogdanm | 84:0b3ab51c8877 | 139 | }FLASH_ProcessTypeDef; |
bogdanm | 84:0b3ab51c8877 | 140 | |
bogdanm | 84:0b3ab51c8877 | 141 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 142 | |
bogdanm | 84:0b3ab51c8877 | 143 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants |
bogdanm | 84:0b3ab51c8877 | 144 | * @{ |
bogdanm | 84:0b3ab51c8877 | 145 | */ |
bogdanm | 84:0b3ab51c8877 | 146 | |
bogdanm | 84:0b3ab51c8877 | 147 | /** @defgroup FLASH_Type_Erase FLASH Type Erase |
bogdanm | 84:0b3ab51c8877 | 148 | * @{ |
bogdanm | 84:0b3ab51c8877 | 149 | */ |
bogdanm | 84:0b3ab51c8877 | 150 | #define TYPEERASE_PAGEERASE ((uint32_t)0x00) /*!<Page erase only*/ |
bogdanm | 84:0b3ab51c8877 | 151 | #define TYPEERASE_WORD ((uint32_t)0x01) /*!<Data erase word activation*/ |
bogdanm | 84:0b3ab51c8877 | 152 | |
bogdanm | 84:0b3ab51c8877 | 153 | #define IS_TYPEERASE(VALUE)(((VALUE) == TYPEERASE_PAGEERASE) || \ |
bogdanm | 84:0b3ab51c8877 | 154 | ((VALUE) == TYPEERASE_WORD)) |
bogdanm | 84:0b3ab51c8877 | 155 | /** |
bogdanm | 84:0b3ab51c8877 | 156 | * @} |
bogdanm | 84:0b3ab51c8877 | 157 | */ |
bogdanm | 84:0b3ab51c8877 | 158 | |
bogdanm | 84:0b3ab51c8877 | 159 | /** @defgroup FLASH_Type_Program FLASH Type Program |
bogdanm | 84:0b3ab51c8877 | 160 | * @{ |
bogdanm | 84:0b3ab51c8877 | 161 | */ |
bogdanm | 84:0b3ab51c8877 | 162 | #define TYPEPROGRAM_BYTE ((uint32_t)0x00) /*!<Program byte (8-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 163 | #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 164 | #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 165 | #define TYPEPROGRAM_FASTBYTE ((uint32_t)0x04) /*!<Fast Program byte (8-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 166 | #define TYPEPROGRAM_FASTHALFWORD ((uint32_t)0x08) /*!<Fast Program a half-word (16-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 167 | #define TYPEPROGRAM_FASTWORD ((uint32_t)0x10) /*!<Fast Program a word (32-bit) at a specified address.*/ |
bogdanm | 84:0b3ab51c8877 | 168 | |
bogdanm | 84:0b3ab51c8877 | 169 | #define IS_TYPEPROGRAM(VALUE)(((VALUE) == TYPEPROGRAM_BYTE) || \ |
bogdanm | 84:0b3ab51c8877 | 170 | ((VALUE) == TYPEPROGRAM_HALFWORD) || \ |
bogdanm | 84:0b3ab51c8877 | 171 | ((VALUE) == TYPEPROGRAM_WORD) || \ |
bogdanm | 84:0b3ab51c8877 | 172 | ((VALUE) == TYPEPROGRAM_FASTBYTE) || \ |
bogdanm | 84:0b3ab51c8877 | 173 | ((VALUE) == TYPEPROGRAM_FASTHALFWORD) || \ |
bogdanm | 84:0b3ab51c8877 | 174 | ((VALUE) == TYPEPROGRAM_FASTWORD)) |
bogdanm | 84:0b3ab51c8877 | 175 | /** |
bogdanm | 84:0b3ab51c8877 | 176 | * @} |
bogdanm | 84:0b3ab51c8877 | 177 | */ |
bogdanm | 84:0b3ab51c8877 | 178 | |
bogdanm | 84:0b3ab51c8877 | 179 | /** @defgroup FLASH_WRP_State FLASH WRP State |
bogdanm | 84:0b3ab51c8877 | 180 | * @{ |
bogdanm | 84:0b3ab51c8877 | 181 | */ |
bogdanm | 84:0b3ab51c8877 | 182 | #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired bank 1 sectors*/ |
bogdanm | 84:0b3ab51c8877 | 183 | #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired bank 1 sectors*/ |
bogdanm | 84:0b3ab51c8877 | 184 | |
bogdanm | 84:0b3ab51c8877 | 185 | #define IS_WRPSTATE(VALUE)(((VALUE) == WRPSTATE_DISABLE) || \ |
bogdanm | 84:0b3ab51c8877 | 186 | ((VALUE) == WRPSTATE_ENABLE)) |
bogdanm | 84:0b3ab51c8877 | 187 | /** |
bogdanm | 84:0b3ab51c8877 | 188 | * @} |
bogdanm | 84:0b3ab51c8877 | 189 | */ |
bogdanm | 84:0b3ab51c8877 | 190 | |
bogdanm | 84:0b3ab51c8877 | 191 | /** @defgroup FLASH_Option_Type FLASH Option Type |
bogdanm | 84:0b3ab51c8877 | 192 | * @{ |
bogdanm | 84:0b3ab51c8877 | 193 | */ |
bogdanm | 84:0b3ab51c8877 | 194 | #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/ |
bogdanm | 84:0b3ab51c8877 | 195 | #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/ |
bogdanm | 84:0b3ab51c8877 | 196 | #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/ |
bogdanm | 84:0b3ab51c8877 | 197 | #define OPTIONBYTE_BOR ((uint32_t)0x08) /*!<BOR option byte configuration*/ |
bogdanm | 84:0b3ab51c8877 | 198 | |
bogdanm | 84:0b3ab51c8877 | 199 | #define IS_OPTIONBYTE(VALUE)(((VALUE) < (OPTIONBYTE_WRP|OPTIONBYTE_RDP|OPTIONBYTE_USER|OPTIONBYTE_BOR))) |
bogdanm | 84:0b3ab51c8877 | 200 | /** |
bogdanm | 84:0b3ab51c8877 | 201 | * @} |
bogdanm | 84:0b3ab51c8877 | 202 | */ |
bogdanm | 84:0b3ab51c8877 | 203 | |
bogdanm | 84:0b3ab51c8877 | 204 | /** @defgroup FLASH_Interrupts |
bogdanm | 84:0b3ab51c8877 | 205 | * @{ |
bogdanm | 84:0b3ab51c8877 | 206 | */ |
bogdanm | 84:0b3ab51c8877 | 207 | #define FLASH_IT_EOP FLASH_PECR_EOPIE /*!< End of programming interrupt source */ |
bogdanm | 84:0b3ab51c8877 | 208 | #define FLASH_IT_ERR FLASH_PECR_ERRIE /*!< Error interrupt source */ |
bogdanm | 84:0b3ab51c8877 | 209 | #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFCFFFF) == 0x00000000) && (((IT) != 0x00000000))) |
bogdanm | 84:0b3ab51c8877 | 210 | /** |
bogdanm | 84:0b3ab51c8877 | 211 | * @} |
bogdanm | 84:0b3ab51c8877 | 212 | */ |
bogdanm | 84:0b3ab51c8877 | 213 | |
bogdanm | 84:0b3ab51c8877 | 214 | /** @defgroup FLASH_Address |
bogdanm | 84:0b3ab51c8877 | 215 | * @{ |
bogdanm | 84:0b3ab51c8877 | 216 | */ |
bogdanm | 84:0b3ab51c8877 | 217 | #define IS_FLASH_DATA_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08080000) && ((ADDRESS) <= 0x080807FF)) /* 2K */ |
bogdanm | 84:0b3ab51c8877 | 218 | #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0800FFFF)) /* 64K */ |
bogdanm | 84:0b3ab51c8877 | 219 | #define IS_NBPAGES(PAGES) (((PAGES) >= 1) && ((PAGES) <= 512)) /* 512 pages from page0 to page 511 */ |
bogdanm | 84:0b3ab51c8877 | 220 | /** |
bogdanm | 84:0b3ab51c8877 | 221 | * @} |
bogdanm | 84:0b3ab51c8877 | 222 | */ |
bogdanm | 84:0b3ab51c8877 | 223 | |
bogdanm | 84:0b3ab51c8877 | 224 | /** @defgroup Option_Bytes_Write_Protection |
bogdanm | 84:0b3ab51c8877 | 225 | * @{ |
bogdanm | 84:0b3ab51c8877 | 226 | */ |
bogdanm | 84:0b3ab51c8877 | 227 | #define OB_WRP_Pages0to31 ((uint32_t)0x00000001) /* Write protection of Sector0 */ |
bogdanm | 84:0b3ab51c8877 | 228 | #define OB_WRP_Pages32to63 ((uint32_t)0x00000002) /* Write protection of Sector1 */ |
bogdanm | 84:0b3ab51c8877 | 229 | #define OB_WRP_Pages64to95 ((uint32_t)0x00000004) /* Write protection of Sector2 */ |
bogdanm | 84:0b3ab51c8877 | 230 | #define OB_WRP_Pages96to127 ((uint32_t)0x00000008) /* Write protection of Sector3 */ |
bogdanm | 84:0b3ab51c8877 | 231 | #define OB_WRP_Pages128to159 ((uint32_t)0x00000010) /* Write protection of Sector4 */ |
bogdanm | 84:0b3ab51c8877 | 232 | #define OB_WRP_Pages160to191 ((uint32_t)0x00000020) /* Write protection of Sector5 */ |
bogdanm | 84:0b3ab51c8877 | 233 | #define OB_WRP_Pages192to223 ((uint32_t)0x00000040) /* Write protection of Sector6 */ |
bogdanm | 84:0b3ab51c8877 | 234 | #define OB_WRP_Pages224to255 ((uint32_t)0x00000080) /* Write protection of Sector7 */ |
bogdanm | 84:0b3ab51c8877 | 235 | #define OB_WRP_Pages256to287 ((uint32_t)0x00000100) /* Write protection of Sector8 */ |
bogdanm | 84:0b3ab51c8877 | 236 | #define OB_WRP_Pages288to319 ((uint32_t)0x00000200) /* Write protection of Sector9 */ |
bogdanm | 84:0b3ab51c8877 | 237 | #define OB_WRP_Pages320to351 ((uint32_t)0x00000400) /* Write protection of Sector10 */ |
bogdanm | 84:0b3ab51c8877 | 238 | #define OB_WRP_Pages352to383 ((uint32_t)0x00000800) /* Write protection of Sector11 */ |
bogdanm | 84:0b3ab51c8877 | 239 | #define OB_WRP_Pages384to415 ((uint32_t)0x00001000) /* Write protection of Sector12 */ |
bogdanm | 84:0b3ab51c8877 | 240 | #define OB_WRP_Pages416to447 ((uint32_t)0x00002000) /* Write protection of Sector13 */ |
bogdanm | 84:0b3ab51c8877 | 241 | #define OB_WRP_Pages448to479 ((uint32_t)0x00004000) /* Write protection of Sector14 */ |
bogdanm | 84:0b3ab51c8877 | 242 | #define OB_WRP_Pages480to511 ((uint32_t)0x00008000) /* Write protection of Sector15 */ |
bogdanm | 84:0b3ab51c8877 | 243 | |
bogdanm | 84:0b3ab51c8877 | 244 | #define OB_WRP_AllPages ((uint32_t)0x0000FFFF) /*!< Write protection of all Sectors */ |
bogdanm | 84:0b3ab51c8877 | 245 | |
bogdanm | 84:0b3ab51c8877 | 246 | #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000)) |
bogdanm | 84:0b3ab51c8877 | 247 | /** |
bogdanm | 84:0b3ab51c8877 | 248 | * @} |
bogdanm | 84:0b3ab51c8877 | 249 | */ |
bogdanm | 84:0b3ab51c8877 | 250 | |
bogdanm | 84:0b3ab51c8877 | 251 | /** @defgroup Option_Bytes_Read_Protection |
bogdanm | 84:0b3ab51c8877 | 252 | * @{ |
bogdanm | 84:0b3ab51c8877 | 253 | */ |
bogdanm | 84:0b3ab51c8877 | 254 | |
bogdanm | 84:0b3ab51c8877 | 255 | /** |
bogdanm | 84:0b3ab51c8877 | 256 | * @brief FLASH_Option_Bytes_Read_Protection |
bogdanm | 84:0b3ab51c8877 | 257 | */ |
bogdanm | 84:0b3ab51c8877 | 258 | #define OB_RDP_Level_0 ((uint8_t)0xAA) |
bogdanm | 84:0b3ab51c8877 | 259 | #define OB_RDP_Level_1 ((uint8_t)0xBB) |
bogdanm | 84:0b3ab51c8877 | 260 | /*#define OB_RDP_Level_2 ((uint8_t)0xCC)*/ /* Warning: When enabling read protection level 2 |
bogdanm | 84:0b3ab51c8877 | 261 | it's no more possible to go back to level 1 or 0 */ |
bogdanm | 84:0b3ab51c8877 | 262 | |
bogdanm | 84:0b3ab51c8877 | 263 | #define IS_OB_RDP(LEVEL) (((LEVEL) == OB_RDP_Level_0)||\ |
bogdanm | 84:0b3ab51c8877 | 264 | ((LEVEL) == OB_RDP_Level_1))/*||\ |
bogdanm | 84:0b3ab51c8877 | 265 | ((LEVEL) == OB_RDP_Level_2))*/ |
bogdanm | 84:0b3ab51c8877 | 266 | /** |
bogdanm | 84:0b3ab51c8877 | 267 | * @} |
bogdanm | 84:0b3ab51c8877 | 268 | */ |
bogdanm | 84:0b3ab51c8877 | 269 | |
bogdanm | 84:0b3ab51c8877 | 270 | /** @defgroup Option_Bytes_IWatchdog |
bogdanm | 84:0b3ab51c8877 | 271 | * @{ |
bogdanm | 84:0b3ab51c8877 | 272 | */ |
bogdanm | 84:0b3ab51c8877 | 273 | #define OB_IWDG_SW ((uint8_t)0x10) /*!< Software WDG selected */ |
bogdanm | 84:0b3ab51c8877 | 274 | #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */ |
bogdanm | 84:0b3ab51c8877 | 275 | #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) |
bogdanm | 84:0b3ab51c8877 | 276 | /** |
bogdanm | 84:0b3ab51c8877 | 277 | * @} |
bogdanm | 84:0b3ab51c8877 | 278 | */ |
bogdanm | 84:0b3ab51c8877 | 279 | |
bogdanm | 84:0b3ab51c8877 | 280 | /** @defgroup Option_Bytes_nRST_STOP |
bogdanm | 84:0b3ab51c8877 | 281 | * @{ |
bogdanm | 84:0b3ab51c8877 | 282 | */ |
bogdanm | 84:0b3ab51c8877 | 283 | #define OB_STOP_NoRST ((uint8_t)0x20) /*!< No reset generated when entering in STOP */ |
bogdanm | 84:0b3ab51c8877 | 284 | #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */ |
bogdanm | 84:0b3ab51c8877 | 285 | #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST)) |
bogdanm | 84:0b3ab51c8877 | 286 | /** |
bogdanm | 84:0b3ab51c8877 | 287 | * @} |
bogdanm | 84:0b3ab51c8877 | 288 | */ |
bogdanm | 84:0b3ab51c8877 | 289 | |
bogdanm | 84:0b3ab51c8877 | 290 | /** @defgroup Option_Bytes_nRST_STDBY |
bogdanm | 84:0b3ab51c8877 | 291 | * @{ |
bogdanm | 84:0b3ab51c8877 | 292 | */ |
bogdanm | 84:0b3ab51c8877 | 293 | #define OB_STDBY_NoRST ((uint8_t)0x40) /*!< No reset generated when entering in STANDBY */ |
bogdanm | 84:0b3ab51c8877 | 294 | #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */ |
bogdanm | 84:0b3ab51c8877 | 295 | #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST)) |
bogdanm | 84:0b3ab51c8877 | 296 | /** |
bogdanm | 84:0b3ab51c8877 | 297 | * @} |
bogdanm | 84:0b3ab51c8877 | 298 | */ |
bogdanm | 84:0b3ab51c8877 | 299 | |
bogdanm | 84:0b3ab51c8877 | 300 | /** @defgroup Option_Bytes_BOR_Level |
bogdanm | 84:0b3ab51c8877 | 301 | * @{ |
bogdanm | 84:0b3ab51c8877 | 302 | */ |
bogdanm | 84:0b3ab51c8877 | 303 | |
bogdanm | 84:0b3ab51c8877 | 304 | #define OB_BOR_OFF ((uint8_t)0x00) /*!< BOR is disabled at power down, the reset is asserted when the VDD |
bogdanm | 84:0b3ab51c8877 | 305 | power supply reaches the PDR(Power Down Reset) threshold (1.5V) */ |
bogdanm | 84:0b3ab51c8877 | 306 | #define OB_BOR_LEVEL1 ((uint8_t)0x08) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply */ |
bogdanm | 84:0b3ab51c8877 | 307 | #define OB_BOR_LEVEL2 ((uint8_t)0x09) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply */ |
bogdanm | 84:0b3ab51c8877 | 308 | #define OB_BOR_LEVEL3 ((uint8_t)0x0A) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply */ |
bogdanm | 84:0b3ab51c8877 | 309 | #define OB_BOR_LEVEL4 ((uint8_t)0x0B) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply */ |
bogdanm | 84:0b3ab51c8877 | 310 | #define OB_BOR_LEVEL5 ((uint8_t)0x0C) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply */ |
bogdanm | 84:0b3ab51c8877 | 311 | |
bogdanm | 84:0b3ab51c8877 | 312 | #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_OFF) || \ |
bogdanm | 84:0b3ab51c8877 | 313 | ((LEVEL) == OB_BOR_LEVEL1) || \ |
bogdanm | 84:0b3ab51c8877 | 314 | ((LEVEL) == OB_BOR_LEVEL2) || \ |
bogdanm | 84:0b3ab51c8877 | 315 | ((LEVEL) == OB_BOR_LEVEL3) || \ |
bogdanm | 84:0b3ab51c8877 | 316 | ((LEVEL) == OB_BOR_LEVEL4) || \ |
bogdanm | 84:0b3ab51c8877 | 317 | ((LEVEL) == OB_BOR_LEVEL5)) |
bogdanm | 84:0b3ab51c8877 | 318 | |
bogdanm | 84:0b3ab51c8877 | 319 | /** |
bogdanm | 84:0b3ab51c8877 | 320 | * @} |
bogdanm | 84:0b3ab51c8877 | 321 | */ |
bogdanm | 84:0b3ab51c8877 | 322 | |
bogdanm | 84:0b3ab51c8877 | 323 | /** @defgroup FLASH_Flags |
bogdanm | 84:0b3ab51c8877 | 324 | * @{ |
bogdanm | 84:0b3ab51c8877 | 325 | */ |
bogdanm | 84:0b3ab51c8877 | 326 | |
bogdanm | 84:0b3ab51c8877 | 327 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
bogdanm | 84:0b3ab51c8877 | 328 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Programming flag */ |
bogdanm | 84:0b3ab51c8877 | 329 | #define FLASH_FLAG_ENDHV FLASH_SR_ENHV /*!< FLASH End of High Voltage flag */ |
bogdanm | 84:0b3ab51c8877 | 330 | #define FLASH_FLAG_READY FLASH_SR_READY /*!< FLASH Ready flag after low power mode */ |
bogdanm | 84:0b3ab51c8877 | 331 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
bogdanm | 84:0b3ab51c8877 | 332 | #define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */ |
bogdanm | 84:0b3ab51c8877 | 333 | #define FLASH_FLAG_SIZERR FLASH_SR_SIZERR /*!< FLASH Size error flag */ |
bogdanm | 84:0b3ab51c8877 | 334 | #define FLASH_FLAG_OPTVERR FLASH_SR_OPTVERR /*!< FLASH Option Validity error flag */ |
bogdanm | 84:0b3ab51c8877 | 335 | #define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< FLASH Read protected error flag */ |
bogdanm | 84:0b3ab51c8877 | 336 | #define FLASH_FLAG_NOTZEROERR FLASH_SR_NOTZEROERR /*!< FLASH Read protected error flag */ |
bogdanm | 84:0b3ab51c8877 | 337 | |
bogdanm | 84:0b3ab51c8877 | 338 | #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFED0FF) == 0x00000000) && ((FLAG) != 0x00000000)) |
bogdanm | 84:0b3ab51c8877 | 339 | |
bogdanm | 84:0b3ab51c8877 | 340 | #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \ |
bogdanm | 84:0b3ab51c8877 | 341 | ((FLAG) == FLASH_FLAG_ENDHV) || ((FLAG) == FLASH_FLAG_READY ) || \ |
bogdanm | 84:0b3ab51c8877 | 342 | ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_PGAERR ) || \ |
bogdanm | 84:0b3ab51c8877 | 343 | ((FLAG) == FLASH_FLAG_SIZERR) || ((FLAG) == FLASH_FLAG_OPTVERR) || \ |
bogdanm | 84:0b3ab51c8877 | 344 | ((FLAG) == FLASH_FLAG_RDERR) || ((FLAG) == FLASH_FLAG_NOTZEROERR)) |
bogdanm | 84:0b3ab51c8877 | 345 | /** |
bogdanm | 84:0b3ab51c8877 | 346 | * @} |
bogdanm | 84:0b3ab51c8877 | 347 | */ |
bogdanm | 84:0b3ab51c8877 | 348 | |
bogdanm | 84:0b3ab51c8877 | 349 | /** @defgroup FLASH_Keys |
bogdanm | 84:0b3ab51c8877 | 350 | * @{ |
bogdanm | 84:0b3ab51c8877 | 351 | */ |
bogdanm | 84:0b3ab51c8877 | 352 | |
bogdanm | 84:0b3ab51c8877 | 353 | #define FLASH_PDKEY1 ((uint32_t)0x04152637) /*!< Flash power down key1 */ |
bogdanm | 84:0b3ab51c8877 | 354 | #define FLASH_PDKEY2 ((uint32_t)0xFAFBFCFD) /*!< Flash power down key2: used with FLASH_PDKEY1 |
bogdanm | 84:0b3ab51c8877 | 355 | to unlock the RUN_PD bit in FLASH_ACR */ |
bogdanm | 84:0b3ab51c8877 | 356 | |
bogdanm | 84:0b3ab51c8877 | 357 | #define FLASH_PEKEY1 ((uint32_t)0x89ABCDEF) /*!< Flash program erase key1 */ |
bogdanm | 84:0b3ab51c8877 | 358 | #define FLASH_PEKEY2 ((uint32_t)0x02030405) /*!< Flash program erase key: used with FLASH_PEKEY2 |
bogdanm | 84:0b3ab51c8877 | 359 | to unlock the write access to the FLASH_PECR register and |
bogdanm | 84:0b3ab51c8877 | 360 | data EEPROM */ |
bogdanm | 84:0b3ab51c8877 | 361 | |
bogdanm | 84:0b3ab51c8877 | 362 | #define FLASH_PRGKEY1 ((uint32_t)0x8C9DAEBF) /*!< Flash program memory key1 */ |
bogdanm | 84:0b3ab51c8877 | 363 | #define FLASH_PRGKEY2 ((uint32_t)0x13141516) /*!< Flash program memory key2: used with FLASH_PRGKEY2 |
bogdanm | 84:0b3ab51c8877 | 364 | to unlock the program memory */ |
bogdanm | 84:0b3ab51c8877 | 365 | |
bogdanm | 84:0b3ab51c8877 | 366 | #define FLASH_OPTKEY1 ((uint32_t)0xFBEAD9C8) /*!< Flash option key1 */ |
bogdanm | 84:0b3ab51c8877 | 367 | #define FLASH_OPTKEY2 ((uint32_t)0x24252627) /*!< Flash option key2: used with FLASH_OPTKEY1 to |
bogdanm | 84:0b3ab51c8877 | 368 | unlock the write access to the option byte block */ |
bogdanm | 84:0b3ab51c8877 | 369 | /** |
bogdanm | 84:0b3ab51c8877 | 370 | * @} |
bogdanm | 84:0b3ab51c8877 | 371 | */ |
bogdanm | 84:0b3ab51c8877 | 372 | |
bogdanm | 84:0b3ab51c8877 | 373 | /** @defgroup CMSIS_Legacy |
bogdanm | 84:0b3ab51c8877 | 374 | * @{ |
bogdanm | 84:0b3ab51c8877 | 375 | */ |
bogdanm | 84:0b3ab51c8877 | 376 | #if defined ( __ICCARM__ ) |
bogdanm | 84:0b3ab51c8877 | 377 | #define InterruptType_ACTLR_DISMCYCINT_Msk IntType_ACTLR_DISMCYCINT_Msk |
bogdanm | 84:0b3ab51c8877 | 378 | #endif |
bogdanm | 84:0b3ab51c8877 | 379 | /** |
bogdanm | 84:0b3ab51c8877 | 380 | * @} |
bogdanm | 84:0b3ab51c8877 | 381 | */ |
bogdanm | 84:0b3ab51c8877 | 382 | |
bogdanm | 84:0b3ab51c8877 | 383 | /** |
bogdanm | 84:0b3ab51c8877 | 384 | * @} |
bogdanm | 84:0b3ab51c8877 | 385 | */ |
bogdanm | 84:0b3ab51c8877 | 386 | |
bogdanm | 84:0b3ab51c8877 | 387 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 84:0b3ab51c8877 | 388 | /** @defgroup FLASH_Interrupt FLASH Interrupt |
bogdanm | 84:0b3ab51c8877 | 389 | * @brief macros to handle FLASH interrupts |
bogdanm | 84:0b3ab51c8877 | 390 | * @{ |
bogdanm | 84:0b3ab51c8877 | 391 | */ |
bogdanm | 84:0b3ab51c8877 | 392 | |
bogdanm | 84:0b3ab51c8877 | 393 | /** |
bogdanm | 84:0b3ab51c8877 | 394 | * @brief Enables or disables the specified FLASH interrupts. |
bogdanm | 84:0b3ab51c8877 | 395 | * @param __INTERRUPT__: specifies the FLASH interrupt sources to be enabled or |
bogdanm | 84:0b3ab51c8877 | 396 | * disabled. |
bogdanm | 84:0b3ab51c8877 | 397 | * This parameter can be any combination of the following values: |
bogdanm | 84:0b3ab51c8877 | 398 | * @arg FLASH_IT_EOP: FLASH end of programming Interrupt |
bogdanm | 84:0b3ab51c8877 | 399 | * @arg FLASH_IT_ERR: FLASH Error Interrupt |
bogdanm | 84:0b3ab51c8877 | 400 | * @retval None |
bogdanm | 84:0b3ab51c8877 | 401 | */ |
bogdanm | 84:0b3ab51c8877 | 402 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->PECR |= (__INTERRUPT__)) |
bogdanm | 84:0b3ab51c8877 | 403 | |
bogdanm | 84:0b3ab51c8877 | 404 | /** |
bogdanm | 84:0b3ab51c8877 | 405 | * @brief Disable the specified FLASH interrupt. |
bogdanm | 84:0b3ab51c8877 | 406 | * @param __INTERRUPT__ : FLASH interrupt |
bogdanm | 84:0b3ab51c8877 | 407 | * This parameter can be any combination of the following values: |
bogdanm | 84:0b3ab51c8877 | 408 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
bogdanm | 84:0b3ab51c8877 | 409 | * @arg FLASH_IT_ERR: Error Interrupt |
bogdanm | 84:0b3ab51c8877 | 410 | * @retval none |
bogdanm | 84:0b3ab51c8877 | 411 | */ |
bogdanm | 84:0b3ab51c8877 | 412 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->PECR &= ~(uint32_t)(__INTERRUPT__)) |
bogdanm | 84:0b3ab51c8877 | 413 | |
bogdanm | 84:0b3ab51c8877 | 414 | /** |
bogdanm | 84:0b3ab51c8877 | 415 | * @brief Checks whether the specified FLASH flag is set or not. |
bogdanm | 84:0b3ab51c8877 | 416 | * @param __FLAG__: specifies the FLASH flag to check. |
bogdanm | 84:0b3ab51c8877 | 417 | * This parameter can be one of the following values: |
bogdanm | 84:0b3ab51c8877 | 418 | * @arg FLASH_FLAG_BSY: FLASH write/erase operations in progress flag |
bogdanm | 84:0b3ab51c8877 | 419 | * @arg FLASH_FLAG_EOP: FLASH End of Operation flag |
bogdanm | 84:0b3ab51c8877 | 420 | * @arg FLASH_FLAG_READY: FLASH Ready flag after low power mode |
bogdanm | 84:0b3ab51c8877 | 421 | * @arg FLASH_FLAG_ENDHV: FLASH End of high voltage flag |
bogdanm | 84:0b3ab51c8877 | 422 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 84:0b3ab51c8877 | 423 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
bogdanm | 84:0b3ab51c8877 | 424 | * @arg FLASH_FLAG_SIZERR: FLASH size error flag |
bogdanm | 84:0b3ab51c8877 | 425 | * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error flag |
bogdanm | 84:0b3ab51c8877 | 426 | * @arg FLASH_FLAG_OPTVERRUSR: FLASH Option User validity error flag |
bogdanm | 84:0b3ab51c8877 | 427 | * @arg FLASH_FLAG_RDERR: FLASH Read protected error flag |
bogdanm | 84:0b3ab51c8877 | 428 | * @arg FLASH_FLAG_NOTZEROERR: Not Zero area error flag |
bogdanm | 84:0b3ab51c8877 | 429 | * @retval The new state of FLASH_FLAG (SET or RESET). |
bogdanm | 84:0b3ab51c8877 | 430 | */ |
bogdanm | 84:0b3ab51c8877 | 431 | #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)) == (__FLAG__)) |
bogdanm | 84:0b3ab51c8877 | 432 | |
bogdanm | 84:0b3ab51c8877 | 433 | /** |
bogdanm | 84:0b3ab51c8877 | 434 | * @brief Clears the FLASH's pending flags. |
bogdanm | 84:0b3ab51c8877 | 435 | * @param __FLAG__: specifies the FLASH flags to clear. |
bogdanm | 84:0b3ab51c8877 | 436 | * This parameter can be any combination of the following values: |
bogdanm | 84:0b3ab51c8877 | 437 | * @arg FLASH_FLAG_EOP: FLASH End of Operation flag |
bogdanm | 84:0b3ab51c8877 | 438 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 84:0b3ab51c8877 | 439 | * @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag |
bogdanm | 84:0b3ab51c8877 | 440 | * @arg FLASH_FLAG_SIZERR: FLASH size error flag |
bogdanm | 84:0b3ab51c8877 | 441 | * @arg FLASH_FLAG_OPTVERR: FLASH Option validity error flag |
bogdanm | 84:0b3ab51c8877 | 442 | * @arg FLASH_FLAG_OPTVERRUSR: FLASH Option User validity error flag |
bogdanm | 84:0b3ab51c8877 | 443 | * @arg FLASH_FLAG_RDERR: FLASH Read protected error flag |
bogdanm | 84:0b3ab51c8877 | 444 | * @arg FLASH_FLAG_NOTZEROERR: Not Zero area error flag |
bogdanm | 84:0b3ab51c8877 | 445 | * @retval None |
bogdanm | 84:0b3ab51c8877 | 446 | */ |
bogdanm | 84:0b3ab51c8877 | 447 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) |
bogdanm | 84:0b3ab51c8877 | 448 | |
bogdanm | 84:0b3ab51c8877 | 449 | /** |
bogdanm | 84:0b3ab51c8877 | 450 | * @} |
bogdanm | 84:0b3ab51c8877 | 451 | */ |
bogdanm | 84:0b3ab51c8877 | 452 | |
bogdanm | 84:0b3ab51c8877 | 453 | /* Include FLASH HAL Extension module */ |
bogdanm | 84:0b3ab51c8877 | 454 | #include "stm32l0xx_hal_flash_ex.h" |
bogdanm | 84:0b3ab51c8877 | 455 | #include "stm32l0xx_hal_flash_ramfunc.h" |
bogdanm | 84:0b3ab51c8877 | 456 | |
bogdanm | 84:0b3ab51c8877 | 457 | /* Exported functions ------------------------------------------------------- */ |
bogdanm | 84:0b3ab51c8877 | 458 | |
bogdanm | 84:0b3ab51c8877 | 459 | /** |
bogdanm | 84:0b3ab51c8877 | 460 | * @brief FLASH memory functions that can be executed from FLASH. |
bogdanm | 84:0b3ab51c8877 | 461 | */ |
bogdanm | 84:0b3ab51c8877 | 462 | /* Program operation functions ***********************************************/ |
bogdanm | 84:0b3ab51c8877 | 463 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data); |
bogdanm | 84:0b3ab51c8877 | 464 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint32_t Data); |
bogdanm | 84:0b3ab51c8877 | 465 | |
bogdanm | 84:0b3ab51c8877 | 466 | /* FLASH IRQ handler function */ |
bogdanm | 84:0b3ab51c8877 | 467 | void HAL_FLASH_IRQHandler(void); |
bogdanm | 84:0b3ab51c8877 | 468 | |
bogdanm | 84:0b3ab51c8877 | 469 | /* Callbacks in non blocking modes */ |
bogdanm | 84:0b3ab51c8877 | 470 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
bogdanm | 84:0b3ab51c8877 | 471 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
bogdanm | 84:0b3ab51c8877 | 472 | |
bogdanm | 84:0b3ab51c8877 | 473 | /* Peripheral Control functions **********************************************/ |
bogdanm | 84:0b3ab51c8877 | 474 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
bogdanm | 84:0b3ab51c8877 | 475 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
bogdanm | 84:0b3ab51c8877 | 476 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
bogdanm | 84:0b3ab51c8877 | 477 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
bogdanm | 84:0b3ab51c8877 | 478 | |
bogdanm | 84:0b3ab51c8877 | 479 | /* Option bytes control */ |
bogdanm | 84:0b3ab51c8877 | 480 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
bogdanm | 84:0b3ab51c8877 | 481 | |
bogdanm | 84:0b3ab51c8877 | 482 | /* Peripheral State functions ************************************************/ |
bogdanm | 84:0b3ab51c8877 | 483 | FLASH_ErrorTypeDef HAL_FLASH_GetError(void); |
bogdanm | 84:0b3ab51c8877 | 484 | |
bogdanm | 84:0b3ab51c8877 | 485 | /* Non-User functions ********************************************************/ |
bogdanm | 84:0b3ab51c8877 | 486 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); |
bogdanm | 84:0b3ab51c8877 | 487 | void FLASH_Erase_Page(uint32_t Page_Address); |
bogdanm | 84:0b3ab51c8877 | 488 | |
bogdanm | 84:0b3ab51c8877 | 489 | #ifdef __cplusplus |
bogdanm | 84:0b3ab51c8877 | 490 | } |
bogdanm | 84:0b3ab51c8877 | 491 | #endif |
bogdanm | 84:0b3ab51c8877 | 492 | |
bogdanm | 84:0b3ab51c8877 | 493 | #endif /* __STM32L0XX_HAL_FLASH_H */ |
bogdanm | 84:0b3ab51c8877 | 494 | |
bogdanm | 84:0b3ab51c8877 | 495 | /** |
bogdanm | 84:0b3ab51c8877 | 496 | * @} |
bogdanm | 84:0b3ab51c8877 | 497 | */ |
bogdanm | 84:0b3ab51c8877 | 498 | |
bogdanm | 84:0b3ab51c8877 | 499 | /** |
bogdanm | 84:0b3ab51c8877 | 500 | * @} |
bogdanm | 84:0b3ab51c8877 | 501 | */ |
bogdanm | 84:0b3ab51c8877 | 502 | |
bogdanm | 84:0b3ab51c8877 | 503 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |