mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Dec 02 11:30:05 2013 +0000
Revision:
52:a51c77007319
Child:
70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd

Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/

Add STMicroelectronics NUCLEO_F103RB target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 52:a51c77007319 1 /**
mbed_official 52:a51c77007319 2 ******************************************************************************
mbed_official 52:a51c77007319 3 * @file stm32f10x_flash.h
mbed_official 52:a51c77007319 4 * @author MCD Application Team
mbed_official 52:a51c77007319 5 * @version V3.5.0
mbed_official 52:a51c77007319 6 * @date 11-March-2011
mbed_official 52:a51c77007319 7 * @brief This file contains all the functions prototypes for the FLASH
mbed_official 52:a51c77007319 8 * firmware library.
mbed_official 52:a51c77007319 9 ******************************************************************************
mbed_official 52:a51c77007319 10 * @attention
mbed_official 52:a51c77007319 11 *
mbed_official 52:a51c77007319 12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mbed_official 52:a51c77007319 13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
mbed_official 52:a51c77007319 14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
mbed_official 52:a51c77007319 15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
mbed_official 52:a51c77007319 16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
mbed_official 52:a51c77007319 17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mbed_official 52:a51c77007319 18 *
mbed_official 52:a51c77007319 19 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
mbed_official 52:a51c77007319 20 ******************************************************************************
mbed_official 52:a51c77007319 21 */
mbed_official 52:a51c77007319 22
mbed_official 52:a51c77007319 23 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 52:a51c77007319 24 #ifndef __STM32F10x_FLASH_H
mbed_official 52:a51c77007319 25 #define __STM32F10x_FLASH_H
mbed_official 52:a51c77007319 26
mbed_official 52:a51c77007319 27 #ifdef __cplusplus
mbed_official 52:a51c77007319 28 extern "C" {
mbed_official 52:a51c77007319 29 #endif
mbed_official 52:a51c77007319 30
mbed_official 52:a51c77007319 31 /* Includes ------------------------------------------------------------------*/
mbed_official 52:a51c77007319 32 #include "stm32f10x.h"
mbed_official 52:a51c77007319 33
mbed_official 52:a51c77007319 34 /** @addtogroup STM32F10x_StdPeriph_Driver
mbed_official 52:a51c77007319 35 * @{
mbed_official 52:a51c77007319 36 */
mbed_official 52:a51c77007319 37
mbed_official 52:a51c77007319 38 /** @addtogroup FLASH
mbed_official 52:a51c77007319 39 * @{
mbed_official 52:a51c77007319 40 */
mbed_official 52:a51c77007319 41
mbed_official 52:a51c77007319 42 /** @defgroup FLASH_Exported_Types
mbed_official 52:a51c77007319 43 * @{
mbed_official 52:a51c77007319 44 */
mbed_official 52:a51c77007319 45
mbed_official 52:a51c77007319 46 /**
mbed_official 52:a51c77007319 47 * @brief FLASH Status
mbed_official 52:a51c77007319 48 */
mbed_official 52:a51c77007319 49
mbed_official 52:a51c77007319 50 typedef enum
mbed_official 52:a51c77007319 51 {
mbed_official 52:a51c77007319 52 FLASH_BUSY = 1,
mbed_official 52:a51c77007319 53 FLASH_ERROR_PG,
mbed_official 52:a51c77007319 54 FLASH_ERROR_WRP,
mbed_official 52:a51c77007319 55 FLASH_COMPLETE,
mbed_official 52:a51c77007319 56 FLASH_TIMEOUT
mbed_official 52:a51c77007319 57 }FLASH_Status;
mbed_official 52:a51c77007319 58
mbed_official 52:a51c77007319 59 /**
mbed_official 52:a51c77007319 60 * @}
mbed_official 52:a51c77007319 61 */
mbed_official 52:a51c77007319 62
mbed_official 52:a51c77007319 63 /** @defgroup FLASH_Exported_Constants
mbed_official 52:a51c77007319 64 * @{
mbed_official 52:a51c77007319 65 */
mbed_official 52:a51c77007319 66
mbed_official 52:a51c77007319 67 /** @defgroup Flash_Latency
mbed_official 52:a51c77007319 68 * @{
mbed_official 52:a51c77007319 69 */
mbed_official 52:a51c77007319 70
mbed_official 52:a51c77007319 71 #define FLASH_Latency_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
mbed_official 52:a51c77007319 72 #define FLASH_Latency_1 ((uint32_t)0x00000001) /*!< FLASH One Latency cycle */
mbed_official 52:a51c77007319 73 #define FLASH_Latency_2 ((uint32_t)0x00000002) /*!< FLASH Two Latency cycles */
mbed_official 52:a51c77007319 74 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \
mbed_official 52:a51c77007319 75 ((LATENCY) == FLASH_Latency_1) || \
mbed_official 52:a51c77007319 76 ((LATENCY) == FLASH_Latency_2))
mbed_official 52:a51c77007319 77 /**
mbed_official 52:a51c77007319 78 * @}
mbed_official 52:a51c77007319 79 */
mbed_official 52:a51c77007319 80
mbed_official 52:a51c77007319 81 /** @defgroup Half_Cycle_Enable_Disable
mbed_official 52:a51c77007319 82 * @{
mbed_official 52:a51c77007319 83 */
mbed_official 52:a51c77007319 84
mbed_official 52:a51c77007319 85 #define FLASH_HalfCycleAccess_Enable ((uint32_t)0x00000008) /*!< FLASH Half Cycle Enable */
mbed_official 52:a51c77007319 86 #define FLASH_HalfCycleAccess_Disable ((uint32_t)0x00000000) /*!< FLASH Half Cycle Disable */
mbed_official 52:a51c77007319 87 #define IS_FLASH_HALFCYCLEACCESS_STATE(STATE) (((STATE) == FLASH_HalfCycleAccess_Enable) || \
mbed_official 52:a51c77007319 88 ((STATE) == FLASH_HalfCycleAccess_Disable))
mbed_official 52:a51c77007319 89 /**
mbed_official 52:a51c77007319 90 * @}
mbed_official 52:a51c77007319 91 */
mbed_official 52:a51c77007319 92
mbed_official 52:a51c77007319 93 /** @defgroup Prefetch_Buffer_Enable_Disable
mbed_official 52:a51c77007319 94 * @{
mbed_official 52:a51c77007319 95 */
mbed_official 52:a51c77007319 96
mbed_official 52:a51c77007319 97 #define FLASH_PrefetchBuffer_Enable ((uint32_t)0x00000010) /*!< FLASH Prefetch Buffer Enable */
mbed_official 52:a51c77007319 98 #define FLASH_PrefetchBuffer_Disable ((uint32_t)0x00000000) /*!< FLASH Prefetch Buffer Disable */
mbed_official 52:a51c77007319 99 #define IS_FLASH_PREFETCHBUFFER_STATE(STATE) (((STATE) == FLASH_PrefetchBuffer_Enable) || \
mbed_official 52:a51c77007319 100 ((STATE) == FLASH_PrefetchBuffer_Disable))
mbed_official 52:a51c77007319 101 /**
mbed_official 52:a51c77007319 102 * @}
mbed_official 52:a51c77007319 103 */
mbed_official 52:a51c77007319 104
mbed_official 52:a51c77007319 105 /** @defgroup Option_Bytes_Write_Protection
mbed_official 52:a51c77007319 106 * @{
mbed_official 52:a51c77007319 107 */
mbed_official 52:a51c77007319 108
mbed_official 52:a51c77007319 109 /* Values to be used with STM32 Low and Medium density devices */
mbed_official 52:a51c77007319 110 #define FLASH_WRProt_Pages0to3 ((uint32_t)0x00000001) /*!< STM32 Low and Medium density devices: Write protection of page 0 to 3 */
mbed_official 52:a51c77007319 111 #define FLASH_WRProt_Pages4to7 ((uint32_t)0x00000002) /*!< STM32 Low and Medium density devices: Write protection of page 4 to 7 */
mbed_official 52:a51c77007319 112 #define FLASH_WRProt_Pages8to11 ((uint32_t)0x00000004) /*!< STM32 Low and Medium density devices: Write protection of page 8 to 11 */
mbed_official 52:a51c77007319 113 #define FLASH_WRProt_Pages12to15 ((uint32_t)0x00000008) /*!< STM32 Low and Medium density devices: Write protection of page 12 to 15 */
mbed_official 52:a51c77007319 114 #define FLASH_WRProt_Pages16to19 ((uint32_t)0x00000010) /*!< STM32 Low and Medium density devices: Write protection of page 16 to 19 */
mbed_official 52:a51c77007319 115 #define FLASH_WRProt_Pages20to23 ((uint32_t)0x00000020) /*!< STM32 Low and Medium density devices: Write protection of page 20 to 23 */
mbed_official 52:a51c77007319 116 #define FLASH_WRProt_Pages24to27 ((uint32_t)0x00000040) /*!< STM32 Low and Medium density devices: Write protection of page 24 to 27 */
mbed_official 52:a51c77007319 117 #define FLASH_WRProt_Pages28to31 ((uint32_t)0x00000080) /*!< STM32 Low and Medium density devices: Write protection of page 28 to 31 */
mbed_official 52:a51c77007319 118
mbed_official 52:a51c77007319 119 /* Values to be used with STM32 Medium-density devices */
mbed_official 52:a51c77007319 120 #define FLASH_WRProt_Pages32to35 ((uint32_t)0x00000100) /*!< STM32 Medium-density devices: Write protection of page 32 to 35 */
mbed_official 52:a51c77007319 121 #define FLASH_WRProt_Pages36to39 ((uint32_t)0x00000200) /*!< STM32 Medium-density devices: Write protection of page 36 to 39 */
mbed_official 52:a51c77007319 122 #define FLASH_WRProt_Pages40to43 ((uint32_t)0x00000400) /*!< STM32 Medium-density devices: Write protection of page 40 to 43 */
mbed_official 52:a51c77007319 123 #define FLASH_WRProt_Pages44to47 ((uint32_t)0x00000800) /*!< STM32 Medium-density devices: Write protection of page 44 to 47 */
mbed_official 52:a51c77007319 124 #define FLASH_WRProt_Pages48to51 ((uint32_t)0x00001000) /*!< STM32 Medium-density devices: Write protection of page 48 to 51 */
mbed_official 52:a51c77007319 125 #define FLASH_WRProt_Pages52to55 ((uint32_t)0x00002000) /*!< STM32 Medium-density devices: Write protection of page 52 to 55 */
mbed_official 52:a51c77007319 126 #define FLASH_WRProt_Pages56to59 ((uint32_t)0x00004000) /*!< STM32 Medium-density devices: Write protection of page 56 to 59 */
mbed_official 52:a51c77007319 127 #define FLASH_WRProt_Pages60to63 ((uint32_t)0x00008000) /*!< STM32 Medium-density devices: Write protection of page 60 to 63 */
mbed_official 52:a51c77007319 128 #define FLASH_WRProt_Pages64to67 ((uint32_t)0x00010000) /*!< STM32 Medium-density devices: Write protection of page 64 to 67 */
mbed_official 52:a51c77007319 129 #define FLASH_WRProt_Pages68to71 ((uint32_t)0x00020000) /*!< STM32 Medium-density devices: Write protection of page 68 to 71 */
mbed_official 52:a51c77007319 130 #define FLASH_WRProt_Pages72to75 ((uint32_t)0x00040000) /*!< STM32 Medium-density devices: Write protection of page 72 to 75 */
mbed_official 52:a51c77007319 131 #define FLASH_WRProt_Pages76to79 ((uint32_t)0x00080000) /*!< STM32 Medium-density devices: Write protection of page 76 to 79 */
mbed_official 52:a51c77007319 132 #define FLASH_WRProt_Pages80to83 ((uint32_t)0x00100000) /*!< STM32 Medium-density devices: Write protection of page 80 to 83 */
mbed_official 52:a51c77007319 133 #define FLASH_WRProt_Pages84to87 ((uint32_t)0x00200000) /*!< STM32 Medium-density devices: Write protection of page 84 to 87 */
mbed_official 52:a51c77007319 134 #define FLASH_WRProt_Pages88to91 ((uint32_t)0x00400000) /*!< STM32 Medium-density devices: Write protection of page 88 to 91 */
mbed_official 52:a51c77007319 135 #define FLASH_WRProt_Pages92to95 ((uint32_t)0x00800000) /*!< STM32 Medium-density devices: Write protection of page 92 to 95 */
mbed_official 52:a51c77007319 136 #define FLASH_WRProt_Pages96to99 ((uint32_t)0x01000000) /*!< STM32 Medium-density devices: Write protection of page 96 to 99 */
mbed_official 52:a51c77007319 137 #define FLASH_WRProt_Pages100to103 ((uint32_t)0x02000000) /*!< STM32 Medium-density devices: Write protection of page 100 to 103 */
mbed_official 52:a51c77007319 138 #define FLASH_WRProt_Pages104to107 ((uint32_t)0x04000000) /*!< STM32 Medium-density devices: Write protection of page 104 to 107 */
mbed_official 52:a51c77007319 139 #define FLASH_WRProt_Pages108to111 ((uint32_t)0x08000000) /*!< STM32 Medium-density devices: Write protection of page 108 to 111 */
mbed_official 52:a51c77007319 140 #define FLASH_WRProt_Pages112to115 ((uint32_t)0x10000000) /*!< STM32 Medium-density devices: Write protection of page 112 to 115 */
mbed_official 52:a51c77007319 141 #define FLASH_WRProt_Pages116to119 ((uint32_t)0x20000000) /*!< STM32 Medium-density devices: Write protection of page 115 to 119 */
mbed_official 52:a51c77007319 142 #define FLASH_WRProt_Pages120to123 ((uint32_t)0x40000000) /*!< STM32 Medium-density devices: Write protection of page 120 to 123 */
mbed_official 52:a51c77007319 143 #define FLASH_WRProt_Pages124to127 ((uint32_t)0x80000000) /*!< STM32 Medium-density devices: Write protection of page 124 to 127 */
mbed_official 52:a51c77007319 144
mbed_official 52:a51c77007319 145 /* Values to be used with STM32 High-density and STM32F10X Connectivity line devices */
mbed_official 52:a51c77007319 146 #define FLASH_WRProt_Pages0to1 ((uint32_t)0x00000001) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 147 Write protection of page 0 to 1 */
mbed_official 52:a51c77007319 148 #define FLASH_WRProt_Pages2to3 ((uint32_t)0x00000002) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 149 Write protection of page 2 to 3 */
mbed_official 52:a51c77007319 150 #define FLASH_WRProt_Pages4to5 ((uint32_t)0x00000004) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 151 Write protection of page 4 to 5 */
mbed_official 52:a51c77007319 152 #define FLASH_WRProt_Pages6to7 ((uint32_t)0x00000008) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 153 Write protection of page 6 to 7 */
mbed_official 52:a51c77007319 154 #define FLASH_WRProt_Pages8to9 ((uint32_t)0x00000010) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 155 Write protection of page 8 to 9 */
mbed_official 52:a51c77007319 156 #define FLASH_WRProt_Pages10to11 ((uint32_t)0x00000020) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 157 Write protection of page 10 to 11 */
mbed_official 52:a51c77007319 158 #define FLASH_WRProt_Pages12to13 ((uint32_t)0x00000040) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 159 Write protection of page 12 to 13 */
mbed_official 52:a51c77007319 160 #define FLASH_WRProt_Pages14to15 ((uint32_t)0x00000080) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 161 Write protection of page 14 to 15 */
mbed_official 52:a51c77007319 162 #define FLASH_WRProt_Pages16to17 ((uint32_t)0x00000100) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 163 Write protection of page 16 to 17 */
mbed_official 52:a51c77007319 164 #define FLASH_WRProt_Pages18to19 ((uint32_t)0x00000200) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 165 Write protection of page 18 to 19 */
mbed_official 52:a51c77007319 166 #define FLASH_WRProt_Pages20to21 ((uint32_t)0x00000400) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 167 Write protection of page 20 to 21 */
mbed_official 52:a51c77007319 168 #define FLASH_WRProt_Pages22to23 ((uint32_t)0x00000800) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 169 Write protection of page 22 to 23 */
mbed_official 52:a51c77007319 170 #define FLASH_WRProt_Pages24to25 ((uint32_t)0x00001000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 171 Write protection of page 24 to 25 */
mbed_official 52:a51c77007319 172 #define FLASH_WRProt_Pages26to27 ((uint32_t)0x00002000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 173 Write protection of page 26 to 27 */
mbed_official 52:a51c77007319 174 #define FLASH_WRProt_Pages28to29 ((uint32_t)0x00004000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 175 Write protection of page 28 to 29 */
mbed_official 52:a51c77007319 176 #define FLASH_WRProt_Pages30to31 ((uint32_t)0x00008000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 177 Write protection of page 30 to 31 */
mbed_official 52:a51c77007319 178 #define FLASH_WRProt_Pages32to33 ((uint32_t)0x00010000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 179 Write protection of page 32 to 33 */
mbed_official 52:a51c77007319 180 #define FLASH_WRProt_Pages34to35 ((uint32_t)0x00020000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 181 Write protection of page 34 to 35 */
mbed_official 52:a51c77007319 182 #define FLASH_WRProt_Pages36to37 ((uint32_t)0x00040000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 183 Write protection of page 36 to 37 */
mbed_official 52:a51c77007319 184 #define FLASH_WRProt_Pages38to39 ((uint32_t)0x00080000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 185 Write protection of page 38 to 39 */
mbed_official 52:a51c77007319 186 #define FLASH_WRProt_Pages40to41 ((uint32_t)0x00100000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 187 Write protection of page 40 to 41 */
mbed_official 52:a51c77007319 188 #define FLASH_WRProt_Pages42to43 ((uint32_t)0x00200000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 189 Write protection of page 42 to 43 */
mbed_official 52:a51c77007319 190 #define FLASH_WRProt_Pages44to45 ((uint32_t)0x00400000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 191 Write protection of page 44 to 45 */
mbed_official 52:a51c77007319 192 #define FLASH_WRProt_Pages46to47 ((uint32_t)0x00800000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 193 Write protection of page 46 to 47 */
mbed_official 52:a51c77007319 194 #define FLASH_WRProt_Pages48to49 ((uint32_t)0x01000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 195 Write protection of page 48 to 49 */
mbed_official 52:a51c77007319 196 #define FLASH_WRProt_Pages50to51 ((uint32_t)0x02000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 197 Write protection of page 50 to 51 */
mbed_official 52:a51c77007319 198 #define FLASH_WRProt_Pages52to53 ((uint32_t)0x04000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 199 Write protection of page 52 to 53 */
mbed_official 52:a51c77007319 200 #define FLASH_WRProt_Pages54to55 ((uint32_t)0x08000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 201 Write protection of page 54 to 55 */
mbed_official 52:a51c77007319 202 #define FLASH_WRProt_Pages56to57 ((uint32_t)0x10000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 203 Write protection of page 56 to 57 */
mbed_official 52:a51c77007319 204 #define FLASH_WRProt_Pages58to59 ((uint32_t)0x20000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 205 Write protection of page 58 to 59 */
mbed_official 52:a51c77007319 206 #define FLASH_WRProt_Pages60to61 ((uint32_t)0x40000000) /*!< STM32 High-density, XL-density and Connectivity line devices:
mbed_official 52:a51c77007319 207 Write protection of page 60 to 61 */
mbed_official 52:a51c77007319 208 #define FLASH_WRProt_Pages62to127 ((uint32_t)0x80000000) /*!< STM32 Connectivity line devices: Write protection of page 62 to 127 */
mbed_official 52:a51c77007319 209 #define FLASH_WRProt_Pages62to255 ((uint32_t)0x80000000) /*!< STM32 Medium-density devices: Write protection of page 62 to 255 */
mbed_official 52:a51c77007319 210 #define FLASH_WRProt_Pages62to511 ((uint32_t)0x80000000) /*!< STM32 XL-density devices: Write protection of page 62 to 511 */
mbed_official 52:a51c77007319 211
mbed_official 52:a51c77007319 212 #define FLASH_WRProt_AllPages ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Pages */
mbed_official 52:a51c77007319 213
mbed_official 52:a51c77007319 214 #define IS_FLASH_WRPROT_PAGE(PAGE) (((PAGE) != 0x00000000))
mbed_official 52:a51c77007319 215
mbed_official 52:a51c77007319 216 #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x080FFFFF))
mbed_official 52:a51c77007319 217
mbed_official 52:a51c77007319 218 #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806))
mbed_official 52:a51c77007319 219
mbed_official 52:a51c77007319 220 /**
mbed_official 52:a51c77007319 221 * @}
mbed_official 52:a51c77007319 222 */
mbed_official 52:a51c77007319 223
mbed_official 52:a51c77007319 224 /** @defgroup Option_Bytes_IWatchdog
mbed_official 52:a51c77007319 225 * @{
mbed_official 52:a51c77007319 226 */
mbed_official 52:a51c77007319 227
mbed_official 52:a51c77007319 228 #define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */
mbed_official 52:a51c77007319 229 #define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */
mbed_official 52:a51c77007319 230 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
mbed_official 52:a51c77007319 231
mbed_official 52:a51c77007319 232 /**
mbed_official 52:a51c77007319 233 * @}
mbed_official 52:a51c77007319 234 */
mbed_official 52:a51c77007319 235
mbed_official 52:a51c77007319 236 /** @defgroup Option_Bytes_nRST_STOP
mbed_official 52:a51c77007319 237 * @{
mbed_official 52:a51c77007319 238 */
mbed_official 52:a51c77007319 239
mbed_official 52:a51c77007319 240 #define OB_STOP_NoRST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */
mbed_official 52:a51c77007319 241 #define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */
mbed_official 52:a51c77007319 242 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST))
mbed_official 52:a51c77007319 243
mbed_official 52:a51c77007319 244 /**
mbed_official 52:a51c77007319 245 * @}
mbed_official 52:a51c77007319 246 */
mbed_official 52:a51c77007319 247
mbed_official 52:a51c77007319 248 /** @defgroup Option_Bytes_nRST_STDBY
mbed_official 52:a51c77007319 249 * @{
mbed_official 52:a51c77007319 250 */
mbed_official 52:a51c77007319 251
mbed_official 52:a51c77007319 252 #define OB_STDBY_NoRST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */
mbed_official 52:a51c77007319 253 #define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */
mbed_official 52:a51c77007319 254 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST))
mbed_official 52:a51c77007319 255
mbed_official 52:a51c77007319 256 #ifdef STM32F10X_XL
mbed_official 52:a51c77007319 257 /**
mbed_official 52:a51c77007319 258 * @}
mbed_official 52:a51c77007319 259 */
mbed_official 52:a51c77007319 260 /** @defgroup FLASH_Boot
mbed_official 52:a51c77007319 261 * @{
mbed_official 52:a51c77007319 262 */
mbed_official 52:a51c77007319 263 #define FLASH_BOOT_Bank1 ((uint16_t)0x0000) /*!< At startup, if boot pins are set in boot from user Flash position
mbed_official 52:a51c77007319 264 and this parameter is selected the device will boot from Bank1(Default) */
mbed_official 52:a51c77007319 265 #define FLASH_BOOT_Bank2 ((uint16_t)0x0001) /*!< At startup, if boot pins are set in boot from user Flash position
mbed_official 52:a51c77007319 266 and this parameter is selected the device will boot from Bank 2 or Bank 1,
mbed_official 52:a51c77007319 267 depending on the activation of the bank */
mbed_official 52:a51c77007319 268 #define IS_FLASH_BOOT(BOOT) (((BOOT) == FLASH_BOOT_Bank1) || ((BOOT) == FLASH_BOOT_Bank2))
mbed_official 52:a51c77007319 269 #endif
mbed_official 52:a51c77007319 270 /**
mbed_official 52:a51c77007319 271 * @}
mbed_official 52:a51c77007319 272 */
mbed_official 52:a51c77007319 273 /** @defgroup FLASH_Interrupts
mbed_official 52:a51c77007319 274 * @{
mbed_official 52:a51c77007319 275 */
mbed_official 52:a51c77007319 276 #ifdef STM32F10X_XL
mbed_official 52:a51c77007319 277 #define FLASH_IT_BANK2_ERROR ((uint32_t)0x80000400) /*!< FPEC BANK2 error interrupt source */
mbed_official 52:a51c77007319 278 #define FLASH_IT_BANK2_EOP ((uint32_t)0x80001000) /*!< End of FLASH BANK2 Operation Interrupt source */
mbed_official 52:a51c77007319 279
mbed_official 52:a51c77007319 280 #define FLASH_IT_BANK1_ERROR FLASH_IT_ERROR /*!< FPEC BANK1 error interrupt source */
mbed_official 52:a51c77007319 281 #define FLASH_IT_BANK1_EOP FLASH_IT_EOP /*!< End of FLASH BANK1 Operation Interrupt source */
mbed_official 52:a51c77007319 282
mbed_official 52:a51c77007319 283 #define FLASH_IT_ERROR ((uint32_t)0x00000400) /*!< FPEC BANK1 error interrupt source */
mbed_official 52:a51c77007319 284 #define FLASH_IT_EOP ((uint32_t)0x00001000) /*!< End of FLASH BANK1 Operation Interrupt source */
mbed_official 52:a51c77007319 285 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0x7FFFEBFF) == 0x00000000) && (((IT) != 0x00000000)))
mbed_official 52:a51c77007319 286 #else
mbed_official 52:a51c77007319 287 #define FLASH_IT_ERROR ((uint32_t)0x00000400) /*!< FPEC error interrupt source */
mbed_official 52:a51c77007319 288 #define FLASH_IT_EOP ((uint32_t)0x00001000) /*!< End of FLASH Operation Interrupt source */
mbed_official 52:a51c77007319 289 #define FLASH_IT_BANK1_ERROR FLASH_IT_ERROR /*!< FPEC BANK1 error interrupt source */
mbed_official 52:a51c77007319 290 #define FLASH_IT_BANK1_EOP FLASH_IT_EOP /*!< End of FLASH BANK1 Operation Interrupt source */
mbed_official 52:a51c77007319 291
mbed_official 52:a51c77007319 292 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000)))
mbed_official 52:a51c77007319 293 #endif
mbed_official 52:a51c77007319 294
mbed_official 52:a51c77007319 295 /**
mbed_official 52:a51c77007319 296 * @}
mbed_official 52:a51c77007319 297 */
mbed_official 52:a51c77007319 298
mbed_official 52:a51c77007319 299 /** @defgroup FLASH_Flags
mbed_official 52:a51c77007319 300 * @{
mbed_official 52:a51c77007319 301 */
mbed_official 52:a51c77007319 302 #ifdef STM32F10X_XL
mbed_official 52:a51c77007319 303 #define FLASH_FLAG_BANK2_BSY ((uint32_t)0x80000001) /*!< FLASH BANK2 Busy flag */
mbed_official 52:a51c77007319 304 #define FLASH_FLAG_BANK2_EOP ((uint32_t)0x80000020) /*!< FLASH BANK2 End of Operation flag */
mbed_official 52:a51c77007319 305 #define FLASH_FLAG_BANK2_PGERR ((uint32_t)0x80000004) /*!< FLASH BANK2 Program error flag */
mbed_official 52:a51c77007319 306 #define FLASH_FLAG_BANK2_WRPRTERR ((uint32_t)0x80000010) /*!< FLASH BANK2 Write protected error flag */
mbed_official 52:a51c77007319 307
mbed_official 52:a51c77007319 308 #define FLASH_FLAG_BANK1_BSY FLASH_FLAG_BSY /*!< FLASH BANK1 Busy flag*/
mbed_official 52:a51c77007319 309 #define FLASH_FLAG_BANK1_EOP FLASH_FLAG_EOP /*!< FLASH BANK1 End of Operation flag */
mbed_official 52:a51c77007319 310 #define FLASH_FLAG_BANK1_PGERR FLASH_FLAG_PGERR /*!< FLASH BANK1 Program error flag */
mbed_official 52:a51c77007319 311 #define FLASH_FLAG_BANK1_WRPRTERR FLASH_FLAG_WRPRTERR /*!< FLASH BANK1 Write protected error flag */
mbed_official 52:a51c77007319 312
mbed_official 52:a51c77007319 313 #define FLASH_FLAG_BSY ((uint32_t)0x00000001) /*!< FLASH Busy flag */
mbed_official 52:a51c77007319 314 #define FLASH_FLAG_EOP ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
mbed_official 52:a51c77007319 315 #define FLASH_FLAG_PGERR ((uint32_t)0x00000004) /*!< FLASH Program error flag */
mbed_official 52:a51c77007319 316 #define FLASH_FLAG_WRPRTERR ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
mbed_official 52:a51c77007319 317 #define FLASH_FLAG_OPTERR ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
mbed_official 52:a51c77007319 318
mbed_official 52:a51c77007319 319 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0x7FFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
mbed_official 52:a51c77007319 320 #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \
mbed_official 52:a51c77007319 321 ((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_WRPRTERR) || \
mbed_official 52:a51c77007319 322 ((FLAG) == FLASH_FLAG_OPTERR)|| \
mbed_official 52:a51c77007319 323 ((FLAG) == FLASH_FLAG_BANK1_BSY) || ((FLAG) == FLASH_FLAG_BANK1_EOP) || \
mbed_official 52:a51c77007319 324 ((FLAG) == FLASH_FLAG_BANK1_PGERR) || ((FLAG) == FLASH_FLAG_BANK1_WRPRTERR) || \
mbed_official 52:a51c77007319 325 ((FLAG) == FLASH_FLAG_BANK2_BSY) || ((FLAG) == FLASH_FLAG_BANK2_EOP) || \
mbed_official 52:a51c77007319 326 ((FLAG) == FLASH_FLAG_BANK2_PGERR) || ((FLAG) == FLASH_FLAG_BANK2_WRPRTERR))
mbed_official 52:a51c77007319 327 #else
mbed_official 52:a51c77007319 328 #define FLASH_FLAG_BSY ((uint32_t)0x00000001) /*!< FLASH Busy flag */
mbed_official 52:a51c77007319 329 #define FLASH_FLAG_EOP ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
mbed_official 52:a51c77007319 330 #define FLASH_FLAG_PGERR ((uint32_t)0x00000004) /*!< FLASH Program error flag */
mbed_official 52:a51c77007319 331 #define FLASH_FLAG_WRPRTERR ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
mbed_official 52:a51c77007319 332 #define FLASH_FLAG_OPTERR ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
mbed_official 52:a51c77007319 333
mbed_official 52:a51c77007319 334 #define FLASH_FLAG_BANK1_BSY FLASH_FLAG_BSY /*!< FLASH BANK1 Busy flag*/
mbed_official 52:a51c77007319 335 #define FLASH_FLAG_BANK1_EOP FLASH_FLAG_EOP /*!< FLASH BANK1 End of Operation flag */
mbed_official 52:a51c77007319 336 #define FLASH_FLAG_BANK1_PGERR FLASH_FLAG_PGERR /*!< FLASH BANK1 Program error flag */
mbed_official 52:a51c77007319 337 #define FLASH_FLAG_BANK1_WRPRTERR FLASH_FLAG_WRPRTERR /*!< FLASH BANK1 Write protected error flag */
mbed_official 52:a51c77007319 338
mbed_official 52:a51c77007319 339 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
mbed_official 52:a51c77007319 340 #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \
mbed_official 52:a51c77007319 341 ((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_WRPRTERR) || \
mbed_official 52:a51c77007319 342 ((FLAG) == FLASH_FLAG_BANK1_BSY) || ((FLAG) == FLASH_FLAG_BANK1_EOP) || \
mbed_official 52:a51c77007319 343 ((FLAG) == FLASH_FLAG_BANK1_PGERR) || ((FLAG) == FLASH_FLAG_BANK1_WRPRTERR) || \
mbed_official 52:a51c77007319 344 ((FLAG) == FLASH_FLAG_OPTERR))
mbed_official 52:a51c77007319 345 #endif
mbed_official 52:a51c77007319 346
mbed_official 52:a51c77007319 347 /**
mbed_official 52:a51c77007319 348 * @}
mbed_official 52:a51c77007319 349 */
mbed_official 52:a51c77007319 350
mbed_official 52:a51c77007319 351 /**
mbed_official 52:a51c77007319 352 * @}
mbed_official 52:a51c77007319 353 */
mbed_official 52:a51c77007319 354
mbed_official 52:a51c77007319 355 /** @defgroup FLASH_Exported_Macros
mbed_official 52:a51c77007319 356 * @{
mbed_official 52:a51c77007319 357 */
mbed_official 52:a51c77007319 358
mbed_official 52:a51c77007319 359 /**
mbed_official 52:a51c77007319 360 * @}
mbed_official 52:a51c77007319 361 */
mbed_official 52:a51c77007319 362
mbed_official 52:a51c77007319 363 /** @defgroup FLASH_Exported_Functions
mbed_official 52:a51c77007319 364 * @{
mbed_official 52:a51c77007319 365 */
mbed_official 52:a51c77007319 366
mbed_official 52:a51c77007319 367 /*------------ Functions used for all STM32F10x devices -----*/
mbed_official 52:a51c77007319 368 void FLASH_SetLatency(uint32_t FLASH_Latency);
mbed_official 52:a51c77007319 369 void FLASH_HalfCycleAccessCmd(uint32_t FLASH_HalfCycleAccess);
mbed_official 52:a51c77007319 370 void FLASH_PrefetchBufferCmd(uint32_t FLASH_PrefetchBuffer);
mbed_official 52:a51c77007319 371 void FLASH_Unlock(void);
mbed_official 52:a51c77007319 372 void FLASH_Lock(void);
mbed_official 52:a51c77007319 373 FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
mbed_official 52:a51c77007319 374 FLASH_Status FLASH_EraseAllPages(void);
mbed_official 52:a51c77007319 375 FLASH_Status FLASH_EraseOptionBytes(void);
mbed_official 52:a51c77007319 376 FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
mbed_official 52:a51c77007319 377 FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
mbed_official 52:a51c77007319 378 FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data);
mbed_official 52:a51c77007319 379 FLASH_Status FLASH_EnableWriteProtection(uint32_t FLASH_Pages);
mbed_official 52:a51c77007319 380 FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState);
mbed_official 52:a51c77007319 381 FLASH_Status FLASH_UserOptionByteConfig(uint16_t OB_IWDG, uint16_t OB_STOP, uint16_t OB_STDBY);
mbed_official 52:a51c77007319 382 uint32_t FLASH_GetUserOptionByte(void);
mbed_official 52:a51c77007319 383 uint32_t FLASH_GetWriteProtectionOptionByte(void);
mbed_official 52:a51c77007319 384 FlagStatus FLASH_GetReadOutProtectionStatus(void);
mbed_official 52:a51c77007319 385 FlagStatus FLASH_GetPrefetchBufferStatus(void);
mbed_official 52:a51c77007319 386 void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState);
mbed_official 52:a51c77007319 387 FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG);
mbed_official 52:a51c77007319 388 void FLASH_ClearFlag(uint32_t FLASH_FLAG);
mbed_official 52:a51c77007319 389 FLASH_Status FLASH_GetStatus(void);
mbed_official 52:a51c77007319 390 FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
mbed_official 52:a51c77007319 391
mbed_official 52:a51c77007319 392 /*------------ New function used for all STM32F10x devices -----*/
mbed_official 52:a51c77007319 393 void FLASH_UnlockBank1(void);
mbed_official 52:a51c77007319 394 void FLASH_LockBank1(void);
mbed_official 52:a51c77007319 395 FLASH_Status FLASH_EraseAllBank1Pages(void);
mbed_official 52:a51c77007319 396 FLASH_Status FLASH_GetBank1Status(void);
mbed_official 52:a51c77007319 397 FLASH_Status FLASH_WaitForLastBank1Operation(uint32_t Timeout);
mbed_official 52:a51c77007319 398
mbed_official 52:a51c77007319 399 #ifdef STM32F10X_XL
mbed_official 52:a51c77007319 400 /*---- New Functions used only with STM32F10x_XL density devices -----*/
mbed_official 52:a51c77007319 401 void FLASH_UnlockBank2(void);
mbed_official 52:a51c77007319 402 void FLASH_LockBank2(void);
mbed_official 52:a51c77007319 403 FLASH_Status FLASH_EraseAllBank2Pages(void);
mbed_official 52:a51c77007319 404 FLASH_Status FLASH_GetBank2Status(void);
mbed_official 52:a51c77007319 405 FLASH_Status FLASH_WaitForLastBank2Operation(uint32_t Timeout);
mbed_official 52:a51c77007319 406 FLASH_Status FLASH_BootConfig(uint16_t FLASH_BOOT);
mbed_official 52:a51c77007319 407 #endif
mbed_official 52:a51c77007319 408
mbed_official 52:a51c77007319 409 #ifdef __cplusplus
mbed_official 52:a51c77007319 410 }
mbed_official 52:a51c77007319 411 #endif
mbed_official 52:a51c77007319 412
mbed_official 52:a51c77007319 413 #endif /* __STM32F10x_FLASH_H */
mbed_official 52:a51c77007319 414 /**
mbed_official 52:a51c77007319 415 * @}
mbed_official 52:a51c77007319 416 */
mbed_official 52:a51c77007319 417
mbed_official 52:a51c77007319 418 /**
mbed_official 52:a51c77007319 419 * @}
mbed_official 52:a51c77007319 420 */
mbed_official 52:a51c77007319 421
mbed_official 52:a51c77007319 422 /**
mbed_official 52:a51c77007319 423 * @}
mbed_official 52:a51c77007319 424 */
mbed_official 52:a51c77007319 425
mbed_official 52:a51c77007319 426 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/