version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
erezi
Date:
Wed Jun 25 06:08:49 2014 +0000
Revision:
86:4f9a848d74c7
Parent:
81:7d30d6019079
version_2.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32f0xx_flash.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
emilmont 77:869cf507173a 5 * @version V1.3.0
emilmont 77:869cf507173a 6 * @date 16-January-2014
emilmont 77:869cf507173a 7 * @brief This file contains all the functions prototypes for the FLASH
emilmont 77:869cf507173a 8 * firmware library.
emilmont 77:869cf507173a 9 ******************************************************************************
emilmont 77:869cf507173a 10 * @attention
emilmont 77:869cf507173a 11 *
bogdanm 81:7d30d6019079 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 13 *
bogdanm 81:7d30d6019079 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 81:7d30d6019079 15 * are permitted provided that the following conditions are met:
bogdanm 81:7d30d6019079 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 81:7d30d6019079 17 * this list of conditions and the following disclaimer.
bogdanm 81:7d30d6019079 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 81:7d30d6019079 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 81:7d30d6019079 20 * and/or other materials provided with the distribution.
bogdanm 81:7d30d6019079 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 81:7d30d6019079 22 * may be used to endorse or promote products derived from this software
bogdanm 81:7d30d6019079 23 * without specific prior written permission.
emilmont 77:869cf507173a 24 *
bogdanm 81:7d30d6019079 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 81:7d30d6019079 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 81:7d30d6019079 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 81:7d30d6019079 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 81:7d30d6019079 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 81:7d30d6019079 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 81:7d30d6019079 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 81:7d30d6019079 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 81:7d30d6019079 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 81:7d30d6019079 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 35 *
emilmont 77:869cf507173a 36 ******************************************************************************
emilmont 77:869cf507173a 37 */
emilmont 77:869cf507173a 38
emilmont 77:869cf507173a 39 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 40 #ifndef __STM32F0XX_FLASH_H
emilmont 77:869cf507173a 41 #define __STM32F0XX_FLASH_H
emilmont 77:869cf507173a 42
emilmont 77:869cf507173a 43 #ifdef __cplusplus
emilmont 77:869cf507173a 44 extern "C" {
emilmont 77:869cf507173a 45 #endif
emilmont 77:869cf507173a 46
emilmont 77:869cf507173a 47 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 48 #include "stm32f0xx.h"
emilmont 77:869cf507173a 49
emilmont 77:869cf507173a 50 /** @addtogroup STM32F0xx_StdPeriph_Driver
emilmont 77:869cf507173a 51 * @{
emilmont 77:869cf507173a 52 */
emilmont 77:869cf507173a 53
emilmont 77:869cf507173a 54 /** @addtogroup FLASH
emilmont 77:869cf507173a 55 * @{
emilmont 77:869cf507173a 56 */
emilmont 77:869cf507173a 57
emilmont 77:869cf507173a 58 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 59
emilmont 77:869cf507173a 60 /**
emilmont 77:869cf507173a 61 * @brief FLASH Status
emilmont 77:869cf507173a 62 */
emilmont 77:869cf507173a 63 typedef enum
emilmont 77:869cf507173a 64 {
emilmont 77:869cf507173a 65 FLASH_BUSY = 1,
emilmont 77:869cf507173a 66 FLASH_ERROR_WRP,
emilmont 77:869cf507173a 67 FLASH_ERROR_PROGRAM,
emilmont 77:869cf507173a 68 FLASH_COMPLETE,
emilmont 77:869cf507173a 69 FLASH_TIMEOUT
emilmont 77:869cf507173a 70 }FLASH_Status;
emilmont 77:869cf507173a 71
emilmont 77:869cf507173a 72 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 73
emilmont 77:869cf507173a 74 /** @defgroup FLASH_Exported_Constants
emilmont 77:869cf507173a 75 * @{
emilmont 77:869cf507173a 76 */
emilmont 77:869cf507173a 77
emilmont 77:869cf507173a 78 /** @defgroup FLASH_Latency
emilmont 77:869cf507173a 79 * @{
emilmont 77:869cf507173a 80 */
emilmont 77:869cf507173a 81 #define FLASH_Latency_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
emilmont 77:869cf507173a 82 #define FLASH_Latency_1 FLASH_ACR_LATENCY /*!< FLASH One Latency cycle */
emilmont 77:869cf507173a 83
emilmont 77:869cf507173a 84 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \
emilmont 77:869cf507173a 85 ((LATENCY) == FLASH_Latency_1))
emilmont 77:869cf507173a 86 /**
emilmont 77:869cf507173a 87 * @}
emilmont 77:869cf507173a 88 */
emilmont 77:869cf507173a 89
emilmont 77:869cf507173a 90 /** @defgroup FLASH_Interrupts
emilmont 77:869cf507173a 91 * @{
emilmont 77:869cf507173a 92 */
emilmont 77:869cf507173a 93
emilmont 77:869cf507173a 94 #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of programming interrupt source */
emilmont 77:869cf507173a 95 #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error interrupt source */
emilmont 77:869cf507173a 96 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000)))
emilmont 77:869cf507173a 97 /**
emilmont 77:869cf507173a 98 * @}
emilmont 77:869cf507173a 99 */
emilmont 77:869cf507173a 100
emilmont 77:869cf507173a 101 /** @defgroup FLASH_Address
emilmont 77:869cf507173a 102 * @{
emilmont 77:869cf507173a 103 */
emilmont 77:869cf507173a 104 #ifndef STM32F072
emilmont 77:869cf507173a 105 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0800FFFF))
emilmont 77:869cf507173a 106 #else
emilmont 77:869cf507173a 107 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0801FFFF))
emilmont 77:869cf507173a 108 #endif /* STM32F072 */
emilmont 77:869cf507173a 109 /**
emilmont 77:869cf507173a 110 * @}
emilmont 77:869cf507173a 111 */
emilmont 77:869cf507173a 112
emilmont 77:869cf507173a 113 /** @defgroup FLASH_OB_DATA_ADDRESS
emilmont 77:869cf507173a 114 * @{
emilmont 77:869cf507173a 115 */
emilmont 77:869cf507173a 116 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806))
emilmont 77:869cf507173a 117
emilmont 77:869cf507173a 118 /**
emilmont 77:869cf507173a 119 * @}
emilmont 77:869cf507173a 120 */
emilmont 77:869cf507173a 121
emilmont 77:869cf507173a 122 /** @defgroup FLASH_Option_Bytes_Write_Protection
emilmont 77:869cf507173a 123 * @{
emilmont 77:869cf507173a 124 */
emilmont 77:869cf507173a 125
emilmont 77:869cf507173a 126 #ifndef STM32F072
emilmont 77:869cf507173a 127
emilmont 77:869cf507173a 128 #define OB_WRP_Pages0to3 ((uint32_t)0x00000001) /* Write protection of page 0 to 3 */
emilmont 77:869cf507173a 129 #define OB_WRP_Pages4to7 ((uint32_t)0x00000002) /* Write protection of page 4 to 7 */
emilmont 77:869cf507173a 130 #define OB_WRP_Pages8to11 ((uint32_t)0x00000004) /* Write protection of page 8 to 11 */
emilmont 77:869cf507173a 131 #define OB_WRP_Pages12to15 ((uint32_t)0x00000008) /* Write protection of page 12 to 15 */
emilmont 77:869cf507173a 132 #define OB_WRP_Pages16to19 ((uint32_t)0x00000010) /* Write protection of page 16 to 19 */
emilmont 77:869cf507173a 133 #define OB_WRP_Pages20to23 ((uint32_t)0x00000020) /* Write protection of page 20 to 23 */
emilmont 77:869cf507173a 134 #define OB_WRP_Pages24to27 ((uint32_t)0x00000040) /* Write protection of page 24 to 27 */
emilmont 77:869cf507173a 135 #define OB_WRP_Pages28to31 ((uint32_t)0x00000080) /* Write protection of page 28 to 31 */
emilmont 77:869cf507173a 136 #define OB_WRP_Pages32to35 ((uint32_t)0x00000100) /* Write protection of page 32 to 35 */
emilmont 77:869cf507173a 137 #define OB_WRP_Pages36to39 ((uint32_t)0x00000200) /* Write protection of page 36 to 39 */
emilmont 77:869cf507173a 138 #define OB_WRP_Pages40to43 ((uint32_t)0x00000400) /* Write protection of page 40 to 43 */
emilmont 77:869cf507173a 139 #define OB_WRP_Pages44to47 ((uint32_t)0x00000800) /* Write protection of page 44 to 47 */
emilmont 77:869cf507173a 140 #define OB_WRP_Pages48to51 ((uint32_t)0x00001000) /* Write protection of page 48 to 51 */
emilmont 77:869cf507173a 141 #define OB_WRP_Pages52to55 ((uint32_t)0x00002000) /* Write protection of page 52 to 55 */
emilmont 77:869cf507173a 142 #define OB_WRP_Pages56to59 ((uint32_t)0x00004000) /* Write protection of page 56 to 59 */
emilmont 77:869cf507173a 143 #define OB_WRP_Pages60to63 ((uint32_t)0x00008000) /* Write protection of page 60 to 63 */
emilmont 77:869cf507173a 144
emilmont 77:869cf507173a 145 #define OB_WRP_AllPages ((uint32_t)0x0000FFFF) /*!< Write protection of all Sectors */
emilmont 77:869cf507173a 146
emilmont 77:869cf507173a 147 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
emilmont 77:869cf507173a 148
emilmont 77:869cf507173a 149 #else
emilmont 77:869cf507173a 150
emilmont 77:869cf507173a 151 #define OB_WRP_Pages0to1 ((uint32_t)0x00000001) /* Write protection of page 0 to 1 */
emilmont 77:869cf507173a 152 #define OB_WRP_Pages2to3 ((uint32_t)0x00000002) /* Write protection of page 2 to 3 */
emilmont 77:869cf507173a 153 #define OB_WRP_Pages4to5 ((uint32_t)0x00000004) /* Write protection of page 4 to 5 */
emilmont 77:869cf507173a 154 #define OB_WRP_Pages6to7 ((uint32_t)0x00000008) /* Write protection of page 6 to 7 */
emilmont 77:869cf507173a 155 #define OB_WRP_Pages8to9 ((uint32_t)0x00000010) /* Write protection of page 8 to 9 */
emilmont 77:869cf507173a 156 #define OB_WRP_Pages10to11 ((uint32_t)0x00000020) /* Write protection of page 10 to 11 */
emilmont 77:869cf507173a 157 #define OB_WRP_Pages12to13 ((uint32_t)0x00000040) /* Write protection of page 12 to 13 */
emilmont 77:869cf507173a 158 #define OB_WRP_Pages14to15 ((uint32_t)0x00000080) /* Write protection of page 14 to 15 */
emilmont 77:869cf507173a 159 #define OB_WRP_Pages16to17 ((uint32_t)0x00000100) /* Write protection of page 16 to 17 */
emilmont 77:869cf507173a 160 #define OB_WRP_Pages18to19 ((uint32_t)0x00000200) /* Write protection of page 18 to 19 */
emilmont 77:869cf507173a 161 #define OB_WRP_Pages20to21 ((uint32_t)0x00000400) /* Write protection of page 20 to 21 */
emilmont 77:869cf507173a 162 #define OB_WRP_Pages22to23 ((uint32_t)0x00000800) /* Write protection of page 22 to 23 */
emilmont 77:869cf507173a 163 #define OB_WRP_Pages24to25 ((uint32_t)0x00001000) /* Write protection of page 24 to 25 */
emilmont 77:869cf507173a 164 #define OB_WRP_Pages26to27 ((uint32_t)0x00002000) /* Write protection of page 26 to 27 */
emilmont 77:869cf507173a 165 #define OB_WRP_Pages28to29 ((uint32_t)0x00004000) /* Write protection of page 28 to 29 */
emilmont 77:869cf507173a 166 #define OB_WRP_Pages30to31 ((uint32_t)0x00008000) /* Write protection of page 30 to 31 */
emilmont 77:869cf507173a 167 #define OB_WRP_Pages32to33 ((uint32_t)0x00010000) /* Write protection of page 32 to 33 */
emilmont 77:869cf507173a 168 #define OB_WRP_Pages34to35 ((uint32_t)0x00020000) /* Write protection of page 34 to 35 */
emilmont 77:869cf507173a 169 #define OB_WRP_Pages36to37 ((uint32_t)0x00040000) /* Write protection of page 36 to 37 */
emilmont 77:869cf507173a 170 #define OB_WRP_Pages38to39 ((uint32_t)0x00080000) /* Write protection of page 38 to 39 */
emilmont 77:869cf507173a 171 #define OB_WRP_Pages40to41 ((uint32_t)0x00100000) /* Write protection of page 40 to 41 */
emilmont 77:869cf507173a 172 #define OB_WRP_Pages42to43 ((uint32_t)0x00200000) /* Write protection of page 42 to 43 */
emilmont 77:869cf507173a 173 #define OB_WRP_Pages44to45 ((uint32_t)0x00400000) /* Write protection of page 44 to 45 */
emilmont 77:869cf507173a 174 #define OB_WRP_Pages46to47 ((uint32_t)0x00800000) /* Write protection of page 46 to 47 */
emilmont 77:869cf507173a 175 #define OB_WRP_Pages48to49 ((uint32_t)0x01000000) /* Write protection of page 48 to 49 */
emilmont 77:869cf507173a 176 #define OB_WRP_Pages50to51 ((uint32_t)0x02000000) /* Write protection of page 50 to 51 */
emilmont 77:869cf507173a 177 #define OB_WRP_Pages52to53 ((uint32_t)0x04000000) /* Write protection of page 52 to 53 */
emilmont 77:869cf507173a 178 #define OB_WRP_Pages54to55 ((uint32_t)0x08000000) /* Write protection of page 54 to 55 */
emilmont 77:869cf507173a 179 #define OB_WRP_Pages56to57 ((uint32_t)0x10000000) /* Write protection of page 56 to 57 */
emilmont 77:869cf507173a 180 #define OB_WRP_Pages58to59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */
emilmont 77:869cf507173a 181 #define OB_WRP_Pages60to61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */
emilmont 77:869cf507173a 182 #define OB_WRP_Pages62to63 ((uint32_t)0x80000000) /* Write protection of page 62 to 63 */
emilmont 77:869cf507173a 183
emilmont 77:869cf507173a 184 #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */
emilmont 77:869cf507173a 185
emilmont 77:869cf507173a 186 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
emilmont 77:869cf507173a 187
emilmont 77:869cf507173a 188 #endif /* STM32F072 */
emilmont 77:869cf507173a 189
emilmont 77:869cf507173a 190 /**
emilmont 77:869cf507173a 191 * @}
emilmont 77:869cf507173a 192 */
emilmont 77:869cf507173a 193
emilmont 77:869cf507173a 194 /** @defgroup FLASH_Option_Bytes_Read_Protection
emilmont 77:869cf507173a 195 * @{
emilmont 77:869cf507173a 196 */
emilmont 77:869cf507173a 197
emilmont 77:869cf507173a 198 /**
emilmont 77:869cf507173a 199 * @brief FLASH_Read Protection Level
emilmont 77:869cf507173a 200 */
emilmont 77:869cf507173a 201 #define OB_RDP_Level_0 ((uint8_t)0xAA)
emilmont 77:869cf507173a 202 #define OB_RDP_Level_1 ((uint8_t)0xBB)
emilmont 77:869cf507173a 203 /*#define OB_RDP_Level_2 ((uint8_t)0xCC)*/ /* Warning: When enabling read protection level 2
emilmont 77:869cf507173a 204 it's no more possible to go back to level 1 or 0 */
emilmont 77:869cf507173a 205
emilmont 77:869cf507173a 206 #define IS_OB_RDP(LEVEL) (((LEVEL) == OB_RDP_Level_0)||\
emilmont 77:869cf507173a 207 ((LEVEL) == OB_RDP_Level_1))/*||\
emilmont 77:869cf507173a 208 ((LEVEL) == OB_RDP_Level_2))*/
emilmont 77:869cf507173a 209 /**
emilmont 77:869cf507173a 210 * @}
emilmont 77:869cf507173a 211 */
emilmont 77:869cf507173a 212
emilmont 77:869cf507173a 213 /** @defgroup FLASH_Option_Bytes_IWatchdog
emilmont 77:869cf507173a 214 * @{
emilmont 77:869cf507173a 215 */
emilmont 77:869cf507173a 216
emilmont 77:869cf507173a 217 #define OB_IWDG_SW ((uint8_t)0x01) /*!< Software IWDG selected */
emilmont 77:869cf507173a 218 #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */
emilmont 77:869cf507173a 219 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
emilmont 77:869cf507173a 220
emilmont 77:869cf507173a 221 /**
emilmont 77:869cf507173a 222 * @}
emilmont 77:869cf507173a 223 */
emilmont 77:869cf507173a 224
emilmont 77:869cf507173a 225 /** @defgroup FLASH_Option_Bytes_nRST_STOP
emilmont 77:869cf507173a 226 * @{
emilmont 77:869cf507173a 227 */
emilmont 77:869cf507173a 228
emilmont 77:869cf507173a 229 #define OB_STOP_NoRST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
emilmont 77:869cf507173a 230 #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */
emilmont 77:869cf507173a 231 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST))
emilmont 77:869cf507173a 232
emilmont 77:869cf507173a 233 /**
emilmont 77:869cf507173a 234 * @}
emilmont 77:869cf507173a 235 */
emilmont 77:869cf507173a 236
emilmont 77:869cf507173a 237 /** @defgroup FLASH_Option_Bytes_nRST_STDBY
emilmont 77:869cf507173a 238 * @{
emilmont 77:869cf507173a 239 */
emilmont 77:869cf507173a 240
emilmont 77:869cf507173a 241 #define OB_STDBY_NoRST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
emilmont 77:869cf507173a 242 #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */
emilmont 77:869cf507173a 243 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST))
emilmont 77:869cf507173a 244
emilmont 77:869cf507173a 245 /**
emilmont 77:869cf507173a 246 * @}
emilmont 77:869cf507173a 247 */
emilmont 77:869cf507173a 248
emilmont 77:869cf507173a 249 /** @defgroup FLASH_Option_Bytes_BOOT1
emilmont 77:869cf507173a 250 * @{
emilmont 77:869cf507173a 251 */
emilmont 77:869cf507173a 252
emilmont 77:869cf507173a 253 #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */
emilmont 77:869cf507173a 254 #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */
emilmont 77:869cf507173a 255 #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET))
emilmont 77:869cf507173a 256
emilmont 77:869cf507173a 257 /**
emilmont 77:869cf507173a 258 * @}
emilmont 77:869cf507173a 259 */
emilmont 77:869cf507173a 260
emilmont 77:869cf507173a 261 /** @defgroup FLASH_Option_Bytes_BOOT0
emilmont 77:869cf507173a 262 * @{
emilmont 77:869cf507173a 263 */
emilmont 77:869cf507173a 264
emilmont 77:869cf507173a 265 #define OB_BOOT0_RESET ((uint8_t)0x00) /*!< BOOT0 Reset */
emilmont 77:869cf507173a 266 #define OB_BOOT0_SET ((uint8_t)0x08) /*!< BOOT0 Set */
emilmont 77:869cf507173a 267 #define IS_OB_BOOT0(BOOT0) (((BOOT0) == OB_BOOT0_RESET) || ((BOOT0) == OB_BOOT0_SET))
emilmont 77:869cf507173a 268
emilmont 77:869cf507173a 269 /**
emilmont 77:869cf507173a 270 * @}
emilmont 77:869cf507173a 271 */
emilmont 77:869cf507173a 272
emilmont 77:869cf507173a 273 /** @defgroup FLASH_Option_Bytes_BOOT0SW
emilmont 77:869cf507173a 274 * @{
emilmont 77:869cf507173a 275 */
emilmont 77:869cf507173a 276
emilmont 77:869cf507173a 277 #define OB_BOOT0_SW ((uint8_t)0x00) /*!< BOOT0 pin disabled */
emilmont 77:869cf507173a 278 #define OB_BOOT0_HW ((uint8_t)0x80) /*!< BOOT0 pin bonded with GPIO */
emilmont 77:869cf507173a 279 #define IS_OB_BOOT0SW(BOOT0) (((BOOT0) == OB_BOOT0_SW) || ((BOOT0) == OB_BOOT0_HW))
emilmont 77:869cf507173a 280
emilmont 77:869cf507173a 281 /**
emilmont 77:869cf507173a 282 * @}
emilmont 77:869cf507173a 283 */
emilmont 77:869cf507173a 284
emilmont 77:869cf507173a 285 /** @defgroup FLASH_Option_Bytes_VDDA_Analog_Monitoring
emilmont 77:869cf507173a 286 * @{
emilmont 77:869cf507173a 287 */
emilmont 77:869cf507173a 288
emilmont 77:869cf507173a 289 #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */
emilmont 77:869cf507173a 290 #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */
emilmont 77:869cf507173a 291
emilmont 77:869cf507173a 292 #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
emilmont 77:869cf507173a 293
emilmont 77:869cf507173a 294 /**
emilmont 77:869cf507173a 295 * @}
emilmont 77:869cf507173a 296 */
emilmont 77:869cf507173a 297
emilmont 77:869cf507173a 298 /** @defgroup FLASH_Option_Bytes_SRAM_Parity_Enable
emilmont 77:869cf507173a 299 * @{
emilmont 77:869cf507173a 300 */
emilmont 77:869cf507173a 301
emilmont 77:869cf507173a 302 #define OB_SRAM_PARITY_SET ((uint8_t)0x00) /*!< SRAM parity enable Set */
emilmont 77:869cf507173a 303 #define OB_SRAM_PARITY_RESET ((uint8_t)0x40) /*!< SRAM parity enable reset */
emilmont 77:869cf507173a 304
emilmont 77:869cf507173a 305 #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET))
emilmont 77:869cf507173a 306
emilmont 77:869cf507173a 307 /**
emilmont 77:869cf507173a 308 * @}
emilmont 77:869cf507173a 309 */
emilmont 77:869cf507173a 310
emilmont 77:869cf507173a 311 /** @defgroup FLASH_Flags
emilmont 77:869cf507173a 312 * @{
emilmont 77:869cf507173a 313 */
emilmont 77:869cf507173a 314
emilmont 77:869cf507173a 315 #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
emilmont 77:869cf507173a 316 #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */
emilmont 77:869cf507173a 317 #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */
emilmont 77:869cf507173a 318 #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Programming flag */
emilmont 77:869cf507173a 319
emilmont 77:869cf507173a 320 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCB) == 0x00000000) && ((FLAG) != 0x00000000))
emilmont 77:869cf507173a 321
emilmont 77:869cf507173a 322 #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PGERR) || \
emilmont 77:869cf507173a 323 ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP))
emilmont 77:869cf507173a 324 /**
emilmont 77:869cf507173a 325 * @}
emilmont 77:869cf507173a 326 */
emilmont 77:869cf507173a 327
emilmont 77:869cf507173a 328 /** @defgroup FLASH_Timeout_definition
emilmont 77:869cf507173a 329 * @{
emilmont 77:869cf507173a 330 */
emilmont 77:869cf507173a 331 #define FLASH_ER_PRG_TIMEOUT ((uint32_t)0x000B0000)
emilmont 77:869cf507173a 332
emilmont 77:869cf507173a 333 /**
emilmont 77:869cf507173a 334 * @}
emilmont 77:869cf507173a 335 */
emilmont 77:869cf507173a 336
emilmont 77:869cf507173a 337 /** @defgroup FLASH_Legacy
emilmont 77:869cf507173a 338 * @{
emilmont 77:869cf507173a 339 */
emilmont 77:869cf507173a 340 #define FLASH_WRProt_Pages0to3 OB_WRP_Pages0to3
emilmont 77:869cf507173a 341 #define FLASH_WRProt_Pages4to7 OB_WRP_Pages4to7
emilmont 77:869cf507173a 342 #define FLASH_WRProt_Pages8to11 OB_WRP_Pages8to11
emilmont 77:869cf507173a 343 #define FLASH_WRProt_Pages12to15 OB_WRP_Pages12to15
emilmont 77:869cf507173a 344 #define FLASH_WRProt_Pages16to19 OB_WRP_Pages16to19
emilmont 77:869cf507173a 345 #define FLASH_WRProt_Pages20to23 OB_WRP_Pages20to23
emilmont 77:869cf507173a 346 #define FLASH_WRProt_Pages24to27 OB_WRP_Pages24to27
emilmont 77:869cf507173a 347 #define FLASH_WRProt_Pages28to31 OB_WRP_Pages28to31
emilmont 77:869cf507173a 348 #define FLASH_WRProt_Pages32to35 OB_WRP_Pages32to35
emilmont 77:869cf507173a 349 #define FLASH_WRProt_Pages36to39 OB_WRP_Pages36to39
emilmont 77:869cf507173a 350 #define FLASH_WRProt_Pages40to43 OB_WRP_Pages40to21
emilmont 77:869cf507173a 351 #define FLASH_WRProt_Pages44to47 OB_WRP_Pages44to23
emilmont 77:869cf507173a 352 #define FLASH_WRProt_Pages48to51 OB_WRP_Pages48to51
emilmont 77:869cf507173a 353 #define FLASH_WRProt_Pages52to55 OB_WRP_Pages52to55
emilmont 77:869cf507173a 354 #define FLASH_WRProt_Pages56to59 OB_WRP_Pages56to59
emilmont 77:869cf507173a 355 #define FLASH_WRProt_Pages60to63 OB_WRP_Pages60to63
emilmont 77:869cf507173a 356
emilmont 77:869cf507173a 357
emilmont 77:869cf507173a 358 #define FLASH_WRProt_AllPages OB_WRP_AllPages
emilmont 77:869cf507173a 359 /**
emilmont 77:869cf507173a 360 * @}
emilmont 77:869cf507173a 361 */
emilmont 77:869cf507173a 362
emilmont 77:869cf507173a 363 /**
emilmont 77:869cf507173a 364 * @}
emilmont 77:869cf507173a 365 */
emilmont 77:869cf507173a 366
emilmont 77:869cf507173a 367 /* Exported macro ------------------------------------------------------------*/
emilmont 77:869cf507173a 368 /* Exported functions ------------------------------------------------------- */
emilmont 77:869cf507173a 369
emilmont 77:869cf507173a 370 /**
emilmont 77:869cf507173a 371 * @brief FLASH memory functions that can be executed from FLASH.
emilmont 77:869cf507173a 372 */
emilmont 77:869cf507173a 373 /* FLASH Interface configuration functions ************************************/
emilmont 77:869cf507173a 374 void FLASH_SetLatency(uint32_t FLASH_Latency);
emilmont 77:869cf507173a 375 void FLASH_PrefetchBufferCmd(FunctionalState NewState);
emilmont 77:869cf507173a 376 FlagStatus FLASH_GetPrefetchBufferStatus(void);
emilmont 77:869cf507173a 377
emilmont 77:869cf507173a 378 /* FLASH Memory Programming functions *****************************************/
emilmont 77:869cf507173a 379 void FLASH_Unlock(void);
emilmont 77:869cf507173a 380 void FLASH_Lock(void);
emilmont 77:869cf507173a 381 FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
emilmont 77:869cf507173a 382 FLASH_Status FLASH_EraseAllPages(void);
emilmont 77:869cf507173a 383 FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
emilmont 77:869cf507173a 384 FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
emilmont 77:869cf507173a 385
emilmont 77:869cf507173a 386 /* FLASH Option Bytes Programming functions *****************************************/
emilmont 77:869cf507173a 387 void FLASH_OB_Unlock(void);
emilmont 77:869cf507173a 388 void FLASH_OB_Lock(void);
emilmont 77:869cf507173a 389 void FLASH_OB_Launch(void);
emilmont 77:869cf507173a 390 FLASH_Status FLASH_OB_Erase(void);
emilmont 77:869cf507173a 391 FLASH_Status FLASH_OB_EnableWRP(uint32_t OB_WRP);
emilmont 77:869cf507173a 392 FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP);
emilmont 77:869cf507173a 393 FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY);
emilmont 77:869cf507173a 394 FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1);
emilmont 77:869cf507173a 395 FLASH_Status FLASH_OB_BOOT0Config(uint8_t OB_BOOT0);
emilmont 77:869cf507173a 396 FLASH_Status FLASH_OB_BOOT0SWConfig(uint8_t OB_BOOT0SW);
emilmont 77:869cf507173a 397 FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG);
emilmont 77:869cf507173a 398 FLASH_Status FLASH_OB_SRAMParityConfig(uint8_t OB_SRAM_Parity);
emilmont 77:869cf507173a 399 FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER);
emilmont 77:869cf507173a 400 FLASH_Status FLASH_OB_ProgramData(uint32_t Address, uint8_t Data);
emilmont 77:869cf507173a 401 uint8_t FLASH_OB_GetUser(void);
emilmont 77:869cf507173a 402 uint32_t FLASH_OB_GetWRP(void);
emilmont 77:869cf507173a 403 FlagStatus FLASH_OB_GetRDP(void);
emilmont 77:869cf507173a 404
emilmont 77:869cf507173a 405 /* FLASH Interrupts and flags management functions **********************************/
emilmont 77:869cf507173a 406 void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState);
emilmont 77:869cf507173a 407 FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG);
emilmont 77:869cf507173a 408 void FLASH_ClearFlag(uint32_t FLASH_FLAG);
emilmont 77:869cf507173a 409 FLASH_Status FLASH_GetStatus(void);
emilmont 77:869cf507173a 410 FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
emilmont 77:869cf507173a 411
emilmont 77:869cf507173a 412 /** @defgroup FLASH_Legacy
emilmont 77:869cf507173a 413 * @{
emilmont 77:869cf507173a 414 */
emilmont 77:869cf507173a 415 #define FLASH_EraseOptionBytes FLASH_OB_Erase
emilmont 77:869cf507173a 416 #define FLASH_EnableWriteProtection FLASH_OB_EnableWRP
emilmont 77:869cf507173a 417 #define FLASH_UserOptionByteConfig FLASH_OB_UserConfig
emilmont 77:869cf507173a 418 #define FLASH_ProgramOptionByteData FLASH_OB_ProgramData
emilmont 77:869cf507173a 419 #define FLASH_GetUserOptionByte FLASH_OB_GetUser
emilmont 77:869cf507173a 420 #define FLASH_GetWriteProtectionOptionByte FLASH_OB_GetWRP
emilmont 77:869cf507173a 421
emilmont 77:869cf507173a 422 /**
emilmont 77:869cf507173a 423 * @}
emilmont 77:869cf507173a 424 */
emilmont 77:869cf507173a 425
emilmont 77:869cf507173a 426 #ifdef __cplusplus
emilmont 77:869cf507173a 427 }
emilmont 77:869cf507173a 428 #endif
emilmont 77:869cf507173a 429
emilmont 77:869cf507173a 430 #endif /* __STM32F0XX_FLASH_H */
emilmont 77:869cf507173a 431
emilmont 77:869cf507173a 432 /**
emilmont 77:869cf507173a 433 * @}
emilmont 77:869cf507173a 434 */
emilmont 77:869cf507173a 435
emilmont 77:869cf507173a 436 /**
emilmont 77:869cf507173a 437 * @}
emilmont 77:869cf507173a 438 */
emilmont 77:869cf507173a 439
emilmont 77:869cf507173a 440 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/