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