mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Jan 27 14:30:07 2014 +0000
Revision:
76:aeb1df146756
Child:
106:ced8cbb51063
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd

Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/

Add NUCLEO_L152RE

Who changed what in which revision?

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