Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 28 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32l1xx_hal_flash.h |
3 | * @file stm32l1xx_hal_flash_ex.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.2.0 |
- | |
| 6 | * @date 01-July-2016 |
- | |
| 7 | * @brief Header file of Flash HAL module. |
5 | * @brief Header file of Flash HAL Extended module. |
| 8 | ****************************************************************************** |
6 | ****************************************************************************** |
| 9 | * @attention |
7 | * @attention |
| 10 | * |
8 | * |
| 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 12 | * |
11 | * |
| 13 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 14 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 15 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer. |
- | |
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 18 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 19 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 21 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 22 | * without specific prior written permission. |
- | |
| 23 | * |
- | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 34 | * |
16 | * |
| 35 | ****************************************************************************** |
17 | ****************************************************************************** |
| 36 | */ |
18 | */ |
| 37 | 19 | ||
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Line 84... | Line 66... | ||
| 84 | 66 | ||
| 85 | #if defined(STM32L100xB) || defined(STM32L151xB) || defined(STM32L152xB) || defined(STM32L100xBA) \ |
67 | #if defined(STM32L100xB) || defined(STM32L151xB) || defined(STM32L152xB) || defined(STM32L100xBA) \ |
| 86 | || defined(STM32L151xBA) || defined(STM32L152xBA) |
68 | || defined(STM32L151xBA) || defined(STM32L152xBA) |
| 87 | 69 | ||
| 88 | /******* Devices with FLASH 128K *******/ |
70 | /******* Devices with FLASH 128K *******/ |
| 89 | #define FLASH_NBPAGES_MAX 512 /* 512 pages from page 0 to page 511 */ |
71 | #define FLASH_NBPAGES_MAX 512U /* 512 pages from page 0 to page 511U */ |
| 90 | 72 | ||
| 91 | #elif defined(STM32L100xC) || defined(STM32L151xC) || defined(STM32L152xC) || defined(STM32L162xC) \ |
73 | #elif defined(STM32L100xC) || defined(STM32L151xC) || defined(STM32L152xC) || defined(STM32L162xC) \ |
| 92 | || defined(STM32L151xCA) || defined(STM32L152xCA) || defined(STM32L162xCA) |
74 | || defined(STM32L151xCA) || defined(STM32L152xCA) || defined(STM32L162xCA) |
| 93 | 75 | ||
| 94 | /******* Devices with FLASH 256K *******/ |
76 | /******* Devices with FLASH 256K *******/ |
| 95 | #define FLASH_NBPAGES_MAX 1025 /* 1025 pages from page 0 to page 1024 */ |
77 | #define FLASH_NBPAGES_MAX 1025U /* 1025 pages from page 0 to page 1024U */ |
| 96 | 78 | ||
| 97 | #elif defined(STM32L151xD) || defined(STM32L151xDX) || defined(STM32L152xD) || defined(STM32L152xDX) \ |
79 | #elif defined(STM32L151xD) || defined(STM32L151xDX) || defined(STM32L152xD) || defined(STM32L152xDX) \ |
| 98 | || defined(STM32L162xD) || defined(STM32L162xDX) |
80 | || defined(STM32L162xD) || defined(STM32L162xDX) |
| 99 | 81 | ||
| 100 | /******* Devices with FLASH 384K *******/ |
82 | /******* Devices with FLASH 384K *******/ |
| 101 | #define FLASH_NBPAGES_MAX 1536 /* 1536 pages from page 0 to page 1535 */ |
83 | #define FLASH_NBPAGES_MAX 1536U /* 1536 pages from page 0 to page 1535U */ |
| 102 | 84 | ||
| 103 | #elif defined(STM32L151xE) || defined(STM32L152xE) || defined(STM32L162xE) |
85 | #elif defined(STM32L151xE) || defined(STM32L152xE) || defined(STM32L162xE) |
| 104 | 86 | ||
| 105 | /******* Devices with FLASH 512K *******/ |
87 | /******* Devices with FLASH 512K *******/ |
| 106 | #define FLASH_NBPAGES_MAX 2048 /* 2048 pages from page 0 to page 2047 */ |
88 | #define FLASH_NBPAGES_MAX 2048U /* 2048 pages from page 0 to page 2047U */ |
| 107 | 89 | ||
| 108 | #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA */ |
90 | #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA */ |
| 109 | 91 | ||
| 110 | #define WRP_MASK_LOW ((uint32_t)0x0000FFFFU) |
92 | #define WRP_MASK_LOW (0x0000FFFFU) |
| 111 | #define WRP_MASK_HIGH ((uint32_t)0xFFFF0000U) |
93 | #define WRP_MASK_HIGH (0xFFFF0000U) |
| 112 | 94 | ||
| 113 | /** |
95 | /** |
| 114 | * @} |
96 | * @} |
| 115 | */ |
97 | */ |
| 116 | 98 | ||
| Line 173... | Line 155... | ||
| 173 | #endif /* FLASH_OBR_nRST_BFB2 */ |
155 | #endif /* FLASH_OBR_nRST_BFB2 */ |
| 174 | 156 | ||
| 175 | #define IS_TYPEERASEDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEERASEDATA_BYTE) || \ |
157 | #define IS_TYPEERASEDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEERASEDATA_BYTE) || \ |
| 176 | ((__VALUE__) == FLASH_TYPEERASEDATA_HALFWORD) || \ |
158 | ((__VALUE__) == FLASH_TYPEERASEDATA_HALFWORD) || \ |
| 177 | ((__VALUE__) == FLASH_TYPEERASEDATA_WORD)) |
159 | ((__VALUE__) == FLASH_TYPEERASEDATA_WORD)) |
| 178 | - | ||
| 179 | #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \ |
160 | #define IS_TYPEPROGRAMDATA(__VALUE__) (((__VALUE__) == FLASH_TYPEPROGRAMDATA_BYTE) || \ |
| 180 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \ |
161 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_HALFWORD) || \ |
| 181 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD) || \ |
162 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_WORD) || \ |
| 182 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTBYTE) || \ |
163 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTBYTE) || \ |
| 183 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTHALFWORD) || \ |
164 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTHALFWORD) || \ |
| 184 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTWORD)) |
165 | ((__VALUE__) == FLASH_TYPEPROGRAMDATA_FASTWORD)) |
| 185 | 166 | ||
| - | 167 | ||
| 186 | /** @defgroup FLASHEx_Address FLASHEx Address |
168 | /** @defgroup FLASHEx_Address FLASHEx Address |
| 187 | * @{ |
169 | * @{ |
| 188 | */ |
170 | */ |
| 189 | 171 | ||
| 190 | #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_EEPROM_BASE) && ((__ADDRESS__) <= FLASH_EEPROM_END)) |
172 | #define IS_FLASH_DATA_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_EEPROM_BASE) && ((__ADDRESS__) <= FLASH_EEPROM_END)) |
| Line 202... | Line 184... | ||
| 202 | #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) <= FLASH_BANK1_END)) |
184 | #define IS_FLASH_PROGRAM_BANK1_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BASE) && ((__ADDRESS__) <= FLASH_BANK1_END)) |
| 203 | #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) <= FLASH_BANK2_END)) |
185 | #define IS_FLASH_PROGRAM_BANK2_ADDRESS(__ADDRESS__) (((__ADDRESS__) >= FLASH_BANK2_BASE) && ((__ADDRESS__) <= FLASH_BANK2_END)) |
| 204 | 186 | ||
| 205 | #endif /* STM32L100xB || STM32L151xB || STM32L152xB || (...) || STM32L151xCA || STM32L152xCA || STM32L162xCA */ |
187 | #endif /* STM32L100xB || STM32L151xB || STM32L152xB || (...) || STM32L151xCA || STM32L152xCA || STM32L162xCA */ |
| 206 | 188 | ||
| 207 | #define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1) && ((__PAGES__) <= FLASH_NBPAGES_MAX)) |
189 | #define IS_NBPAGES(__PAGES__) (((__PAGES__) >= 1U) && ((__PAGES__) <= FLASH_NBPAGES_MAX)) |
| 208 | 190 | ||
| 209 | /** |
191 | /** |
| 210 | * @} |
192 | * @} |
| 211 | */ |
193 | */ |
| 212 | 194 | ||
| Line 323... | Line 305... | ||
| 323 | */ |
305 | */ |
| 324 | 306 | ||
| 325 | /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase |
307 | /** @defgroup FLASHEx_Type_Erase FLASHEx_Type_Erase |
| 326 | * @{ |
308 | * @{ |
| 327 | */ |
309 | */ |
| 328 | #define FLASH_TYPEERASE_PAGES ((uint32_t)0x00U) /*!<Page erase only*/ |
310 | #define FLASH_TYPEERASE_PAGES (0x00U) /*!<Page erase only*/ |
| 329 | 311 | ||
| 330 | /** |
312 | /** |
| 331 | * @} |
313 | * @} |
| 332 | */ |
314 | */ |
| 333 | 315 | ||
| 334 | /** @defgroup FLASHEx_Option_Type FLASHEx Option Type |
316 | /** @defgroup FLASHEx_Option_Type FLASHEx Option Type |
| 335 | * @{ |
317 | * @{ |
| 336 | */ |
318 | */ |
| 337 | #define OPTIONBYTE_WRP ((uint32_t)0x01U) /*!<WRP option byte configuration*/ |
319 | #define OPTIONBYTE_WRP (0x01U) /*!<WRP option byte configuration*/ |
| 338 | #define OPTIONBYTE_RDP ((uint32_t)0x02U) /*!<RDP option byte configuration*/ |
320 | #define OPTIONBYTE_RDP (0x02U) /*!<RDP option byte configuration*/ |
| 339 | #define OPTIONBYTE_USER ((uint32_t)0x04U) /*!<USER option byte configuration*/ |
321 | #define OPTIONBYTE_USER (0x04U) /*!<USER option byte configuration*/ |
| 340 | #define OPTIONBYTE_BOR ((uint32_t)0x08U) /*!<BOR option byte configuration*/ |
322 | #define OPTIONBYTE_BOR (0x08U) /*!<BOR option byte configuration*/ |
| 341 | 323 | ||
| 342 | /** |
324 | /** |
| 343 | * @} |
325 | * @} |
| 344 | */ |
326 | */ |
| 345 | 327 | ||
| 346 | /** @defgroup FLASHEx_WRP_State FLASHEx WRP State |
328 | /** @defgroup FLASHEx_WRP_State FLASHEx WRP State |
| 347 | * @{ |
329 | * @{ |
| 348 | */ |
330 | */ |
| 349 | #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U) /*!<Disable the write protection of the desired sectors*/ |
331 | #define OB_WRPSTATE_DISABLE (0x00U) /*!<Disable the write protection of the desired sectors*/ |
| 350 | #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U) /*!<Enable the write protection of the desired sectors*/ |
332 | #define OB_WRPSTATE_ENABLE (0x01U) /*!<Enable the write protection of the desired sectors*/ |
| 351 | 333 | ||
| 352 | /** |
334 | /** |
| 353 | * @} |
335 | * @} |
| 354 | */ |
336 | */ |
| 355 | 337 | ||
| 356 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection1 FLASHEx Option Bytes Write Protection1 |
338 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection1 FLASHEx Option Bytes Write Protection1 |
| 357 | * @{ |
339 | * @{ |
| 358 | */ |
340 | */ |
| 359 | 341 | ||
| 360 | /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */ |
342 | /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */ |
| 361 | #define OB_WRP1_PAGES0TO15 ((uint32_t)0x00000001) /* Write protection of Sector0 */ |
343 | #define OB_WRP1_PAGES0TO15 (0x00000001U) /* Write protection of Sector0 */ |
| 362 | #define OB_WRP1_PAGES16TO31 ((uint32_t)0x00000002) /* Write protection of Sector1 */ |
344 | #define OB_WRP1_PAGES16TO31 (0x00000002U) /* Write protection of Sector1 */ |
| 363 | #define OB_WRP1_PAGES32TO47 ((uint32_t)0x00000004) /* Write protection of Sector2 */ |
345 | #define OB_WRP1_PAGES32TO47 (0x00000004U) /* Write protection of Sector2 */ |
| 364 | #define OB_WRP1_PAGES48TO63 ((uint32_t)0x00000008) /* Write protection of Sector3 */ |
346 | #define OB_WRP1_PAGES48TO63 (0x00000008U) /* Write protection of Sector3 */ |
| 365 | #define OB_WRP1_PAGES64TO79 ((uint32_t)0x00000010) /* Write protection of Sector4 */ |
347 | #define OB_WRP1_PAGES64TO79 (0x00000010U) /* Write protection of Sector4 */ |
| 366 | #define OB_WRP1_PAGES80TO95 ((uint32_t)0x00000020) /* Write protection of Sector5 */ |
348 | #define OB_WRP1_PAGES80TO95 (0x00000020U) /* Write protection of Sector5 */ |
| 367 | #define OB_WRP1_PAGES96TO111 ((uint32_t)0x00000040) /* Write protection of Sector6 */ |
349 | #define OB_WRP1_PAGES96TO111 (0x00000040U) /* Write protection of Sector6 */ |
| 368 | #define OB_WRP1_PAGES112TO127 ((uint32_t)0x00000080) /* Write protection of Sector7 */ |
350 | #define OB_WRP1_PAGES112TO127 (0x00000080U) /* Write protection of Sector7 */ |
| 369 | #define OB_WRP1_PAGES128TO143 ((uint32_t)0x00000100) /* Write protection of Sector8 */ |
351 | #define OB_WRP1_PAGES128TO143 (0x00000100U) /* Write protection of Sector8 */ |
| 370 | #define OB_WRP1_PAGES144TO159 ((uint32_t)0x00000200) /* Write protection of Sector9 */ |
352 | #define OB_WRP1_PAGES144TO159 (0x00000200U) /* Write protection of Sector9 */ |
| 371 | #define OB_WRP1_PAGES160TO175 ((uint32_t)0x00000400) /* Write protection of Sector10 */ |
353 | #define OB_WRP1_PAGES160TO175 (0x00000400U) /* Write protection of Sector10 */ |
| 372 | #define OB_WRP1_PAGES176TO191 ((uint32_t)0x00000800) /* Write protection of Sector11 */ |
354 | #define OB_WRP1_PAGES176TO191 (0x00000800U) /* Write protection of Sector11 */ |
| 373 | #define OB_WRP1_PAGES192TO207 ((uint32_t)0x00001000) /* Write protection of Sector12 */ |
355 | #define OB_WRP1_PAGES192TO207 (0x00001000U) /* Write protection of Sector12 */ |
| 374 | #define OB_WRP1_PAGES208TO223 ((uint32_t)0x00002000) /* Write protection of Sector13 */ |
356 | #define OB_WRP1_PAGES208TO223 (0x00002000U) /* Write protection of Sector13 */ |
| 375 | #define OB_WRP1_PAGES224TO239 ((uint32_t)0x00004000) /* Write protection of Sector14 */ |
357 | #define OB_WRP1_PAGES224TO239 (0x00004000U) /* Write protection of Sector14 */ |
| 376 | #define OB_WRP1_PAGES240TO255 ((uint32_t)0x00008000) /* Write protection of Sector15 */ |
358 | #define OB_WRP1_PAGES240TO255 (0x00008000U) /* Write protection of Sector15 */ |
| 377 | #define OB_WRP1_PAGES256TO271 ((uint32_t)0x00010000) /* Write protection of Sector16 */ |
359 | #define OB_WRP1_PAGES256TO271 (0x00010000U) /* Write protection of Sector16 */ |
| 378 | #define OB_WRP1_PAGES272TO287 ((uint32_t)0x00020000) /* Write protection of Sector17 */ |
360 | #define OB_WRP1_PAGES272TO287 (0x00020000U) /* Write protection of Sector17 */ |
| 379 | #define OB_WRP1_PAGES288TO303 ((uint32_t)0x00040000) /* Write protection of Sector18 */ |
361 | #define OB_WRP1_PAGES288TO303 (0x00040000U) /* Write protection of Sector18 */ |
| 380 | #define OB_WRP1_PAGES304TO319 ((uint32_t)0x00080000) /* Write protection of Sector19 */ |
362 | #define OB_WRP1_PAGES304TO319 (0x00080000U) /* Write protection of Sector19 */ |
| 381 | #define OB_WRP1_PAGES320TO335 ((uint32_t)0x00100000) /* Write protection of Sector20 */ |
363 | #define OB_WRP1_PAGES320TO335 (0x00100000U) /* Write protection of Sector20 */ |
| 382 | #define OB_WRP1_PAGES336TO351 ((uint32_t)0x00200000) /* Write protection of Sector21 */ |
364 | #define OB_WRP1_PAGES336TO351 (0x00200000U) /* Write protection of Sector21 */ |
| 383 | #define OB_WRP1_PAGES352TO367 ((uint32_t)0x00400000) /* Write protection of Sector22 */ |
365 | #define OB_WRP1_PAGES352TO367 (0x00400000U) /* Write protection of Sector22 */ |
| 384 | #define OB_WRP1_PAGES368TO383 ((uint32_t)0x00800000) /* Write protection of Sector23 */ |
366 | #define OB_WRP1_PAGES368TO383 (0x00800000U) /* Write protection of Sector23 */ |
| 385 | #define OB_WRP1_PAGES384TO399 ((uint32_t)0x01000000) /* Write protection of Sector24 */ |
367 | #define OB_WRP1_PAGES384TO399 (0x01000000U) /* Write protection of Sector24 */ |
| 386 | #define OB_WRP1_PAGES400TO415 ((uint32_t)0x02000000) /* Write protection of Sector25 */ |
368 | #define OB_WRP1_PAGES400TO415 (0x02000000U) /* Write protection of Sector25 */ |
| 387 | #define OB_WRP1_PAGES416TO431 ((uint32_t)0x04000000) /* Write protection of Sector26 */ |
369 | #define OB_WRP1_PAGES416TO431 (0x04000000U) /* Write protection of Sector26 */ |
| 388 | #define OB_WRP1_PAGES432TO447 ((uint32_t)0x08000000) /* Write protection of Sector27 */ |
370 | #define OB_WRP1_PAGES432TO447 (0x08000000U) /* Write protection of Sector27 */ |
| 389 | #define OB_WRP1_PAGES448TO463 ((uint32_t)0x10000000) /* Write protection of Sector28 */ |
371 | #define OB_WRP1_PAGES448TO463 (0x10000000U) /* Write protection of Sector28 */ |
| 390 | #define OB_WRP1_PAGES464TO479 ((uint32_t)0x20000000) /* Write protection of Sector29 */ |
372 | #define OB_WRP1_PAGES464TO479 (0x20000000U) /* Write protection of Sector29 */ |
| 391 | #define OB_WRP1_PAGES480TO495 ((uint32_t)0x40000000) /* Write protection of Sector30 */ |
373 | #define OB_WRP1_PAGES480TO495 (0x40000000U) /* Write protection of Sector30 */ |
| 392 | #define OB_WRP1_PAGES496TO511 ((uint32_t)0x80000000U) /* Write protection of Sector31 */ |
374 | #define OB_WRP1_PAGES496TO511 (0x80000000U) /* Write protection of Sector31 */ |
| 393 | 375 | ||
| 394 | #define OB_WRP1_ALLPAGES ((uint32_t)FLASH_WRPR1_WRP) /*!< Write protection of all Sectors */ |
376 | #define OB_WRP1_ALLPAGES ((uint32_t)FLASH_WRPR1_WRP) /*!< Write protection of all Sectors */ |
| 395 | 377 | ||
| 396 | /** |
378 | /** |
| 397 | * @} |
379 | * @} |
| Line 405... | Line 387... | ||
| 405 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASHEx Option Bytes Write Protection2 |
387 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection2 FLASHEx Option Bytes Write Protection2 |
| 406 | * @{ |
388 | * @{ |
| 407 | */ |
389 | */ |
| 408 | 390 | ||
| 409 | /* Pages for Cat3, Cat4 & Cat5 devices*/ |
391 | /* Pages for Cat3, Cat4 & Cat5 devices*/ |
| 410 | #define OB_WRP2_PAGES512TO527 ((uint32_t)0x00000001) /* Write protection of Sector32 */ |
392 | #define OB_WRP2_PAGES512TO527 (0x00000001U) /* Write protection of Sector32 */ |
| 411 | #define OB_WRP2_PAGES528TO543 ((uint32_t)0x00000002) /* Write protection of Sector33 */ |
393 | #define OB_WRP2_PAGES528TO543 (0x00000002U) /* Write protection of Sector33 */ |
| 412 | #define OB_WRP2_PAGES544TO559 ((uint32_t)0x00000004) /* Write protection of Sector34 */ |
394 | #define OB_WRP2_PAGES544TO559 (0x00000004U) /* Write protection of Sector34 */ |
| 413 | #define OB_WRP2_PAGES560TO575 ((uint32_t)0x00000008) /* Write protection of Sector35 */ |
395 | #define OB_WRP2_PAGES560TO575 (0x00000008U) /* Write protection of Sector35 */ |
| 414 | #define OB_WRP2_PAGES576TO591 ((uint32_t)0x00000010) /* Write protection of Sector36 */ |
396 | #define OB_WRP2_PAGES576TO591 (0x00000010U) /* Write protection of Sector36 */ |
| 415 | #define OB_WRP2_PAGES592TO607 ((uint32_t)0x00000020) /* Write protection of Sector37 */ |
397 | #define OB_WRP2_PAGES592TO607 (0x00000020U) /* Write protection of Sector37 */ |
| 416 | #define OB_WRP2_PAGES608TO623 ((uint32_t)0x00000040) /* Write protection of Sector38 */ |
398 | #define OB_WRP2_PAGES608TO623 (0x00000040U) /* Write protection of Sector38 */ |
| 417 | #define OB_WRP2_PAGES624TO639 ((uint32_t)0x00000080) /* Write protection of Sector39 */ |
399 | #define OB_WRP2_PAGES624TO639 (0x00000080U) /* Write protection of Sector39 */ |
| 418 | #define OB_WRP2_PAGES640TO655 ((uint32_t)0x00000100) /* Write protection of Sector40 */ |
400 | #define OB_WRP2_PAGES640TO655 (0x00000100U) /* Write protection of Sector40 */ |
| 419 | #define OB_WRP2_PAGES656TO671 ((uint32_t)0x00000200) /* Write protection of Sector41 */ |
401 | #define OB_WRP2_PAGES656TO671 (0x00000200U) /* Write protection of Sector41 */ |
| 420 | #define OB_WRP2_PAGES672TO687 ((uint32_t)0x00000400) /* Write protection of Sector42 */ |
402 | #define OB_WRP2_PAGES672TO687 (0x00000400U) /* Write protection of Sector42 */ |
| 421 | #define OB_WRP2_PAGES688TO703 ((uint32_t)0x00000800) /* Write protection of Sector43 */ |
403 | #define OB_WRP2_PAGES688TO703 (0x00000800U) /* Write protection of Sector43 */ |
| 422 | #define OB_WRP2_PAGES704TO719 ((uint32_t)0x00001000) /* Write protection of Sector44 */ |
404 | #define OB_WRP2_PAGES704TO719 (0x00001000U) /* Write protection of Sector44 */ |
| 423 | #define OB_WRP2_PAGES720TO735 ((uint32_t)0x00002000) /* Write protection of Sector45 */ |
405 | #define OB_WRP2_PAGES720TO735 (0x00002000U) /* Write protection of Sector45 */ |
| 424 | #define OB_WRP2_PAGES736TO751 ((uint32_t)0x00004000) /* Write protection of Sector46 */ |
406 | #define OB_WRP2_PAGES736TO751 (0x00004000U) /* Write protection of Sector46 */ |
| 425 | #define OB_WRP2_PAGES752TO767 ((uint32_t)0x00008000) /* Write protection of Sector47 */ |
407 | #define OB_WRP2_PAGES752TO767 (0x00008000U) /* Write protection of Sector47 */ |
| 426 | 408 | ||
| 427 | #if defined(STM32L100xC) || defined(STM32L151xC) || defined(STM32L152xC) || defined(STM32L162xC) \ |
409 | #if defined(STM32L100xC) || defined(STM32L151xC) || defined(STM32L152xC) || defined(STM32L162xC) \ |
| 428 | || defined(STM32L151xCA) || defined(STM32L151xD) || defined(STM32L152xCA) || defined(STM32L152xD) \ |
410 | || defined(STM32L151xCA) || defined(STM32L151xD) || defined(STM32L152xCA) || defined(STM32L152xD) \ |
| 429 | || defined(STM32L162xCA) || defined(STM32L162xD) || defined(STM32L151xE) || defined(STM32L152xE) \ |
411 | || defined(STM32L162xCA) || defined(STM32L162xD) || defined(STM32L151xE) || defined(STM32L152xE) \ |
| 430 | || defined(STM32L162xE) |
412 | || defined(STM32L162xE) |
| 431 | 413 | ||
| 432 | #define OB_WRP2_PAGES768TO783 ((uint32_t)0x00010000) /* Write protection of Sector48 */ |
414 | #define OB_WRP2_PAGES768TO783 (0x00010000U) /* Write protection of Sector48 */ |
| 433 | #define OB_WRP2_PAGES784TO799 ((uint32_t)0x00020000) /* Write protection of Sector49 */ |
415 | #define OB_WRP2_PAGES784TO799 (0x00020000U) /* Write protection of Sector49 */ |
| 434 | #define OB_WRP2_PAGES800TO815 ((uint32_t)0x00040000) /* Write protection of Sector50 */ |
416 | #define OB_WRP2_PAGES800TO815 (0x00040000U) /* Write protection of Sector50 */ |
| 435 | #define OB_WRP2_PAGES816TO831 ((uint32_t)0x00080000) /* Write protection of Sector51 */ |
417 | #define OB_WRP2_PAGES816TO831 (0x00080000U) /* Write protection of Sector51 */ |
| 436 | #define OB_WRP2_PAGES832TO847 ((uint32_t)0x00100000) /* Write protection of Sector52 */ |
418 | #define OB_WRP2_PAGES832TO847 (0x00100000U) /* Write protection of Sector52 */ |
| 437 | #define OB_WRP2_PAGES848TO863 ((uint32_t)0x00200000) /* Write protection of Sector53 */ |
419 | #define OB_WRP2_PAGES848TO863 (0x00200000U) /* Write protection of Sector53 */ |
| 438 | #define OB_WRP2_PAGES864TO879 ((uint32_t)0x00400000) /* Write protection of Sector54 */ |
420 | #define OB_WRP2_PAGES864TO879 (0x00400000U) /* Write protection of Sector54 */ |
| 439 | #define OB_WRP2_PAGES880TO895 ((uint32_t)0x00800000) /* Write protection of Sector55 */ |
421 | #define OB_WRP2_PAGES880TO895 (0x00800000U) /* Write protection of Sector55 */ |
| 440 | #define OB_WRP2_PAGES896TO911 ((uint32_t)0x01000000) /* Write protection of Sector56 */ |
422 | #define OB_WRP2_PAGES896TO911 (0x01000000U) /* Write protection of Sector56 */ |
| 441 | #define OB_WRP2_PAGES912TO927 ((uint32_t)0x02000000) /* Write protection of Sector57 */ |
423 | #define OB_WRP2_PAGES912TO927 (0x02000000U) /* Write protection of Sector57 */ |
| 442 | #define OB_WRP2_PAGES928TO943 ((uint32_t)0x04000000) /* Write protection of Sector58 */ |
424 | #define OB_WRP2_PAGES928TO943 (0x04000000U) /* Write protection of Sector58 */ |
| 443 | #define OB_WRP2_PAGES944TO959 ((uint32_t)0x08000000) /* Write protection of Sector59 */ |
425 | #define OB_WRP2_PAGES944TO959 (0x08000000U) /* Write protection of Sector59 */ |
| 444 | #define OB_WRP2_PAGES960TO975 ((uint32_t)0x10000000) /* Write protection of Sector60 */ |
426 | #define OB_WRP2_PAGES960TO975 (0x10000000U) /* Write protection of Sector60 */ |
| 445 | #define OB_WRP2_PAGES976TO991 ((uint32_t)0x20000000) /* Write protection of Sector61 */ |
427 | #define OB_WRP2_PAGES976TO991 (0x20000000U) /* Write protection of Sector61 */ |
| 446 | #define OB_WRP2_PAGES992TO1007 ((uint32_t)0x40000000) /* Write protection of Sector62 */ |
428 | #define OB_WRP2_PAGES992TO1007 (0x40000000U) /* Write protection of Sector62 */ |
| 447 | #define OB_WRP2_PAGES1008TO1023 ((uint32_t)0x80000000U) /* Write protection of Sector63 */ |
429 | #define OB_WRP2_PAGES1008TO1023 (0x80000000U) /* Write protection of Sector63 */ |
| 448 | 430 | ||
| 449 | #endif /* STM32L100xC || STM32L151xC || STM32L152xC || (...) || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */ |
431 | #endif /* STM32L100xC || STM32L151xC || STM32L152xC || (...) || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE */ |
| 450 | 432 | ||
| 451 | #define OB_WRP2_ALLPAGES ((uint32_t)FLASH_WRPR2_WRP) /*!< Write protection of all Sectors */ |
433 | #define OB_WRP2_ALLPAGES ((uint32_t)FLASH_WRPR2_WRP) /*!< Write protection of all Sectors */ |
| 452 | 434 | ||
| Line 463... | Line 445... | ||
| 463 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection3 FLASHEx Option Bytes Write Protection3 |
445 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection3 FLASHEx Option Bytes Write Protection3 |
| 464 | * @{ |
446 | * @{ |
| 465 | */ |
447 | */ |
| 466 | 448 | ||
| 467 | /* Pages for devices with FLASH >= 256KB*/ |
449 | /* Pages for devices with FLASH >= 256KB*/ |
| 468 | #define OB_WRP3_PAGES1024TO1039 ((uint32_t)0x00000001) /* Write protection of Sector64 */ |
450 | #define OB_WRP3_PAGES1024TO1039 (0x00000001U) /* Write protection of Sector64 */ |
| 469 | #define OB_WRP3_PAGES1040TO1055 ((uint32_t)0x00000002) /* Write protection of Sector65 */ |
451 | #define OB_WRP3_PAGES1040TO1055 (0x00000002U) /* Write protection of Sector65 */ |
| 470 | #define OB_WRP3_PAGES1056TO1071 ((uint32_t)0x00000004) /* Write protection of Sector66 */ |
452 | #define OB_WRP3_PAGES1056TO1071 (0x00000004U) /* Write protection of Sector66 */ |
| 471 | #define OB_WRP3_PAGES1072TO1087 ((uint32_t)0x00000008) /* Write protection of Sector67 */ |
453 | #define OB_WRP3_PAGES1072TO1087 (0x00000008U) /* Write protection of Sector67 */ |
| 472 | #define OB_WRP3_PAGES1088TO1103 ((uint32_t)0x00000010) /* Write protection of Sector68 */ |
454 | #define OB_WRP3_PAGES1088TO1103 (0x00000010U) /* Write protection of Sector68 */ |
| 473 | #define OB_WRP3_PAGES1104TO1119 ((uint32_t)0x00000020) /* Write protection of Sector69 */ |
455 | #define OB_WRP3_PAGES1104TO1119 (0x00000020U) /* Write protection of Sector69 */ |
| 474 | #define OB_WRP3_PAGES1120TO1135 ((uint32_t)0x00000040) /* Write protection of Sector70 */ |
456 | #define OB_WRP3_PAGES1120TO1135 (0x00000040U) /* Write protection of Sector70 */ |
| 475 | #define OB_WRP3_PAGES1136TO1151 ((uint32_t)0x00000080) /* Write protection of Sector71 */ |
457 | #define OB_WRP3_PAGES1136TO1151 (0x00000080U) /* Write protection of Sector71 */ |
| 476 | #define OB_WRP3_PAGES1152TO1167 ((uint32_t)0x00000100) /* Write protection of Sector72 */ |
458 | #define OB_WRP3_PAGES1152TO1167 (0x00000100U) /* Write protection of Sector72 */ |
| 477 | #define OB_WRP3_PAGES1168TO1183 ((uint32_t)0x00000200) /* Write protection of Sector73 */ |
459 | #define OB_WRP3_PAGES1168TO1183 (0x00000200U) /* Write protection of Sector73 */ |
| 478 | #define OB_WRP3_PAGES1184TO1199 ((uint32_t)0x00000400) /* Write protection of Sector74 */ |
460 | #define OB_WRP3_PAGES1184TO1199 (0x00000400U) /* Write protection of Sector74 */ |
| 479 | #define OB_WRP3_PAGES1200TO1215 ((uint32_t)0x00000800) /* Write protection of Sector75 */ |
461 | #define OB_WRP3_PAGES1200TO1215 (0x00000800U) /* Write protection of Sector75 */ |
| 480 | #define OB_WRP3_PAGES1216TO1231 ((uint32_t)0x00001000) /* Write protection of Sector76 */ |
462 | #define OB_WRP3_PAGES1216TO1231 (0x00001000U) /* Write protection of Sector76 */ |
| 481 | #define OB_WRP3_PAGES1232TO1247 ((uint32_t)0x00002000) /* Write protection of Sector77 */ |
463 | #define OB_WRP3_PAGES1232TO1247 (0x00002000U) /* Write protection of Sector77 */ |
| 482 | #define OB_WRP3_PAGES1248TO1263 ((uint32_t)0x00004000) /* Write protection of Sector78 */ |
464 | #define OB_WRP3_PAGES1248TO1263 (0x00004000U) /* Write protection of Sector78 */ |
| 483 | #define OB_WRP3_PAGES1264TO1279 ((uint32_t)0x00008000) /* Write protection of Sector79 */ |
465 | #define OB_WRP3_PAGES1264TO1279 (0x00008000U) /* Write protection of Sector79 */ |
| 484 | #define OB_WRP3_PAGES1280TO1295 ((uint32_t)0x00010000) /* Write protection of Sector80 */ |
466 | #define OB_WRP3_PAGES1280TO1295 (0x00010000U) /* Write protection of Sector80 */ |
| 485 | #define OB_WRP3_PAGES1296TO1311 ((uint32_t)0x00020000) /* Write protection of Sector81 */ |
467 | #define OB_WRP3_PAGES1296TO1311 (0x00020000U) /* Write protection of Sector81 */ |
| 486 | #define OB_WRP3_PAGES1312TO1327 ((uint32_t)0x00040000) /* Write protection of Sector82 */ |
468 | #define OB_WRP3_PAGES1312TO1327 (0x00040000U) /* Write protection of Sector82 */ |
| 487 | #define OB_WRP3_PAGES1328TO1343 ((uint32_t)0x00080000) /* Write protection of Sector83 */ |
469 | #define OB_WRP3_PAGES1328TO1343 (0x00080000U) /* Write protection of Sector83 */ |
| 488 | #define OB_WRP3_PAGES1344TO1359 ((uint32_t)0x00100000) /* Write protection of Sector84 */ |
470 | #define OB_WRP3_PAGES1344TO1359 (0x00100000U) /* Write protection of Sector84 */ |
| 489 | #define OB_WRP3_PAGES1360TO1375 ((uint32_t)0x00200000) /* Write protection of Sector85 */ |
471 | #define OB_WRP3_PAGES1360TO1375 (0x00200000U) /* Write protection of Sector85 */ |
| 490 | #define OB_WRP3_PAGES1376TO1391 ((uint32_t)0x00400000) /* Write protection of Sector86 */ |
472 | #define OB_WRP3_PAGES1376TO1391 (0x00400000U) /* Write protection of Sector86 */ |
| 491 | #define OB_WRP3_PAGES1392TO1407 ((uint32_t)0x00800000) /* Write protection of Sector87 */ |
473 | #define OB_WRP3_PAGES1392TO1407 (0x00800000U) /* Write protection of Sector87 */ |
| 492 | #define OB_WRP3_PAGES1408TO1423 ((uint32_t)0x01000000) /* Write protection of Sector88 */ |
474 | #define OB_WRP3_PAGES1408TO1423 (0x01000000U) /* Write protection of Sector88 */ |
| 493 | #define OB_WRP3_PAGES1424TO1439 ((uint32_t)0x02000000) /* Write protection of Sector89 */ |
475 | #define OB_WRP3_PAGES1424TO1439 (0x02000000U) /* Write protection of Sector89 */ |
| 494 | #define OB_WRP3_PAGES1440TO1455 ((uint32_t)0x04000000) /* Write protection of Sector90 */ |
476 | #define OB_WRP3_PAGES1440TO1455 (0x04000000U) /* Write protection of Sector90 */ |
| 495 | #define OB_WRP3_PAGES1456TO1471 ((uint32_t)0x08000000) /* Write protection of Sector91 */ |
477 | #define OB_WRP3_PAGES1456TO1471 (0x08000000U) /* Write protection of Sector91 */ |
| 496 | #define OB_WRP3_PAGES1472TO1487 ((uint32_t)0x10000000) /* Write protection of Sector92 */ |
478 | #define OB_WRP3_PAGES1472TO1487 (0x10000000U) /* Write protection of Sector92 */ |
| 497 | #define OB_WRP3_PAGES1488TO1503 ((uint32_t)0x20000000) /* Write protection of Sector93 */ |
479 | #define OB_WRP3_PAGES1488TO1503 (0x20000000U) /* Write protection of Sector93 */ |
| 498 | #define OB_WRP3_PAGES1504TO1519 ((uint32_t)0x40000000) /* Write protection of Sector94 */ |
480 | #define OB_WRP3_PAGES1504TO1519 (0x40000000U) /* Write protection of Sector94 */ |
| 499 | #define OB_WRP3_PAGES1520TO1535 ((uint32_t)0x80000000U) /* Write protection of Sector95 */ |
481 | #define OB_WRP3_PAGES1520TO1535 (0x80000000U) /* Write protection of Sector95 */ |
| 500 | 482 | ||
| 501 | #define OB_WRP3_ALLPAGES ((uint32_t)FLASH_WRPR3_WRP) /*!< Write protection of all Sectors */ |
483 | #define OB_WRP3_ALLPAGES ((uint32_t)FLASH_WRPR3_WRP) /*!< Write protection of all Sectors */ |
| 502 | 484 | ||
| 503 | /** |
485 | /** |
| 504 | * @} |
486 | * @} |
| Line 512... | Line 494... | ||
| 512 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection4 FLASHEx Option Bytes Write Protection4 |
494 | /** @defgroup FLASHEx_Option_Bytes_Write_Protection4 FLASHEx Option Bytes Write Protection4 |
| 513 | * @{ |
495 | * @{ |
| 514 | */ |
496 | */ |
| 515 | 497 | ||
| 516 | /* Pages for Cat5 devices*/ |
498 | /* Pages for Cat5 devices*/ |
| 517 | #define OB_WRP4_PAGES1536TO1551 ((uint32_t)0x00000001)/* Write protection of Sector96*/ |
499 | #define OB_WRP4_PAGES1536TO1551 (0x00000001U)/* Write protection of Sector96*/ |
| 518 | #define OB_WRP4_PAGES1552TO1567 ((uint32_t)0x00000002)/* Write protection of Sector97*/ |
500 | #define OB_WRP4_PAGES1552TO1567 (0x00000002U)/* Write protection of Sector97*/ |
| 519 | #define OB_WRP4_PAGES1568TO1583 ((uint32_t)0x00000004)/* Write protection of Sector98*/ |
501 | #define OB_WRP4_PAGES1568TO1583 (0x00000004U)/* Write protection of Sector98*/ |
| 520 | #define OB_WRP4_PAGES1584TO1599 ((uint32_t)0x00000008)/* Write protection of Sector99*/ |
502 | #define OB_WRP4_PAGES1584TO1599 (0x00000008U)/* Write protection of Sector99*/ |
| 521 | #define OB_WRP4_PAGES1600TO1615 ((uint32_t)0x00000010) /* Write protection of Sector100*/ |
503 | #define OB_WRP4_PAGES1600TO1615 (0x00000010U) /* Write protection of Sector100*/ |
| 522 | #define OB_WRP4_PAGES1616TO1631 ((uint32_t)0x00000020) /* Write protection of Sector101*/ |
504 | #define OB_WRP4_PAGES1616TO1631 (0x00000020U) /* Write protection of Sector101*/ |
| 523 | #define OB_WRP4_PAGES1632TO1647 ((uint32_t)0x00000040) /* Write protection of Sector102*/ |
505 | #define OB_WRP4_PAGES1632TO1647 (0x00000040U) /* Write protection of Sector102*/ |
| 524 | #define OB_WRP4_PAGES1648TO1663 ((uint32_t)0x00000080) /* Write protection of Sector103*/ |
506 | #define OB_WRP4_PAGES1648TO1663 (0x00000080U) /* Write protection of Sector103*/ |
| 525 | #define OB_WRP4_PAGES1664TO1679 ((uint32_t)0x00000100) /* Write protection of Sector104*/ |
507 | #define OB_WRP4_PAGES1664TO1679 (0x00000100U) /* Write protection of Sector104*/ |
| 526 | #define OB_WRP4_PAGES1680TO1695 ((uint32_t)0x00000200) /* Write protection of Sector105*/ |
508 | #define OB_WRP4_PAGES1680TO1695 (0x00000200U) /* Write protection of Sector105*/ |
| 527 | #define OB_WRP4_PAGES1696TO1711 ((uint32_t)0x00000400) /* Write protection of Sector106*/ |
509 | #define OB_WRP4_PAGES1696TO1711 (0x00000400U) /* Write protection of Sector106*/ |
| 528 | #define OB_WRP4_PAGES1712TO1727 ((uint32_t)0x00000800) /* Write protection of Sector107*/ |
510 | #define OB_WRP4_PAGES1712TO1727 (0x00000800U) /* Write protection of Sector107*/ |
| 529 | #define OB_WRP4_PAGES1728TO1743 ((uint32_t)0x00001000) /* Write protection of Sector108*/ |
511 | #define OB_WRP4_PAGES1728TO1743 (0x00001000U) /* Write protection of Sector108*/ |
| 530 | #define OB_WRP4_PAGES1744TO1759 ((uint32_t)0x00002000) /* Write protection of Sector109*/ |
512 | #define OB_WRP4_PAGES1744TO1759 (0x00002000U) /* Write protection of Sector109*/ |
| 531 | #define OB_WRP4_PAGES1760TO1775 ((uint32_t)0x00004000) /* Write protection of Sector110*/ |
513 | #define OB_WRP4_PAGES1760TO1775 (0x00004000U) /* Write protection of Sector110*/ |
| 532 | #define OB_WRP4_PAGES1776TO1791 ((uint32_t)0x00008000) /* Write protection of Sector111*/ |
514 | #define OB_WRP4_PAGES1776TO1791 (0x00008000U) /* Write protection of Sector111*/ |
| 533 | 515 | ||
| 534 | #if defined(STM32L151xE) || defined(STM32L152xE) || defined(STM32L162xE) |
516 | #if defined(STM32L151xE) || defined(STM32L152xE) || defined(STM32L162xE) |
| 535 | 517 | ||
| 536 | #define OB_WRP4_PAGES1792TO1807 ((uint32_t)0x00010000) /* Write protection of Sector112*/ |
518 | #define OB_WRP4_PAGES1792TO1807 (0x00010000U) /* Write protection of Sector112*/ |
| 537 | #define OB_WRP4_PAGES1808TO1823 ((uint32_t)0x00020000) /* Write protection of Sector113*/ |
519 | #define OB_WRP4_PAGES1808TO1823 (0x00020000U) /* Write protection of Sector113*/ |
| 538 | #define OB_WRP4_PAGES1824TO1839 ((uint32_t)0x00040000) /* Write protection of Sector114*/ |
520 | #define OB_WRP4_PAGES1824TO1839 (0x00040000U) /* Write protection of Sector114*/ |
| 539 | #define OB_WRP4_PAGES1840TO1855 ((uint32_t)0x00080000) /* Write protection of Sector115*/ |
521 | #define OB_WRP4_PAGES1840TO1855 (0x00080000U) /* Write protection of Sector115*/ |
| 540 | #define OB_WRP4_PAGES1856TO1871 ((uint32_t)0x00100000) /* Write protection of Sector116*/ |
522 | #define OB_WRP4_PAGES1856TO1871 (0x00100000U) /* Write protection of Sector116*/ |
| 541 | #define OB_WRP4_PAGES1872TO1887 ((uint32_t)0x00200000) /* Write protection of Sector117*/ |
523 | #define OB_WRP4_PAGES1872TO1887 (0x00200000U) /* Write protection of Sector117*/ |
| 542 | #define OB_WRP4_PAGES1888TO1903 ((uint32_t)0x00400000) /* Write protection of Sector118*/ |
524 | #define OB_WRP4_PAGES1888TO1903 (0x00400000U) /* Write protection of Sector118*/ |
| 543 | #define OB_WRP4_PAGES1904TO1919 ((uint32_t)0x00800000) /* Write protection of Sector119*/ |
525 | #define OB_WRP4_PAGES1904TO1919 (0x00800000U) /* Write protection of Sector119*/ |
| 544 | #define OB_WRP4_PAGES1920TO1935 ((uint32_t)0x01000000) /* Write protection of Sector120*/ |
526 | #define OB_WRP4_PAGES1920TO1935 (0x01000000U) /* Write protection of Sector120*/ |
| 545 | #define OB_WRP4_PAGES1936TO1951 ((uint32_t)0x02000000) /* Write protection of Sector121*/ |
527 | #define OB_WRP4_PAGES1936TO1951 (0x02000000U) /* Write protection of Sector121*/ |
| 546 | #define OB_WRP4_PAGES1952TO1967 ((uint32_t)0x04000000) /* Write protection of Sector122*/ |
528 | #define OB_WRP4_PAGES1952TO1967 (0x04000000U) /* Write protection of Sector122*/ |
| 547 | #define OB_WRP4_PAGES1968TO1983 ((uint32_t)0x08000000) /* Write protection of Sector123*/ |
529 | #define OB_WRP4_PAGES1968TO1983 (0x08000000U) /* Write protection of Sector123*/ |
| 548 | #define OB_WRP4_PAGES1984TO1999 ((uint32_t)0x10000000) /* Write protection of Sector124*/ |
530 | #define OB_WRP4_PAGES1984TO1999 (0x10000000U) /* Write protection of Sector124*/ |
| 549 | #define OB_WRP4_PAGES2000TO2015 ((uint32_t)0x20000000) /* Write protection of Sector125*/ |
531 | #define OB_WRP4_PAGES2000TO2015 (0x20000000U) /* Write protection of Sector125*/ |
| 550 | #define OB_WRP4_PAGES2016TO2031 ((uint32_t)0x40000000) /* Write protection of Sector126*/ |
532 | #define OB_WRP4_PAGES2016TO2031 (0x40000000U) /* Write protection of Sector126*/ |
| 551 | #define OB_WRP4_PAGES2032TO2047 ((uint32_t)0x80000000U) /* Write protection of Sector127*/ |
533 | #define OB_WRP4_PAGES2032TO2047 (0x80000000U) /* Write protection of Sector127*/ |
| 552 | 534 | ||
| 553 | #endif /* STM32L151xE || STM32L152xE || STM32L162xE */ |
535 | #endif /* STM32L151xE || STM32L152xE || STM32L162xE */ |
| 554 | 536 | ||
| 555 | #define OB_WRP4_ALLPAGES ((uint32_t)FLASH_WRPR4_WRP) /*!< Write protection of all Sectors */ |
537 | #define OB_WRP4_ALLPAGES ((uint32_t)FLASH_WRPR4_WRP) /*!< Write protection of all Sectors */ |
| 556 | 538 | ||
| Line 624... | Line 606... | ||
| 624 | 606 | ||
| 625 | /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type |
607 | /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type |
| 626 | * @{ |
608 | * @{ |
| 627 | */ |
609 | */ |
| 628 | 610 | ||
| 629 | #define OPTIONBYTE_PCROP ((uint32_t)0x01U) /*!<PCROP option byte configuration*/ |
611 | #define OPTIONBYTE_PCROP (0x01U) /*!<PCROP option byte configuration*/ |
| 630 | 612 | ||
| 631 | /** |
613 | /** |
| 632 | * @} |
614 | * @} |
| 633 | */ |
615 | */ |
| 634 | 616 | ||
| Line 638... | Line 620... | ||
| 638 | 620 | ||
| 639 | /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type |
621 | /** @defgroup FLASHEx_OptionAdv_Type FLASHEx Option Advanced Type |
| 640 | * @{ |
622 | * @{ |
| 641 | */ |
623 | */ |
| 642 | 624 | ||
| 643 | #define OPTIONBYTE_BOOTCONFIG ((uint32_t)0x02U) /*!<BOOTConfig option byte configuration*/ |
625 | #define OPTIONBYTE_BOOTCONFIG (0x02U) /*!<BOOTConfig option byte configuration*/ |
| 644 | 626 | ||
| 645 | /** |
627 | /** |
| 646 | * @} |
628 | * @} |
| 647 | */ |
629 | */ |
| 648 | 630 | ||
| Line 651... | Line 633... | ||
| 651 | #if defined(FLASH_OBR_SPRMOD) |
633 | #if defined(FLASH_OBR_SPRMOD) |
| 652 | 634 | ||
| 653 | /** @defgroup FLASHEx_PCROP_State FLASHEx PCROP State |
635 | /** @defgroup FLASHEx_PCROP_State FLASHEx PCROP State |
| 654 | * @{ |
636 | * @{ |
| 655 | */ |
637 | */ |
| 656 | #define OB_PCROP_STATE_DISABLE ((uint32_t)0x00U) /*!<Disable PCROP for selected sectors */ |
638 | #define OB_PCROP_STATE_DISABLE (0x00U) /*!<Disable PCROP for selected sectors */ |
| 657 | #define OB_PCROP_STATE_ENABLE ((uint32_t)0x01U) /*!<Enable PCROP for selected sectors */ |
639 | #define OB_PCROP_STATE_ENABLE (0x01U) /*!<Enable PCROP for selected sectors */ |
| 658 | 640 | ||
| 659 | /** |
641 | /** |
| 660 | * @} |
642 | * @} |
| 661 | */ |
643 | */ |
| 662 | 644 | ||
| Line 676... | Line 658... | ||
| 676 | /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection1 FLASHEx Option Bytes PC ReadWrite Protection 1 |
658 | /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection1 FLASHEx Option Bytes PC ReadWrite Protection 1 |
| 677 | * @{ |
659 | * @{ |
| 678 | */ |
660 | */ |
| 679 | 661 | ||
| 680 | /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */ |
662 | /* Common pages for Cat1, Cat2, Cat3, Cat4 & Cat5 devices */ |
| 681 | #define OB_PCROP1_PAGES0TO15 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector0 */ |
663 | #define OB_PCROP1_PAGES0TO15 (0x00000001U) /* PC Read/Write protection of Sector0 */ |
| 682 | #define OB_PCROP1_PAGES16TO31 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector1 */ |
664 | #define OB_PCROP1_PAGES16TO31 (0x00000002U) /* PC Read/Write protection of Sector1 */ |
| 683 | #define OB_PCROP1_PAGES32TO47 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector2 */ |
665 | #define OB_PCROP1_PAGES32TO47 (0x00000004U) /* PC Read/Write protection of Sector2 */ |
| 684 | #define OB_PCROP1_PAGES48TO63 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector3 */ |
666 | #define OB_PCROP1_PAGES48TO63 (0x00000008U) /* PC Read/Write protection of Sector3 */ |
| 685 | #define OB_PCROP1_PAGES64TO79 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector4 */ |
667 | #define OB_PCROP1_PAGES64TO79 (0x00000010U) /* PC Read/Write protection of Sector4 */ |
| 686 | #define OB_PCROP1_PAGES80TO95 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector5 */ |
668 | #define OB_PCROP1_PAGES80TO95 (0x00000020U) /* PC Read/Write protection of Sector5 */ |
| 687 | #define OB_PCROP1_PAGES96TO111 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector6 */ |
669 | #define OB_PCROP1_PAGES96TO111 (0x00000040U) /* PC Read/Write protection of Sector6 */ |
| 688 | #define OB_PCROP1_PAGES112TO127 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector7 */ |
670 | #define OB_PCROP1_PAGES112TO127 (0x00000080U) /* PC Read/Write protection of Sector7 */ |
| 689 | #define OB_PCROP1_PAGES128TO143 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector8 */ |
671 | #define OB_PCROP1_PAGES128TO143 (0x00000100U) /* PC Read/Write protection of Sector8 */ |
| 690 | #define OB_PCROP1_PAGES144TO159 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector9 */ |
672 | #define OB_PCROP1_PAGES144TO159 (0x00000200U) /* PC Read/Write protection of Sector9 */ |
| 691 | #define OB_PCROP1_PAGES160TO175 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector10 */ |
673 | #define OB_PCROP1_PAGES160TO175 (0x00000400U) /* PC Read/Write protection of Sector10 */ |
| 692 | #define OB_PCROP1_PAGES176TO191 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector11 */ |
674 | #define OB_PCROP1_PAGES176TO191 (0x00000800U) /* PC Read/Write protection of Sector11 */ |
| 693 | #define OB_PCROP1_PAGES192TO207 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector12 */ |
675 | #define OB_PCROP1_PAGES192TO207 (0x00001000U) /* PC Read/Write protection of Sector12 */ |
| 694 | #define OB_PCROP1_PAGES208TO223 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector13 */ |
676 | #define OB_PCROP1_PAGES208TO223 (0x00002000U) /* PC Read/Write protection of Sector13 */ |
| 695 | #define OB_PCROP1_PAGES224TO239 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector14 */ |
677 | #define OB_PCROP1_PAGES224TO239 (0x00004000U) /* PC Read/Write protection of Sector14 */ |
| 696 | #define OB_PCROP1_PAGES240TO255 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector15 */ |
678 | #define OB_PCROP1_PAGES240TO255 (0x00008000U) /* PC Read/Write protection of Sector15 */ |
| 697 | #define OB_PCROP1_PAGES256TO271 ((uint32_t)0x00010000U) /* PC Read/Write protection of Sector16 */ |
679 | #define OB_PCROP1_PAGES256TO271 (0x00010000U) /* PC Read/Write protection of Sector16 */ |
| 698 | #define OB_PCROP1_PAGES272TO287 ((uint32_t)0x00020000U) /* PC Read/Write protection of Sector17 */ |
680 | #define OB_PCROP1_PAGES272TO287 (0x00020000U) /* PC Read/Write protection of Sector17 */ |
| 699 | #define OB_PCROP1_PAGES288TO303 ((uint32_t)0x00040000U) /* PC Read/Write protection of Sector18 */ |
681 | #define OB_PCROP1_PAGES288TO303 (0x00040000U) /* PC Read/Write protection of Sector18 */ |
| 700 | #define OB_PCROP1_PAGES304TO319 ((uint32_t)0x00080000U) /* PC Read/Write protection of Sector19 */ |
682 | #define OB_PCROP1_PAGES304TO319 (0x00080000U) /* PC Read/Write protection of Sector19 */ |
| 701 | #define OB_PCROP1_PAGES320TO335 ((uint32_t)0x00100000U) /* PC Read/Write protection of Sector20 */ |
683 | #define OB_PCROP1_PAGES320TO335 (0x00100000U) /* PC Read/Write protection of Sector20 */ |
| 702 | #define OB_PCROP1_PAGES336TO351 ((uint32_t)0x00200000U) /* PC Read/Write protection of Sector21 */ |
684 | #define OB_PCROP1_PAGES336TO351 (0x00200000U) /* PC Read/Write protection of Sector21 */ |
| 703 | #define OB_PCROP1_PAGES352TO367 ((uint32_t)0x00400000U) /* PC Read/Write protection of Sector22 */ |
685 | #define OB_PCROP1_PAGES352TO367 (0x00400000U) /* PC Read/Write protection of Sector22 */ |
| 704 | #define OB_PCROP1_PAGES368TO383 ((uint32_t)0x00800000U) /* PC Read/Write protection of Sector23 */ |
686 | #define OB_PCROP1_PAGES368TO383 (0x00800000U) /* PC Read/Write protection of Sector23 */ |
| 705 | #define OB_PCROP1_PAGES384TO399 ((uint32_t)0x01000000U) /* PC Read/Write protection of Sector24 */ |
687 | #define OB_PCROP1_PAGES384TO399 (0x01000000U) /* PC Read/Write protection of Sector24 */ |
| 706 | #define OB_PCROP1_PAGES400TO415 ((uint32_t)0x02000000U) /* PC Read/Write protection of Sector25 */ |
688 | #define OB_PCROP1_PAGES400TO415 (0x02000000U) /* PC Read/Write protection of Sector25 */ |
| 707 | #define OB_PCROP1_PAGES416TO431 ((uint32_t)0x04000000U) /* PC Read/Write protection of Sector26 */ |
689 | #define OB_PCROP1_PAGES416TO431 (0x04000000U) /* PC Read/Write protection of Sector26 */ |
| 708 | #define OB_PCROP1_PAGES432TO447 ((uint32_t)0x08000000U) /* PC Read/Write protection of Sector27 */ |
690 | #define OB_PCROP1_PAGES432TO447 (0x08000000U) /* PC Read/Write protection of Sector27 */ |
| 709 | #define OB_PCROP1_PAGES448TO463 ((uint32_t)0x10000000U) /* PC Read/Write protection of Sector28 */ |
691 | #define OB_PCROP1_PAGES448TO463 (0x10000000U) /* PC Read/Write protection of Sector28 */ |
| 710 | #define OB_PCROP1_PAGES464TO479 ((uint32_t)0x20000000U) /* PC Read/Write protection of Sector29 */ |
692 | #define OB_PCROP1_PAGES464TO479 (0x20000000U) /* PC Read/Write protection of Sector29 */ |
| 711 | #define OB_PCROP1_PAGES480TO495 ((uint32_t)0x40000000U) /* PC Read/Write protection of Sector30 */ |
693 | #define OB_PCROP1_PAGES480TO495 (0x40000000U) /* PC Read/Write protection of Sector30 */ |
| 712 | #define OB_PCROP1_PAGES496TO511 ((uint32_t)0x80000000U) /* PC Read/Write protection of Sector31 */ |
694 | #define OB_PCROP1_PAGES496TO511 (0x80000000U) /* PC Read/Write protection of Sector31 */ |
| 713 | 695 | ||
| 714 | #define OB_PCROP1_ALLPAGES ((uint32_t)0xFFFFFFFFU) /*!< PC Read/Write protection of all Sectors */ |
696 | #define OB_PCROP1_ALLPAGES (0xFFFFFFFFU) /*!< PC Read/Write protection of all Sectors */ |
| 715 | 697 | ||
| 716 | /** |
698 | /** |
| 717 | * @} |
699 | * @} |
| 718 | */ |
700 | */ |
| 719 | #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */ |
701 | #endif /* STM32L151xBA || STM32L152xBA || STM32L151xC || STM32L152xC || STM32L162xC */ |
| Line 723... | Line 705... | ||
| 723 | /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 FLASHEx Option Bytes PC ReadWrite Protection 2 |
705 | /** @defgroup FLASHEx_Option_Bytes_PC_ReadWrite_Protection2 FLASHEx Option Bytes PC ReadWrite Protection 2 |
| 724 | * @{ |
706 | * @{ |
| 725 | */ |
707 | */ |
| 726 | 708 | ||
| 727 | /* Pages for Cat3, Cat4 & Cat5 devices*/ |
709 | /* Pages for Cat3, Cat4 & Cat5 devices*/ |
| 728 | #define OB_PCROP2_PAGES512TO527 ((uint32_t)0x00000001U) /* PC Read/Write protection of Sector32 */ |
710 | #define OB_PCROP2_PAGES512TO527 (0x00000001U) /* PC Read/Write protection of Sector32 */ |
| 729 | #define OB_PCROP2_PAGES528TO543 ((uint32_t)0x00000002U) /* PC Read/Write protection of Sector33 */ |
711 | #define OB_PCROP2_PAGES528TO543 (0x00000002U) /* PC Read/Write protection of Sector33 */ |
| 730 | #define OB_PCROP2_PAGES544TO559 ((uint32_t)0x00000004U) /* PC Read/Write protection of Sector34 */ |
712 | #define OB_PCROP2_PAGES544TO559 (0x00000004U) /* PC Read/Write protection of Sector34 */ |
| 731 | #define OB_PCROP2_PAGES560TO575 ((uint32_t)0x00000008U) /* PC Read/Write protection of Sector35 */ |
713 | #define OB_PCROP2_PAGES560TO575 (0x00000008U) /* PC Read/Write protection of Sector35 */ |
| 732 | #define OB_PCROP2_PAGES576TO591 ((uint32_t)0x00000010U) /* PC Read/Write protection of Sector36 */ |
714 | #define OB_PCROP2_PAGES576TO591 (0x00000010U) /* PC Read/Write protection of Sector36 */ |
| 733 | #define OB_PCROP2_PAGES592TO607 ((uint32_t)0x00000020U) /* PC Read/Write protection of Sector37 */ |
715 | #define OB_PCROP2_PAGES592TO607 (0x00000020U) /* PC Read/Write protection of Sector37 */ |
| 734 | #define OB_PCROP2_PAGES608TO623 ((uint32_t)0x00000040U) /* PC Read/Write protection of Sector38 */ |
716 | #define OB_PCROP2_PAGES608TO623 (0x00000040U) /* PC Read/Write protection of Sector38 */ |
| 735 | #define OB_PCROP2_PAGES624TO639 ((uint32_t)0x00000080U) /* PC Read/Write protection of Sector39 */ |
717 | #define OB_PCROP2_PAGES624TO639 (0x00000080U) /* PC Read/Write protection of Sector39 */ |
| 736 | #define OB_PCROP2_PAGES640TO655 ((uint32_t)0x00000100U) /* PC Read/Write protection of Sector40 */ |
718 | #define OB_PCROP2_PAGES640TO655 (0x00000100U) /* PC Read/Write protection of Sector40 */ |
| 737 | #define OB_PCROP2_PAGES656TO671 ((uint32_t)0x00000200U) /* PC Read/Write protection of Sector41 */ |
719 | #define OB_PCROP2_PAGES656TO671 (0x00000200U) /* PC Read/Write protection of Sector41 */ |
| 738 | #define OB_PCROP2_PAGES672TO687 ((uint32_t)0x00000400U) /* PC Read/Write protection of Sector42 */ |
720 | #define OB_PCROP2_PAGES672TO687 (0x00000400U) /* PC Read/Write protection of Sector42 */ |
| 739 | #define OB_PCROP2_PAGES688TO703 ((uint32_t)0x00000800U) /* PC Read/Write protection of Sector43 */ |
721 | #define OB_PCROP2_PAGES688TO703 (0x00000800U) /* PC Read/Write protection of Sector43 */ |
| 740 | #define OB_PCROP2_PAGES704TO719 ((uint32_t)0x00001000U) /* PC Read/Write protection of Sector44 */ |
722 | #define OB_PCROP2_PAGES704TO719 (0x00001000U) /* PC Read/Write protection of Sector44 */ |
| 741 | #define OB_PCROP2_PAGES720TO735 ((uint32_t)0x00002000U) /* PC Read/Write protection of Sector45 */ |
723 | #define OB_PCROP2_PAGES720TO735 (0x00002000U) /* PC Read/Write protection of Sector45 */ |
| 742 | #define OB_PCROP2_PAGES736TO751 ((uint32_t)0x00004000U) /* PC Read/Write protection of Sector46 */ |
724 | #define OB_PCROP2_PAGES736TO751 (0x00004000U) /* PC Read/Write protection of Sector46 */ |
| 743 | #define OB_PCROP2_PAGES752TO767 ((uint32_t)0x00008000U) /* PC Read/Write protection of Sector47 */ |
725 | #define OB_PCROP2_PAGES752TO767 (0x00008000U) /* PC Read/Write protection of Sector47 */ |
| 744 | #define OB_PCROP2_PAGES768TO783 ((uint32_t)0x00010000U) /* PC Read/Write protection of Sector48 */ |
726 | #define OB_PCROP2_PAGES768TO783 (0x00010000U) /* PC Read/Write protection of Sector48 */ |
| 745 | #define OB_PCROP2_PAGES784TO799 ((uint32_t)0x00020000U) /* PC Read/Write protection of Sector49 */ |
727 | #define OB_PCROP2_PAGES784TO799 (0x00020000U) /* PC Read/Write protection of Sector49 */ |
| 746 | #define OB_PCROP2_PAGES800TO815 ((uint32_t)0x00040000U) /* PC Read/Write protection of Sector50 */ |
728 | #define OB_PCROP2_PAGES800TO815 (0x00040000U) /* PC Read/Write protection of Sector50 */ |
| 747 | #define OB_PCROP2_PAGES816TO831 ((uint32_t)0x00080000U) /* PC Read/Write protection of Sector51 */ |
729 | #define OB_PCROP2_PAGES816TO831 (0x00080000U) /* PC Read/Write protection of Sector51 */ |
| 748 | #define OB_PCROP2_PAGES832TO847 ((uint32_t)0x00100000U) /* PC Read/Write protection of Sector52 */ |
730 | #define OB_PCROP2_PAGES832TO847 (0x00100000U) /* PC Read/Write protection of Sector52 */ |
| 749 | #define OB_PCROP2_PAGES848TO863 ((uint32_t)0x00200000U) /* PC Read/Write protection of Sector53 */ |
731 | #define OB_PCROP2_PAGES848TO863 (0x00200000U) /* PC Read/Write protection of Sector53 */ |
| 750 | #define OB_PCROP2_PAGES864TO879 ((uint32_t)0x00400000U) /* PC Read/Write protection of Sector54 */ |
732 | #define OB_PCROP2_PAGES864TO879 (0x00400000U) /* PC Read/Write protection of Sector54 */ |
| 751 | #define OB_PCROP2_PAGES880TO895 ((uint32_t)0x00800000U) /* PC Read/Write protection of Sector55 */ |
733 | #define OB_PCROP2_PAGES880TO895 (0x00800000U) /* PC Read/Write protection of Sector55 */ |
| 752 | #define OB_PCROP2_PAGES896TO911 ((uint32_t)0x01000000U) /* PC Read/Write protection of Sector56 */ |
734 | #define OB_PCROP2_PAGES896TO911 (0x01000000U) /* PC Read/Write protection of Sector56 */ |
| 753 | #define OB_PCROP2_PAGES912TO927 ((uint32_t)0x02000000U) /* PC Read/Write protection of Sector57 */ |
735 | #define OB_PCROP2_PAGES912TO927 (0x02000000U) /* PC Read/Write protection of Sector57 */ |
| 754 | #define OB_PCROP2_PAGES928TO943 ((uint32_t)0x04000000U) /* PC Read/Write protection of Sector58 */ |
736 | #define OB_PCROP2_PAGES928TO943 (0x04000000U) /* PC Read/Write protection of Sector58 */ |
| 755 | #define OB_PCROP2_PAGES944TO959 ((uint32_t)0x08000000U) /* PC Read/Write protection of Sector59 */ |
737 | #define OB_PCROP2_PAGES944TO959 (0x08000000U) /* PC Read/Write protection of Sector59 */ |
| 756 | #define OB_PCROP2_PAGES960TO975 ((uint32_t)0x10000000U) /* PC Read/Write protection of Sector60 */ |
738 | #define OB_PCROP2_PAGES960TO975 (0x10000000U) /* PC Read/Write protection of Sector60 */ |
| 757 | #define OB_PCROP2_PAGES976TO991 ((uint32_t)0x20000000U) /* PC Read/Write protection of Sector61 */ |
739 | #define OB_PCROP2_PAGES976TO991 (0x20000000U) /* PC Read/Write protection of Sector61 */ |
| 758 | #define OB_PCROP2_PAGES992TO1007 ((uint32_t)0x40000000U) /* PC Read/Write protection of Sector62 */ |
740 | #define OB_PCROP2_PAGES992TO1007 (0x40000000U) /* PC Read/Write protection of Sector62 */ |
| 759 | #define OB_PCROP2_PAGES1008TO1023 ((uint32_t)0x80000000U) /* PC Read/Write protection of Sector63 */ |
741 | #define OB_PCROP2_PAGES1008TO1023 (0x80000000U) /* PC Read/Write protection of Sector63 */ |
| 760 | 742 | ||
| 761 | #define OB_PCROP2_ALLPAGES ((uint32_t)0xFFFFFFFFU) /*!< PC Read/Write protection of all Sectors */ |
743 | #define OB_PCROP2_ALLPAGES (0xFFFFFFFFU) /*!< PC Read/Write protection of all Sectors */ |
| 762 | 744 | ||
| 763 | /** |
745 | /** |
| 764 | * @} |
746 | * @} |
| 765 | */ |
747 | */ |
| 766 | #endif /* STM32L151xC || STM32L152xC || STM32L162xC */ |
748 | #endif /* STM32L151xC || STM32L152xC || STM32L162xC */ |
| 767 | 749 | ||
| 768 | /** @defgroup FLASHEx_Type_Erase_Data FLASHEx Type Erase Data |
750 | /** @defgroup FLASHEx_Type_Erase_Data FLASHEx Type Erase Data |
| 769 | * @{ |
751 | * @{ |
| 770 | */ |
752 | */ |
| 771 | #define FLASH_TYPEERASEDATA_BYTE ((uint32_t)0x00U) /*!<Erase byte (8-bit) at a specified address.*/ |
753 | #define FLASH_TYPEERASEDATA_BYTE (0x00U) /*!<Erase byte (8-bit) at a specified address.*/ |
| 772 | #define FLASH_TYPEERASEDATA_HALFWORD ((uint32_t)0x01U) /*!<Erase a half-word (16-bit) at a specified address.*/ |
754 | #define FLASH_TYPEERASEDATA_HALFWORD (0x01U) /*!<Erase a half-word (16-bit) at a specified address.*/ |
| 773 | #define FLASH_TYPEERASEDATA_WORD ((uint32_t)0x02U) /*!<Erase a word (32-bit) at a specified address.*/ |
755 | #define FLASH_TYPEERASEDATA_WORD (0x02U) /*!<Erase a word (32-bit) at a specified address.*/ |
| 774 | 756 | ||
| 775 | /** |
757 | /** |
| 776 | * @} |
758 | * @} |
| 777 | */ |
759 | */ |
| 778 | 760 | ||
| 779 | /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data |
761 | /** @defgroup FLASHEx_Type_Program_Data FLASHEx Type Program Data |
| 780 | * @{ |
762 | * @{ |
| 781 | */ |
763 | */ |
| 782 | #define FLASH_TYPEPROGRAMDATA_BYTE ((uint32_t)0x00U) /*!<Program byte (8-bit) at a specified address.*/ |
764 | #define FLASH_TYPEPROGRAMDATA_BYTE (0x00U) /*!<Program byte (8-bit) at a specified address.*/ |
| 783 | #define FLASH_TYPEPROGRAMDATA_HALFWORD ((uint32_t)0x01U) /*!<Program a half-word (16-bit) at a specified address.*/ |
765 | #define FLASH_TYPEPROGRAMDATA_HALFWORD (0x01U) /*!<Program a half-word (16-bit) at a specified address.*/ |
| 784 | #define FLASH_TYPEPROGRAMDATA_WORD ((uint32_t)0x02U) /*!<Program a word (32-bit) at a specified address.*/ |
766 | #define FLASH_TYPEPROGRAMDATA_WORD (0x02U) /*!<Program a word (32-bit) at a specified address.*/ |
| 785 | #define FLASH_TYPEPROGRAMDATA_FASTBYTE ((uint32_t)0x04U) /*!<Fast Program byte (8-bit) at a specified address.*/ |
767 | #define FLASH_TYPEPROGRAMDATA_FASTBYTE (0x04U) /*!<Fast Program byte (8-bit) at a specified address.*/ |
| 786 | #define FLASH_TYPEPROGRAMDATA_FASTHALFWORD ((uint32_t)0x08U) /*!<Fast Program a half-word (16-bit) at a specified address.*/ |
768 | #define FLASH_TYPEPROGRAMDATA_FASTHALFWORD (0x08U) /*!<Fast Program a half-word (16-bit) at a specified address.*/ |
| 787 | #define FLASH_TYPEPROGRAMDATA_FASTWORD ((uint32_t)0x10U) /*!<Fast Program a word (32-bit) at a specified address.*/ |
769 | #define FLASH_TYPEPROGRAMDATA_FASTWORD (0x10U) /*!<Fast Program a word (32-bit) at a specified address.*/ |
| 788 | 770 | ||
| 789 | /** |
771 | /** |
| 790 | * @} |
772 | * @} |
| 791 | */ |
773 | */ |
| 792 | 774 | ||
| Line 797... | Line 779... | ||
| 797 | */ |
779 | */ |
| 798 | 780 | ||
| 799 | #define OB_BOOT_BANK2 ((uint8_t)0x00U) /*!< At startup, if boot pins are set in boot from user Flash position |
781 | #define OB_BOOT_BANK2 ((uint8_t)0x00U) /*!< At startup, if boot pins are set in boot from user Flash position |
| 800 | and this parameter is selected the device will boot from Bank 2 |
782 | and this parameter is selected the device will boot from Bank 2 |
| 801 | or Bank 1, depending on the activation of the bank */ |
783 | or Bank 1, depending on the activation of the bank */ |
| 802 | #define OB_BOOT_BANK1 ((uint8_t)(FLASH_OBR_nRST_BFB2 >> 16)) /*!< At startup, if boot pins are set in boot from user Flash position |
784 | #define OB_BOOT_BANK1 ((uint8_t)(FLASH_OBR_nRST_BFB2 >> 16U)) /*!< At startup, if boot pins are set in boot from user Flash position |
| 803 | and this parameter is selected the device will boot from Bank1(Default) */ |
785 | and this parameter is selected the device will boot from Bank1(Default) */ |
| 804 | 786 | ||
| 805 | /** |
787 | /** |
| 806 | * @} |
788 | * @} |
| 807 | */ |
789 | */ |
| Line 826... | Line 808... | ||
| 826 | * @retval none |
808 | * @retval none |
| 827 | */ |
809 | */ |
| 828 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) do { \ |
810 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) do { \ |
| 829 | if ((__LATENCY__) == FLASH_LATENCY_1) {__HAL_FLASH_ACC64_ENABLE();} \ |
811 | if ((__LATENCY__) == FLASH_LATENCY_1) {__HAL_FLASH_ACC64_ENABLE();} \ |
| 830 | MODIFY_REG((FLASH->ACR), FLASH_ACR_LATENCY, (__LATENCY__)); \ |
812 | MODIFY_REG((FLASH->ACR), FLASH_ACR_LATENCY, (__LATENCY__)); \ |
| 831 | } while(0) |
813 | } while(0U) |
| 832 | 814 | ||
| 833 | /** |
815 | /** |
| 834 | * @brief Get the FLASH Latency. |
816 | * @brief Get the FLASH Latency. |
| 835 | * @retval FLASH Latency |
817 | * @retval FLASH Latency |
| 836 | * This parameter can be one of the following values: |
818 | * This parameter can be one of the following values: |
| Line 861... | Line 843... | ||
| 861 | * @brief Enable the FLASH prefetch buffer. |
843 | * @brief Enable the FLASH prefetch buffer. |
| 862 | * @retval none |
844 | * @retval none |
| 863 | */ |
845 | */ |
| 864 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() do { __HAL_FLASH_ACC64_ENABLE(); \ |
846 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() do { __HAL_FLASH_ACC64_ENABLE(); \ |
| 865 | SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN); \ |
847 | SET_BIT((FLASH->ACR), FLASH_ACR_PRFTEN); \ |
| 866 | } while(0) |
848 | } while(0U) |
| 867 | 849 | ||
| 868 | /** |
850 | /** |
| 869 | * @brief Disable the FLASH prefetch buffer. |
851 | * @brief Disable the FLASH prefetch buffer. |
| 870 | * @retval none |
852 | * @retval none |
| 871 | */ |
853 | */ |
| Line 889... | Line 871... | ||
| 889 | * loss and a new unlock sequence is necessary to re-write it to 1. |
871 | * loss and a new unlock sequence is necessary to re-write it to 1. |
| 890 | */ |
872 | */ |
| 891 | #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ |
873 | #define __HAL_FLASH_POWER_DOWN_ENABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ |
| 892 | FLASH->PDKEYR = FLASH_PDKEY2; \ |
874 | FLASH->PDKEYR = FLASH_PDKEY2; \ |
| 893 | SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ |
875 | SET_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ |
| 894 | } while (0) |
876 | } while (0U) |
| 895 | 877 | ||
| 896 | /** |
878 | /** |
| 897 | * @brief Disable the Flash Run power down mode. |
879 | * @brief Disable the Flash Run power down mode. |
| 898 | * @note Writing this bit to 0 this bit, automatically the keys are |
880 | * @note Writing this bit to 0 this bit, automatically the keys are |
| 899 | * loss and a new unlock sequence is necessary to re-write it to 1. |
881 | * loss and a new unlock sequence is necessary to re-write it to 1. |
| 900 | */ |
882 | */ |
| 901 | #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ |
883 | #define __HAL_FLASH_POWER_DOWN_DISABLE() do { FLASH->PDKEYR = FLASH_PDKEY1; \ |
| 902 | FLASH->PDKEYR = FLASH_PDKEY2; \ |
884 | FLASH->PDKEYR = FLASH_PDKEY2; \ |
| 903 | CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ |
885 | CLEAR_BIT((FLASH->ACR), FLASH_ACR_RUN_PD); \ |
| 904 | } while (0) |
886 | } while (0U) |
| 905 | 887 | ||
| 906 | /** |
888 | /** |
| 907 | * @} |
889 | * @} |
| 908 | */ |
890 | */ |
| 909 | 891 | ||