annotate f103c8/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 * @file stm32f1xx_hal_flash.h
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * @author MCD Application Team
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * @version V1.0.4
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 * @date 29-April-2016
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 * @brief Header file of Flash HAL module.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 * @attention
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 * and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 * without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 #ifndef __STM32F1xx_HAL_FLASH_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 #define __STM32F1xx_HAL_FLASH_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 #ifdef __cplusplus
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 extern "C" {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 #include "stm32f1xx_hal_def.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 /** @addtogroup STM32F1xx_HAL_Driver
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 /** @addtogroup FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 /** @addtogroup FLASH_Private_Constants
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 /** @addtogroup FLASH_Private_Macros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 #if defined(FLASH_ACR_LATENCY)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 ((__LATENCY__) == FLASH_LATENCY_1) || \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 ((__LATENCY__) == FLASH_LATENCY_2))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 #define IS_FLASH_LATENCY(__LATENCY__) ((__LATENCY__) == FLASH_LATENCY_0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 #endif /* FLASH_ACR_LATENCY */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 /* Exported types ------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 /** @defgroup FLASH_Exported_Types FLASH Exported Types
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 * @brief FLASH Procedure structure definition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 typedef enum
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 FLASH_PROC_NONE = 0,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 FLASH_PROC_PAGEERASE = 1,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 FLASH_PROC_MASSERASE = 2,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 FLASH_PROC_PROGRAMHALFWORD = 3,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 FLASH_PROC_PROGRAMWORD = 4,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 FLASH_PROC_PROGRAMDOUBLEWORD = 5
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 } FLASH_ProcedureTypeDef;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 * @brief FLASH handle Structure definition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 typedef struct
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 __IO uint64_t Data; /*!< Internal variable to save data to be programmed */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 HAL_LockTypeDef Lock; /*!< FLASH locking object */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 __IO uint32_t ErrorCode; /*!< FLASH error code
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 This parameter can be a value of @ref FLASH_Error_Codes */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 } FLASH_ProcessTypeDef;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 /* Exported constants --------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 /** @defgroup FLASH_Error_Codes FLASH Error Codes
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00) /*!< No error */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 #define HAL_FLASH_ERROR_PROG ((uint32_t)0x01) /*!< Programming error */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02) /*!< Write protection error */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x04) /*!< Option validity error */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 /** @defgroup FLASH_Type_Program FLASH Type Program
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 #if defined(FLASH_ACR_LATENCY)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 /** @defgroup FLASH_Latency FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_0 /*!< FLASH One Latency cycle */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_1 /*!< FLASH Two Latency cycles */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 /** @defgroup FLASH_Latency FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 #define FLASH_LATENCY_0 ((uint32_t)0x00000000) /*!< FLASH Zero Latency cycle */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 #endif /* FLASH_ACR_LATENCY */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183 /* Exported macro ------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 * @brief macros to control FLASH features
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 /** @defgroup FLASH_Half_Cycle FLASH Half Cycle
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191 * @brief macros to handle FLASH half cycle
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 * @brief Enable the FLASH half cycle access.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197 * @note half cycle access can only be used with a low-frequency clock of less than
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 #define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE() (FLASH->ACR |= FLASH_ACR_HLFCYA)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204 * @brief Disable the FLASH half cycle access.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205 * @note half cycle access can only be used with a low-frequency clock of less than
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209 #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 #if defined(FLASH_ACR_LATENCY)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 /** @defgroup FLASH_EM_Latency FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 * @brief macros to handle FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 * @brief Set the FLASH Latency.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223 * @param __LATENCY__ FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224 * The value of this parameter depend on device used within the same series
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 * @brief Get the FLASH Latency.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 * @retval FLASH Latency
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 * The value of this parameter depend on device used within the same series
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241 #endif /* FLASH_ACR_LATENCY */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 /** @defgroup FLASH_Prefetch FLASH Prefetch
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243 * @brief macros to handle FLASH Prefetch buffer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247 * @brief Enable the FLASH prefetch buffer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
249 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
250 #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
251
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
252 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
253 * @brief Disable the FLASH prefetch buffer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
254 * @retval None
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
255 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
256 #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
257
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
258 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
259 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
260 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
261
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
262 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
263 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
264 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
265
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
266 /* Include FLASH HAL Extended module */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
267 #include "stm32f1xx_hal_flash_ex.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
268
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
269 /* Exported functions --------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
270 /** @addtogroup FLASH_Exported_Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
271 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
272 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
273
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
274 /** @addtogroup FLASH_Exported_Functions_Group1
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
275 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
276 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
277 /* IO operation functions *****************************************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
278 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
279 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
280
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
281 /* FLASH IRQ handler function */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
282 void HAL_FLASH_IRQHandler(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
283 /* Callbacks in non blocking modes */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
284 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
285 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
286
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
287 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
288 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
289 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
290
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
291 /** @addtogroup FLASH_Exported_Functions_Group2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
292 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
293 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
294 /* Peripheral Control functions ***********************************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
295 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
296 HAL_StatusTypeDef HAL_FLASH_Lock(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
297 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
298 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
299 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
300
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
301 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
302 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
303 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
304
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
305 /** @addtogroup FLASH_Exported_Functions_Group3
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
306 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
307 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
308 /* Peripheral State and Error functions ***************************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
309 uint32_t HAL_FLASH_GetError(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
310
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
311 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
312 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
313 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
314
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
315 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
316 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
317 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
318
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
319 /* Private function -------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
320 /** @addtogroup FLASH_Private_Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
321 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
322 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
323 void FLASH_PageErase(uint32_t PageAddress);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
324 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
325 #if defined(FLASH_BANK2_END)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
326 HAL_StatusTypeDef FLASH_WaitForLastOperationBank2(uint32_t Timeout);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
327 #endif /* FLASH_BANK2_END */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
328
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
329 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
330 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
331 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
332
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
333 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
334 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
335 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
336
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
337 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
338 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
339 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
340
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
341 #ifdef __cplusplus
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
342 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
343 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
344
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
345 #endif /* __STM32F1xx_HAL_FLASH_H */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
346
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
347 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
348