version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_F302R8/stm32f30x_flash.h@86:4f9a848d74c7, 2014-06-25 (annotated)
- Committer:
- erezi
- Date:
- Wed Jun 25 06:08:49 2014 +0000
- Revision:
- 86:4f9a848d74c7
- Parent:
- 82:6473597d706e
version_2.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /** |
bogdanm | 82:6473597d706e | 2 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 3 | * @file stm32f30x_flash.h |
bogdanm | 82:6473597d706e | 4 | * @author MCD Application Team |
bogdanm | 82:6473597d706e | 5 | * @version V1.1.0 |
bogdanm | 82:6473597d706e | 6 | * @date 27-February-2014 |
bogdanm | 82:6473597d706e | 7 | * @brief This file contains all the functions prototypes for the FLASH |
bogdanm | 82:6473597d706e | 8 | * firmware library. |
bogdanm | 82:6473597d706e | 9 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 10 | * @attention |
bogdanm | 82:6473597d706e | 11 | * |
bogdanm | 82:6473597d706e | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 82:6473597d706e | 13 | * |
bogdanm | 82:6473597d706e | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 15 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 82:6473597d706e | 17 | * this list of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 82:6473597d706e | 19 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 82:6473597d706e | 20 | * and/or other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 82:6473597d706e | 22 | * may be used to endorse or promote products derived from this software |
bogdanm | 82:6473597d706e | 23 | * without specific prior written permission. |
bogdanm | 82:6473597d706e | 24 | * |
bogdanm | 82:6473597d706e | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 82:6473597d706e | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 82:6473597d706e | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 82:6473597d706e | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 82:6473597d706e | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 82:6473597d706e | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 82:6473597d706e | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 82:6473597d706e | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 82:6473597d706e | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 35 | * |
bogdanm | 82:6473597d706e | 36 | ****************************************************************************** |
bogdanm | 82:6473597d706e | 37 | */ |
bogdanm | 82:6473597d706e | 38 | |
bogdanm | 82:6473597d706e | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 82:6473597d706e | 40 | #ifndef __STM32F30x_FLASH_H |
bogdanm | 82:6473597d706e | 41 | #define __STM32F30x_FLASH_H |
bogdanm | 82:6473597d706e | 42 | |
bogdanm | 82:6473597d706e | 43 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 44 | extern "C" { |
bogdanm | 82:6473597d706e | 45 | #endif |
bogdanm | 82:6473597d706e | 46 | |
bogdanm | 82:6473597d706e | 47 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 48 | #include "stm32f30x.h" |
bogdanm | 82:6473597d706e | 49 | |
bogdanm | 82:6473597d706e | 50 | /** @addtogroup STM32F30x_StdPeriph_Driver |
bogdanm | 82:6473597d706e | 51 | * @{ |
bogdanm | 82:6473597d706e | 52 | */ |
bogdanm | 82:6473597d706e | 53 | |
bogdanm | 82:6473597d706e | 54 | /** @addtogroup FLASH |
bogdanm | 82:6473597d706e | 55 | * @{ |
bogdanm | 82:6473597d706e | 56 | */ |
bogdanm | 82:6473597d706e | 57 | |
bogdanm | 82:6473597d706e | 58 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 59 | /** |
bogdanm | 82:6473597d706e | 60 | * @brief FLASH Status |
bogdanm | 82:6473597d706e | 61 | */ |
bogdanm | 82:6473597d706e | 62 | typedef enum |
bogdanm | 82:6473597d706e | 63 | { |
bogdanm | 82:6473597d706e | 64 | FLASH_BUSY = 1, |
bogdanm | 82:6473597d706e | 65 | FLASH_ERROR_WRP, |
bogdanm | 82:6473597d706e | 66 | FLASH_ERROR_PROGRAM, |
bogdanm | 82:6473597d706e | 67 | FLASH_COMPLETE, |
bogdanm | 82:6473597d706e | 68 | FLASH_TIMEOUT |
bogdanm | 82:6473597d706e | 69 | }FLASH_Status; |
bogdanm | 82:6473597d706e | 70 | |
bogdanm | 82:6473597d706e | 71 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 72 | |
bogdanm | 82:6473597d706e | 73 | /** @defgroup FLASH_Exported_Constants |
bogdanm | 82:6473597d706e | 74 | * @{ |
bogdanm | 82:6473597d706e | 75 | */ |
bogdanm | 82:6473597d706e | 76 | |
bogdanm | 82:6473597d706e | 77 | /** @defgroup Flash_Latency |
bogdanm | 82:6473597d706e | 78 | * @{ |
bogdanm | 82:6473597d706e | 79 | */ |
bogdanm | 82:6473597d706e | 80 | #define FLASH_Latency_0 ((uint8_t)0x0000) /*!< FLASH Zero Latency cycle */ |
bogdanm | 82:6473597d706e | 81 | #define FLASH_Latency_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */ |
bogdanm | 82:6473597d706e | 82 | #define FLASH_Latency_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two Latency cycles */ |
bogdanm | 82:6473597d706e | 83 | |
bogdanm | 82:6473597d706e | 84 | #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \ |
bogdanm | 82:6473597d706e | 85 | ((LATENCY) == FLASH_Latency_1) || \ |
bogdanm | 82:6473597d706e | 86 | ((LATENCY) == FLASH_Latency_2)) |
bogdanm | 82:6473597d706e | 87 | /** |
bogdanm | 82:6473597d706e | 88 | * @} |
bogdanm | 82:6473597d706e | 89 | */ |
bogdanm | 82:6473597d706e | 90 | |
bogdanm | 82:6473597d706e | 91 | /** @defgroup FLASH_Interrupts |
bogdanm | 82:6473597d706e | 92 | * @{ |
bogdanm | 82:6473597d706e | 93 | */ |
bogdanm | 82:6473597d706e | 94 | |
bogdanm | 82:6473597d706e | 95 | #define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of programming interrupt source */ |
bogdanm | 82:6473597d706e | 96 | #define FLASH_IT_ERR FLASH_CR_ERRIE /*!< Error interrupt source */ |
bogdanm | 82:6473597d706e | 97 | #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000))) |
bogdanm | 82:6473597d706e | 98 | /** |
bogdanm | 82:6473597d706e | 99 | * @} |
bogdanm | 82:6473597d706e | 100 | */ |
bogdanm | 82:6473597d706e | 101 | /** @defgroup FLASH_Address |
bogdanm | 82:6473597d706e | 102 | * @{ |
bogdanm | 82:6473597d706e | 103 | */ |
bogdanm | 82:6473597d706e | 104 | |
bogdanm | 82:6473597d706e | 105 | #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0803FFFF)) |
bogdanm | 82:6473597d706e | 106 | |
bogdanm | 82:6473597d706e | 107 | /** |
bogdanm | 82:6473597d706e | 108 | * @} |
bogdanm | 82:6473597d706e | 109 | */ |
bogdanm | 82:6473597d706e | 110 | |
bogdanm | 82:6473597d706e | 111 | /** @defgroup FLASH_OB_DATA_ADDRESS |
bogdanm | 82:6473597d706e | 112 | * @{ |
bogdanm | 82:6473597d706e | 113 | */ |
bogdanm | 82:6473597d706e | 114 | #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806)) |
bogdanm | 82:6473597d706e | 115 | |
bogdanm | 82:6473597d706e | 116 | /** |
bogdanm | 82:6473597d706e | 117 | * @} |
bogdanm | 82:6473597d706e | 118 | */ |
bogdanm | 82:6473597d706e | 119 | |
bogdanm | 82:6473597d706e | 120 | /** @defgroup Option_Bytes_Write_Protection |
bogdanm | 82:6473597d706e | 121 | * @{ |
bogdanm | 82:6473597d706e | 122 | */ |
bogdanm | 82:6473597d706e | 123 | |
bogdanm | 82:6473597d706e | 124 | #define OB_WRP_Pages0to1 ((uint32_t)0x00000001) /* Write protection of page 0 to 1 */ |
bogdanm | 82:6473597d706e | 125 | #define OB_WRP_Pages2to3 ((uint32_t)0x00000002) /* Write protection of page 2 to 3 */ |
bogdanm | 82:6473597d706e | 126 | #define OB_WRP_Pages4to5 ((uint32_t)0x00000004) /* Write protection of page 4 to 5 */ |
bogdanm | 82:6473597d706e | 127 | #define OB_WRP_Pages6to7 ((uint32_t)0x00000008) /* Write protection of page 6 to 7 */ |
bogdanm | 82:6473597d706e | 128 | #define OB_WRP_Pages8to9 ((uint32_t)0x00000010) /* Write protection of page 8 to 9 */ |
bogdanm | 82:6473597d706e | 129 | #define OB_WRP_Pages10to11 ((uint32_t)0x00000020) /* Write protection of page 10 to 11 */ |
bogdanm | 82:6473597d706e | 130 | #define OB_WRP_Pages12to13 ((uint32_t)0x00000040) /* Write protection of page 12 to 13 */ |
bogdanm | 82:6473597d706e | 131 | #define OB_WRP_Pages14to15 ((uint32_t)0x00000080) /* Write protection of page 14 to 15 */ |
bogdanm | 82:6473597d706e | 132 | #define OB_WRP_Pages16to17 ((uint32_t)0x00000100) /* Write protection of page 16 to 17 */ |
bogdanm | 82:6473597d706e | 133 | #define OB_WRP_Pages18to19 ((uint32_t)0x00000200) /* Write protection of page 18 to 19 */ |
bogdanm | 82:6473597d706e | 134 | #define OB_WRP_Pages20to21 ((uint32_t)0x00000400) /* Write protection of page 20 to 21 */ |
bogdanm | 82:6473597d706e | 135 | #define OB_WRP_Pages22to23 ((uint32_t)0x00000800) /* Write protection of page 22 to 23 */ |
bogdanm | 82:6473597d706e | 136 | #define OB_WRP_Pages24to25 ((uint32_t)0x00001000) /* Write protection of page 24 to 25 */ |
bogdanm | 82:6473597d706e | 137 | #define OB_WRP_Pages26to27 ((uint32_t)0x00002000) /* Write protection of page 26 to 27 */ |
bogdanm | 82:6473597d706e | 138 | #define OB_WRP_Pages28to29 ((uint32_t)0x00004000) /* Write protection of page 28 to 29 */ |
bogdanm | 82:6473597d706e | 139 | #define OB_WRP_Pages30to31 ((uint32_t)0x00008000) /* Write protection of page 30 to 31 */ |
bogdanm | 82:6473597d706e | 140 | #define OB_WRP_Pages32to33 ((uint32_t)0x00010000) /* Write protection of page 32 to 33 */ |
bogdanm | 82:6473597d706e | 141 | #define OB_WRP_Pages34to35 ((uint32_t)0x00020000) /* Write protection of page 34 to 35 */ |
bogdanm | 82:6473597d706e | 142 | #define OB_WRP_Pages36to37 ((uint32_t)0x00040000) /* Write protection of page 36 to 37 */ |
bogdanm | 82:6473597d706e | 143 | #define OB_WRP_Pages38to39 ((uint32_t)0x00080000) /* Write protection of page 38 to 39 */ |
bogdanm | 82:6473597d706e | 144 | #define OB_WRP_Pages40to41 ((uint32_t)0x00100000) /* Write protection of page 40 to 41 */ |
bogdanm | 82:6473597d706e | 145 | #define OB_WRP_Pages42to43 ((uint32_t)0x00200000) /* Write protection of page 42 to 43 */ |
bogdanm | 82:6473597d706e | 146 | #define OB_WRP_Pages44to45 ((uint32_t)0x00400000) /* Write protection of page 44 to 45 */ |
bogdanm | 82:6473597d706e | 147 | #define OB_WRP_Pages46to47 ((uint32_t)0x00800000) /* Write protection of page 46 to 47 */ |
bogdanm | 82:6473597d706e | 148 | #define OB_WRP_Pages48to49 ((uint32_t)0x01000000) /* Write protection of page 48 to 49 */ |
bogdanm | 82:6473597d706e | 149 | #define OB_WRP_Pages50to51 ((uint32_t)0x02000000) /* Write protection of page 50 to 51 */ |
bogdanm | 82:6473597d706e | 150 | #define OB_WRP_Pages52to53 ((uint32_t)0x04000000) /* Write protection of page 52 to 53 */ |
bogdanm | 82:6473597d706e | 151 | #define OB_WRP_Pages54to55 ((uint32_t)0x08000000) /* Write protection of page 54 to 55 */ |
bogdanm | 82:6473597d706e | 152 | #define OB_WRP_Pages56to57 ((uint32_t)0x10000000) /* Write protection of page 56 to 57 */ |
bogdanm | 82:6473597d706e | 153 | #define OB_WRP_Pages58to59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */ |
bogdanm | 82:6473597d706e | 154 | #define OB_WRP_Pages60to61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */ |
bogdanm | 82:6473597d706e | 155 | #define OB_WRP_Pages62to127 ((uint32_t)0x80000000) /* Write protection of page 62 to 127 */ |
bogdanm | 82:6473597d706e | 156 | |
bogdanm | 82:6473597d706e | 157 | #define OB_WRP_AllPages ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */ |
bogdanm | 82:6473597d706e | 158 | |
bogdanm | 82:6473597d706e | 159 | #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000)) |
bogdanm | 82:6473597d706e | 160 | |
bogdanm | 82:6473597d706e | 161 | /** |
bogdanm | 82:6473597d706e | 162 | * @} |
bogdanm | 82:6473597d706e | 163 | */ |
bogdanm | 82:6473597d706e | 164 | |
bogdanm | 82:6473597d706e | 165 | /** @defgroup Option_Bytes_Read_Protection |
bogdanm | 82:6473597d706e | 166 | * @{ |
bogdanm | 82:6473597d706e | 167 | */ |
bogdanm | 82:6473597d706e | 168 | |
bogdanm | 82:6473597d706e | 169 | /** |
bogdanm | 82:6473597d706e | 170 | * @brief Read Protection Level |
bogdanm | 82:6473597d706e | 171 | */ |
bogdanm | 82:6473597d706e | 172 | #define OB_RDP_Level_0 ((uint8_t)0xAA) |
bogdanm | 82:6473597d706e | 173 | #define OB_RDP_Level_1 ((uint8_t)0xBB) |
bogdanm | 82:6473597d706e | 174 | /*#define OB_RDP_Level_2 ((uint8_t)0xCC)*/ /* Warning: When enabling read protection level 2 |
bogdanm | 82:6473597d706e | 175 | it's no more possible to go back to level 1 or 0 */ |
bogdanm | 82:6473597d706e | 176 | |
bogdanm | 82:6473597d706e | 177 | #define IS_OB_RDP(LEVEL) (((LEVEL) == OB_RDP_Level_0)||\ |
bogdanm | 82:6473597d706e | 178 | ((LEVEL) == OB_RDP_Level_1))/*||\ |
bogdanm | 82:6473597d706e | 179 | ((LEVEL) == OB_RDP_Level_2))*/ |
bogdanm | 82:6473597d706e | 180 | /** |
bogdanm | 82:6473597d706e | 181 | * @} |
bogdanm | 82:6473597d706e | 182 | */ |
bogdanm | 82:6473597d706e | 183 | |
bogdanm | 82:6473597d706e | 184 | /** @defgroup Option_Bytes_IWatchdog |
bogdanm | 82:6473597d706e | 185 | * @{ |
bogdanm | 82:6473597d706e | 186 | */ |
bogdanm | 82:6473597d706e | 187 | |
bogdanm | 82:6473597d706e | 188 | #define OB_IWDG_SW ((uint8_t)0x01) /*!< Software IWDG selected */ |
bogdanm | 82:6473597d706e | 189 | #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */ |
bogdanm | 82:6473597d706e | 190 | #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) |
bogdanm | 82:6473597d706e | 191 | |
bogdanm | 82:6473597d706e | 192 | /** |
bogdanm | 82:6473597d706e | 193 | * @} |
bogdanm | 82:6473597d706e | 194 | */ |
bogdanm | 82:6473597d706e | 195 | |
bogdanm | 82:6473597d706e | 196 | /** @defgroup Option_Bytes_nRST_STOP |
bogdanm | 82:6473597d706e | 197 | * @{ |
bogdanm | 82:6473597d706e | 198 | */ |
bogdanm | 82:6473597d706e | 199 | |
bogdanm | 82:6473597d706e | 200 | #define OB_STOP_NoRST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */ |
bogdanm | 82:6473597d706e | 201 | #define OB_STOP_RST ((uint8_t)0x00) /*!< Reset generated when entering in STOP */ |
bogdanm | 82:6473597d706e | 202 | #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST)) |
bogdanm | 82:6473597d706e | 203 | |
bogdanm | 82:6473597d706e | 204 | /** |
bogdanm | 82:6473597d706e | 205 | * @} |
bogdanm | 82:6473597d706e | 206 | */ |
bogdanm | 82:6473597d706e | 207 | |
bogdanm | 82:6473597d706e | 208 | /** @defgroup Option_Bytes_nRST_STDBY |
bogdanm | 82:6473597d706e | 209 | * @{ |
bogdanm | 82:6473597d706e | 210 | */ |
bogdanm | 82:6473597d706e | 211 | |
bogdanm | 82:6473597d706e | 212 | #define OB_STDBY_NoRST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */ |
bogdanm | 82:6473597d706e | 213 | #define OB_STDBY_RST ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */ |
bogdanm | 82:6473597d706e | 214 | #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST)) |
bogdanm | 82:6473597d706e | 215 | |
bogdanm | 82:6473597d706e | 216 | /** |
bogdanm | 82:6473597d706e | 217 | * @} |
bogdanm | 82:6473597d706e | 218 | */ |
bogdanm | 82:6473597d706e | 219 | /** @defgroup Option_Bytes_BOOT1 |
bogdanm | 82:6473597d706e | 220 | * @{ |
bogdanm | 82:6473597d706e | 221 | */ |
bogdanm | 82:6473597d706e | 222 | |
bogdanm | 82:6473597d706e | 223 | #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */ |
bogdanm | 82:6473597d706e | 224 | #define OB_BOOT1_SET ((uint8_t)0x10) /*!< BOOT1 Set */ |
bogdanm | 82:6473597d706e | 225 | #define IS_OB_BOOT1(BOOT1) (((BOOT1) == OB_BOOT1_RESET) || ((BOOT1) == OB_BOOT1_SET)) |
bogdanm | 82:6473597d706e | 226 | |
bogdanm | 82:6473597d706e | 227 | /** |
bogdanm | 82:6473597d706e | 228 | * @} |
bogdanm | 82:6473597d706e | 229 | */ |
bogdanm | 82:6473597d706e | 230 | /** @defgroup Option_Bytes_VDDA_Analog_Monitoring |
bogdanm | 82:6473597d706e | 231 | * @{ |
bogdanm | 82:6473597d706e | 232 | */ |
bogdanm | 82:6473597d706e | 233 | |
bogdanm | 82:6473597d706e | 234 | #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */ |
bogdanm | 82:6473597d706e | 235 | #define OB_VDDA_ANALOG_OFF ((uint8_t)0x00) /*!< Analog monitoring on VDDA Power source OFF */ |
bogdanm | 82:6473597d706e | 236 | |
bogdanm | 82:6473597d706e | 237 | #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF)) |
bogdanm | 82:6473597d706e | 238 | |
bogdanm | 82:6473597d706e | 239 | /** |
bogdanm | 82:6473597d706e | 240 | * @} |
bogdanm | 82:6473597d706e | 241 | */ |
bogdanm | 82:6473597d706e | 242 | |
bogdanm | 82:6473597d706e | 243 | /** @defgroup FLASH_Option_Bytes_SRAM_Parity_Enable |
bogdanm | 82:6473597d706e | 244 | * @{ |
bogdanm | 82:6473597d706e | 245 | */ |
bogdanm | 82:6473597d706e | 246 | |
bogdanm | 82:6473597d706e | 247 | #define OB_SRAM_PARITY_SET ((uint8_t)0x00) /*!< SRAM parity enable Set */ |
bogdanm | 82:6473597d706e | 248 | #define OB_SRAM_PARITY_RESET ((uint8_t)0x40) /*!< SRAM parity enable reset */ |
bogdanm | 82:6473597d706e | 249 | |
bogdanm | 82:6473597d706e | 250 | #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET)) |
bogdanm | 82:6473597d706e | 251 | |
bogdanm | 82:6473597d706e | 252 | /** |
bogdanm | 82:6473597d706e | 253 | * @} |
bogdanm | 82:6473597d706e | 254 | */ |
bogdanm | 82:6473597d706e | 255 | |
bogdanm | 82:6473597d706e | 256 | /** @defgroup FLASH_Flags |
bogdanm | 82:6473597d706e | 257 | * @{ |
bogdanm | 82:6473597d706e | 258 | */ |
bogdanm | 82:6473597d706e | 259 | |
bogdanm | 82:6473597d706e | 260 | #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ |
bogdanm | 82:6473597d706e | 261 | #define FLASH_FLAG_PGERR FLASH_SR_PGERR /*!< FLASH Programming error flag */ |
bogdanm | 82:6473597d706e | 262 | #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */ |
bogdanm | 82:6473597d706e | 263 | #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Programming flag */ |
bogdanm | 82:6473597d706e | 264 | |
bogdanm | 82:6473597d706e | 265 | #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCB) == 0x00000000) && ((FLAG) != 0x00000000)) |
bogdanm | 82:6473597d706e | 266 | |
bogdanm | 82:6473597d706e | 267 | #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PGERR) || \ |
bogdanm | 82:6473597d706e | 268 | ((FLAG) == FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_EOP)) |
bogdanm | 82:6473597d706e | 269 | /** |
bogdanm | 82:6473597d706e | 270 | * @} |
bogdanm | 82:6473597d706e | 271 | */ |
bogdanm | 82:6473597d706e | 272 | /** @defgroup Timeout_definition |
bogdanm | 82:6473597d706e | 273 | * @{ |
bogdanm | 82:6473597d706e | 274 | */ |
bogdanm | 82:6473597d706e | 275 | #define FLASH_ER_PRG_TIMEOUT ((uint32_t)0x000B0000) |
bogdanm | 82:6473597d706e | 276 | |
bogdanm | 82:6473597d706e | 277 | /** |
bogdanm | 82:6473597d706e | 278 | * @} |
bogdanm | 82:6473597d706e | 279 | */ |
bogdanm | 82:6473597d706e | 280 | |
bogdanm | 82:6473597d706e | 281 | /** |
bogdanm | 82:6473597d706e | 282 | * @} |
bogdanm | 82:6473597d706e | 283 | */ |
bogdanm | 82:6473597d706e | 284 | |
bogdanm | 82:6473597d706e | 285 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 286 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 82:6473597d706e | 287 | |
bogdanm | 82:6473597d706e | 288 | /* FLASH Interface configuration functions ************************************/ |
bogdanm | 82:6473597d706e | 289 | void FLASH_SetLatency(uint32_t FLASH_Latency); |
bogdanm | 82:6473597d706e | 290 | void FLASH_HalfCycleAccessCmd(FunctionalState NewState); |
bogdanm | 82:6473597d706e | 291 | void FLASH_PrefetchBufferCmd(FunctionalState NewState); |
bogdanm | 82:6473597d706e | 292 | |
bogdanm | 82:6473597d706e | 293 | /* FLASH Memory Programming functions *****************************************/ |
bogdanm | 82:6473597d706e | 294 | void FLASH_Unlock(void); |
bogdanm | 82:6473597d706e | 295 | void FLASH_Lock(void); |
bogdanm | 82:6473597d706e | 296 | FLASH_Status FLASH_ErasePage(uint32_t Page_Address); |
bogdanm | 82:6473597d706e | 297 | FLASH_Status FLASH_EraseAllPages(void); |
bogdanm | 82:6473597d706e | 298 | FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data); |
bogdanm | 82:6473597d706e | 299 | FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data); |
bogdanm | 82:6473597d706e | 300 | |
bogdanm | 82:6473597d706e | 301 | /* Option Bytes Programming functions *****************************************/ |
bogdanm | 82:6473597d706e | 302 | void FLASH_OB_Unlock(void); |
bogdanm | 82:6473597d706e | 303 | void FLASH_OB_Lock(void); |
bogdanm | 82:6473597d706e | 304 | void FLASH_OB_Launch(void); |
bogdanm | 82:6473597d706e | 305 | FLASH_Status FLASH_OB_Erase(void); |
bogdanm | 82:6473597d706e | 306 | FLASH_Status FLASH_OB_EnableWRP(uint32_t OB_WRP); |
bogdanm | 82:6473597d706e | 307 | FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP); |
bogdanm | 82:6473597d706e | 308 | FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY); |
bogdanm | 82:6473597d706e | 309 | FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1); |
bogdanm | 82:6473597d706e | 310 | FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG); |
bogdanm | 82:6473597d706e | 311 | FLASH_Status FLASH_OB_SRAMParityConfig(uint8_t OB_SRAM_Parity); |
bogdanm | 82:6473597d706e | 312 | FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER); |
bogdanm | 82:6473597d706e | 313 | FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data); |
bogdanm | 82:6473597d706e | 314 | uint8_t FLASH_OB_GetUser(void); |
bogdanm | 82:6473597d706e | 315 | uint32_t FLASH_OB_GetWRP(void); |
bogdanm | 82:6473597d706e | 316 | FlagStatus FLASH_OB_GetRDP(void); |
bogdanm | 82:6473597d706e | 317 | |
bogdanm | 82:6473597d706e | 318 | /* Interrupts and flags management functions **********************************/ |
bogdanm | 82:6473597d706e | 319 | void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState); |
bogdanm | 82:6473597d706e | 320 | FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG); |
bogdanm | 82:6473597d706e | 321 | void FLASH_ClearFlag(uint32_t FLASH_FLAG); |
bogdanm | 82:6473597d706e | 322 | FLASH_Status FLASH_GetStatus(void); |
bogdanm | 82:6473597d706e | 323 | FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout); |
bogdanm | 82:6473597d706e | 324 | |
bogdanm | 82:6473597d706e | 325 | #ifdef __cplusplus |
bogdanm | 82:6473597d706e | 326 | } |
bogdanm | 82:6473597d706e | 327 | #endif |
bogdanm | 82:6473597d706e | 328 | |
bogdanm | 82:6473597d706e | 329 | #endif /* __STM32F30x_FLASH_H */ |
bogdanm | 82:6473597d706e | 330 | |
bogdanm | 82:6473597d706e | 331 | /** |
bogdanm | 82:6473597d706e | 332 | * @} |
bogdanm | 82:6473597d706e | 333 | */ |
bogdanm | 82:6473597d706e | 334 | |
bogdanm | 82:6473597d706e | 335 | /** |
bogdanm | 82:6473597d706e | 336 | * @} |
bogdanm | 82:6473597d706e | 337 | */ |
bogdanm | 82:6473597d706e | 338 | |
bogdanm | 82:6473597d706e | 339 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |