/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }
Fork of mbed by
TARGET_NUCLEO_F072RB/stm32f0xx_hal_flash.h@85:024bf7f99721, 2014-06-11 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jun 11 15:14:05 2014 +0100
- Revision:
- 85:024bf7f99721
- Child:
- 92:4fc01daae5a5
Release 85 of the mbed library
Main changes:
- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F
There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 85:024bf7f99721 | 1 | /** |
bogdanm | 85:024bf7f99721 | 2 | ****************************************************************************** |
bogdanm | 85:024bf7f99721 | 3 | * @file stm32f0xx_hal_flash.h |
bogdanm | 85:024bf7f99721 | 4 | * @author MCD Application Team |
bogdanm | 85:024bf7f99721 | 5 | * @version V1.0.0 |
bogdanm | 85:024bf7f99721 | 6 | * @date 28-May-2014 |
bogdanm | 85:024bf7f99721 | 7 | * @brief Header file of Flash HAL module. |
bogdanm | 85:024bf7f99721 | 8 | ****************************************************************************** |
bogdanm | 85:024bf7f99721 | 9 | * @attention |
bogdanm | 85:024bf7f99721 | 10 | * |
bogdanm | 85:024bf7f99721 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 85:024bf7f99721 | 12 | * |
bogdanm | 85:024bf7f99721 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 85:024bf7f99721 | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 85:024bf7f99721 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 85:024bf7f99721 | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 85:024bf7f99721 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 85:024bf7f99721 | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 85:024bf7f99721 | 19 | * and/or other materials provided with the distribution. |
bogdanm | 85:024bf7f99721 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 85:024bf7f99721 | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 85:024bf7f99721 | 22 | * without specific prior written permission. |
bogdanm | 85:024bf7f99721 | 23 | * |
bogdanm | 85:024bf7f99721 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 85:024bf7f99721 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 85:024bf7f99721 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 85:024bf7f99721 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 85:024bf7f99721 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 85:024bf7f99721 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 85:024bf7f99721 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 85:024bf7f99721 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 85:024bf7f99721 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 85:024bf7f99721 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 85:024bf7f99721 | 34 | * |
bogdanm | 85:024bf7f99721 | 35 | ****************************************************************************** |
bogdanm | 85:024bf7f99721 | 36 | */ |
bogdanm | 85:024bf7f99721 | 37 | |
bogdanm | 85:024bf7f99721 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 39 | #ifndef __STM32F0xx_HAL_FLASH_H |
bogdanm | 85:024bf7f99721 | 40 | #define __STM32F0xx_HAL_FLASH_H |
bogdanm | 85:024bf7f99721 | 41 | |
bogdanm | 85:024bf7f99721 | 42 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 43 | extern "C" { |
bogdanm | 85:024bf7f99721 | 44 | #endif |
bogdanm | 85:024bf7f99721 | 45 | |
bogdanm | 85:024bf7f99721 | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 47 | #include "stm32f0xx_hal_def.h" |
bogdanm | 85:024bf7f99721 | 48 | |
bogdanm | 85:024bf7f99721 | 49 | /** @addtogroup STM32F0xx_HAL_Driver |
bogdanm | 85:024bf7f99721 | 50 | * @{ |
bogdanm | 85:024bf7f99721 | 51 | */ |
bogdanm | 85:024bf7f99721 | 52 | |
bogdanm | 85:024bf7f99721 | 53 | /** @addtogroup FLASH |
bogdanm | 85:024bf7f99721 | 54 | * @{ |
bogdanm | 85:024bf7f99721 | 55 | */ |
bogdanm | 85:024bf7f99721 | 56 | |
bogdanm | 85:024bf7f99721 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 58 | /** @defgroup FLASH_Exported_Types |
bogdanm | 85:024bf7f99721 | 59 | * @{ |
bogdanm | 85:024bf7f99721 | 60 | */ |
bogdanm | 85:024bf7f99721 | 61 | |
bogdanm | 85:024bf7f99721 | 62 | /** |
bogdanm | 85:024bf7f99721 | 63 | * @brief FLASH Error source |
bogdanm | 85:024bf7f99721 | 64 | */ |
bogdanm | 85:024bf7f99721 | 65 | typedef enum |
bogdanm | 85:024bf7f99721 | 66 | { |
bogdanm | 85:024bf7f99721 | 67 | FLASH_ERROR_PG = 0x01, |
bogdanm | 85:024bf7f99721 | 68 | FLASH_ERROR_WRP = 0x02 |
bogdanm | 85:024bf7f99721 | 69 | } FLASH_ErrorTypeDef; |
bogdanm | 85:024bf7f99721 | 70 | |
bogdanm | 85:024bf7f99721 | 71 | /** |
bogdanm | 85:024bf7f99721 | 72 | * @brief FLASH Erase structure definition |
bogdanm | 85:024bf7f99721 | 73 | */ |
bogdanm | 85:024bf7f99721 | 74 | typedef struct |
bogdanm | 85:024bf7f99721 | 75 | { |
bogdanm | 85:024bf7f99721 | 76 | uint32_t TypeErase; /*!< TypeErase: Mass erase or page erase. |
bogdanm | 85:024bf7f99721 | 77 | This parameter can be a value of @ref FLASH_Type_Erase */ |
bogdanm | 85:024bf7f99721 | 78 | |
bogdanm | 85:024bf7f99721 | 79 | uint32_t PageAddress; /*!< PageAdress: Initial FLASH page address to erase when mass erase is disabled |
bogdanm | 85:024bf7f99721 | 80 | This parameter must be a value of @ref FLASHEx_Address */ |
bogdanm | 85:024bf7f99721 | 81 | |
bogdanm | 85:024bf7f99721 | 82 | uint32_t NbPages; /*!< NbPages: Number of pagess to be erased. |
bogdanm | 85:024bf7f99721 | 83 | This parameter must be a value between 1 and (max number of pages - value of initial page)*/ |
bogdanm | 85:024bf7f99721 | 84 | |
bogdanm | 85:024bf7f99721 | 85 | } FLASH_EraseInitTypeDef; |
bogdanm | 85:024bf7f99721 | 86 | |
bogdanm | 85:024bf7f99721 | 87 | /** |
bogdanm | 85:024bf7f99721 | 88 | * @brief FLASH Options bytes program structure definition |
bogdanm | 85:024bf7f99721 | 89 | */ |
bogdanm | 85:024bf7f99721 | 90 | typedef struct |
bogdanm | 85:024bf7f99721 | 91 | { |
bogdanm | 85:024bf7f99721 | 92 | uint32_t OptionType; /*!< OptionType: Option byte to be configured. |
bogdanm | 85:024bf7f99721 | 93 | This parameter can be a value of @ref FLASH_OB_Type */ |
bogdanm | 85:024bf7f99721 | 94 | |
bogdanm | 85:024bf7f99721 | 95 | uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation. |
bogdanm | 85:024bf7f99721 | 96 | This parameter can be a value of @ref FLASH_OB_WRP_State */ |
bogdanm | 85:024bf7f99721 | 97 | |
bogdanm | 85:024bf7f99721 | 98 | uint32_t WRPPage; /*!< WRPSector: specifies the page(s) to be write protected |
bogdanm | 85:024bf7f99721 | 99 | This parameter can be a value of @ref FLASHEx_OB_Write_Protection */ |
bogdanm | 85:024bf7f99721 | 100 | |
bogdanm | 85:024bf7f99721 | 101 | uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level.. |
bogdanm | 85:024bf7f99721 | 102 | This parameter can be a value of @ref FLASH_OB_Read_Protection */ |
bogdanm | 85:024bf7f99721 | 103 | |
bogdanm | 85:024bf7f99721 | 104 | uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: |
bogdanm | 85:024bf7f99721 | 105 | IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY |
bogdanm | 85:024bf7f99721 | 106 | This parameter can be a combination of @ref FLASH_OB_Watchdog, @ref FLASH_OB_nRST_STOP, |
bogdanm | 85:024bf7f99721 | 107 | @ref FLASH_OB_nRST_STDBY, @ref FLASH_OB_BOOT1, @ref FLASH_OB_VDDA_Analog_Monitoring and |
bogdanm | 85:024bf7f99721 | 108 | @ref FLASH_OB_RAM_Parity_Check_Enable */ |
bogdanm | 85:024bf7f99721 | 109 | |
bogdanm | 85:024bf7f99721 | 110 | uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be prgrammed |
bogdanm | 85:024bf7f99721 | 111 | This parameter can be a value of @ref FLASH_OB_Data_Address */ |
bogdanm | 85:024bf7f99721 | 112 | |
bogdanm | 85:024bf7f99721 | 113 | uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA |
bogdanm | 85:024bf7f99721 | 114 | This parameter can have any value */ |
bogdanm | 85:024bf7f99721 | 115 | |
bogdanm | 85:024bf7f99721 | 116 | } FLASH_OBProgramInitTypeDef; |
bogdanm | 85:024bf7f99721 | 117 | |
bogdanm | 85:024bf7f99721 | 118 | /** |
bogdanm | 85:024bf7f99721 | 119 | * @brief FLASH Procedure structure definition |
bogdanm | 85:024bf7f99721 | 120 | */ |
bogdanm | 85:024bf7f99721 | 121 | typedef enum |
bogdanm | 85:024bf7f99721 | 122 | { |
bogdanm | 85:024bf7f99721 | 123 | FLASH_PROC_NONE = 0, |
bogdanm | 85:024bf7f99721 | 124 | FLASH_PROC_PAGEERASE = 1, |
bogdanm | 85:024bf7f99721 | 125 | FLASH_PROC_MASSERASE = 2, |
bogdanm | 85:024bf7f99721 | 126 | FLASH_PROC_PROGRAMHALFWORD = 3, |
bogdanm | 85:024bf7f99721 | 127 | FLASH_PROC_PROGRAMWORD = 4, |
bogdanm | 85:024bf7f99721 | 128 | FLASH_PROC_PROGRAMDOUBLEWORD = 5 |
bogdanm | 85:024bf7f99721 | 129 | } FLASH_ProcedureTypeDef; |
bogdanm | 85:024bf7f99721 | 130 | |
bogdanm | 85:024bf7f99721 | 131 | /** |
bogdanm | 85:024bf7f99721 | 132 | * @brief FLASH handle Structure definition |
bogdanm | 85:024bf7f99721 | 133 | */ |
bogdanm | 85:024bf7f99721 | 134 | typedef struct |
bogdanm | 85:024bf7f99721 | 135 | { |
bogdanm | 85:024bf7f99721 | 136 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */ |
bogdanm | 85:024bf7f99721 | 137 | |
bogdanm | 85:024bf7f99721 | 138 | __IO uint32_t DataRemaining; /* Internal variable to save the remaining pages to erase or half-word to program in IT context */ |
bogdanm | 85:024bf7f99721 | 139 | |
bogdanm | 85:024bf7f99721 | 140 | __IO uint32_t Address; /* Internal variable to save address selected for program or erase */ |
bogdanm | 85:024bf7f99721 | 141 | |
bogdanm | 85:024bf7f99721 | 142 | __IO uint64_t Data; /* Internal variable to save data to be programmed */ |
bogdanm | 85:024bf7f99721 | 143 | |
bogdanm | 85:024bf7f99721 | 144 | HAL_LockTypeDef Lock; /* FLASH locking object */ |
bogdanm | 85:024bf7f99721 | 145 | |
bogdanm | 85:024bf7f99721 | 146 | __IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */ |
bogdanm | 85:024bf7f99721 | 147 | |
bogdanm | 85:024bf7f99721 | 148 | } FLASH_ProcessTypeDef; |
bogdanm | 85:024bf7f99721 | 149 | |
bogdanm | 85:024bf7f99721 | 150 | /** |
bogdanm | 85:024bf7f99721 | 151 | * @} |
bogdanm | 85:024bf7f99721 | 152 | */ |
bogdanm | 85:024bf7f99721 | 153 | |
bogdanm | 85:024bf7f99721 | 154 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 155 | |
bogdanm | 85:024bf7f99721 | 156 | /** @defgroup FLASH_Exported_Constants |
bogdanm | 85:024bf7f99721 | 157 | * @{ |
bogdanm | 85:024bf7f99721 | 158 | */ |
bogdanm | 85:024bf7f99721 | 159 | |
bogdanm | 85:024bf7f99721 | 160 | /** @defgroup FLASH_Type_Erase FLASH Type Erase |
bogdanm | 85:024bf7f99721 | 161 | * @{ |
bogdanm | 85:024bf7f99721 | 162 | */ |
bogdanm | 85:024bf7f99721 | 163 | #define TYPEERASE_PAGES ((uint32_t)0x00) /*!<Pages erase only*/ |
bogdanm | 85:024bf7f99721 | 164 | #define TYPEERASE_MASSERASE ((uint32_t)0x01) /*!<Flash mass erase activation*/ |
bogdanm | 85:024bf7f99721 | 165 | |
bogdanm | 85:024bf7f99721 | 166 | #define IS_TYPEERASE(VALUE) (((VALUE) == TYPEERASE_PAGES) || \ |
bogdanm | 85:024bf7f99721 | 167 | ((VALUE) == TYPEERASE_MASSERASE)) |
bogdanm | 85:024bf7f99721 | 168 | /** |
bogdanm | 85:024bf7f99721 | 169 | * @} |
bogdanm | 85:024bf7f99721 | 170 | */ |
bogdanm | 85:024bf7f99721 | 171 | |
bogdanm | 85:024bf7f99721 | 172 | /** @defgroup FLASH_Type_Program FLASH Type Program |
bogdanm | 85:024bf7f99721 | 173 | * @{ |
bogdanm | 85:024bf7f99721 | 174 | */ |
bogdanm | 85:024bf7f99721 | 175 | #define TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/ |
bogdanm | 85:024bf7f99721 | 176 | #define TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/ |
bogdanm | 85:024bf7f99721 | 177 | #define TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/ |
bogdanm | 85:024bf7f99721 | 178 | |
bogdanm | 85:024bf7f99721 | 179 | #define IS_TYPEPROGRAM(VALUE) (((VALUE) == TYPEPROGRAM_HALFWORD) || \ |
bogdanm | 85:024bf7f99721 | 180 | ((VALUE) == TYPEPROGRAM_WORD) || \ |
bogdanm | 85:024bf7f99721 | 181 | ((VALUE) == TYPEPROGRAM_DOUBLEWORD)) |
bogdanm | 85:024bf7f99721 | 182 | /** |
bogdanm | 85:024bf7f99721 | 183 | * @} |
bogdanm | 85:024bf7f99721 | 184 | */ |
bogdanm | 85:024bf7f99721 | 185 | |
bogdanm | 85:024bf7f99721 | 186 | /** @defgroup FLASH_OB_WRP_State FLASH WRP State |
bogdanm | 85:024bf7f99721 | 187 | * @{ |
bogdanm | 85:024bf7f99721 | 188 | */ |
bogdanm | 85:024bf7f99721 | 189 | #define WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/ |
bogdanm | 85:024bf7f99721 | 190 | #define WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/ |
bogdanm | 85:024bf7f99721 | 191 | |
bogdanm | 85:024bf7f99721 | 192 | #define IS_WRPSTATE(VALUE) (((VALUE) == WRPSTATE_DISABLE) || \ |
bogdanm | 85:024bf7f99721 | 193 | ((VALUE) == WRPSTATE_ENABLE)) |
bogdanm | 85:024bf7f99721 | 194 | /** |
bogdanm | 85:024bf7f99721 | 195 | * @} |
bogdanm | 85:024bf7f99721 | 196 | */ |
bogdanm | 85:024bf7f99721 | 197 | |
bogdanm | 85:024bf7f99721 | 198 | /** @defgroup FLASH_OB_Type FLASH Option Bytes Type |
bogdanm | 85:024bf7f99721 | 199 | * @{ |
bogdanm | 85:024bf7f99721 | 200 | */ |
bogdanm | 85:024bf7f99721 | 201 | #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/ |
bogdanm | 85:024bf7f99721 | 202 | #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/ |
bogdanm | 85:024bf7f99721 | 203 | #define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/ |
bogdanm | 85:024bf7f99721 | 204 | #define OPTIONBYTE_DATA ((uint32_t)0x08) /*!<DATA option byte configuration*/ |
bogdanm | 85:024bf7f99721 | 205 | |
bogdanm | 85:024bf7f99721 | 206 | #define IS_OPTIONBYTE(VALUE) (((VALUE) < (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))) |
bogdanm | 85:024bf7f99721 | 207 | /** |
bogdanm | 85:024bf7f99721 | 208 | * @} |
bogdanm | 85:024bf7f99721 | 209 | */ |
bogdanm | 85:024bf7f99721 | 210 | |
bogdanm | 85:024bf7f99721 | 211 | /** @defgroup FLASH_Latency |
bogdanm | 85:024bf7f99721 | 212 | * @{ |
bogdanm | 85:024bf7f99721 | 213 | */ |
bogdanm | 85:024bf7f99721 | 214 | #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */ |
bogdanm | 85:024bf7f99721 | 215 | #define FLASH_LATENCY_1 FLASH_ACR_LATENCY /*!< FLASH One Latency cycle */ |
bogdanm | 85:024bf7f99721 | 216 | |
bogdanm | 85:024bf7f99721 | 217 | #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ |
bogdanm | 85:024bf7f99721 | 218 | ((LATENCY) == FLASH_LATENCY_1)) |
bogdanm | 85:024bf7f99721 | 219 | /** |
bogdanm | 85:024bf7f99721 | 220 | * @} |
bogdanm | 85:024bf7f99721 | 221 | */ |
bogdanm | 85:024bf7f99721 | 222 | |
bogdanm | 85:024bf7f99721 | 223 | /** @defgroup FLASH_OB_Data_Address |
bogdanm | 85:024bf7f99721 | 224 | * @{ |
bogdanm | 85:024bf7f99721 | 225 | */ |
bogdanm | 85:024bf7f99721 | 226 | #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806)) |
bogdanm | 85:024bf7f99721 | 227 | /** |
bogdanm | 85:024bf7f99721 | 228 | * @} |
bogdanm | 85:024bf7f99721 | 229 | */ |
bogdanm | 85:024bf7f99721 | 230 | |
bogdanm | 85:024bf7f99721 | 231 | /** @defgroup FLASH_OB_Read_Protection |
bogdanm | 85:024bf7f99721 | 232 | * @{ |
bogdanm | 85:024bf7f99721 | 233 | */ |
bogdanm | 85:024bf7f99721 | 234 | #define OB_RDP_LEVEL_0 ((uint8_t)0xAA) |
bogdanm | 85:024bf7f99721 | 235 | #define OB_RDP_LEVEL_1 ((uint8_t)0xBB) |
bogdanm | 85:024bf7f99721 | 236 | #define OB_RDP_LEVEL_2 ((uint8_t)0xCC) /*!< Warning: When enabling read protection level 2 |
bogdanm | 85:024bf7f99721 | 237 | it's no more possible to go back to level 1 or 0 */ |
bogdanm | 85:024bf7f99721 | 238 | #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\ |
bogdanm | 85:024bf7f99721 | 239 | ((LEVEL) == OB_RDP_LEVEL_1))/*||\ |
bogdanm | 85:024bf7f99721 | 240 | ((LEVEL) == OB_RDP_LEVEL_2))*/ |
bogdanm | 85:024bf7f99721 | 241 | /** |
bogdanm | 85:024bf7f99721 | 242 | * @} |
bogdanm | 85:024bf7f99721 | 243 | */ |
bogdanm | 85:024bf7f99721 | 244 | |
bogdanm | 85:024bf7f99721 | 245 | /** @defgroup FLASH_OB_Watchdog |
bogdanm | 85:024bf7f99721 | 246 | * @{ |
bogdanm | 85:024bf7f99721 | 247 | */ |
bogdanm | 85:024bf7f99721 | 248 | #define OB_WDG_SW ((uint8_t)0x01) /*!< Software WDG selected */ |
bogdanm | 85:024bf7f99721 | 249 | #define OB_WDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */ |
bogdanm | 85:024bf7f99721 | 250 | #define IS_OB_WDG_SOURCE(SOURCE) (((SOURCE) == OB_WDG_SW) || ((SOURCE) == OB_WDG_HW)) |
bogdanm | 85:024bf7f99721 | 251 | /** |
bogdanm | 85:024bf7f99721 | 252 | * @} |
bogdanm | 85:024bf7f99721 | 253 | */ |
bogdanm | 85:024bf7f99721 | 254 | |
bogdanm | 85:024bf7f99721 | 255 | /** @defgroup FLASH_OB_nRST_STOP |
bogdanm | 85:024bf7f99721 | 256 | * @{ |
bogdanm | 85:024bf7f99721 | 257 | */ |
bogdanm | 85:024bf7f99721 | 258 | #define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */ |
bogdanm | 85:024bf7f99721 | 259 | #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */ |
bogdanm | 85:024bf7f99721 | 260 | #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST)) |
bogdanm | 85:024bf7f99721 | 261 | /** |
bogdanm | 85:024bf7f99721 | 262 | * @} |
bogdanm | 85:024bf7f99721 | 263 | */ |
bogdanm | 85:024bf7f99721 | 264 | |
bogdanm | 85:024bf7f99721 | 265 | /** @defgroup FLASH_OB_nRST_STDBY |
bogdanm | 85:024bf7f99721 | 266 | * @{ |
bogdanm | 85:024bf7f99721 | 267 | */ |
bogdanm | 85:024bf7f99721 | 268 | #define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */ |
bogdanm | 85:024bf7f99721 | 269 | #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */ |
bogdanm | 85:024bf7f99721 | 270 | #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST)) |
bogdanm | 85:024bf7f99721 | 271 | /** |
bogdanm | 85:024bf7f99721 | 272 | * @} |
bogdanm | 85:024bf7f99721 | 273 | */ |
bogdanm | 85:024bf7f99721 | 274 | |
bogdanm | 85:024bf7f99721 | 275 | /** @defgroup FLASH_OB_BOOT1 |
bogdanm | 85:024bf7f99721 | 276 | * @{ |
bogdanm | 85:024bf7f99721 | 277 | */ |
bogdanm | 85:024bf7f99721 | 278 | #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */ |
bogdanm | 85:024bf7f99721 | 279 | #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */ |
bogdanm | 85:024bf7f99721 | 280 | #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET)) |
bogdanm | 85:024bf7f99721 | 281 | /** |
bogdanm | 85:024bf7f99721 | 282 | * @} |
bogdanm | 85:024bf7f99721 | 283 | */ |
bogdanm | 85:024bf7f99721 | 284 | |
bogdanm | 85:024bf7f99721 | 285 | /** @defgroup FLASH_OB_VDDA_Analog_Monitoring |
bogdanm | 85:024bf7f99721 | 286 | * @{ |
bogdanm | 85:024bf7f99721 | 287 | */ |
bogdanm | 85:024bf7f99721 | 288 | #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */ |
bogdanm | 85:024bf7f99721 | 289 | #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */ |
bogdanm | 85:024bf7f99721 | 290 | #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF)) |
bogdanm | 85:024bf7f99721 | 291 | /** |
bogdanm | 85:024bf7f99721 | 292 | * @} |
bogdanm | 85:024bf7f99721 | 293 | */ |
bogdanm | 85:024bf7f99721 | 294 | |
bogdanm | 85:024bf7f99721 | 295 | /** @defgroup FLASH_OB_RAM_Parity_Check_Enable |
bogdanm | 85:024bf7f99721 | 296 | * @{ |
bogdanm | 85:024bf7f99721 | 297 | */ |
bogdanm | 85:024bf7f99721 | 298 | #define OB_RAM_PARITY_CHECK_SET ((uint8_t)0x00) /*!< RAM parity check enable set */ |
bogdanm | 85:024bf7f99721 | 299 | #define OB_RAM_PARITY_CHECK_RESET ((uint8_t)0x40) /*!< RAM parity check enable reset */ |
bogdanm | 85:024bf7f99721 | 300 | #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_RAM_PARITY_CHECK_SET) || ((PARITY) == OB_RAM_PARITY_CHECK_RESET)) |
bogdanm | 85:024bf7f99721 | 301 | /** |
bogdanm | 85:024bf7f99721 | 302 | * @} |
bogdanm | 85:024bf7f99721 | 303 | */ |
bogdanm | 85:024bf7f99721 | 304 | |
bogdanm | 85:024bf7f99721 | 305 | /** @defgroup FLASH_Flag_definition |
bogdanm | 85:024bf7f99721 | 306 | * @brief Flag definition |
bogdanm | 85:024bf7f99721 | 307 | * @{ |
bogdanm | 85:024bf7f99721 | 308 | */ |
bogdanm | 85:024bf7f99721 | 309 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
bogdanm | 85:024bf7f99721 | 310 | #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */ |
bogdanm | 85:024bf7f99721 | 311 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
bogdanm | 85:024bf7f99721 | 312 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */ |
bogdanm | 85:024bf7f99721 | 313 | |
bogdanm | 85:024bf7f99721 | 314 | #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFC3) == 0x00000000) && ((FLAG) != 0x00000000)) |
bogdanm | 85:024bf7f99721 | 315 | #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PGERR) || \ |
bogdanm | 85:024bf7f99721 | 316 | ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP)) |
bogdanm | 85:024bf7f99721 | 317 | /** |
bogdanm | 85:024bf7f99721 | 318 | * @} |
bogdanm | 85:024bf7f99721 | 319 | */ |
bogdanm | 85:024bf7f99721 | 320 | |
bogdanm | 85:024bf7f99721 | 321 | /** @defgroup FLASH_Interrupt_definition |
bogdanm | 85:024bf7f99721 | 322 | * @brief FLASH Interrupt definition |
bogdanm | 85:024bf7f99721 | 323 | * @{ |
bogdanm | 85:024bf7f99721 | 324 | */ |
bogdanm | 85:024bf7f99721 | 325 | #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */ |
bogdanm | 85:024bf7f99721 | 326 | #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error Interrupt source */ |
bogdanm | 85:024bf7f99721 | 327 | #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && ((IT) != 0x00000000)) |
bogdanm | 85:024bf7f99721 | 328 | /** |
bogdanm | 85:024bf7f99721 | 329 | * @} |
bogdanm | 85:024bf7f99721 | 330 | */ |
bogdanm | 85:024bf7f99721 | 331 | |
bogdanm | 85:024bf7f99721 | 332 | /** @defgroup FLASH_Timeout_definition |
bogdanm | 85:024bf7f99721 | 333 | * @brief FLASH Timeout definition |
bogdanm | 85:024bf7f99721 | 334 | * @{ |
bogdanm | 85:024bf7f99721 | 335 | */ |
bogdanm | 85:024bf7f99721 | 336 | #define HAL_FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */ |
bogdanm | 85:024bf7f99721 | 337 | /** |
bogdanm | 85:024bf7f99721 | 338 | * @} |
bogdanm | 85:024bf7f99721 | 339 | */ |
bogdanm | 85:024bf7f99721 | 340 | |
bogdanm | 85:024bf7f99721 | 341 | /** |
bogdanm | 85:024bf7f99721 | 342 | * @} |
bogdanm | 85:024bf7f99721 | 343 | */ |
bogdanm | 85:024bf7f99721 | 344 | |
bogdanm | 85:024bf7f99721 | 345 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 346 | |
bogdanm | 85:024bf7f99721 | 347 | /** @defgroup FLASH_Exported_Macros |
bogdanm | 85:024bf7f99721 | 348 | * @brief macros to control FLASH features |
bogdanm | 85:024bf7f99721 | 349 | * @{ |
bogdanm | 85:024bf7f99721 | 350 | */ |
bogdanm | 85:024bf7f99721 | 351 | |
bogdanm | 85:024bf7f99721 | 352 | /** |
bogdanm | 85:024bf7f99721 | 353 | * @brief Set the FLASH Latency. |
bogdanm | 85:024bf7f99721 | 354 | * @param __LATENCY__: FLASH Latency |
bogdanm | 85:024bf7f99721 | 355 | * The value of this parameter depend on device used within the same series |
bogdanm | 85:024bf7f99721 | 356 | * @retval None |
bogdanm | 85:024bf7f99721 | 357 | */ |
bogdanm | 85:024bf7f99721 | 358 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__)) |
bogdanm | 85:024bf7f99721 | 359 | |
bogdanm | 85:024bf7f99721 | 360 | /** |
bogdanm | 85:024bf7f99721 | 361 | * @brief Enable the FLASH prefetch buffer. |
bogdanm | 85:024bf7f99721 | 362 | * @param None |
bogdanm | 85:024bf7f99721 | 363 | * @retval None |
bogdanm | 85:024bf7f99721 | 364 | */ |
bogdanm | 85:024bf7f99721 | 365 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE) |
bogdanm | 85:024bf7f99721 | 366 | |
bogdanm | 85:024bf7f99721 | 367 | /** |
bogdanm | 85:024bf7f99721 | 368 | * @brief Disable the FLASH prefetch buffer. |
bogdanm | 85:024bf7f99721 | 369 | * @param None |
bogdanm | 85:024bf7f99721 | 370 | * @retval None |
bogdanm | 85:024bf7f99721 | 371 | */ |
bogdanm | 85:024bf7f99721 | 372 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE)) |
bogdanm | 85:024bf7f99721 | 373 | |
bogdanm | 85:024bf7f99721 | 374 | /** |
bogdanm | 85:024bf7f99721 | 375 | * @} |
bogdanm | 85:024bf7f99721 | 376 | */ |
bogdanm | 85:024bf7f99721 | 377 | |
bogdanm | 85:024bf7f99721 | 378 | /** @defgroup FLASH_Interrupt |
bogdanm | 85:024bf7f99721 | 379 | * @brief macros to handle FLASH interrupts |
bogdanm | 85:024bf7f99721 | 380 | * @{ |
bogdanm | 85:024bf7f99721 | 381 | */ |
bogdanm | 85:024bf7f99721 | 382 | |
bogdanm | 85:024bf7f99721 | 383 | /** |
bogdanm | 85:024bf7f99721 | 384 | * @brief Enable the specified FLASH interrupt. |
bogdanm | 85:024bf7f99721 | 385 | * @param __INTERRUPT__ : FLASH interrupt |
bogdanm | 85:024bf7f99721 | 386 | * This parameter can be any combination of the following values: |
bogdanm | 85:024bf7f99721 | 387 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
bogdanm | 85:024bf7f99721 | 388 | * @arg FLASH_IT_ERR: Error Interrupt |
bogdanm | 85:024bf7f99721 | 389 | * @retval none |
bogdanm | 85:024bf7f99721 | 390 | */ |
bogdanm | 85:024bf7f99721 | 391 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
bogdanm | 85:024bf7f99721 | 392 | |
bogdanm | 85:024bf7f99721 | 393 | /** |
bogdanm | 85:024bf7f99721 | 394 | * @brief Disable the specified FLASH interrupt. |
bogdanm | 85:024bf7f99721 | 395 | * @param __INTERRUPT__ : FLASH interrupt |
bogdanm | 85:024bf7f99721 | 396 | * This parameter can be any combination of the following values: |
bogdanm | 85:024bf7f99721 | 397 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
bogdanm | 85:024bf7f99721 | 398 | * @arg FLASH_IT_ERR: Error Interrupt |
bogdanm | 85:024bf7f99721 | 399 | * @retval none |
bogdanm | 85:024bf7f99721 | 400 | */ |
bogdanm | 85:024bf7f99721 | 401 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__)) |
bogdanm | 85:024bf7f99721 | 402 | |
bogdanm | 85:024bf7f99721 | 403 | /** |
bogdanm | 85:024bf7f99721 | 404 | * @brief Get the specified FLASH flag status. |
bogdanm | 85:024bf7f99721 | 405 | * @param __FLAG__: specifies the FLASH flag to check. |
bogdanm | 85:024bf7f99721 | 406 | * This parameter can be one of the following values: |
bogdanm | 85:024bf7f99721 | 407 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
bogdanm | 85:024bf7f99721 | 408 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 85:024bf7f99721 | 409 | * @arg FLASH_FLAG_PGERR : FLASH Programming error flag |
bogdanm | 85:024bf7f99721 | 410 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
bogdanm | 85:024bf7f99721 | 411 | * @retval The new state of __FLAG__ (SET or RESET). |
bogdanm | 85:024bf7f99721 | 412 | */ |
bogdanm | 85:024bf7f99721 | 413 | #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)) == (__FLAG__)) |
bogdanm | 85:024bf7f99721 | 414 | |
bogdanm | 85:024bf7f99721 | 415 | /** |
bogdanm | 85:024bf7f99721 | 416 | * @brief Clear the specified FLASH flag. |
bogdanm | 85:024bf7f99721 | 417 | * @param __FLAG__: specifies the FLASH flags to clear. |
bogdanm | 85:024bf7f99721 | 418 | * This parameter can be any combination of the following values: |
bogdanm | 85:024bf7f99721 | 419 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
bogdanm | 85:024bf7f99721 | 420 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
bogdanm | 85:024bf7f99721 | 421 | * @arg FLASH_FLAG_PGERR : FLASH Programming error flag |
bogdanm | 85:024bf7f99721 | 422 | * @retval none |
bogdanm | 85:024bf7f99721 | 423 | */ |
bogdanm | 85:024bf7f99721 | 424 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__)) |
bogdanm | 85:024bf7f99721 | 425 | |
bogdanm | 85:024bf7f99721 | 426 | /** |
bogdanm | 85:024bf7f99721 | 427 | * @} |
bogdanm | 85:024bf7f99721 | 428 | */ |
bogdanm | 85:024bf7f99721 | 429 | |
bogdanm | 85:024bf7f99721 | 430 | /* Include FLASH HAL Extension module */ |
bogdanm | 85:024bf7f99721 | 431 | #include "stm32f0xx_hal_flash_ex.h" |
bogdanm | 85:024bf7f99721 | 432 | |
bogdanm | 85:024bf7f99721 | 433 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 434 | /** @defgroup FLASH_Exported_Functions |
bogdanm | 85:024bf7f99721 | 435 | * @{ |
bogdanm | 85:024bf7f99721 | 436 | */ |
bogdanm | 85:024bf7f99721 | 437 | |
bogdanm | 85:024bf7f99721 | 438 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 439 | /* IO operation functions *****************************************************/ |
bogdanm | 85:024bf7f99721 | 440 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 85:024bf7f99721 | 441 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); |
bogdanm | 85:024bf7f99721 | 442 | |
bogdanm | 85:024bf7f99721 | 443 | /* FLASH IRQ handler method */ |
bogdanm | 85:024bf7f99721 | 444 | void HAL_FLASH_IRQHandler(void); |
bogdanm | 85:024bf7f99721 | 445 | /* Callbacks in non blocking modes */ |
bogdanm | 85:024bf7f99721 | 446 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); |
bogdanm | 85:024bf7f99721 | 447 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); |
bogdanm | 85:024bf7f99721 | 448 | |
bogdanm | 85:024bf7f99721 | 449 | /* Peripheral Control functions ***********************************************/ |
bogdanm | 85:024bf7f99721 | 450 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); |
bogdanm | 85:024bf7f99721 | 451 | HAL_StatusTypeDef HAL_FLASH_Lock(void); |
bogdanm | 85:024bf7f99721 | 452 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); |
bogdanm | 85:024bf7f99721 | 453 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); |
bogdanm | 85:024bf7f99721 | 454 | /* Option bytes control */ |
bogdanm | 85:024bf7f99721 | 455 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); |
bogdanm | 85:024bf7f99721 | 456 | |
bogdanm | 85:024bf7f99721 | 457 | /* Peripheral State and Error functions ***************************************/ |
bogdanm | 85:024bf7f99721 | 458 | FLASH_ErrorTypeDef HAL_FLASH_GetError(void); |
bogdanm | 85:024bf7f99721 | 459 | |
bogdanm | 85:024bf7f99721 | 460 | /** |
bogdanm | 85:024bf7f99721 | 461 | * @} |
bogdanm | 85:024bf7f99721 | 462 | */ |
bogdanm | 85:024bf7f99721 | 463 | |
bogdanm | 85:024bf7f99721 | 464 | /** |
bogdanm | 85:024bf7f99721 | 465 | * @} |
bogdanm | 85:024bf7f99721 | 466 | */ |
bogdanm | 85:024bf7f99721 | 467 | |
bogdanm | 85:024bf7f99721 | 468 | /** |
bogdanm | 85:024bf7f99721 | 469 | * @} |
bogdanm | 85:024bf7f99721 | 470 | */ |
bogdanm | 85:024bf7f99721 | 471 | |
bogdanm | 85:024bf7f99721 | 472 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 473 | } |
bogdanm | 85:024bf7f99721 | 474 | #endif |
bogdanm | 85:024bf7f99721 | 475 | |
bogdanm | 85:024bf7f99721 | 476 | #endif /* __STM32F0xx_HAL_FLASH_H */ |
bogdanm | 85:024bf7f99721 | 477 | |
bogdanm | 85:024bf7f99721 | 478 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |