]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/ST_Code/Libraries/STM32L1xx_StdPeriph_Driver/inc/stm32l1xx_flash.h
Tidy up STM32L low power demo and add 'comprehensive demo' option.
[freertos] / FreeRTOS / Demo / CORTEX_STM32L152_Discovery_IAR / ST_Code / Libraries / STM32L1xx_StdPeriph_Driver / inc / stm32l1xx_flash.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32l1xx_flash.h\r
4   * @author  MCD Application Team\r
5   * @version V1.1.1\r
6   * @date    05-March-2012\r
7   * @brief   This file contains all the functions prototypes for the FLASH \r
8   *          firmware library.\r
9   ******************************************************************************\r
10   * @attention\r
11   *\r
12   * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>\r
13   *\r
14   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");\r
15   * You may not use this file except in compliance with the License.\r
16   * You may obtain a copy of the License at:\r
17   *\r
18   *        http://www.st.com/software_license_agreement_liberty_v2\r
19   *\r
20   * Unless required by applicable law or agreed to in writing, software \r
21   * distributed under the License is distributed on an "AS IS" BASIS, \r
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
23   * See the License for the specific language governing permissions and\r
24   * limitations under the License.\r
25   *\r
26   ******************************************************************************\r
27   */\r
28 \r
29 /* Define to prevent recursive inclusion -------------------------------------*/\r
30 #ifndef __STM32L1xx_FLASH_H\r
31 #define __STM32L1xx_FLASH_H\r
32 \r
33 #ifdef __cplusplus\r
34  extern "C" {\r
35 #endif\r
36 \r
37 /* Includes ------------------------------------------------------------------*/\r
38 #include "stm32l1xx.h"\r
39 \r
40 /** @addtogroup STM32L1xx_StdPeriph_Driver\r
41   * @{\r
42   */\r
43 \r
44 /** @addtogroup FLASH\r
45   * @{\r
46   */\r
47 \r
48 /* Exported types ------------------------------------------------------------*/\r
49 \r
50 /** \r
51   * @brief  FLASH Status  \r
52   */ \r
53 typedef enum\r
54\r
55   FLASH_BUSY = 1,\r
56   FLASH_ERROR_WRP,\r
57   FLASH_ERROR_PROGRAM,\r
58   FLASH_COMPLETE,\r
59   FLASH_TIMEOUT\r
60 }FLASH_Status;\r
61 \r
62 /* Exported constants --------------------------------------------------------*/\r
63   \r
64 /** @defgroup FLASH_Exported_Constants\r
65   * @{\r
66   */ \r
67   \r
68 /** @defgroup FLASH_Latency \r
69   * @{\r
70   */ \r
71 #define FLASH_Latency_0                ((uint8_t)0x00)  /*!< FLASH Zero Latency cycle */\r
72 #define FLASH_Latency_1                ((uint8_t)0x01)  /*!< FLASH One Latency cycle */\r
73 \r
74 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \\r
75                                    ((LATENCY) == FLASH_Latency_1))\r
76 /**\r
77   * @}\r
78   */ \r
79 \r
80 /** @defgroup FLASH_Interrupts \r
81   * @{\r
82   */\r
83    \r
84 #define FLASH_IT_EOP               FLASH_PECR_EOPIE  /*!< End of programming interrupt source */\r
85 #define FLASH_IT_ERR               FLASH_PECR_ERRIE  /*!< Error interrupt source */\r
86 #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFCFFFF) == 0x00000000) && (((IT) != 0x00000000)))\r
87 /**\r
88   * @}\r
89   */ \r
90 \r
91 /** @defgroup FLASH_Address \r
92   * @{\r
93   */\r
94   \r
95 #define IS_FLASH_DATA_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08080000) && ((ADDRESS) <= 0x08082FFF))\r
96 #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0805FFFF))  \r
97 \r
98 /**\r
99   * @}\r
100   */ \r
101 \r
102 /** @defgroup Option_Bytes_Write_Protection \r
103   * @{\r
104   */\r
105   \r
106 #define OB_WRP_Pages0to15              ((uint32_t)0x00000001) /* Write protection of Sector0 */\r
107 #define OB_WRP_Pages16to31             ((uint32_t)0x00000002) /* Write protection of Sector1 */\r
108 #define OB_WRP_Pages32to47             ((uint32_t)0x00000004) /* Write protection of Sector2 */\r
109 #define OB_WRP_Pages48to63             ((uint32_t)0x00000008) /* Write protection of Sector3 */\r
110 #define OB_WRP_Pages64to79             ((uint32_t)0x00000010) /* Write protection of Sector4 */\r
111 #define OB_WRP_Pages80to95             ((uint32_t)0x00000020) /* Write protection of Sector5 */\r
112 #define OB_WRP_Pages96to111            ((uint32_t)0x00000040) /* Write protection of Sector6 */\r
113 #define OB_WRP_Pages112to127           ((uint32_t)0x00000080) /* Write protection of Sector7 */\r
114 #define OB_WRP_Pages128to143           ((uint32_t)0x00000100) /* Write protection of Sector8 */\r
115 #define OB_WRP_Pages144to159           ((uint32_t)0x00000200) /* Write protection of Sector9 */\r
116 #define OB_WRP_Pages160to175           ((uint32_t)0x00000400) /* Write protection of Sector10 */\r
117 #define OB_WRP_Pages176to191           ((uint32_t)0x00000800) /* Write protection of Sector11 */\r
118 #define OB_WRP_Pages192to207           ((uint32_t)0x00001000) /* Write protection of Sector12 */\r
119 #define OB_WRP_Pages208to223           ((uint32_t)0x00002000) /* Write protection of Sector13 */\r
120 #define OB_WRP_Pages224to239           ((uint32_t)0x00004000) /* Write protection of Sector14 */\r
121 #define OB_WRP_Pages240to255           ((uint32_t)0x00008000) /* Write protection of Sector15 */\r
122 #define OB_WRP_Pages256to271           ((uint32_t)0x00010000) /* Write protection of Sector16 */\r
123 #define OB_WRP_Pages272to287           ((uint32_t)0x00020000) /* Write protection of Sector17 */\r
124 #define OB_WRP_Pages288to303           ((uint32_t)0x00040000) /* Write protection of Sector18 */\r
125 #define OB_WRP_Pages304to319           ((uint32_t)0x00080000) /* Write protection of Sector19 */\r
126 #define OB_WRP_Pages320to335           ((uint32_t)0x00100000) /* Write protection of Sector20 */\r
127 #define OB_WRP_Pages336to351           ((uint32_t)0x00200000) /* Write protection of Sector21 */\r
128 #define OB_WRP_Pages352to367           ((uint32_t)0x00400000) /* Write protection of Sector22 */\r
129 #define OB_WRP_Pages368to383           ((uint32_t)0x00800000) /* Write protection of Sector23 */\r
130 #define OB_WRP_Pages384to399           ((uint32_t)0x01000000) /* Write protection of Sector24 */\r
131 #define OB_WRP_Pages400to415           ((uint32_t)0x02000000) /* Write protection of Sector25 */\r
132 #define OB_WRP_Pages416to431           ((uint32_t)0x04000000) /* Write protection of Sector26 */\r
133 #define OB_WRP_Pages432to447           ((uint32_t)0x08000000) /* Write protection of Sector27 */\r
134 #define OB_WRP_Pages448to463           ((uint32_t)0x10000000) /* Write protection of Sector28 */\r
135 #define OB_WRP_Pages464to479           ((uint32_t)0x20000000) /* Write protection of Sector29 */\r
136 #define OB_WRP_Pages480to495           ((uint32_t)0x40000000) /* Write protection of Sector30 */\r
137 #define OB_WRP_Pages496to511           ((uint32_t)0x80000000) /* Write protection of Sector31 */\r
138 \r
139 #define OB_WRP_AllPages                ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */\r
140 \r
141 #define OB_WRP1_Pages512to527          ((uint32_t)0x00000001) /* Write protection of Sector32 */\r
142 #define OB_WRP1_Pages528to543          ((uint32_t)0x00000002) /* Write protection of Sector33 */\r
143 #define OB_WRP1_Pages544to559          ((uint32_t)0x00000004) /* Write protection of Sector34 */\r
144 #define OB_WRP1_Pages560to575          ((uint32_t)0x00000008) /* Write protection of Sector35 */\r
145 #define OB_WRP1_Pages576to591          ((uint32_t)0x00000010) /* Write protection of Sector36 */\r
146 #define OB_WRP1_Pages592to607          ((uint32_t)0x00000020) /* Write protection of Sector37 */\r
147 #define OB_WRP1_Pages608to623          ((uint32_t)0x00000040) /* Write protection of Sector38 */\r
148 #define OB_WRP1_Pages624to639          ((uint32_t)0x00000080) /* Write protection of Sector39 */\r
149 #define OB_WRP1_Pages640to655          ((uint32_t)0x00000100) /* Write protection of Sector40 */\r
150 #define OB_WRP1_Pages656to671          ((uint32_t)0x00000200) /* Write protection of Sector41 */\r
151 #define OB_WRP1_Pages672to687          ((uint32_t)0x00000400) /* Write protection of Sector42 */\r
152 #define OB_WRP1_Pages688to703          ((uint32_t)0x00000800) /* Write protection of Sector43 */\r
153 #define OB_WRP1_Pages704to719          ((uint32_t)0x00001000) /* Write protection of Sector44 */\r
154 #define OB_WRP1_Pages720to735          ((uint32_t)0x00002000) /* Write protection of Sector45 */\r
155 #define OB_WRP1_Pages736to751          ((uint32_t)0x00004000) /* Write protection of Sector46 */\r
156 #define OB_WRP1_Pages752to767          ((uint32_t)0x00008000) /* Write protection of Sector47 */\r
157 #define OB_WRP1_Pages768to783          ((uint32_t)0x00010000) /* Write protection of Sector48 */\r
158 #define OB_WRP1_Pages784to799          ((uint32_t)0x00020000) /* Write protection of Sector49 */\r
159 #define OB_WRP1_Pages800to815          ((uint32_t)0x00040000) /* Write protection of Sector50 */\r
160 #define OB_WRP1_Pages816to831          ((uint32_t)0x00080000) /* Write protection of Sector51 */\r
161 #define OB_WRP1_Pages832to847          ((uint32_t)0x00100000) /* Write protection of Sector52 */\r
162 #define OB_WRP1_Pages848to863          ((uint32_t)0x00200000) /* Write protection of Sector53 */\r
163 #define OB_WRP1_Pages864to879          ((uint32_t)0x00400000) /* Write protection of Sector54 */\r
164 #define OB_WRP1_Pages880to895          ((uint32_t)0x00800000) /* Write protection of Sector55 */\r
165 #define OB_WRP1_Pages896to911          ((uint32_t)0x01000000) /* Write protection of Sector56 */\r
166 #define OB_WRP1_Pages912to927          ((uint32_t)0x02000000) /* Write protection of Sector57 */\r
167 #define OB_WRP1_Pages928to943          ((uint32_t)0x04000000) /* Write protection of Sector58 */\r
168 #define OB_WRP1_Pages944to959          ((uint32_t)0x08000000) /* Write protection of Sector59 */\r
169 #define OB_WRP1_Pages960to975          ((uint32_t)0x10000000) /* Write protection of Sector60 */\r
170 #define OB_WRP1_Pages976to991          ((uint32_t)0x20000000) /* Write protection of Sector61 */\r
171 #define OB_WRP1_Pages992to1007         ((uint32_t)0x40000000) /* Write protection of Sector62 */\r
172 #define OB_WRP1_Pages1008to1023        ((uint32_t)0x80000000) /* Write protection of Sector63 */\r
173 \r
174 #define OB_WRP1_AllPages               ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */\r
175 \r
176 #define OB_WRP2_Pages1024to1039        ((uint32_t)0x00000001) /* Write protection of Sector64 */\r
177 #define OB_WRP2_Pages1040to1055        ((uint32_t)0x00000002) /* Write protection of Sector65 */\r
178 #define OB_WRP2_Pages1056to1071        ((uint32_t)0x00000004) /* Write protection of Sector66 */\r
179 #define OB_WRP2_Pages1072to1087        ((uint32_t)0x00000008) /* Write protection of Sector67 */\r
180 #define OB_WRP2_Pages1088to1103        ((uint32_t)0x00000010) /* Write protection of Sector68 */\r
181 #define OB_WRP2_Pages1104to1119        ((uint32_t)0x00000020) /* Write protection of Sector69 */\r
182 #define OB_WRP2_Pages1120to1135        ((uint32_t)0x00000040) /* Write protection of Sector70 */\r
183 #define OB_WRP2_Pages1136to1151        ((uint32_t)0x00000080) /* Write protection of Sector71 */\r
184 #define OB_WRP2_Pages1152to1167        ((uint32_t)0x00000100) /* Write protection of Sector72 */\r
185 #define OB_WRP2_Pages1168to1183        ((uint32_t)0x00000200) /* Write protection of Sector73 */\r
186 #define OB_WRP2_Pages1184to1199        ((uint32_t)0x00000400) /* Write protection of Sector74 */\r
187 #define OB_WRP2_Pages1200to1215        ((uint32_t)0x00000800) /* Write protection of Sector75 */\r
188 #define OB_WRP2_Pages1216to1231        ((uint32_t)0x00001000) /* Write protection of Sector76 */\r
189 #define OB_WRP2_Pages1232to1247        ((uint32_t)0x00002000) /* Write protection of Sector77 */\r
190 #define OB_WRP2_Pages1248to1263        ((uint32_t)0x00004000) /* Write protection of Sector78 */\r
191 #define OB_WRP2_Pages1264to1279        ((uint32_t)0x00008000) /* Write protection of Sector79 */\r
192 #define OB_WRP2_Pages1280to1295        ((uint32_t)0x00010000) /* Write protection of Sector80 */\r
193 #define OB_WRP2_Pages1296to1311        ((uint32_t)0x00020000) /* Write protection of Sector81 */\r
194 #define OB_WRP2_Pages1312to1327        ((uint32_t)0x00040000) /* Write protection of Sector82 */\r
195 #define OB_WRP2_Pages1328to1343        ((uint32_t)0x00080000) /* Write protection of Sector83 */\r
196 #define OB_WRP2_Pages1344to1359        ((uint32_t)0x00100000) /* Write protection of Sector84 */\r
197 #define OB_WRP2_Pages1360to1375        ((uint32_t)0x00200000) /* Write protection of Sector85 */\r
198 #define OB_WRP2_Pages1376to1391        ((uint32_t)0x00400000) /* Write protection of Sector86 */\r
199 #define OB_WRP2_Pages1392to1407        ((uint32_t)0x00800000) /* Write protection of Sector87 */\r
200 #define OB_WRP2_Pages1408to1423        ((uint32_t)0x01000000) /* Write protection of Sector88 */\r
201 #define OB_WRP2_Pages1424to1439        ((uint32_t)0x02000000) /* Write protection of Sector89 */\r
202 #define OB_WRP2_Pages1440to1455        ((uint32_t)0x04000000) /* Write protection of Sector90 */\r
203 #define OB_WRP2_Pages1456to1471        ((uint32_t)0x08000000) /* Write protection of Sector91 */\r
204 #define OB_WRP2_Pages1472to1487        ((uint32_t)0x10000000) /* Write protection of Sector92 */\r
205 #define OB_WRP2_Pages1488to1503        ((uint32_t)0x20000000) /* Write protection of Sector93 */\r
206 #define OB_WRP2_Pages1504to1519        ((uint32_t)0x40000000) /* Write protection of Sector94 */\r
207 #define OB_WRP2_Pages1520to1535        ((uint32_t)0x80000000) /* Write protection of Sector95 */\r
208 \r
209 #define OB_WRP2_AllPages               ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Sectors */\r
210 \r
211 #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))\r
212 \r
213 /**\r
214   * @}\r
215   */\r
216 \r
217 /** @defgroup Option_Bytes_Read_Protection \r
218   * @{\r
219   */ \r
220 \r
221 /** \r
222   * @brief  Read Protection Level  \r
223   */ \r
224 #define OB_RDP_Level_0   ((uint8_t)0xAA)\r
225 #define OB_RDP_Level_1   ((uint8_t)0xBB)\r
226 /*#define OB_RDP_Level_2   ((uint8_t)0xCC)*/ /* Warning: When enabling read protection level 2 \r
227                                                 it's no more possible to go back to level 1 or 0 */\r
228 \r
229 #define IS_OB_RDP(LEVEL) (((LEVEL) == OB_RDP_Level_0)||\\r
230                           ((LEVEL) == OB_RDP_Level_1))/*||\\r
231                           ((LEVEL) == OB_RDP_Level_2))*/\r
232 /**\r
233   * @}\r
234   */ \r
235 \r
236 /** @defgroup Option_Bytes_IWatchdog \r
237   * @{\r
238   */\r
239 \r
240 #define OB_IWDG_SW                     ((uint8_t)0x10)  /*!< Software WDG selected */\r
241 #define OB_IWDG_HW                     ((uint8_t)0x00)  /*!< Hardware WDG selected */\r
242 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))\r
243 \r
244 /**\r
245   * @}\r
246   */\r
247 \r
248 /** @defgroup Option_Bytes_nRST_STOP \r
249   * @{\r
250   */\r
251 \r
252 #define OB_STOP_NoRST                  ((uint8_t)0x20) /*!< No reset generated when entering in STOP */\r
253 #define OB_STOP_RST                    ((uint8_t)0x00) /*!< Reset generated when entering in STOP */\r
254 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST))\r
255 \r
256 /**\r
257   * @}\r
258   */\r
259 \r
260 /** @defgroup Option_Bytes_nRST_STDBY \r
261   * @{\r
262   */\r
263 \r
264 #define OB_STDBY_NoRST                 ((uint8_t)0x40) /*!< No reset generated when entering in STANDBY */\r
265 #define OB_STDBY_RST                   ((uint8_t)0x00) /*!< Reset generated when entering in STANDBY */\r
266 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST))\r
267 \r
268 /**\r
269   * @}\r
270   */\r
271 \r
272 /** @defgroup Option_Bytes_BOOT\r
273   * @{\r
274   */\r
275 \r
276 #define OB_BOOT_BANK2                  ((uint8_t)0x00) /*!< At startup, if boot pins are set in boot from user Flash position\r
277                                                             and this parameter is selected the device will boot from Bank 2 \r
278                                                             or Bank 1, depending on the activation of the bank */\r
279 #define OB_BOOT_BANK1                  ((uint8_t)0x80) /*!< At startup, if boot pins are set in boot from user Flash position\r
280                                                             and this parameter is selected the device will boot from Bank1(Default) */\r
281 #define IS_OB_BOOT_BANK(BANK) (((BANK) == OB_BOOT_BANK2) || ((BANK) == OB_BOOT_BANK1))\r
282 \r
283 /**\r
284   * @}\r
285   */\r
286 \r
287 /** @defgroup Option_Bytes_BOR_Level \r
288   * @{\r
289   */\r
290 \r
291 #define OB_BOR_OFF       ((uint8_t)0x00) /*!< BOR is disabled at power down, the reset is asserted when the VDD \r
292                                               power supply reaches the PDR(Power Down Reset) threshold (1.5V) */\r
293 #define OB_BOR_LEVEL1    ((uint8_t)0x08) /*!< BOR Reset threshold levels for 1.7V - 1.8V VDD power supply    */\r
294 #define OB_BOR_LEVEL2    ((uint8_t)0x09) /*!< BOR Reset threshold levels for 1.9V - 2.0V VDD power supply    */\r
295 #define OB_BOR_LEVEL3    ((uint8_t)0x0A) /*!< BOR Reset threshold levels for 2.3V - 2.4V VDD power supply    */\r
296 #define OB_BOR_LEVEL4    ((uint8_t)0x0B) /*!< BOR Reset threshold levels for 2.55V - 2.65V VDD power supply  */\r
297 #define OB_BOR_LEVEL5    ((uint8_t)0x0C) /*!< BOR Reset threshold levels for 2.8V - 2.9V VDD power supply    */\r
298 \r
299 #define IS_OB_BOR_LEVEL(LEVEL)  (((LEVEL) == OB_BOR_OFF) || \\r
300                                  ((LEVEL) == OB_BOR_LEVEL1) || \\r
301                                  ((LEVEL) == OB_BOR_LEVEL2) || \\r
302                                  ((LEVEL) == OB_BOR_LEVEL3) || \\r
303                                  ((LEVEL) == OB_BOR_LEVEL4) || \\r
304                                  ((LEVEL) == OB_BOR_LEVEL5))\r
305 \r
306 /**\r
307   * @}\r
308   */\r
309   \r
310 /** @defgroup FLASH_Flags \r
311   * @{\r
312   */ \r
313 \r
314 #define FLASH_FLAG_BSY                 FLASH_SR_BSY  /*!< FLASH Busy flag */\r
315 #define FLASH_FLAG_EOP                 FLASH_SR_EOP  /*!< FLASH End of Programming flag */\r
316 #define FLASH_FLAG_ENDHV               FLASH_SR_ENHV  /*!< FLASH End of High Voltage flag */\r
317 #define FLASH_FLAG_READY               FLASH_SR_READY  /*!< FLASH Ready flag after low power mode */\r
318 #define FLASH_FLAG_WRPERR              FLASH_SR_WRPERR  /*!< FLASH Write protected error flag */\r
319 #define FLASH_FLAG_PGAERR              FLASH_SR_PGAERR  /*!< FLASH Programming Alignment error flag */\r
320 #define FLASH_FLAG_SIZERR              FLASH_SR_SIZERR  /*!< FLASH Size error flag  */\r
321 #define FLASH_FLAG_OPTVERR             FLASH_SR_OPTVERR  /*!< FLASH Option Validity error flag  */\r
322 #define FLASH_FLAG_OPTVERRUSR          FLASH_SR_OPTVERRUSR  /*!< FLASH Option User Validity error flag  */\r
323  \r
324 #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFE0FD) == 0x00000000) && ((FLAG) != 0x00000000))\r
325 \r
326 #define IS_FLASH_GET_FLAG(FLAG)  (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \\r
327                                   ((FLAG) == FLASH_FLAG_ENDHV) || ((FLAG) == FLASH_FLAG_READY ) || \\r
328                                   ((FLAG) ==  FLASH_FLAG_WRPERR) || ((FLAG) == FLASH_FLAG_PGAERR ) || \\r
329                                   ((FLAG) ==  FLASH_FLAG_SIZERR) || ((FLAG) == FLASH_FLAG_OPTVERR) || \\r
330                                   ((FLAG) ==  FLASH_FLAG_OPTVERRUSR))\r
331 /**\r
332   * @}\r
333   */ \r
334 \r
335 /** @defgroup FLASH_Keys \r
336   * @{\r
337   */ \r
338 \r
339 #define FLASH_PDKEY1               ((uint32_t)0x04152637) /*!< Flash power down key1 */\r
340 #define FLASH_PDKEY2               ((uint32_t)0xFAFBFCFD) /*!< Flash power down key2: used with FLASH_PDKEY1 \r
341                                                               to unlock the RUN_PD bit in FLASH_ACR */\r
342 \r
343 #define FLASH_PEKEY1               ((uint32_t)0x89ABCDEF) /*!< Flash program erase key1 */\r
344 #define FLASH_PEKEY2               ((uint32_t)0x02030405) /*!< Flash program erase key: used with FLASH_PEKEY2\r
345                                                                to unlock the write access to the FLASH_PECR register and\r
346                                                                data EEPROM */\r
347 \r
348 #define FLASH_PRGKEY1              ((uint32_t)0x8C9DAEBF) /*!< Flash program memory key1 */\r
349 #define FLASH_PRGKEY2              ((uint32_t)0x13141516) /*!< Flash program memory key2: used with FLASH_PRGKEY2\r
350                                                                to unlock the program memory */\r
351 \r
352 #define FLASH_OPTKEY1              ((uint32_t)0xFBEAD9C8) /*!< Flash option key1 */\r
353 #define FLASH_OPTKEY2              ((uint32_t)0x24252627) /*!< Flash option key2: used with FLASH_OPTKEY1 to\r
354                                                               unlock the write access to the option byte block */\r
355 /**\r
356   * @}\r
357   */\r
358   \r
359 /** @defgroup Timeout_definition \r
360   * @{\r
361   */ \r
362 #define FLASH_ER_PRG_TIMEOUT         ((uint32_t)0x8000)\r
363 \r
364 /**\r
365   * @}\r
366   */ \r
367 \r
368 /** @defgroup CMSIS_Legacy \r
369   * @{\r
370   */\r
371 #if defined ( __ICCARM__ )   \r
372 #define InterruptType_ACTLR_DISMCYCINT_Msk         IntType_ACTLR_DISMCYCINT_Msk\r
373 #endif\r
374 /**\r
375   * @}\r
376   */ \r
377 /**\r
378   * @}\r
379   */ \r
380 \r
381 /* Exported macro ------------------------------------------------------------*/\r
382 /* Exported functions ------------------------------------------------------- */\r
383   \r
384 /** \r
385   * @brief  FLASH memory functions that can be executed from FLASH.  \r
386   */  \r
387 /* FLASH Interface configuration functions ************************************/  \r
388 void FLASH_SetLatency(uint32_t FLASH_Latency);\r
389 void FLASH_PrefetchBufferCmd(FunctionalState NewState);\r
390 void FLASH_ReadAccess64Cmd(FunctionalState NewState);\r
391 void FLASH_SLEEPPowerDownCmd(FunctionalState NewState);\r
392 \r
393 /* FLASH Memory Programming functions *****************************************/   \r
394 void FLASH_Unlock(void);\r
395 void FLASH_Lock(void);\r
396 FLASH_Status FLASH_ErasePage(uint32_t Page_Address);\r
397 FLASH_Status FLASH_FastProgramWord(uint32_t Address, uint32_t Data);\r
398 \r
399 /* DATA EEPROM Programming functions ******************************************/  \r
400 void DATA_EEPROM_Unlock(void);\r
401 void DATA_EEPROM_Lock(void);\r
402 void DATA_EEPROM_FixedTimeProgramCmd(FunctionalState NewState);\r
403 FLASH_Status DATA_EEPROM_EraseByte(uint32_t Address);\r
404 FLASH_Status DATA_EEPROM_EraseHalfWord(uint32_t Address);\r
405 FLASH_Status DATA_EEPROM_EraseWord(uint32_t Address);\r
406 FLASH_Status DATA_EEPROM_FastProgramByte(uint32_t Address, uint8_t Data);\r
407 FLASH_Status DATA_EEPROM_FastProgramHalfWord(uint32_t Address, uint16_t Data);\r
408 FLASH_Status DATA_EEPROM_FastProgramWord(uint32_t Address, uint32_t Data);\r
409 FLASH_Status DATA_EEPROM_ProgramByte(uint32_t Address, uint8_t Data);\r
410 FLASH_Status DATA_EEPROM_ProgramHalfWord(uint32_t Address, uint16_t Data);\r
411 FLASH_Status DATA_EEPROM_ProgramWord(uint32_t Address, uint32_t Data);\r
412 \r
413 /* Option Bytes Programming functions *****************************************/\r
414 void FLASH_OB_Unlock(void);\r
415 void FLASH_OB_Lock(void);\r
416 void FLASH_OB_Launch(void);\r
417 FLASH_Status FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState);\r
418 FLASH_Status FLASH_OB_WRP1Config(uint32_t OB_WRP1, FunctionalState NewState);\r
419 FLASH_Status FLASH_OB_WRP2Config(uint32_t OB_WRP2, FunctionalState NewState);\r
420 FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP);\r
421 FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY);\r
422 FLASH_Status FLASH_OB_BORConfig(uint8_t OB_BOR);\r
423 FLASH_Status FLASH_OB_BootConfig(uint8_t OB_BOOT);\r
424 uint8_t FLASH_OB_GetUser(void);\r
425 uint32_t FLASH_OB_GetWRP(void);\r
426 uint32_t FLASH_OB_GetWRP1(void);\r
427 uint32_t FLASH_OB_GetWRP2(void);\r
428 FlagStatus FLASH_OB_GetRDP(void);\r
429 uint8_t FLASH_OB_GetBOR(void);\r
430 \r
431 /* Interrupts and flags management functions **********************************/  \r
432 void FLASH_ITConfig(uint32_t FLASH_IT, FunctionalState NewState);\r
433 FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG);\r
434 void FLASH_ClearFlag(uint32_t FLASH_FLAG);\r
435 FLASH_Status FLASH_GetStatus(void);\r
436 FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);\r
437 \r
438 /** \r
439   * @brief  FLASH memory functions that should be executed from internal SRAM.\r
440   *         These functions are defined inside the "stm32l1xx_flash_ramfunc.c"\r
441   *         file.\r
442   */ \r
443 __RAM_FUNC FLASH_RUNPowerDownCmd(FunctionalState NewState);\r
444 __RAM_FUNC FLASH_EraseParallelPage(uint32_t Page_Address1, uint32_t Page_Address2);\r
445 __RAM_FUNC FLASH_ProgramHalfPage(uint32_t Address, uint32_t* pBuffer);\r
446 __RAM_FUNC FLASH_ProgramParallelHalfPage(uint32_t Address1, uint32_t* pBuffer1, uint32_t Address2, uint32_t* pBuffer2);\r
447 __RAM_FUNC DATA_EEPROM_EraseDoubleWord(uint32_t Address);\r
448 __RAM_FUNC DATA_EEPROM_ProgramDoubleWord(uint32_t Address, uint64_t Data);\r
449   \r
450 #ifdef __cplusplus\r
451 }\r
452 #endif\r
453 \r
454 #endif /* __STM32L1xx_FLASH_H */\r
455 \r
456 /**\r
457   * @}\r
458   */\r
459 \r
460 /**\r
461   * @}\r
462   */ \r
463 \r
464 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r