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