mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Mar 19 16:00:09 2014 +0000
Revision:
126:549ba18ddd81
Synchronized with git revision cf8fd1cf86b0cd85131dd24a6ded21cc6fe04827

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

Conflicts:
workspace_tools/targets.py

Who changed what in which revision?

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