mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Jul 02 16:30:08 2015 +0100
Revision:
581:39197bcd20f2
Parent:
489:119543c9f674
Synchronized with git revision ae2d3cdffe70184eb8736d94f76c45c93f4b7724

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

Make it possible to build the core mbed library with yotta

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 489:119543c9f674 1 /**
mbed_official 489:119543c9f674 2 ******************************************************************************
mbed_official 489:119543c9f674 3 * @file stm32f1xx_hal_flash.h
mbed_official 489:119543c9f674 4 * @author MCD Application Team
mbed_official 489:119543c9f674 5 * @version V1.0.0
mbed_official 489:119543c9f674 6 * @date 15-December-2014
mbed_official 489:119543c9f674 7 * @brief Header file of Flash HAL module.
mbed_official 489:119543c9f674 8 ******************************************************************************
mbed_official 489:119543c9f674 9 * @attention
mbed_official 489:119543c9f674 10 *
mbed_official 489:119543c9f674 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 489:119543c9f674 12 *
mbed_official 489:119543c9f674 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 489:119543c9f674 14 * are permitted provided that the following conditions are met:
mbed_official 489:119543c9f674 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 489:119543c9f674 16 * this list of conditions and the following disclaimer.
mbed_official 489:119543c9f674 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 489:119543c9f674 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 489:119543c9f674 19 * and/or other materials provided with the distribution.
mbed_official 489:119543c9f674 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 489:119543c9f674 21 * may be used to endorse or promote products derived from this software
mbed_official 489:119543c9f674 22 * without specific prior written permission.
mbed_official 489:119543c9f674 23 *
mbed_official 489:119543c9f674 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 489:119543c9f674 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 489:119543c9f674 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 489:119543c9f674 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 489:119543c9f674 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 489:119543c9f674 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 489:119543c9f674 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 489:119543c9f674 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 489:119543c9f674 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 489:119543c9f674 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 489:119543c9f674 34 *
mbed_official 489:119543c9f674 35 ******************************************************************************
mbed_official 489:119543c9f674 36 */
mbed_official 489:119543c9f674 37
mbed_official 489:119543c9f674 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 489:119543c9f674 39 #ifndef __STM32F1xx_HAL_FLASH_H
mbed_official 489:119543c9f674 40 #define __STM32F1xx_HAL_FLASH_H
mbed_official 489:119543c9f674 41
mbed_official 489:119543c9f674 42 #ifdef __cplusplus
mbed_official 489:119543c9f674 43 extern "C" {
mbed_official 489:119543c9f674 44 #endif
mbed_official 489:119543c9f674 45
mbed_official 489:119543c9f674 46 /* Includes ------------------------------------------------------------------*/
mbed_official 489:119543c9f674 47 #include "stm32f1xx_hal_def.h"
mbed_official 489:119543c9f674 48
mbed_official 489:119543c9f674 49 /** @addtogroup STM32F1xx_HAL_Driver
mbed_official 489:119543c9f674 50 * @{
mbed_official 489:119543c9f674 51 */
mbed_official 489:119543c9f674 52
mbed_official 489:119543c9f674 53 /** @addtogroup FLASH
mbed_official 489:119543c9f674 54 * @{
mbed_official 489:119543c9f674 55 */
mbed_official 489:119543c9f674 56
mbed_official 489:119543c9f674 57 /** @addtogroup FLASH_Private_Constants
mbed_official 489:119543c9f674 58 * @{
mbed_official 489:119543c9f674 59 */
mbed_official 489:119543c9f674 60 #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
mbed_official 489:119543c9f674 61 /**
mbed_official 489:119543c9f674 62 * @}
mbed_official 489:119543c9f674 63 */
mbed_official 489:119543c9f674 64
mbed_official 489:119543c9f674 65 /** @addtogroup FLASH_Private_Macros
mbed_official 489:119543c9f674 66 * @{
mbed_official 489:119543c9f674 67 */
mbed_official 489:119543c9f674 68
mbed_official 489:119543c9f674 69 #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
mbed_official 489:119543c9f674 70 ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
mbed_official 489:119543c9f674 71 ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
mbed_official 489:119543c9f674 72
mbed_official 489:119543c9f674 73 /**
mbed_official 489:119543c9f674 74 * @}
mbed_official 489:119543c9f674 75 */
mbed_official 489:119543c9f674 76
mbed_official 489:119543c9f674 77 /* Exported types ------------------------------------------------------------*/
mbed_official 489:119543c9f674 78 /** @defgroup FLASH_Exported_Types FLASH Exported Types
mbed_official 489:119543c9f674 79 * @{
mbed_official 489:119543c9f674 80 */
mbed_official 489:119543c9f674 81
mbed_official 489:119543c9f674 82
mbed_official 489:119543c9f674 83 /**
mbed_official 489:119543c9f674 84 * @brief FLASH Procedure structure definition
mbed_official 489:119543c9f674 85 */
mbed_official 489:119543c9f674 86 typedef enum
mbed_official 489:119543c9f674 87 {
mbed_official 489:119543c9f674 88 FLASH_PROC_NONE = 0,
mbed_official 489:119543c9f674 89 FLASH_PROC_PAGEERASE = 1,
mbed_official 489:119543c9f674 90 FLASH_PROC_MASSERASE = 2,
mbed_official 489:119543c9f674 91 FLASH_PROC_PROGRAMHALFWORD = 3,
mbed_official 489:119543c9f674 92 FLASH_PROC_PROGRAMWORD = 4,
mbed_official 489:119543c9f674 93 FLASH_PROC_PROGRAMDOUBLEWORD = 5
mbed_official 489:119543c9f674 94 } FLASH_ProcedureTypeDef;
mbed_official 489:119543c9f674 95
mbed_official 489:119543c9f674 96 /**
mbed_official 489:119543c9f674 97 * @brief FLASH handle Structure definition
mbed_official 489:119543c9f674 98 */
mbed_official 489:119543c9f674 99 typedef struct
mbed_official 489:119543c9f674 100 {
mbed_official 489:119543c9f674 101 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
mbed_official 489:119543c9f674 102
mbed_official 489:119543c9f674 103 __IO uint32_t DataRemaining; /* Internal variable to save the remaining pages to erase or half-word to program in IT context */
mbed_official 489:119543c9f674 104
mbed_official 489:119543c9f674 105 __IO uint32_t Address; /* Internal variable to save address selected for program or erase */
mbed_official 489:119543c9f674 106
mbed_official 489:119543c9f674 107 __IO uint64_t Data; /* Internal variable to save data to be programmed */
mbed_official 489:119543c9f674 108
mbed_official 489:119543c9f674 109 HAL_LockTypeDef Lock; /* FLASH locking object */
mbed_official 489:119543c9f674 110
mbed_official 489:119543c9f674 111 __IO uint32_t ErrorCode; /* FLASH error code */
mbed_official 489:119543c9f674 112
mbed_official 489:119543c9f674 113 } FLASH_ProcessTypeDef;
mbed_official 489:119543c9f674 114
mbed_official 489:119543c9f674 115 /**
mbed_official 489:119543c9f674 116 * @}
mbed_official 489:119543c9f674 117 */
mbed_official 489:119543c9f674 118
mbed_official 489:119543c9f674 119 /* Exported constants --------------------------------------------------------*/
mbed_official 489:119543c9f674 120 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
mbed_official 489:119543c9f674 121 * @{
mbed_official 489:119543c9f674 122 */
mbed_official 489:119543c9f674 123
mbed_official 489:119543c9f674 124 /** @defgroup FLASH_Error_Codes FLASH Error Codes
mbed_official 489:119543c9f674 125 * @{
mbed_official 489:119543c9f674 126 */
mbed_official 489:119543c9f674 127
mbed_official 489:119543c9f674 128 #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00)
mbed_official 489:119543c9f674 129 #define HAL_FLASH_ERROR_PROG ((uint32_t)0x01)
mbed_official 489:119543c9f674 130 #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02)
mbed_official 489:119543c9f674 131 #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x04)
mbed_official 489:119543c9f674 132
mbed_official 489:119543c9f674 133 /**
mbed_official 489:119543c9f674 134 * @}
mbed_official 489:119543c9f674 135 */
mbed_official 489:119543c9f674 136
mbed_official 489:119543c9f674 137
mbed_official 489:119543c9f674 138 /** @defgroup FLASH_Type_Program Type Program
mbed_official 489:119543c9f674 139 * @{
mbed_official 489:119543c9f674 140 */
mbed_official 489:119543c9f674 141 #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
mbed_official 489:119543c9f674 142 #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
mbed_official 489:119543c9f674 143 #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/
mbed_official 489:119543c9f674 144
mbed_official 489:119543c9f674 145 /**
mbed_official 489:119543c9f674 146 * @}
mbed_official 489:119543c9f674 147 */
mbed_official 489:119543c9f674 148
mbed_official 489:119543c9f674 149 /**
mbed_official 489:119543c9f674 150 * @}
mbed_official 489:119543c9f674 151 */
mbed_official 489:119543c9f674 152
mbed_official 489:119543c9f674 153 /* Exported macro ------------------------------------------------------------*/
mbed_official 489:119543c9f674 154
mbed_official 489:119543c9f674 155 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
mbed_official 489:119543c9f674 156 * @brief macros to control FLASH features
mbed_official 489:119543c9f674 157 * @{
mbed_official 489:119543c9f674 158 */
mbed_official 489:119543c9f674 159
mbed_official 489:119543c9f674 160 /**
mbed_official 489:119543c9f674 161 * @brief Enable the FLASH half cycle access.
mbed_official 489:119543c9f674 162 * @note halfcycle access can only be used with a low-frequency clock of less than
mbed_official 489:119543c9f674 163 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
mbed_official 489:119543c9f674 164 * @retval None
mbed_official 489:119543c9f674 165 */
mbed_official 489:119543c9f674 166 #define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE() (FLASH->ACR |= FLASH_ACR_HLFCYA)
mbed_official 489:119543c9f674 167
mbed_official 489:119543c9f674 168 /**
mbed_official 489:119543c9f674 169 * @brief Disable the FLASH half cycle access.
mbed_official 489:119543c9f674 170 * @note halfcycle access can only be used with a low-frequency clock of less than
mbed_official 489:119543c9f674 171 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
mbed_official 489:119543c9f674 172 * @retval None
mbed_official 489:119543c9f674 173 */
mbed_official 489:119543c9f674 174 #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))
mbed_official 489:119543c9f674 175
mbed_official 489:119543c9f674 176 /**
mbed_official 489:119543c9f674 177 * @}
mbed_official 489:119543c9f674 178 */
mbed_official 489:119543c9f674 179
mbed_official 489:119543c9f674 180 /* Include FLASH HAL Extended module */
mbed_official 489:119543c9f674 181 #include "stm32f1xx_hal_flash_ex.h"
mbed_official 489:119543c9f674 182
mbed_official 489:119543c9f674 183 /* Exported functions --------------------------------------------------------*/
mbed_official 489:119543c9f674 184 /** @addtogroup FLASH_Exported_Functions
mbed_official 489:119543c9f674 185 * @{
mbed_official 489:119543c9f674 186 */
mbed_official 489:119543c9f674 187
mbed_official 489:119543c9f674 188 /** @addtogroup FLASH_Exported_Functions_Group1
mbed_official 489:119543c9f674 189 * @{
mbed_official 489:119543c9f674 190 */
mbed_official 489:119543c9f674 191 /* IO operation functions *****************************************************/
mbed_official 489:119543c9f674 192 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 489:119543c9f674 193 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
mbed_official 489:119543c9f674 194
mbed_official 489:119543c9f674 195 /* FLASH IRQ handler method */
mbed_official 489:119543c9f674 196 void HAL_FLASH_IRQHandler(void);
mbed_official 489:119543c9f674 197 /* Callbacks in non blocking modes */
mbed_official 489:119543c9f674 198 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
mbed_official 489:119543c9f674 199 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
mbed_official 489:119543c9f674 200
mbed_official 489:119543c9f674 201 /**
mbed_official 489:119543c9f674 202 * @}
mbed_official 489:119543c9f674 203 */
mbed_official 489:119543c9f674 204
mbed_official 489:119543c9f674 205 /** @addtogroup FLASH_Exported_Functions_Group2
mbed_official 489:119543c9f674 206 * @{
mbed_official 489:119543c9f674 207 */
mbed_official 489:119543c9f674 208 /* Peripheral Control functions ***********************************************/
mbed_official 489:119543c9f674 209 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
mbed_official 489:119543c9f674 210 HAL_StatusTypeDef HAL_FLASH_Lock(void);
mbed_official 489:119543c9f674 211 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
mbed_official 489:119543c9f674 212 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
mbed_official 489:119543c9f674 213 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
mbed_official 489:119543c9f674 214
mbed_official 489:119543c9f674 215 /**
mbed_official 489:119543c9f674 216 * @}
mbed_official 489:119543c9f674 217 */
mbed_official 489:119543c9f674 218
mbed_official 489:119543c9f674 219 /** @addtogroup FLASH_Exported_Functions_Group3
mbed_official 489:119543c9f674 220 * @{
mbed_official 489:119543c9f674 221 */
mbed_official 489:119543c9f674 222 /* Peripheral State and Error functions ***************************************/
mbed_official 489:119543c9f674 223 uint32_t HAL_FLASH_GetError(void);
mbed_official 489:119543c9f674 224
mbed_official 489:119543c9f674 225 /**
mbed_official 489:119543c9f674 226 * @}
mbed_official 489:119543c9f674 227 */
mbed_official 489:119543c9f674 228
mbed_official 489:119543c9f674 229 /**
mbed_official 489:119543c9f674 230 * @}
mbed_official 489:119543c9f674 231 */
mbed_official 489:119543c9f674 232
mbed_official 489:119543c9f674 233 /* Private function -------------------------------------------------*/
mbed_official 489:119543c9f674 234 /** @addtogroup FLASH_Private_Functions
mbed_official 489:119543c9f674 235 * @{
mbed_official 489:119543c9f674 236 */
mbed_official 489:119543c9f674 237 void FLASH_PageErase(uint32_t PageAddress);
mbed_official 489:119543c9f674 238 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
mbed_official 489:119543c9f674 239 void FLASH_SetErrorCode(void);
mbed_official 489:119543c9f674 240 void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data);
mbed_official 489:119543c9f674 241
mbed_official 489:119543c9f674 242 /**
mbed_official 489:119543c9f674 243 * @}
mbed_official 489:119543c9f674 244 */
mbed_official 489:119543c9f674 245
mbed_official 489:119543c9f674 246 /**
mbed_official 489:119543c9f674 247 * @}
mbed_official 489:119543c9f674 248 */
mbed_official 489:119543c9f674 249
mbed_official 489:119543c9f674 250 /**
mbed_official 489:119543c9f674 251 * @}
mbed_official 489:119543c9f674 252 */
mbed_official 489:119543c9f674 253
mbed_official 489:119543c9f674 254 #ifdef __cplusplus
mbed_official 489:119543c9f674 255 }
mbed_official 489:119543c9f674 256 #endif
mbed_official 489:119543c9f674 257
mbed_official 489:119543c9f674 258 #endif /* __STM32F1xx_HAL_FLASH_H */
mbed_official 489:119543c9f674 259
mbed_official 489:119543c9f674 260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 489:119543c9f674 261