mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Mar 19 10:15:22 2014 +0000
Revision:
125:23cc3068a9e4
Synchronized with git revision ace35dfba3748c7cdc102eb38ec6b9e1067c3252

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

[NUCLEO_F302R8] Add cmsis and hal files + change F401RE clock to 84MHz

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 125:23cc3068a9e4 1 /**
mbed_official 125:23cc3068a9e4 2 ******************************************************************************
mbed_official 125:23cc3068a9e4 3 * @file stm32f30x_flash.c
mbed_official 125:23cc3068a9e4 4 * @author MCD Application Team
mbed_official 125:23cc3068a9e4 5 * @version V1.1.0
mbed_official 125:23cc3068a9e4 6 * @date 27-February-2014
mbed_official 125:23cc3068a9e4 7 * @brief This file provides firmware functions to manage the following
mbed_official 125:23cc3068a9e4 8 * functionalities of the FLASH peripheral:
mbed_official 125:23cc3068a9e4 9 * + FLASH Interface configuration
mbed_official 125:23cc3068a9e4 10 * + FLASH Memory Programming
mbed_official 125:23cc3068a9e4 11 * + Option Bytes Programming
mbed_official 125:23cc3068a9e4 12 * + Interrupts and flags management
mbed_official 125:23cc3068a9e4 13 *
mbed_official 125:23cc3068a9e4 14 @verbatim
mbed_official 125:23cc3068a9e4 15
mbed_official 125:23cc3068a9e4 16 ===============================================================================
mbed_official 125:23cc3068a9e4 17 ##### How to use this driver #####
mbed_official 125:23cc3068a9e4 18 ===============================================================================
mbed_official 125:23cc3068a9e4 19 [..] This driver provides functions to configure and program the FLASH
mbed_official 125:23cc3068a9e4 20 memory of all STM32F30x devices. These functions are split in 4 groups:
mbed_official 125:23cc3068a9e4 21 (#) FLASH Interface configuration functions: this group includes the
mbed_official 125:23cc3068a9e4 22 management of following features:
mbed_official 125:23cc3068a9e4 23 (++) Set the latency.
mbed_official 125:23cc3068a9e4 24 (++) Enable/Disable the Half Cycle Access.
mbed_official 125:23cc3068a9e4 25 (++) Enable/Disable the prefetch buffer.
mbed_official 125:23cc3068a9e4 26 (#) FLASH Memory Programming functions: this group includes all needed
mbed_official 125:23cc3068a9e4 27 functions to erase and program the main memory:
mbed_official 125:23cc3068a9e4 28 (++) Lock and Unlock the FLASH interface.
mbed_official 125:23cc3068a9e4 29 (++) Erase function: Erase page, erase all pages.
mbed_official 125:23cc3068a9e4 30 (++) Program functions: Half Word and Word write.
mbed_official 125:23cc3068a9e4 31 (#) FLASH Option Bytes Programming functions: this group includes all
mbed_official 125:23cc3068a9e4 32 needed functions to manage the Option Bytes:
mbed_official 125:23cc3068a9e4 33 (++) Lock and Unlock the Flash Option bytes.
mbed_official 125:23cc3068a9e4 34 (++) Launch the Option Bytes loader
mbed_official 125:23cc3068a9e4 35 (++) Erase the Option Bytes
mbed_official 125:23cc3068a9e4 36 (++) Set/Reset the write protection
mbed_official 125:23cc3068a9e4 37 (++) Set the Read protection Level
mbed_official 125:23cc3068a9e4 38 (++) Program the user option Bytes
mbed_official 125:23cc3068a9e4 39 (++) Set/Reset the BOOT1 bit
mbed_official 125:23cc3068a9e4 40 (++) Enable/Disable the VDDA Analog Monitoring
mbed_official 125:23cc3068a9e4 41 (++) Enable/Disable the SRAM parity
mbed_official 125:23cc3068a9e4 42 (++) Get the user option bytes
mbed_official 125:23cc3068a9e4 43 (++) Get the Write protection
mbed_official 125:23cc3068a9e4 44 (++) Get the read protection status
mbed_official 125:23cc3068a9e4 45 (#) FLASH Interrupts and flags management functions: this group includes
mbed_official 125:23cc3068a9e4 46 all needed functions to:
mbed_official 125:23cc3068a9e4 47 (++) Enable/Disable the FLASH interrupt sources.
mbed_official 125:23cc3068a9e4 48 (++) Get flags status.
mbed_official 125:23cc3068a9e4 49 (++) Clear flags.
mbed_official 125:23cc3068a9e4 50 (++) Get FLASH operation status.
mbed_official 125:23cc3068a9e4 51 (++) Wait for last FLASH operation.
mbed_official 125:23cc3068a9e4 52
mbed_official 125:23cc3068a9e4 53 @endverbatim
mbed_official 125:23cc3068a9e4 54
mbed_official 125:23cc3068a9e4 55 ******************************************************************************
mbed_official 125:23cc3068a9e4 56 * @attention
mbed_official 125:23cc3068a9e4 57 *
mbed_official 125:23cc3068a9e4 58 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 125:23cc3068a9e4 59 *
mbed_official 125:23cc3068a9e4 60 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 125:23cc3068a9e4 61 * are permitted provided that the following conditions are met:
mbed_official 125:23cc3068a9e4 62 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 125:23cc3068a9e4 63 * this list of conditions and the following disclaimer.
mbed_official 125:23cc3068a9e4 64 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 125:23cc3068a9e4 65 * this list of conditions and the following disclaimer in the documentation
mbed_official 125:23cc3068a9e4 66 * and/or other materials provided with the distribution.
mbed_official 125:23cc3068a9e4 67 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 125:23cc3068a9e4 68 * may be used to endorse or promote products derived from this software
mbed_official 125:23cc3068a9e4 69 * without specific prior written permission.
mbed_official 125:23cc3068a9e4 70 *
mbed_official 125:23cc3068a9e4 71 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 125:23cc3068a9e4 72 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 125:23cc3068a9e4 73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 125:23cc3068a9e4 74 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 125:23cc3068a9e4 75 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 125:23cc3068a9e4 76 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 125:23cc3068a9e4 77 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 125:23cc3068a9e4 78 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 125:23cc3068a9e4 79 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 125:23cc3068a9e4 80 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 125:23cc3068a9e4 81 *
mbed_official 125:23cc3068a9e4 82 ******************************************************************************
mbed_official 125:23cc3068a9e4 83 */
mbed_official 125:23cc3068a9e4 84
mbed_official 125:23cc3068a9e4 85 /* Includes ------------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 86 #include "stm32f30x_flash.h"
mbed_official 125:23cc3068a9e4 87
mbed_official 125:23cc3068a9e4 88 /** @addtogroup STM32F30x_StdPeriph_Driver
mbed_official 125:23cc3068a9e4 89 * @{
mbed_official 125:23cc3068a9e4 90 */
mbed_official 125:23cc3068a9e4 91
mbed_official 125:23cc3068a9e4 92 /** @defgroup FLASH
mbed_official 125:23cc3068a9e4 93 * @brief FLASH driver modules
mbed_official 125:23cc3068a9e4 94 * @{
mbed_official 125:23cc3068a9e4 95 */
mbed_official 125:23cc3068a9e4 96
mbed_official 125:23cc3068a9e4 97 /* Private typedef -----------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 98 /* Private define ------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 99
mbed_official 125:23cc3068a9e4 100 /* FLASH Mask */
mbed_official 125:23cc3068a9e4 101 #define RDPRT_MASK ((uint32_t)0x00000002)
mbed_official 125:23cc3068a9e4 102 #define WRP01_MASK ((uint32_t)0x0000FFFF)
mbed_official 125:23cc3068a9e4 103 #define WRP23_MASK ((uint32_t)0xFFFF0000)
mbed_official 125:23cc3068a9e4 104 /* Private macro -------------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 105 /* Private variables ---------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 106 /* Private function prototypes -----------------------------------------------*/
mbed_official 125:23cc3068a9e4 107 /* Private functions ---------------------------------------------------------*/
mbed_official 125:23cc3068a9e4 108
mbed_official 125:23cc3068a9e4 109 /** @defgroup FLASH_Private_Functions
mbed_official 125:23cc3068a9e4 110 * @{
mbed_official 125:23cc3068a9e4 111 */
mbed_official 125:23cc3068a9e4 112
mbed_official 125:23cc3068a9e4 113 /** @defgroup FLASH_Group1 FLASH Interface configuration functions
mbed_official 125:23cc3068a9e4 114 * @brief FLASH Interface configuration functions
mbed_official 125:23cc3068a9e4 115 *
mbed_official 125:23cc3068a9e4 116
mbed_official 125:23cc3068a9e4 117 @verbatim
mbed_official 125:23cc3068a9e4 118 ===============================================================================
mbed_official 125:23cc3068a9e4 119 ##### FLASH Interface configuration functions #####
mbed_official 125:23cc3068a9e4 120 ===============================================================================
mbed_official 125:23cc3068a9e4 121 [..] This group includes the following functions:
mbed_official 125:23cc3068a9e4 122 (+) void FLASH_SetLatency(uint32_t FLASH_Latency);
mbed_official 125:23cc3068a9e4 123 (+) void FLASH_HalfCycleAccessCmd(uint32_t FLASH_HalfCycleAccess);
mbed_official 125:23cc3068a9e4 124 (+) void FLASH_PrefetchBufferCmd(FunctionalState NewState);
mbed_official 125:23cc3068a9e4 125 [..] The unlock sequence is not needed for these functions.
mbed_official 125:23cc3068a9e4 126
mbed_official 125:23cc3068a9e4 127 @endverbatim
mbed_official 125:23cc3068a9e4 128 * @{
mbed_official 125:23cc3068a9e4 129 */
mbed_official 125:23cc3068a9e4 130
mbed_official 125:23cc3068a9e4 131 /**
mbed_official 125:23cc3068a9e4 132 * @brief Sets the code latency value.
mbed_official 125:23cc3068a9e4 133 * @param FLASH_Latency: specifies the FLASH Latency value.
mbed_official 125:23cc3068a9e4 134 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 135 * @arg FLASH_Latency_0: FLASH Zero Latency cycle
mbed_official 125:23cc3068a9e4 136 * @arg FLASH_Latency_1: FLASH One Latency cycle
mbed_official 125:23cc3068a9e4 137 * @arg FLASH_Latency_2: FLASH Two Latency cycles
mbed_official 125:23cc3068a9e4 138 * @retval None
mbed_official 125:23cc3068a9e4 139 */
mbed_official 125:23cc3068a9e4 140 void FLASH_SetLatency(uint32_t FLASH_Latency)
mbed_official 125:23cc3068a9e4 141 {
mbed_official 125:23cc3068a9e4 142 uint32_t tmpreg = 0;
mbed_official 125:23cc3068a9e4 143
mbed_official 125:23cc3068a9e4 144 /* Check the parameters */
mbed_official 125:23cc3068a9e4 145 assert_param(IS_FLASH_LATENCY(FLASH_Latency));
mbed_official 125:23cc3068a9e4 146
mbed_official 125:23cc3068a9e4 147 /* Read the ACR register */
mbed_official 125:23cc3068a9e4 148 tmpreg = FLASH->ACR;
mbed_official 125:23cc3068a9e4 149
mbed_official 125:23cc3068a9e4 150 /* Sets the Latency value */
mbed_official 125:23cc3068a9e4 151 tmpreg &= (uint32_t) (~((uint32_t)FLASH_ACR_LATENCY));
mbed_official 125:23cc3068a9e4 152 tmpreg |= FLASH_Latency;
mbed_official 125:23cc3068a9e4 153
mbed_official 125:23cc3068a9e4 154 /* Write the ACR register */
mbed_official 125:23cc3068a9e4 155 FLASH->ACR = tmpreg;
mbed_official 125:23cc3068a9e4 156 }
mbed_official 125:23cc3068a9e4 157
mbed_official 125:23cc3068a9e4 158 /**
mbed_official 125:23cc3068a9e4 159 * @brief Enables or disables the Half cycle flash access.
mbed_official 125:23cc3068a9e4 160 * @param FLASH_HalfCycleAccess: specifies the FLASH Half cycle Access mode.
mbed_official 125:23cc3068a9e4 161 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 162 * @arg FLASH_HalfCycleAccess_Enable: FLASH Half Cycle Enable
mbed_official 125:23cc3068a9e4 163 * @arg FLASH_HalfCycleAccess_Disable: FLASH Half Cycle Disable
mbed_official 125:23cc3068a9e4 164 * @retval None
mbed_official 125:23cc3068a9e4 165 */
mbed_official 125:23cc3068a9e4 166 void FLASH_HalfCycleAccessCmd(FunctionalState NewState)
mbed_official 125:23cc3068a9e4 167 {
mbed_official 125:23cc3068a9e4 168 /* Check the parameters */
mbed_official 125:23cc3068a9e4 169 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 125:23cc3068a9e4 170
mbed_official 125:23cc3068a9e4 171 if(NewState != DISABLE)
mbed_official 125:23cc3068a9e4 172 {
mbed_official 125:23cc3068a9e4 173 FLASH->ACR |= FLASH_ACR_HLFCYA;
mbed_official 125:23cc3068a9e4 174 }
mbed_official 125:23cc3068a9e4 175 else
mbed_official 125:23cc3068a9e4 176 {
mbed_official 125:23cc3068a9e4 177 FLASH->ACR &= (uint32_t)(~((uint32_t)FLASH_ACR_HLFCYA));
mbed_official 125:23cc3068a9e4 178 }
mbed_official 125:23cc3068a9e4 179 }
mbed_official 125:23cc3068a9e4 180
mbed_official 125:23cc3068a9e4 181 /**
mbed_official 125:23cc3068a9e4 182 * @brief Enables or disables the Prefetch Buffer.
mbed_official 125:23cc3068a9e4 183 * @param NewState: new state of the Prefetch Buffer.
mbed_official 125:23cc3068a9e4 184 * This parameter can be: ENABLE or DISABLE.
mbed_official 125:23cc3068a9e4 185 * @retval None
mbed_official 125:23cc3068a9e4 186 */
mbed_official 125:23cc3068a9e4 187 void FLASH_PrefetchBufferCmd(FunctionalState NewState)
mbed_official 125:23cc3068a9e4 188 {
mbed_official 125:23cc3068a9e4 189 /* Check the parameters */
mbed_official 125:23cc3068a9e4 190 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 125:23cc3068a9e4 191
mbed_official 125:23cc3068a9e4 192 if(NewState != DISABLE)
mbed_official 125:23cc3068a9e4 193 {
mbed_official 125:23cc3068a9e4 194 FLASH->ACR |= FLASH_ACR_PRFTBE;
mbed_official 125:23cc3068a9e4 195 }
mbed_official 125:23cc3068a9e4 196 else
mbed_official 125:23cc3068a9e4 197 {
mbed_official 125:23cc3068a9e4 198 FLASH->ACR &= (uint32_t)(~((uint32_t)FLASH_ACR_PRFTBE));
mbed_official 125:23cc3068a9e4 199 }
mbed_official 125:23cc3068a9e4 200 }
mbed_official 125:23cc3068a9e4 201
mbed_official 125:23cc3068a9e4 202 /**
mbed_official 125:23cc3068a9e4 203 * @}
mbed_official 125:23cc3068a9e4 204 */
mbed_official 125:23cc3068a9e4 205
mbed_official 125:23cc3068a9e4 206 /** @defgroup FLASH_Group2 FLASH Memory Programming functions
mbed_official 125:23cc3068a9e4 207 * @brief FLASH Memory Programming functions
mbed_official 125:23cc3068a9e4 208 *
mbed_official 125:23cc3068a9e4 209 @verbatim
mbed_official 125:23cc3068a9e4 210 ===============================================================================
mbed_official 125:23cc3068a9e4 211 ##### FLASH Memory Programming functions #####
mbed_official 125:23cc3068a9e4 212 ===============================================================================
mbed_official 125:23cc3068a9e4 213 [..] This group includes the following functions:
mbed_official 125:23cc3068a9e4 214 (+) void FLASH_Unlock(void);
mbed_official 125:23cc3068a9e4 215 (+) void FLASH_Lock(void);
mbed_official 125:23cc3068a9e4 216 (+) FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
mbed_official 125:23cc3068a9e4 217 (+) FLASH_Status FLASH_EraseAllPages(void);
mbed_official 125:23cc3068a9e4 218 (+) FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
mbed_official 125:23cc3068a9e4 219 (+) FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
mbed_official 125:23cc3068a9e4 220 [..] Any operation of erase or program should follow these steps:
mbed_official 125:23cc3068a9e4 221 (#) Call the FLASH_Unlock() function to enable the FLASH control register
mbed_official 125:23cc3068a9e4 222 program memory access.
mbed_official 125:23cc3068a9e4 223 (#) Call the desired function to erase page or program data.
mbed_official 125:23cc3068a9e4 224 (#) Call the FLASH_Lock() function to disable the FLASH control register
mbed_official 125:23cc3068a9e4 225 access (recommended to protect the FLASH memory against possible
mbed_official 125:23cc3068a9e4 226 unwanted operation).
mbed_official 125:23cc3068a9e4 227
mbed_official 125:23cc3068a9e4 228 @endverbatim
mbed_official 125:23cc3068a9e4 229 * @{
mbed_official 125:23cc3068a9e4 230 */
mbed_official 125:23cc3068a9e4 231
mbed_official 125:23cc3068a9e4 232 /**
mbed_official 125:23cc3068a9e4 233 * @brief Unlocks the FLASH control register access
mbed_official 125:23cc3068a9e4 234 * @param None
mbed_official 125:23cc3068a9e4 235 * @retval None
mbed_official 125:23cc3068a9e4 236 */
mbed_official 125:23cc3068a9e4 237 void FLASH_Unlock(void)
mbed_official 125:23cc3068a9e4 238 {
mbed_official 125:23cc3068a9e4 239 if((FLASH->CR & FLASH_CR_LOCK) != RESET)
mbed_official 125:23cc3068a9e4 240 {
mbed_official 125:23cc3068a9e4 241 /* Authorize the FLASH Registers access */
mbed_official 125:23cc3068a9e4 242 FLASH->KEYR = FLASH_KEY1;
mbed_official 125:23cc3068a9e4 243 FLASH->KEYR = FLASH_KEY2;
mbed_official 125:23cc3068a9e4 244 }
mbed_official 125:23cc3068a9e4 245 }
mbed_official 125:23cc3068a9e4 246
mbed_official 125:23cc3068a9e4 247 /**
mbed_official 125:23cc3068a9e4 248 * @brief Locks the FLASH control register access
mbed_official 125:23cc3068a9e4 249 * @param None
mbed_official 125:23cc3068a9e4 250 * @retval None
mbed_official 125:23cc3068a9e4 251 */
mbed_official 125:23cc3068a9e4 252 void FLASH_Lock(void)
mbed_official 125:23cc3068a9e4 253 {
mbed_official 125:23cc3068a9e4 254 /* Set the LOCK Bit to lock the FLASH Registers access */
mbed_official 125:23cc3068a9e4 255 FLASH->CR |= FLASH_CR_LOCK;
mbed_official 125:23cc3068a9e4 256 }
mbed_official 125:23cc3068a9e4 257
mbed_official 125:23cc3068a9e4 258 /**
mbed_official 125:23cc3068a9e4 259 * @brief Erases a specified page in program memory.
mbed_official 125:23cc3068a9e4 260 * @note To correctly run this function, the FLASH_Unlock() function
mbed_official 125:23cc3068a9e4 261 * must be called before.
mbed_official 125:23cc3068a9e4 262 * @note Call the FLASH_Lock() to disable the flash memory access
mbed_official 125:23cc3068a9e4 263 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 264 * @param Page_Address: The page address in program memory to be erased.
mbed_official 125:23cc3068a9e4 265 * @note A Page is erased in the Program memory only if the address to load
mbed_official 125:23cc3068a9e4 266 * is the start address of a page (multiple of 1024 bytes).
mbed_official 125:23cc3068a9e4 267 * @retval FLASH Status: The returned value can be:
mbed_official 125:23cc3068a9e4 268 * FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 269 */
mbed_official 125:23cc3068a9e4 270 FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
mbed_official 125:23cc3068a9e4 271 {
mbed_official 125:23cc3068a9e4 272 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 273
mbed_official 125:23cc3068a9e4 274 /* Check the parameters */
mbed_official 125:23cc3068a9e4 275 assert_param(IS_FLASH_PROGRAM_ADDRESS(Page_Address));
mbed_official 125:23cc3068a9e4 276
mbed_official 125:23cc3068a9e4 277 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 278 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 279
mbed_official 125:23cc3068a9e4 280 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 281 {
mbed_official 125:23cc3068a9e4 282 /* If the previous operation is completed, proceed to erase the page */
mbed_official 125:23cc3068a9e4 283 FLASH->CR |= FLASH_CR_PER;
mbed_official 125:23cc3068a9e4 284 FLASH->AR = Page_Address;
mbed_official 125:23cc3068a9e4 285 FLASH->CR |= FLASH_CR_STRT;
mbed_official 125:23cc3068a9e4 286
mbed_official 125:23cc3068a9e4 287 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 288 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 289
mbed_official 125:23cc3068a9e4 290 /* Disable the PER Bit */
mbed_official 125:23cc3068a9e4 291 FLASH->CR &= ~FLASH_CR_PER;
mbed_official 125:23cc3068a9e4 292 }
mbed_official 125:23cc3068a9e4 293
mbed_official 125:23cc3068a9e4 294 /* Return the Erase Status */
mbed_official 125:23cc3068a9e4 295 return status;
mbed_official 125:23cc3068a9e4 296 }
mbed_official 125:23cc3068a9e4 297
mbed_official 125:23cc3068a9e4 298 /**
mbed_official 125:23cc3068a9e4 299 * @brief Erases all FLASH pages.
mbed_official 125:23cc3068a9e4 300 * @note To correctly run this function, the FLASH_Unlock() function
mbed_official 125:23cc3068a9e4 301 * must be called before.
mbed_official 125:23cc3068a9e4 302 * all the FLASH_Lock() to disable the flash memory access
mbed_official 125:23cc3068a9e4 303 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 304 * @param None
mbed_official 125:23cc3068a9e4 305 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 306 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 307 */
mbed_official 125:23cc3068a9e4 308 FLASH_Status FLASH_EraseAllPages(void)
mbed_official 125:23cc3068a9e4 309 {
mbed_official 125:23cc3068a9e4 310 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 311
mbed_official 125:23cc3068a9e4 312 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 313 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 314
mbed_official 125:23cc3068a9e4 315 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 316 {
mbed_official 125:23cc3068a9e4 317 /* if the previous operation is completed, proceed to erase all pages */
mbed_official 125:23cc3068a9e4 318 FLASH->CR |= FLASH_CR_MER;
mbed_official 125:23cc3068a9e4 319 FLASH->CR |= FLASH_CR_STRT;
mbed_official 125:23cc3068a9e4 320
mbed_official 125:23cc3068a9e4 321 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 322 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 323
mbed_official 125:23cc3068a9e4 324 /* Disable the MER Bit */
mbed_official 125:23cc3068a9e4 325 FLASH->CR &= ~FLASH_CR_MER;
mbed_official 125:23cc3068a9e4 326 }
mbed_official 125:23cc3068a9e4 327
mbed_official 125:23cc3068a9e4 328 /* Return the Erase Status */
mbed_official 125:23cc3068a9e4 329 return status;
mbed_official 125:23cc3068a9e4 330 }
mbed_official 125:23cc3068a9e4 331
mbed_official 125:23cc3068a9e4 332 /**
mbed_official 125:23cc3068a9e4 333 * @brief Programs a word at a specified address.
mbed_official 125:23cc3068a9e4 334 * @note To correctly run this function, the FLASH_Unlock() function
mbed_official 125:23cc3068a9e4 335 * must be called before.
mbed_official 125:23cc3068a9e4 336 * Call the FLASH_Lock() to disable the flash memory access
mbed_official 125:23cc3068a9e4 337 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 338 * @param Address: specifies the address to be programmed.
mbed_official 125:23cc3068a9e4 339 * @param Data: specifies the data to be programmed.
mbed_official 125:23cc3068a9e4 340 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 341 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 342 */
mbed_official 125:23cc3068a9e4 343 FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
mbed_official 125:23cc3068a9e4 344 {
mbed_official 125:23cc3068a9e4 345 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 346 __IO uint32_t tmp = 0;
mbed_official 125:23cc3068a9e4 347
mbed_official 125:23cc3068a9e4 348 /* Check the parameters */
mbed_official 125:23cc3068a9e4 349 assert_param(IS_FLASH_PROGRAM_ADDRESS(Address));
mbed_official 125:23cc3068a9e4 350
mbed_official 125:23cc3068a9e4 351 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 352 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 353
mbed_official 125:23cc3068a9e4 354 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 355 {
mbed_official 125:23cc3068a9e4 356 /* If the previous operation is completed, proceed to program the new first
mbed_official 125:23cc3068a9e4 357 half word */
mbed_official 125:23cc3068a9e4 358 FLASH->CR |= FLASH_CR_PG;
mbed_official 125:23cc3068a9e4 359
mbed_official 125:23cc3068a9e4 360 *(__IO uint16_t*)Address = (uint16_t)Data;
mbed_official 125:23cc3068a9e4 361
mbed_official 125:23cc3068a9e4 362 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 363 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 364
mbed_official 125:23cc3068a9e4 365 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 366 {
mbed_official 125:23cc3068a9e4 367 /* If the previous operation is completed, proceed to program the new second
mbed_official 125:23cc3068a9e4 368 half word */
mbed_official 125:23cc3068a9e4 369 tmp = Address + 2;
mbed_official 125:23cc3068a9e4 370
mbed_official 125:23cc3068a9e4 371 *(__IO uint16_t*) tmp = Data >> 16;
mbed_official 125:23cc3068a9e4 372
mbed_official 125:23cc3068a9e4 373 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 374 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 375
mbed_official 125:23cc3068a9e4 376 /* Disable the PG Bit */
mbed_official 125:23cc3068a9e4 377 FLASH->CR &= ~FLASH_CR_PG;
mbed_official 125:23cc3068a9e4 378 }
mbed_official 125:23cc3068a9e4 379 else
mbed_official 125:23cc3068a9e4 380 {
mbed_official 125:23cc3068a9e4 381 /* Disable the PG Bit */
mbed_official 125:23cc3068a9e4 382 FLASH->CR &= ~FLASH_CR_PG;
mbed_official 125:23cc3068a9e4 383 }
mbed_official 125:23cc3068a9e4 384 }
mbed_official 125:23cc3068a9e4 385
mbed_official 125:23cc3068a9e4 386 /* Return the Program Status */
mbed_official 125:23cc3068a9e4 387 return status;
mbed_official 125:23cc3068a9e4 388 }
mbed_official 125:23cc3068a9e4 389
mbed_official 125:23cc3068a9e4 390 /**
mbed_official 125:23cc3068a9e4 391 * @brief Programs a half word at a specified address.
mbed_official 125:23cc3068a9e4 392 * @note To correctly run this function, the FLASH_Unlock() function
mbed_official 125:23cc3068a9e4 393 * must be called before.
mbed_official 125:23cc3068a9e4 394 * Call the FLASH_Lock() to disable the flash memory access
mbed_official 125:23cc3068a9e4 395 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 396 * @param Address: specifies the address to be programmed.
mbed_official 125:23cc3068a9e4 397 * @param Data: specifies the data to be programmed.
mbed_official 125:23cc3068a9e4 398 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 399 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 400 */
mbed_official 125:23cc3068a9e4 401 FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
mbed_official 125:23cc3068a9e4 402 {
mbed_official 125:23cc3068a9e4 403 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 404
mbed_official 125:23cc3068a9e4 405 /* Check the parameters */
mbed_official 125:23cc3068a9e4 406 assert_param(IS_FLASH_PROGRAM_ADDRESS(Address));
mbed_official 125:23cc3068a9e4 407
mbed_official 125:23cc3068a9e4 408 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 409 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 410
mbed_official 125:23cc3068a9e4 411 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 412 {
mbed_official 125:23cc3068a9e4 413 /* If the previous operation is completed, proceed to program the new data */
mbed_official 125:23cc3068a9e4 414 FLASH->CR |= FLASH_CR_PG;
mbed_official 125:23cc3068a9e4 415
mbed_official 125:23cc3068a9e4 416 *(__IO uint16_t*)Address = Data;
mbed_official 125:23cc3068a9e4 417
mbed_official 125:23cc3068a9e4 418 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 419 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 420
mbed_official 125:23cc3068a9e4 421 /* Disable the PG Bit */
mbed_official 125:23cc3068a9e4 422 FLASH->CR &= ~FLASH_CR_PG;
mbed_official 125:23cc3068a9e4 423 }
mbed_official 125:23cc3068a9e4 424
mbed_official 125:23cc3068a9e4 425 /* Return the Program Status */
mbed_official 125:23cc3068a9e4 426 return status;
mbed_official 125:23cc3068a9e4 427 }
mbed_official 125:23cc3068a9e4 428
mbed_official 125:23cc3068a9e4 429 /**
mbed_official 125:23cc3068a9e4 430 * @}
mbed_official 125:23cc3068a9e4 431 */
mbed_official 125:23cc3068a9e4 432
mbed_official 125:23cc3068a9e4 433 /** @defgroup FLASH_Group3 Option Bytes Programming functions
mbed_official 125:23cc3068a9e4 434 * @brief Option Bytes Programming functions
mbed_official 125:23cc3068a9e4 435 *
mbed_official 125:23cc3068a9e4 436 @verbatim
mbed_official 125:23cc3068a9e4 437 ===============================================================================
mbed_official 125:23cc3068a9e4 438 ##### Option Bytes Programming functions #####
mbed_official 125:23cc3068a9e4 439 ===============================================================================
mbed_official 125:23cc3068a9e4 440 [..] This group includes the following functions:
mbed_official 125:23cc3068a9e4 441 (+) void FLASH_OB_Unlock(void);
mbed_official 125:23cc3068a9e4 442 (+) void FLASH_OB_Lock(void);
mbed_official 125:23cc3068a9e4 443 (+) void FLASH_OB_Erase(void);
mbed_official 125:23cc3068a9e4 444 (+) FLASH_Status FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState);
mbed_official 125:23cc3068a9e4 445 (+) FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP);
mbed_official 125:23cc3068a9e4 446 (+) FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY);
mbed_official 125:23cc3068a9e4 447 (+) FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1);
mbed_official 125:23cc3068a9e4 448 (+) FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG);
mbed_official 125:23cc3068a9e4 449 (+) FLASH_Status FLASH_OB_SRMParityConfig(uint8_t OB_SRAM_Parity);
mbed_official 125:23cc3068a9e4 450 (+) FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER);
mbed_official 125:23cc3068a9e4 451 (+) FLASH_Status FLASH_OB_Launch(void);
mbed_official 125:23cc3068a9e4 452 (+) uint32_t FLASH_OB_GetUser(void);
mbed_official 125:23cc3068a9e4 453 (+) uint8_t FLASH_OB_GetWRP(void);
mbed_official 125:23cc3068a9e4 454 (+) uint8_t FLASH_OB_GetRDP(void);
mbed_official 125:23cc3068a9e4 455 [..] Any operation of erase or program should follow these steps:
mbed_official 125:23cc3068a9e4 456 (#) Call the FLASH_OB_Unlock() function to enable the FLASH option control
mbed_official 125:23cc3068a9e4 457 register access.
mbed_official 125:23cc3068a9e4 458 (#) Call one or several functions to program the desired Option Bytes:
mbed_official 125:23cc3068a9e4 459 (++) void FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState);
mbed_official 125:23cc3068a9e4 460 => to Enable/Disable the desired sector write protection.
mbed_official 125:23cc3068a9e4 461 (++) FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP) => to set the
mbed_official 125:23cc3068a9e4 462 desired read Protection Level.
mbed_official 125:23cc3068a9e4 463 (++) FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY);
mbed_official 125:23cc3068a9e4 464 => to configure the user Option Bytes.
mbed_official 125:23cc3068a9e4 465 (++) FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1);
mbed_official 125:23cc3068a9e4 466 => to set the boot1 mode
mbed_official 125:23cc3068a9e4 467 (++) FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG);
mbed_official 125:23cc3068a9e4 468 => to Enable/Disable the VDDA monotoring.
mbed_official 125:23cc3068a9e4 469 (++) FLASH_Status FLASH_OB_SRMParityConfig(uint8_t OB_SRAM_Parity);
mbed_official 125:23cc3068a9e4 470 => to Enable/Disable the SRAM Parity check.
mbed_official 125:23cc3068a9e4 471 (++) FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER);
mbed_official 125:23cc3068a9e4 472 => to write all user option bytes: OB_IWDG, OB_STOP, OB_STDBY,
mbed_official 125:23cc3068a9e4 473 OB_BOOT1, OB_VDDA_ANALOG and OB_VDD_SD12.
mbed_official 125:23cc3068a9e4 474 (#) Once all needed Option Bytes to be programmed are correctly written,
mbed_official 125:23cc3068a9e4 475 call the FLASH_OB_Launch() function to launch the Option Bytes
mbed_official 125:23cc3068a9e4 476 programming process.
mbed_official 125:23cc3068a9e4 477 (#@) When changing the IWDG mode from HW to SW or from SW to HW, a system
mbed_official 125:23cc3068a9e4 478 reset is needed to make the change effective.
mbed_official 125:23cc3068a9e4 479 (#) Call the FLASH_OB_Lock() function to disable the FLASH option control
mbed_official 125:23cc3068a9e4 480 register access (recommended to protect the Option Bytes against
mbed_official 125:23cc3068a9e4 481 possible unwanted operations).
mbed_official 125:23cc3068a9e4 482
mbed_official 125:23cc3068a9e4 483 @endverbatim
mbed_official 125:23cc3068a9e4 484 * @{
mbed_official 125:23cc3068a9e4 485 */
mbed_official 125:23cc3068a9e4 486
mbed_official 125:23cc3068a9e4 487 /**
mbed_official 125:23cc3068a9e4 488 * @brief Unlocks the option bytes block access.
mbed_official 125:23cc3068a9e4 489 * @param None
mbed_official 125:23cc3068a9e4 490 * @retval None
mbed_official 125:23cc3068a9e4 491 */
mbed_official 125:23cc3068a9e4 492 void FLASH_OB_Unlock(void)
mbed_official 125:23cc3068a9e4 493 {
mbed_official 125:23cc3068a9e4 494 if((FLASH->CR & FLASH_CR_OPTWRE) == RESET)
mbed_official 125:23cc3068a9e4 495 {
mbed_official 125:23cc3068a9e4 496 /* Unlocking the option bytes block access */
mbed_official 125:23cc3068a9e4 497 FLASH->OPTKEYR = FLASH_OPTKEY1;
mbed_official 125:23cc3068a9e4 498 FLASH->OPTKEYR = FLASH_OPTKEY2;
mbed_official 125:23cc3068a9e4 499 }
mbed_official 125:23cc3068a9e4 500 }
mbed_official 125:23cc3068a9e4 501
mbed_official 125:23cc3068a9e4 502 /**
mbed_official 125:23cc3068a9e4 503 * @brief Locks the option bytes block access.
mbed_official 125:23cc3068a9e4 504 * @param None
mbed_official 125:23cc3068a9e4 505 * @retval None
mbed_official 125:23cc3068a9e4 506 */
mbed_official 125:23cc3068a9e4 507 void FLASH_OB_Lock(void)
mbed_official 125:23cc3068a9e4 508 {
mbed_official 125:23cc3068a9e4 509 /* Set the OPTWREN Bit to lock the option bytes block access */
mbed_official 125:23cc3068a9e4 510 FLASH->CR &= ~FLASH_CR_OPTWRE;
mbed_official 125:23cc3068a9e4 511 }
mbed_official 125:23cc3068a9e4 512
mbed_official 125:23cc3068a9e4 513 /**
mbed_official 125:23cc3068a9e4 514 * @brief Launch the option byte loading.
mbed_official 125:23cc3068a9e4 515 * @param None
mbed_official 125:23cc3068a9e4 516 * @retval None
mbed_official 125:23cc3068a9e4 517 */
mbed_official 125:23cc3068a9e4 518 void FLASH_OB_Launch(void)
mbed_official 125:23cc3068a9e4 519 {
mbed_official 125:23cc3068a9e4 520 /* Set the OBL_Launch bit to launch the option byte loading */
mbed_official 125:23cc3068a9e4 521 FLASH->CR |= FLASH_CR_OBL_LAUNCH;
mbed_official 125:23cc3068a9e4 522 }
mbed_official 125:23cc3068a9e4 523
mbed_official 125:23cc3068a9e4 524 /**
mbed_official 125:23cc3068a9e4 525 * @brief Erases the FLASH option bytes.
mbed_official 125:23cc3068a9e4 526 * @note This functions erases all option bytes except the Read protection (RDP).
mbed_official 125:23cc3068a9e4 527 * @param None
mbed_official 125:23cc3068a9e4 528 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 529 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 530 */
mbed_official 125:23cc3068a9e4 531 FLASH_Status FLASH_OB_Erase(void)
mbed_official 125:23cc3068a9e4 532 {
mbed_official 125:23cc3068a9e4 533 uint16_t rdptmp = OB_RDP_Level_0;
mbed_official 125:23cc3068a9e4 534
mbed_official 125:23cc3068a9e4 535 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 536
mbed_official 125:23cc3068a9e4 537 /* Get the actual read protection Option Byte value */
mbed_official 125:23cc3068a9e4 538 if(FLASH_OB_GetRDP() != RESET)
mbed_official 125:23cc3068a9e4 539 {
mbed_official 125:23cc3068a9e4 540 rdptmp = 0x00;
mbed_official 125:23cc3068a9e4 541 }
mbed_official 125:23cc3068a9e4 542
mbed_official 125:23cc3068a9e4 543 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 544 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 545
mbed_official 125:23cc3068a9e4 546 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 547 {
mbed_official 125:23cc3068a9e4 548 /* If the previous operation is completed, proceed to erase the option bytes */
mbed_official 125:23cc3068a9e4 549 FLASH->CR |= FLASH_CR_OPTER;
mbed_official 125:23cc3068a9e4 550 FLASH->CR |= FLASH_CR_STRT;
mbed_official 125:23cc3068a9e4 551
mbed_official 125:23cc3068a9e4 552 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 553 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 554
mbed_official 125:23cc3068a9e4 555 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 556 {
mbed_official 125:23cc3068a9e4 557 /* If the erase operation is completed, disable the OPTER Bit */
mbed_official 125:23cc3068a9e4 558 FLASH->CR &= ~FLASH_CR_OPTER;
mbed_official 125:23cc3068a9e4 559
mbed_official 125:23cc3068a9e4 560 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 561 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 562
mbed_official 125:23cc3068a9e4 563 /* Restore the last read protection Option Byte value */
mbed_official 125:23cc3068a9e4 564 OB->RDP = (uint16_t)rdptmp;
mbed_official 125:23cc3068a9e4 565
mbed_official 125:23cc3068a9e4 566 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 567 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 568
mbed_official 125:23cc3068a9e4 569 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 570 {
mbed_official 125:23cc3068a9e4 571 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 572 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 573 }
mbed_official 125:23cc3068a9e4 574 }
mbed_official 125:23cc3068a9e4 575 else
mbed_official 125:23cc3068a9e4 576 {
mbed_official 125:23cc3068a9e4 577 if (status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 578 {
mbed_official 125:23cc3068a9e4 579 /* Disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 580 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 581 }
mbed_official 125:23cc3068a9e4 582 }
mbed_official 125:23cc3068a9e4 583 }
mbed_official 125:23cc3068a9e4 584 /* Return the erase status */
mbed_official 125:23cc3068a9e4 585 return status;
mbed_official 125:23cc3068a9e4 586 }
mbed_official 125:23cc3068a9e4 587
mbed_official 125:23cc3068a9e4 588 /**
mbed_official 125:23cc3068a9e4 589 * @brief Write protects the desired pages
mbed_official 125:23cc3068a9e4 590 * @note To correctly run this function, the FLASH_OB_Unlock() function
mbed_official 125:23cc3068a9e4 591 * must be called before.
mbed_official 125:23cc3068a9e4 592 * @note Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes
mbed_official 125:23cc3068a9e4 593 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 594 * @param OB_WRP: specifies the address of the pages to be write protected.
mbed_official 125:23cc3068a9e4 595 * This parameter can be:
mbed_official 125:23cc3068a9e4 596 * @arg value between OB_WRP_Pages0to35 and OB_WRP_Pages60to63
mbed_official 125:23cc3068a9e4 597 * @arg OB_WRP_AllPages
mbed_official 125:23cc3068a9e4 598 * @retval FLASH Status: The returned value can be:
mbed_official 125:23cc3068a9e4 599 * FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 600 */
mbed_official 125:23cc3068a9e4 601 FLASH_Status FLASH_OB_EnableWRP(uint32_t OB_WRP)
mbed_official 125:23cc3068a9e4 602 {
mbed_official 125:23cc3068a9e4 603 uint16_t WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF;
mbed_official 125:23cc3068a9e4 604
mbed_official 125:23cc3068a9e4 605 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 606
mbed_official 125:23cc3068a9e4 607 /* Check the parameters */
mbed_official 125:23cc3068a9e4 608 assert_param(IS_OB_WRP(OB_WRP));
mbed_official 125:23cc3068a9e4 609
mbed_official 125:23cc3068a9e4 610 OB_WRP = (uint32_t)(~OB_WRP);
mbed_official 125:23cc3068a9e4 611 WRP0_Data = (uint16_t)(OB_WRP & OB_WRP0_WRP0);
mbed_official 125:23cc3068a9e4 612 WRP1_Data = (uint16_t)((OB_WRP & OB_WRP0_nWRP0) >> 8);
mbed_official 125:23cc3068a9e4 613
mbed_official 125:23cc3068a9e4 614 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 615 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 616
mbed_official 125:23cc3068a9e4 617 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 618 {
mbed_official 125:23cc3068a9e4 619 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 620
mbed_official 125:23cc3068a9e4 621 if(WRP0_Data != 0xFF)
mbed_official 125:23cc3068a9e4 622 {
mbed_official 125:23cc3068a9e4 623 OB->WRP0 = WRP0_Data;
mbed_official 125:23cc3068a9e4 624
mbed_official 125:23cc3068a9e4 625 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 626 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 627 }
mbed_official 125:23cc3068a9e4 628 if((status == FLASH_COMPLETE) && (WRP1_Data != 0xFF))
mbed_official 125:23cc3068a9e4 629 {
mbed_official 125:23cc3068a9e4 630 OB->WRP1 = WRP1_Data;
mbed_official 125:23cc3068a9e4 631
mbed_official 125:23cc3068a9e4 632 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 633 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 634 }
mbed_official 125:23cc3068a9e4 635 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 636 {
mbed_official 125:23cc3068a9e4 637 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 638 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 639 }
mbed_official 125:23cc3068a9e4 640 }
mbed_official 125:23cc3068a9e4 641 /* Return the write protection operation Status */
mbed_official 125:23cc3068a9e4 642 return status;
mbed_official 125:23cc3068a9e4 643 }
mbed_official 125:23cc3068a9e4 644
mbed_official 125:23cc3068a9e4 645 /**
mbed_official 125:23cc3068a9e4 646 * @brief Enables or disables the read out protection.
mbed_official 125:23cc3068a9e4 647 * @note To correctly run this function, the FLASH_OB_Unlock() function
mbed_official 125:23cc3068a9e4 648 * must be called before.
mbed_official 125:23cc3068a9e4 649 * @note Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes
mbed_official 125:23cc3068a9e4 650 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 651 * @param FLASH_ReadProtection_Level: specifies the read protection level.
mbed_official 125:23cc3068a9e4 652 * This parameter can be:
mbed_official 125:23cc3068a9e4 653 * @arg OB_RDP_Level_0: No protection
mbed_official 125:23cc3068a9e4 654 * @arg OB_RDP_Level_1: Read protection of the memory
mbed_official 125:23cc3068a9e4 655 * @arg OB_RDP_Level_2: Chip protection
mbed_official 125:23cc3068a9e4 656 * @retval FLASH Status: The returned value can be:
mbed_official 125:23cc3068a9e4 657 * FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 658 */
mbed_official 125:23cc3068a9e4 659 FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP)
mbed_official 125:23cc3068a9e4 660 {
mbed_official 125:23cc3068a9e4 661 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 662
mbed_official 125:23cc3068a9e4 663 /* Check the parameters */
mbed_official 125:23cc3068a9e4 664 assert_param(IS_OB_RDP(OB_RDP));
mbed_official 125:23cc3068a9e4 665 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 666
mbed_official 125:23cc3068a9e4 667 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 668 {
mbed_official 125:23cc3068a9e4 669 FLASH->CR |= FLASH_CR_OPTER;
mbed_official 125:23cc3068a9e4 670 FLASH->CR |= FLASH_CR_STRT;
mbed_official 125:23cc3068a9e4 671
mbed_official 125:23cc3068a9e4 672 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 673 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 674
mbed_official 125:23cc3068a9e4 675 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 676 {
mbed_official 125:23cc3068a9e4 677 /* If the erase operation is completed, disable the OPTER Bit */
mbed_official 125:23cc3068a9e4 678 FLASH->CR &= ~FLASH_CR_OPTER;
mbed_official 125:23cc3068a9e4 679
mbed_official 125:23cc3068a9e4 680 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 681 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 682
mbed_official 125:23cc3068a9e4 683 OB->RDP = OB_RDP;
mbed_official 125:23cc3068a9e4 684
mbed_official 125:23cc3068a9e4 685 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 686 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 687
mbed_official 125:23cc3068a9e4 688 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 689 {
mbed_official 125:23cc3068a9e4 690 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 691 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 692 }
mbed_official 125:23cc3068a9e4 693 }
mbed_official 125:23cc3068a9e4 694 else
mbed_official 125:23cc3068a9e4 695 {
mbed_official 125:23cc3068a9e4 696 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 697 {
mbed_official 125:23cc3068a9e4 698 /* Disable the OPTER Bit */
mbed_official 125:23cc3068a9e4 699 FLASH->CR &= ~FLASH_CR_OPTER;
mbed_official 125:23cc3068a9e4 700 }
mbed_official 125:23cc3068a9e4 701 }
mbed_official 125:23cc3068a9e4 702 }
mbed_official 125:23cc3068a9e4 703 /* Return the protection operation Status */
mbed_official 125:23cc3068a9e4 704 return status;
mbed_official 125:23cc3068a9e4 705 }
mbed_official 125:23cc3068a9e4 706
mbed_official 125:23cc3068a9e4 707 /**
mbed_official 125:23cc3068a9e4 708 * @brief Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
mbed_official 125:23cc3068a9e4 709 * @param OB_IWDG: Selects the IWDG mode
mbed_official 125:23cc3068a9e4 710 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 711 * @arg OB_IWDG_SW: Software IWDG selected
mbed_official 125:23cc3068a9e4 712 * @arg OB_IWDG_HW: Hardware IWDG selected
mbed_official 125:23cc3068a9e4 713 * @param OB_STOP: Reset event when entering STOP mode.
mbed_official 125:23cc3068a9e4 714 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 715 * @arg OB_STOP_NoRST: No reset generated when entering in STOP
mbed_official 125:23cc3068a9e4 716 * @arg OB_STOP_RST: Reset generated when entering in STOP
mbed_official 125:23cc3068a9e4 717 * @param OB_STDBY: Reset event when entering Standby mode.
mbed_official 125:23cc3068a9e4 718 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 719 * @arg OB_STDBY_NoRST: No reset generated when entering in STANDBY
mbed_official 125:23cc3068a9e4 720 * @arg OB_STDBY_RST: Reset generated when entering in STANDBY
mbed_official 125:23cc3068a9e4 721 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 722 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 723 */
mbed_official 125:23cc3068a9e4 724 FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
mbed_official 125:23cc3068a9e4 725 {
mbed_official 125:23cc3068a9e4 726 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 727
mbed_official 125:23cc3068a9e4 728 /* Check the parameters */
mbed_official 125:23cc3068a9e4 729 assert_param(IS_OB_IWDG_SOURCE(OB_IWDG));
mbed_official 125:23cc3068a9e4 730 assert_param(IS_OB_STOP_SOURCE(OB_STOP));
mbed_official 125:23cc3068a9e4 731 assert_param(IS_OB_STDBY_SOURCE(OB_STDBY));
mbed_official 125:23cc3068a9e4 732
mbed_official 125:23cc3068a9e4 733 /* Authorize the small information block programming */
mbed_official 125:23cc3068a9e4 734 FLASH->OPTKEYR = FLASH_KEY1;
mbed_official 125:23cc3068a9e4 735 FLASH->OPTKEYR = FLASH_KEY2;
mbed_official 125:23cc3068a9e4 736
mbed_official 125:23cc3068a9e4 737 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 738 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 739
mbed_official 125:23cc3068a9e4 740 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 741 {
mbed_official 125:23cc3068a9e4 742 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 743 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 744
mbed_official 125:23cc3068a9e4 745 OB->USER = (uint8_t)((uint8_t)(OB_IWDG | OB_STOP) | (uint8_t)(OB_STDBY |0xF8));
mbed_official 125:23cc3068a9e4 746
mbed_official 125:23cc3068a9e4 747 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 748 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 749
mbed_official 125:23cc3068a9e4 750 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 751 {
mbed_official 125:23cc3068a9e4 752 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 753 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 754 }
mbed_official 125:23cc3068a9e4 755 }
mbed_official 125:23cc3068a9e4 756 /* Return the Option Byte program Status */
mbed_official 125:23cc3068a9e4 757 return status;
mbed_official 125:23cc3068a9e4 758 }
mbed_official 125:23cc3068a9e4 759
mbed_official 125:23cc3068a9e4 760 /**
mbed_official 125:23cc3068a9e4 761 * @brief Sets or resets the BOOT1.
mbed_official 125:23cc3068a9e4 762 * @param OB_BOOT1: Set or Reset the BOOT1.
mbed_official 125:23cc3068a9e4 763 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 764 * @arg OB_BOOT1_RESET: BOOT1 Reset
mbed_official 125:23cc3068a9e4 765 * @arg OB_BOOT1_SET: BOOT1 Set
mbed_official 125:23cc3068a9e4 766 * @retval None
mbed_official 125:23cc3068a9e4 767 */
mbed_official 125:23cc3068a9e4 768 FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1)
mbed_official 125:23cc3068a9e4 769 {
mbed_official 125:23cc3068a9e4 770 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 771
mbed_official 125:23cc3068a9e4 772 /* Check the parameters */
mbed_official 125:23cc3068a9e4 773 assert_param(IS_OB_BOOT1(OB_BOOT1));
mbed_official 125:23cc3068a9e4 774
mbed_official 125:23cc3068a9e4 775 /* Authorize the small information block programming */
mbed_official 125:23cc3068a9e4 776 FLASH->OPTKEYR = FLASH_KEY1;
mbed_official 125:23cc3068a9e4 777 FLASH->OPTKEYR = FLASH_KEY2;
mbed_official 125:23cc3068a9e4 778
mbed_official 125:23cc3068a9e4 779 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 780 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 781
mbed_official 125:23cc3068a9e4 782 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 783 {
mbed_official 125:23cc3068a9e4 784 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 785 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 786
mbed_official 125:23cc3068a9e4 787 OB->USER = OB_BOOT1|0xEF;
mbed_official 125:23cc3068a9e4 788
mbed_official 125:23cc3068a9e4 789 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 790 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 791
mbed_official 125:23cc3068a9e4 792 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 793 {
mbed_official 125:23cc3068a9e4 794 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 795 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 796 }
mbed_official 125:23cc3068a9e4 797 }
mbed_official 125:23cc3068a9e4 798 /* Return the Option Byte program Status */
mbed_official 125:23cc3068a9e4 799 return status;
mbed_official 125:23cc3068a9e4 800 }
mbed_official 125:23cc3068a9e4 801
mbed_official 125:23cc3068a9e4 802 /**
mbed_official 125:23cc3068a9e4 803 * @brief Sets or resets the analogue monitoring on VDDA Power source.
mbed_official 125:23cc3068a9e4 804 * @param OB_VDDA_ANALOG: Selects the analog monitoring on VDDA Power source.
mbed_official 125:23cc3068a9e4 805 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 806 * @arg OB_VDDA_ANALOG_ON: Analog monitoring on VDDA Power source ON
mbed_official 125:23cc3068a9e4 807 * @arg OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source OFF
mbed_official 125:23cc3068a9e4 808 * @retval None
mbed_official 125:23cc3068a9e4 809 */
mbed_official 125:23cc3068a9e4 810 FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG)
mbed_official 125:23cc3068a9e4 811 {
mbed_official 125:23cc3068a9e4 812 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 813
mbed_official 125:23cc3068a9e4 814 /* Check the parameters */
mbed_official 125:23cc3068a9e4 815 assert_param(IS_OB_VDDA_ANALOG(OB_VDDA_ANALOG));
mbed_official 125:23cc3068a9e4 816
mbed_official 125:23cc3068a9e4 817 /* Authorize the small information block programming */
mbed_official 125:23cc3068a9e4 818 FLASH->OPTKEYR = FLASH_KEY1;
mbed_official 125:23cc3068a9e4 819 FLASH->OPTKEYR = FLASH_KEY2;
mbed_official 125:23cc3068a9e4 820
mbed_official 125:23cc3068a9e4 821 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 822 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 823
mbed_official 125:23cc3068a9e4 824 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 825 {
mbed_official 125:23cc3068a9e4 826 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 827 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 828
mbed_official 125:23cc3068a9e4 829 OB->USER = OB_VDDA_ANALOG |0xDF;
mbed_official 125:23cc3068a9e4 830
mbed_official 125:23cc3068a9e4 831 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 832 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 833
mbed_official 125:23cc3068a9e4 834 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 835 {
mbed_official 125:23cc3068a9e4 836 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 837 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 838 }
mbed_official 125:23cc3068a9e4 839 }
mbed_official 125:23cc3068a9e4 840 /* Return the Option Byte program Status */
mbed_official 125:23cc3068a9e4 841 return status;
mbed_official 125:23cc3068a9e4 842 }
mbed_official 125:23cc3068a9e4 843
mbed_official 125:23cc3068a9e4 844 /**
mbed_official 125:23cc3068a9e4 845 * @brief Sets or resets the SRAM partiy.
mbed_official 125:23cc3068a9e4 846 * @param OB_SRAM_Parity: Set or Reset the SRAM partiy enable bit.
mbed_official 125:23cc3068a9e4 847 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 848 * @arg OB_SRAM_PARITY_SET: Set SRAM partiy.
mbed_official 125:23cc3068a9e4 849 * @arg OB_SRAM_PARITY_RESET: Reset SRAM partiy.
mbed_official 125:23cc3068a9e4 850 * @retval None
mbed_official 125:23cc3068a9e4 851 */
mbed_official 125:23cc3068a9e4 852 FLASH_Status FLASH_OB_SRAMParityConfig(uint8_t OB_SRAM_Parity)
mbed_official 125:23cc3068a9e4 853 {
mbed_official 125:23cc3068a9e4 854 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 855
mbed_official 125:23cc3068a9e4 856 /* Check the parameters */
mbed_official 125:23cc3068a9e4 857 assert_param(IS_OB_SRAM_PARITY(OB_SRAM_Parity));
mbed_official 125:23cc3068a9e4 858
mbed_official 125:23cc3068a9e4 859 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 860 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 861
mbed_official 125:23cc3068a9e4 862 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 863 {
mbed_official 125:23cc3068a9e4 864 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 865 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 866
mbed_official 125:23cc3068a9e4 867 OB->USER = OB_SRAM_Parity | 0xBF;
mbed_official 125:23cc3068a9e4 868
mbed_official 125:23cc3068a9e4 869 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 870 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 871
mbed_official 125:23cc3068a9e4 872 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 873 {
mbed_official 125:23cc3068a9e4 874 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 875 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 876 }
mbed_official 125:23cc3068a9e4 877 }
mbed_official 125:23cc3068a9e4 878 /* Return the Option Byte program Status */
mbed_official 125:23cc3068a9e4 879 return status;
mbed_official 125:23cc3068a9e4 880 }
mbed_official 125:23cc3068a9e4 881
mbed_official 125:23cc3068a9e4 882 /**
mbed_official 125:23cc3068a9e4 883 * @brief Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG.
mbed_official 125:23cc3068a9e4 884 * @note To correctly run this function, the FLASH_OB_Unlock() function
mbed_official 125:23cc3068a9e4 885 * must be called before.
mbed_official 125:23cc3068a9e4 886 * @note Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes
mbed_official 125:23cc3068a9e4 887 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 888 * @param OB_USER: Selects all user option bytes
mbed_official 125:23cc3068a9e4 889 * This parameter is a combination of the following values:
mbed_official 125:23cc3068a9e4 890 * @arg OB_IWDG_SW / OB_IWDG_HW: Software / Hardware WDG selected
mbed_official 125:23cc3068a9e4 891 * @arg OB_STOP_NoRST / OB_STOP_RST: No reset / Reset generated when entering in STOP
mbed_official 125:23cc3068a9e4 892 * @arg OB_STDBY_NoRST / OB_STDBY_RST: No reset / Reset generated when entering in STANDBY
mbed_official 125:23cc3068a9e4 893 * @arg OB_BOOT1_RESET / OB_BOOT1_SET: BOOT1 Reset / Set
mbed_official 125:23cc3068a9e4 894 * @arg OB_VDDA_ANALOG_ON / OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source ON / OFF
mbed_official 125:23cc3068a9e4 895 * @retval FLASH Status: The returned value can be:
mbed_official 125:23cc3068a9e4 896 * FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 897 */
mbed_official 125:23cc3068a9e4 898 FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER)
mbed_official 125:23cc3068a9e4 899 {
mbed_official 125:23cc3068a9e4 900 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 901
mbed_official 125:23cc3068a9e4 902 /* Authorize the small information block programming */
mbed_official 125:23cc3068a9e4 903 FLASH->OPTKEYR = FLASH_KEY1;
mbed_official 125:23cc3068a9e4 904 FLASH->OPTKEYR = FLASH_KEY2;
mbed_official 125:23cc3068a9e4 905
mbed_official 125:23cc3068a9e4 906 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 907 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 908
mbed_official 125:23cc3068a9e4 909 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 910 {
mbed_official 125:23cc3068a9e4 911 /* Enable the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 912 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 913
mbed_official 125:23cc3068a9e4 914 OB->USER = OB_USER | 0x88;
mbed_official 125:23cc3068a9e4 915
mbed_official 125:23cc3068a9e4 916 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 917 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 918
mbed_official 125:23cc3068a9e4 919 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 920 {
mbed_official 125:23cc3068a9e4 921 /* if the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 922 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 923 }
mbed_official 125:23cc3068a9e4 924 }
mbed_official 125:23cc3068a9e4 925 /* Return the Option Byte program Status */
mbed_official 125:23cc3068a9e4 926 return status;
mbed_official 125:23cc3068a9e4 927
mbed_official 125:23cc3068a9e4 928 }
mbed_official 125:23cc3068a9e4 929
mbed_official 125:23cc3068a9e4 930 /**
mbed_official 125:23cc3068a9e4 931 * @brief Programs a half word at a specified Option Byte Data address.
mbed_official 125:23cc3068a9e4 932 * @note To correctly run this function, the FLASH_OB_Unlock() function
mbed_official 125:23cc3068a9e4 933 * must be called before.
mbed_official 125:23cc3068a9e4 934 * Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes
mbed_official 125:23cc3068a9e4 935 * (recommended to protect the FLASH memory against possible unwanted operation)
mbed_official 125:23cc3068a9e4 936 * @param Address: specifies the address to be programmed.
mbed_official 125:23cc3068a9e4 937 * This parameter can be 0x1FFFF804 or 0x1FFFF806.
mbed_official 125:23cc3068a9e4 938 * @param Data: specifies the data to be programmed.
mbed_official 125:23cc3068a9e4 939 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
mbed_official 125:23cc3068a9e4 940 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 941 */
mbed_official 125:23cc3068a9e4 942 FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
mbed_official 125:23cc3068a9e4 943 {
mbed_official 125:23cc3068a9e4 944 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 945 /* Check the parameters */
mbed_official 125:23cc3068a9e4 946 assert_param(IS_OB_DATA_ADDRESS(Address));
mbed_official 125:23cc3068a9e4 947 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 948
mbed_official 125:23cc3068a9e4 949 if(status == FLASH_COMPLETE)
mbed_official 125:23cc3068a9e4 950 {
mbed_official 125:23cc3068a9e4 951 /* Enables the Option Bytes Programming operation */
mbed_official 125:23cc3068a9e4 952 FLASH->CR |= FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 953 *(__IO uint16_t*)Address = Data;
mbed_official 125:23cc3068a9e4 954
mbed_official 125:23cc3068a9e4 955 /* Wait for last operation to be completed */
mbed_official 125:23cc3068a9e4 956 status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
mbed_official 125:23cc3068a9e4 957
mbed_official 125:23cc3068a9e4 958 if(status != FLASH_TIMEOUT)
mbed_official 125:23cc3068a9e4 959 {
mbed_official 125:23cc3068a9e4 960 /* If the program operation is completed, disable the OPTPG Bit */
mbed_official 125:23cc3068a9e4 961 FLASH->CR &= ~FLASH_CR_OPTPG;
mbed_official 125:23cc3068a9e4 962 }
mbed_official 125:23cc3068a9e4 963 }
mbed_official 125:23cc3068a9e4 964 /* Return the Option Byte Data Program Status */
mbed_official 125:23cc3068a9e4 965 return status;
mbed_official 125:23cc3068a9e4 966 }
mbed_official 125:23cc3068a9e4 967
mbed_official 125:23cc3068a9e4 968 /**
mbed_official 125:23cc3068a9e4 969 * @brief Returns the FLASH User Option Bytes values.
mbed_official 125:23cc3068a9e4 970 * @param None
mbed_official 125:23cc3068a9e4 971 * @retval The FLASH User Option Bytes .
mbed_official 125:23cc3068a9e4 972 */
mbed_official 125:23cc3068a9e4 973 uint8_t FLASH_OB_GetUser(void)
mbed_official 125:23cc3068a9e4 974 {
mbed_official 125:23cc3068a9e4 975 /* Return the User Option Byte */
mbed_official 125:23cc3068a9e4 976 return (uint8_t)(FLASH->OBR >> 8);
mbed_official 125:23cc3068a9e4 977 }
mbed_official 125:23cc3068a9e4 978
mbed_official 125:23cc3068a9e4 979 /**
mbed_official 125:23cc3068a9e4 980 * @brief Returns the FLASH Write Protection Option Bytes value.
mbed_official 125:23cc3068a9e4 981 * @param None
mbed_official 125:23cc3068a9e4 982 * @retval The FLASH Write Protection Option Bytes value
mbed_official 125:23cc3068a9e4 983 */
mbed_official 125:23cc3068a9e4 984 uint32_t FLASH_OB_GetWRP(void)
mbed_official 125:23cc3068a9e4 985 {
mbed_official 125:23cc3068a9e4 986 /* Return the FLASH write protection Register value */
mbed_official 125:23cc3068a9e4 987 return (uint32_t)(FLASH->WRPR);
mbed_official 125:23cc3068a9e4 988 }
mbed_official 125:23cc3068a9e4 989
mbed_official 125:23cc3068a9e4 990 /**
mbed_official 125:23cc3068a9e4 991 * @brief Checks whether the FLASH Read out Protection Status is set or not.
mbed_official 125:23cc3068a9e4 992 * @param None
mbed_official 125:23cc3068a9e4 993 * @retval FLASH ReadOut Protection Status(SET or RESET)
mbed_official 125:23cc3068a9e4 994 */
mbed_official 125:23cc3068a9e4 995 FlagStatus FLASH_OB_GetRDP(void)
mbed_official 125:23cc3068a9e4 996 {
mbed_official 125:23cc3068a9e4 997 FlagStatus readstatus = RESET;
mbed_official 125:23cc3068a9e4 998
mbed_official 125:23cc3068a9e4 999 if ((uint8_t)(FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2)) != RESET)
mbed_official 125:23cc3068a9e4 1000 {
mbed_official 125:23cc3068a9e4 1001 readstatus = SET;
mbed_official 125:23cc3068a9e4 1002 }
mbed_official 125:23cc3068a9e4 1003 else
mbed_official 125:23cc3068a9e4 1004 {
mbed_official 125:23cc3068a9e4 1005 readstatus = RESET;
mbed_official 125:23cc3068a9e4 1006 }
mbed_official 125:23cc3068a9e4 1007 return readstatus;
mbed_official 125:23cc3068a9e4 1008 }
mbed_official 125:23cc3068a9e4 1009
mbed_official 125:23cc3068a9e4 1010 /**
mbed_official 125:23cc3068a9e4 1011 * @}
mbed_official 125:23cc3068a9e4 1012 */
mbed_official 125:23cc3068a9e4 1013
mbed_official 125:23cc3068a9e4 1014 /** @defgroup FLASH_Group4 Interrupts and flags management functions
mbed_official 125:23cc3068a9e4 1015 * @brief Interrupts and flags management functions
mbed_official 125:23cc3068a9e4 1016 *
mbed_official 125:23cc3068a9e4 1017 @verbatim
mbed_official 125:23cc3068a9e4 1018 ===============================================================================
mbed_official 125:23cc3068a9e4 1019 ##### Interrupts and flags management functions #####
mbed_official 125:23cc3068a9e4 1020 ===============================================================================
mbed_official 125:23cc3068a9e4 1021
mbed_official 125:23cc3068a9e4 1022 @endverbatim
mbed_official 125:23cc3068a9e4 1023 * @{
mbed_official 125:23cc3068a9e4 1024 */
mbed_official 125:23cc3068a9e4 1025
mbed_official 125:23cc3068a9e4 1026 /**
mbed_official 125:23cc3068a9e4 1027 * @brief Enables or disables the specified FLASH interrupts.
mbed_official 125:23cc3068a9e4 1028 * @param FLASH_IT: specifies the FLASH interrupt sources to be enabled or
mbed_official 125:23cc3068a9e4 1029 * disabled.
mbed_official 125:23cc3068a9e4 1030 * This parameter can be any combination of the following values:
mbed_official 125:23cc3068a9e4 1031 * @arg FLASH_IT_EOP: FLASH end of programming Interrupt
mbed_official 125:23cc3068a9e4 1032 * @arg FLASH_IT_ERR: FLASH Error Interrupt
mbed_official 125:23cc3068a9e4 1033 * @retval None
mbed_official 125:23cc3068a9e4 1034 */
mbed_official 125:23cc3068a9e4 1035 void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState)
mbed_official 125:23cc3068a9e4 1036 {
mbed_official 125:23cc3068a9e4 1037 /* Check the parameters */
mbed_official 125:23cc3068a9e4 1038 assert_param(IS_FLASH_IT(FLASH_IT));
mbed_official 125:23cc3068a9e4 1039 assert_param(IS_FUNCTIONAL_STATE(NewState));
mbed_official 125:23cc3068a9e4 1040
mbed_official 125:23cc3068a9e4 1041 if(NewState != DISABLE)
mbed_official 125:23cc3068a9e4 1042 {
mbed_official 125:23cc3068a9e4 1043 /* Enable the interrupt sources */
mbed_official 125:23cc3068a9e4 1044 FLASH->CR |= FLASH_IT;
mbed_official 125:23cc3068a9e4 1045 }
mbed_official 125:23cc3068a9e4 1046 else
mbed_official 125:23cc3068a9e4 1047 {
mbed_official 125:23cc3068a9e4 1048 /* Disable the interrupt sources */
mbed_official 125:23cc3068a9e4 1049 FLASH->CR &= ~(uint32_t)FLASH_IT;
mbed_official 125:23cc3068a9e4 1050 }
mbed_official 125:23cc3068a9e4 1051 }
mbed_official 125:23cc3068a9e4 1052
mbed_official 125:23cc3068a9e4 1053 /**
mbed_official 125:23cc3068a9e4 1054 * @brief Checks whether the specified FLASH flag is set or not.
mbed_official 125:23cc3068a9e4 1055 * @param FLASH_FLAG: specifies the FLASH flag to check.
mbed_official 125:23cc3068a9e4 1056 * This parameter can be one of the following values:
mbed_official 125:23cc3068a9e4 1057 * @arg FLASH_FLAG_BSY: FLASH write/erase operations in progress flag
mbed_official 125:23cc3068a9e4 1058 * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag
mbed_official 125:23cc3068a9e4 1059 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
mbed_official 125:23cc3068a9e4 1060 * @arg FLASH_FLAG_EOP: FLASH End of Programming flag
mbed_official 125:23cc3068a9e4 1061 * @retval The new state of FLASH_FLAG (SET or RESET).
mbed_official 125:23cc3068a9e4 1062 */
mbed_official 125:23cc3068a9e4 1063 FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
mbed_official 125:23cc3068a9e4 1064 {
mbed_official 125:23cc3068a9e4 1065 FlagStatus bitstatus = RESET;
mbed_official 125:23cc3068a9e4 1066
mbed_official 125:23cc3068a9e4 1067 /* Check the parameters */
mbed_official 125:23cc3068a9e4 1068 assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG));
mbed_official 125:23cc3068a9e4 1069
mbed_official 125:23cc3068a9e4 1070 if((FLASH->SR & FLASH_FLAG) != (uint32_t)RESET)
mbed_official 125:23cc3068a9e4 1071 {
mbed_official 125:23cc3068a9e4 1072 bitstatus = SET;
mbed_official 125:23cc3068a9e4 1073 }
mbed_official 125:23cc3068a9e4 1074 else
mbed_official 125:23cc3068a9e4 1075 {
mbed_official 125:23cc3068a9e4 1076 bitstatus = RESET;
mbed_official 125:23cc3068a9e4 1077 }
mbed_official 125:23cc3068a9e4 1078 /* Return the new state of FLASH_FLAG (SET or RESET) */
mbed_official 125:23cc3068a9e4 1079 return bitstatus;
mbed_official 125:23cc3068a9e4 1080 }
mbed_official 125:23cc3068a9e4 1081
mbed_official 125:23cc3068a9e4 1082 /**
mbed_official 125:23cc3068a9e4 1083 * @brief Clears the FLASH's pending flags.
mbed_official 125:23cc3068a9e4 1084 * @param FLASH_FLAG: specifies the FLASH flags to clear.
mbed_official 125:23cc3068a9e4 1085 * This parameter can be any combination of the following values:
mbed_official 125:23cc3068a9e4 1086 * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag
mbed_official 125:23cc3068a9e4 1087 * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
mbed_official 125:23cc3068a9e4 1088 * @arg FLASH_FLAG_EOP: FLASH End of Programming flag
mbed_official 125:23cc3068a9e4 1089 * @retval None
mbed_official 125:23cc3068a9e4 1090 */
mbed_official 125:23cc3068a9e4 1091 void FLASH_ClearFlag(uint32_t FLASH_FLAG)
mbed_official 125:23cc3068a9e4 1092 {
mbed_official 125:23cc3068a9e4 1093 /* Check the parameters */
mbed_official 125:23cc3068a9e4 1094 assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG));
mbed_official 125:23cc3068a9e4 1095
mbed_official 125:23cc3068a9e4 1096 /* Clear the flags */
mbed_official 125:23cc3068a9e4 1097 FLASH->SR = FLASH_FLAG;
mbed_official 125:23cc3068a9e4 1098 }
mbed_official 125:23cc3068a9e4 1099
mbed_official 125:23cc3068a9e4 1100 /**
mbed_official 125:23cc3068a9e4 1101 * @brief Returns the FLASH Status.
mbed_official 125:23cc3068a9e4 1102 * @param None
mbed_official 125:23cc3068a9e4 1103 * @retval FLASH Status: The returned value can be:
mbed_official 125:23cc3068a9e4 1104 * FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP or FLASH_COMPLETE.
mbed_official 125:23cc3068a9e4 1105 */
mbed_official 125:23cc3068a9e4 1106 FLASH_Status FLASH_GetStatus(void)
mbed_official 125:23cc3068a9e4 1107 {
mbed_official 125:23cc3068a9e4 1108 FLASH_Status FLASHstatus = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 1109
mbed_official 125:23cc3068a9e4 1110 if((FLASH->SR & FLASH_FLAG_BSY) == FLASH_FLAG_BSY)
mbed_official 125:23cc3068a9e4 1111 {
mbed_official 125:23cc3068a9e4 1112 FLASHstatus = FLASH_BUSY;
mbed_official 125:23cc3068a9e4 1113 }
mbed_official 125:23cc3068a9e4 1114 else
mbed_official 125:23cc3068a9e4 1115 {
mbed_official 125:23cc3068a9e4 1116 if((FLASH->SR & (uint32_t)FLASH_FLAG_WRPERR)!= (uint32_t)0x00)
mbed_official 125:23cc3068a9e4 1117 {
mbed_official 125:23cc3068a9e4 1118 FLASHstatus = FLASH_ERROR_WRP;
mbed_official 125:23cc3068a9e4 1119 }
mbed_official 125:23cc3068a9e4 1120 else
mbed_official 125:23cc3068a9e4 1121 {
mbed_official 125:23cc3068a9e4 1122 if((FLASH->SR & (uint32_t)(FLASH_SR_PGERR)) != (uint32_t)0x00)
mbed_official 125:23cc3068a9e4 1123 {
mbed_official 125:23cc3068a9e4 1124 FLASHstatus = FLASH_ERROR_PROGRAM;
mbed_official 125:23cc3068a9e4 1125 }
mbed_official 125:23cc3068a9e4 1126 else
mbed_official 125:23cc3068a9e4 1127 {
mbed_official 125:23cc3068a9e4 1128 FLASHstatus = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 1129 }
mbed_official 125:23cc3068a9e4 1130 }
mbed_official 125:23cc3068a9e4 1131 }
mbed_official 125:23cc3068a9e4 1132 /* Return the FLASH Status */
mbed_official 125:23cc3068a9e4 1133 return FLASHstatus;
mbed_official 125:23cc3068a9e4 1134 }
mbed_official 125:23cc3068a9e4 1135
mbed_official 125:23cc3068a9e4 1136 /**
mbed_official 125:23cc3068a9e4 1137 * @brief Waits for a FLASH operation to complete or a TIMEOUT to occur.
mbed_official 125:23cc3068a9e4 1138 * @param Timeout: FLASH programming Timeout
mbed_official 125:23cc3068a9e4 1139 * @retval FLASH Status: The returned value can be: FLASH_BUSY,
mbed_official 125:23cc3068a9e4 1140 * FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
mbed_official 125:23cc3068a9e4 1141 */
mbed_official 125:23cc3068a9e4 1142 FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
mbed_official 125:23cc3068a9e4 1143 {
mbed_official 125:23cc3068a9e4 1144 FLASH_Status status = FLASH_COMPLETE;
mbed_official 125:23cc3068a9e4 1145
mbed_official 125:23cc3068a9e4 1146 /* Check for the FLASH Status */
mbed_official 125:23cc3068a9e4 1147 status = FLASH_GetStatus();
mbed_official 125:23cc3068a9e4 1148
mbed_official 125:23cc3068a9e4 1149 /* Wait for a FLASH operation to complete or a TIMEOUT to occur */
mbed_official 125:23cc3068a9e4 1150 while((status == FLASH_BUSY) && (Timeout != 0x00))
mbed_official 125:23cc3068a9e4 1151 {
mbed_official 125:23cc3068a9e4 1152 status = FLASH_GetStatus();
mbed_official 125:23cc3068a9e4 1153 Timeout--;
mbed_official 125:23cc3068a9e4 1154 }
mbed_official 125:23cc3068a9e4 1155
mbed_official 125:23cc3068a9e4 1156 if(Timeout == 0x00 )
mbed_official 125:23cc3068a9e4 1157 {
mbed_official 125:23cc3068a9e4 1158 status = FLASH_TIMEOUT;
mbed_official 125:23cc3068a9e4 1159 }
mbed_official 125:23cc3068a9e4 1160 /* Return the operation status */
mbed_official 125:23cc3068a9e4 1161 return status;
mbed_official 125:23cc3068a9e4 1162 }
mbed_official 125:23cc3068a9e4 1163
mbed_official 125:23cc3068a9e4 1164 /**
mbed_official 125:23cc3068a9e4 1165 * @}
mbed_official 125:23cc3068a9e4 1166 */
mbed_official 125:23cc3068a9e4 1167
mbed_official 125:23cc3068a9e4 1168 /**
mbed_official 125:23cc3068a9e4 1169 * @}
mbed_official 125:23cc3068a9e4 1170 */
mbed_official 125:23cc3068a9e4 1171
mbed_official 125:23cc3068a9e4 1172 /**
mbed_official 125:23cc3068a9e4 1173 * @}
mbed_official 125:23cc3068a9e4 1174 */
mbed_official 125:23cc3068a9e4 1175
mbed_official 125:23cc3068a9e4 1176 /**
mbed_official 125:23cc3068a9e4 1177 * @}
mbed_official 125:23cc3068a9e4 1178 */
mbed_official 125:23cc3068a9e4 1179
mbed_official 125:23cc3068a9e4 1180 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/