stm32f7xx_hal_flash_ex.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F7xx_HAL_FLASH_EX_H
22 #define __STM32F7xx_HAL_FLASH_EX_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
47 typedef struct
48 {
49  uint32_t TypeErase;
52 #if defined (FLASH_OPTCR_nDBANK)
53  uint32_t Banks;
55 #endif /* FLASH_OPTCR_nDBANK */
56 
57  uint32_t Sector;
60  uint32_t NbSectors;
63  uint32_t VoltageRange;
67 
71 typedef struct
72 {
73  uint32_t OptionType;
76  uint32_t WRPState;
79  uint32_t WRPSector;
82  uint32_t RDPLevel;
85  uint32_t BORLevel;
88  uint32_t USERConfig;
92  uint32_t BootAddr0;
95  uint32_t BootAddr1;
98 #if defined (FLASH_OPTCR2_PCROP)
99  uint32_t PCROPSector;
102  uint32_t PCROPRdp;
104 #endif /* FLASH_OPTCR2_PCROP */
105 
107 
111 /* Exported constants --------------------------------------------------------*/
112 
120 #define FLASH_TYPEERASE_SECTORS ((uint32_t)0x00U)
121 #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01U)
129 #define FLASH_VOLTAGE_RANGE_1 ((uint32_t)0x00U)
130 #define FLASH_VOLTAGE_RANGE_2 ((uint32_t)0x01U)
131 #define FLASH_VOLTAGE_RANGE_3 ((uint32_t)0x02U)
132 #define FLASH_VOLTAGE_RANGE_4 ((uint32_t)0x03U)
140 #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U)
141 #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U)
149 #define OPTIONBYTE_WRP ((uint32_t)0x01U)
150 #define OPTIONBYTE_RDP ((uint32_t)0x02U)
151 #define OPTIONBYTE_USER ((uint32_t)0x04U)
152 #define OPTIONBYTE_BOR ((uint32_t)0x08U)
153 #define OPTIONBYTE_BOOTADDR_0 ((uint32_t)0x10U)
154 #define OPTIONBYTE_BOOTADDR_1 ((uint32_t)0x20U)
155 #if defined (FLASH_OPTCR2_PCROP)
156 #define OPTIONBYTE_PCROP ((uint32_t)0x40U)
157 #define OPTIONBYTE_PCROP_RDP ((uint32_t)0x80U)
158 #endif /* FLASH_OPTCR2_PCROP */
159 
166 #define OB_RDP_LEVEL_0 ((uint8_t)0xAAU)
167 #define OB_RDP_LEVEL_1 ((uint8_t)0x55U)
168 #define OB_RDP_LEVEL_2 ((uint8_t)0xCCU)
177 #define OB_WWDG_SW ((uint32_t)0x10U)
178 #define OB_WWDG_HW ((uint32_t)0x00U)
187 #define OB_IWDG_SW ((uint32_t)0x20U)
188 #define OB_IWDG_HW ((uint32_t)0x00U)
196 #define OB_STOP_NO_RST ((uint32_t)0x40U)
197 #define OB_STOP_RST ((uint32_t)0x00U)
205 #define OB_STDBY_NO_RST ((uint32_t)0x80U)
206 #define OB_STDBY_RST ((uint32_t)0x00U)
214 #define OB_IWDG_STOP_FREEZE ((uint32_t)0x00000000U)
215 #define OB_IWDG_STOP_ACTIVE ((uint32_t)0x80000000U)
223 #define OB_IWDG_STDBY_FREEZE ((uint32_t)0x00000000U)
224 #define OB_IWDG_STDBY_ACTIVE ((uint32_t)0x40000000U)
232 #define OB_BOR_LEVEL3 ((uint32_t)0x00U)
233 #define OB_BOR_LEVEL2 ((uint32_t)0x04U)
234 #define OB_BOR_LEVEL1 ((uint32_t)0x08U)
235 #define OB_BOR_OFF ((uint32_t)0x0CU)
240 #if defined (FLASH_OPTCR_nDBOOT)
241 
244 #define OB_DUAL_BOOT_DISABLE ((uint32_t)0x10000000U) /* !< Dual Boot disable. Boot according to boot address option */
245 #define OB_DUAL_BOOT_ENABLE ((uint32_t)0x00000000U) /* !< Dual Boot enable. Boot always from system memory if boot address in flash
246  (Dual bank Boot mode), or RAM if Boot address option in RAM */
247 
250 #endif /* FLASH_OPTCR_nDBOOT */
251 
252 #if defined (FLASH_OPTCR_nDBANK)
253 
256 #define OB_NDBANK_SINGLE_BANK ((uint32_t)0x20000000U)
257 #define OB_NDBANK_DUAL_BANK ((uint32_t)0x00000000U)
261 #endif /* FLASH_OPTCR_nDBANK */
262 
266 #define OB_BOOTADDR_ITCM_RAM ((uint32_t)0x0000U)
267 #define OB_BOOTADDR_SYSTEM ((uint32_t)0x0040U)
268 #define OB_BOOTADDR_ITCM_FLASH ((uint32_t)0x0080U)
269 #define OB_BOOTADDR_AXIM_FLASH ((uint32_t)0x2000U)
270 #define OB_BOOTADDR_DTCM_RAM ((uint32_t)0x8000U)
271 #define OB_BOOTADDR_SRAM1 ((uint32_t)0x8004U)
272 #if (SRAM2_BASE == 0x2003C000U)
273 #define OB_BOOTADDR_SRAM2 ((uint32_t)0x800FU)
274 #else
275 #define OB_BOOTADDR_SRAM2 ((uint32_t)0x8013U)
276 #endif /* SRAM2_BASE == 0x2003C000U */
277 
284 #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS
285 #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS
286 #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS
287 #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS
288 #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS
289 #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS
290 #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS
291 #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS
292 #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS
293 #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS
294 #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS
295 #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS
296 #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS
297 #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS
298 #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS
299 #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS
304 #if defined (FLASH_OPTCR_nDBANK)
305 
308 #define FLASH_BANK_1 ((uint32_t)0x01U)
309 #define FLASH_BANK_2 ((uint32_t)0x02U)
310 #define FLASH_BANK_BOTH ((uint32_t)(FLASH_BANK_1 | FLASH_BANK_2))
314 #endif /* FLASH_OPTCR_nDBANK */
315 
319 #if defined (FLASH_OPTCR_nDBANK)
320 #define FLASH_MER_BIT (FLASH_CR_MER1 | FLASH_CR_MER2)
321 #else
322 #define FLASH_MER_BIT (FLASH_CR_MER)
323 #endif /* FLASH_OPTCR_nDBANK */
324 
331 #if (FLASH_SECTOR_TOTAL == 24)
332 #define FLASH_SECTOR_8 ((uint32_t)8U)
333 #define FLASH_SECTOR_9 ((uint32_t)9U)
334 #define FLASH_SECTOR_10 ((uint32_t)10U)
335 #define FLASH_SECTOR_11 ((uint32_t)11U)
336 #define FLASH_SECTOR_12 ((uint32_t)12U)
337 #define FLASH_SECTOR_13 ((uint32_t)13U)
338 #define FLASH_SECTOR_14 ((uint32_t)14U)
339 #define FLASH_SECTOR_15 ((uint32_t)15U)
340 #define FLASH_SECTOR_16 ((uint32_t)16U)
341 #define FLASH_SECTOR_17 ((uint32_t)17U)
342 #define FLASH_SECTOR_18 ((uint32_t)18U)
343 #define FLASH_SECTOR_19 ((uint32_t)19U)
344 #define FLASH_SECTOR_20 ((uint32_t)20U)
345 #define FLASH_SECTOR_21 ((uint32_t)21U)
346 #define FLASH_SECTOR_22 ((uint32_t)22U)
347 #define FLASH_SECTOR_23 ((uint32_t)23U)
348 #endif /* FLASH_SECTOR_TOTAL == 24 */
349 
353 #if (FLASH_SECTOR_TOTAL == 24)
354 
363 /* Single Bank Sectors */
364 #define OB_WRP_SECTOR_0 ((uint32_t)0x00010000U)
365 #define OB_WRP_SECTOR_1 ((uint32_t)0x00020000U)
366 #define OB_WRP_SECTOR_2 ((uint32_t)0x00040000U)
367 #define OB_WRP_SECTOR_3 ((uint32_t)0x00080000U)
368 #define OB_WRP_SECTOR_4 ((uint32_t)0x00100000U)
369 #define OB_WRP_SECTOR_5 ((uint32_t)0x00200000U)
370 #define OB_WRP_SECTOR_6 ((uint32_t)0x00400000U)
371 #define OB_WRP_SECTOR_7 ((uint32_t)0x00800000U)
372 #define OB_WRP_SECTOR_8 ((uint32_t)0x01000000U)
373 #define OB_WRP_SECTOR_9 ((uint32_t)0x02000000U)
374 #define OB_WRP_SECTOR_10 ((uint32_t)0x04000000U)
375 #define OB_WRP_SECTOR_11 ((uint32_t)0x08000000U)
376 #define OB_WRP_SECTOR_All ((uint32_t)0x0FFF0000U)
378 /* Dual Bank Sectors */
379 #define OB_WRP_DB_SECTOR_0 ((uint32_t)0x00010000U)
380 #define OB_WRP_DB_SECTOR_1 ((uint32_t)0x00010000U)
381 #define OB_WRP_DB_SECTOR_2 ((uint32_t)0x00020000U)
382 #define OB_WRP_DB_SECTOR_3 ((uint32_t)0x00020000U)
383 #define OB_WRP_DB_SECTOR_4 ((uint32_t)0x00040000U)
384 #define OB_WRP_DB_SECTOR_5 ((uint32_t)0x00040000U)
385 #define OB_WRP_DB_SECTOR_6 ((uint32_t)0x00080000U)
386 #define OB_WRP_DB_SECTOR_7 ((uint32_t)0x00080000U)
387 #define OB_WRP_DB_SECTOR_8 ((uint32_t)0x00100000U)
388 #define OB_WRP_DB_SECTOR_9 ((uint32_t)0x00100000U)
389 #define OB_WRP_DB_SECTOR_10 ((uint32_t)0x00200000U)
390 #define OB_WRP_DB_SECTOR_11 ((uint32_t)0x00200000U)
391 #define OB_WRP_DB_SECTOR_12 ((uint32_t)0x00400000U)
392 #define OB_WRP_DB_SECTOR_13 ((uint32_t)0x00400000U)
393 #define OB_WRP_DB_SECTOR_14 ((uint32_t)0x00800000U)
394 #define OB_WRP_DB_SECTOR_15 ((uint32_t)0x00800000U)
395 #define OB_WRP_DB_SECTOR_16 ((uint32_t)0x01000000U)
396 #define OB_WRP_DB_SECTOR_17 ((uint32_t)0x01000000U)
397 #define OB_WRP_DB_SECTOR_18 ((uint32_t)0x02000000U)
398 #define OB_WRP_DB_SECTOR_19 ((uint32_t)0x02000000U)
399 #define OB_WRP_DB_SECTOR_20 ((uint32_t)0x04000000U)
400 #define OB_WRP_DB_SECTOR_21 ((uint32_t)0x04000000U)
401 #define OB_WRP_DB_SECTOR_22 ((uint32_t)0x08000000U)
402 #define OB_WRP_DB_SECTOR_23 ((uint32_t)0x08000000U)
403 #define OB_WRP_DB_SECTOR_All ((uint32_t)0x0FFF0000U)
407 #endif /* FLASH_SECTOR_TOTAL == 24 */
408 
409 #if (FLASH_SECTOR_TOTAL == 8)
410 
413 #define OB_WRP_SECTOR_0 ((uint32_t)0x00010000U)
414 #define OB_WRP_SECTOR_1 ((uint32_t)0x00020000U)
415 #define OB_WRP_SECTOR_2 ((uint32_t)0x00040000U)
416 #define OB_WRP_SECTOR_3 ((uint32_t)0x00080000U)
417 #define OB_WRP_SECTOR_4 ((uint32_t)0x00100000U)
418 #define OB_WRP_SECTOR_5 ((uint32_t)0x00200000U)
419 #define OB_WRP_SECTOR_6 ((uint32_t)0x00400000U)
420 #define OB_WRP_SECTOR_7 ((uint32_t)0x00800000U)
421 #define OB_WRP_SECTOR_All ((uint32_t)0x00FF0000U)
425 #endif /* FLASH_SECTOR_TOTAL == 8 */
426 
427 #if (FLASH_SECTOR_TOTAL == 4)
428 
431 #define OB_WRP_SECTOR_0 ((uint32_t)0x00010000U)
432 #define OB_WRP_SECTOR_1 ((uint32_t)0x00020000U)
433 #define OB_WRP_SECTOR_2 ((uint32_t)0x00040000U)
434 #define OB_WRP_SECTOR_3 ((uint32_t)0x00080000U)
435 #define OB_WRP_SECTOR_All ((uint32_t)0x000F0000U)
439 #endif /* FLASH_SECTOR_TOTAL == 4 */
440 
441 #if (FLASH_SECTOR_TOTAL == 2)
442 
445 #define OB_WRP_SECTOR_0 ((uint32_t)0x00010000U)
446 #define OB_WRP_SECTOR_1 ((uint32_t)0x00020000U)
447 #define OB_WRP_SECTOR_All ((uint32_t)0x00030000U)
451 #endif /* FLASH_SECTOR_TOTAL == 2 */
452 
453 #if defined (FLASH_OPTCR2_PCROP)
454 #if (FLASH_SECTOR_TOTAL == 8)
455 
458 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U)
459 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U)
460 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U)
461 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U)
462 #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U)
463 #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020U)
464 #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040U)
465 #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080U)
466 #define OB_PCROP_SECTOR_All ((uint32_t)0x000000FFU)
470 #endif /* FLASH_SECTOR_TOTAL == 8 */
471 
472 #if (FLASH_SECTOR_TOTAL == 4)
473 
476 #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U)
477 #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U)
478 #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U)
479 #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U)
480 #define OB_PCROP_SECTOR_All ((uint32_t)0x0000000FU)
484 #endif /* FLASH_SECTOR_TOTAL == 4 */
485 
489 #define OB_PCROP_RDP_ENABLE ((uint32_t)0x80000000U)
490 #define OB_PCROP_RDP_DISABLE ((uint32_t)0x00000000U)
494 #endif /* FLASH_OPTCR2_PCROP */
495 
500 /* Exported macro ------------------------------------------------------------*/
510 #define __HAL_FLASH_CALC_BOOT_BASE_ADR(__ADDRESS__) ((__ADDRESS__) >> 14)
511 
515 /* Exported functions --------------------------------------------------------*/
523 /* Extension Program operation functions *************************************/
524 HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError);
528 
536 /* Private types -------------------------------------------------------------*/
537 /* Private variables ---------------------------------------------------------*/
538 /* Private constants ---------------------------------------------------------*/
539 /* Private macros ------------------------------------------------------------*/
548 #define IS_FLASH_TYPEERASE(VALUE)(((VALUE) == FLASH_TYPEERASE_SECTORS) || \
549  ((VALUE) == FLASH_TYPEERASE_MASSERASE))
550 
551 #define IS_VOLTAGERANGE(RANGE)(((RANGE) == FLASH_VOLTAGE_RANGE_1) || \
552  ((RANGE) == FLASH_VOLTAGE_RANGE_2) || \
553  ((RANGE) == FLASH_VOLTAGE_RANGE_3) || \
554  ((RANGE) == FLASH_VOLTAGE_RANGE_4))
555 
556 #define IS_WRPSTATE(VALUE)(((VALUE) == OB_WRPSTATE_DISABLE) || \
557  ((VALUE) == OB_WRPSTATE_ENABLE))
558 
559 #if defined (FLASH_OPTCR2_PCROP)
560 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER |\
561  OPTIONBYTE_BOR | OPTIONBYTE_BOOTADDR_0 | OPTIONBYTE_BOOTADDR_1 |\
562  OPTIONBYTE_PCROP | OPTIONBYTE_PCROP_RDP)))
563 #else
564 #define IS_OPTIONBYTE(VALUE)(((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER |\
565  OPTIONBYTE_BOR | OPTIONBYTE_BOOTADDR_0 | OPTIONBYTE_BOOTADDR_1)))
566 #endif /* FLASH_OPTCR2_PCROP */
567 
568 #define IS_OB_BOOT_ADDRESS(ADDRESS) ((ADDRESS) <= 0x8013)
569 
570 #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\
571  ((LEVEL) == OB_RDP_LEVEL_1) ||\
572  ((LEVEL) == OB_RDP_LEVEL_2))
573 
574 #define IS_OB_WWDG_SOURCE(SOURCE) (((SOURCE) == OB_WWDG_SW) || ((SOURCE) == OB_WWDG_HW))
575 
576 #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW))
577 
578 #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NO_RST) || ((SOURCE) == OB_STOP_RST))
579 
580 #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NO_RST) || ((SOURCE) == OB_STDBY_RST))
581 
582 #define IS_OB_IWDG_STOP_FREEZE(FREEZE) (((FREEZE) == OB_IWDG_STOP_FREEZE) || ((FREEZE) == OB_IWDG_STOP_ACTIVE))
583 
584 #define IS_OB_IWDG_STDBY_FREEZE(FREEZE) (((FREEZE) == OB_IWDG_STDBY_FREEZE) || ((FREEZE) == OB_IWDG_STDBY_ACTIVE))
585 
586 #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\
587  ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF))
588 
589 #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \
590  ((LATENCY) == FLASH_LATENCY_1) || \
591  ((LATENCY) == FLASH_LATENCY_2) || \
592  ((LATENCY) == FLASH_LATENCY_3) || \
593  ((LATENCY) == FLASH_LATENCY_4) || \
594  ((LATENCY) == FLASH_LATENCY_5) || \
595  ((LATENCY) == FLASH_LATENCY_6) || \
596  ((LATENCY) == FLASH_LATENCY_7) || \
597  ((LATENCY) == FLASH_LATENCY_8) || \
598  ((LATENCY) == FLASH_LATENCY_9) || \
599  ((LATENCY) == FLASH_LATENCY_10) || \
600  ((LATENCY) == FLASH_LATENCY_11) || \
601  ((LATENCY) == FLASH_LATENCY_12) || \
602  ((LATENCY) == FLASH_LATENCY_13) || \
603  ((LATENCY) == FLASH_LATENCY_14) || \
604  ((LATENCY) == FLASH_LATENCY_15))
605 
606 #define IS_FLASH_ADDRESS(ADDRESS) ((((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) || \
607  (((ADDRESS) >= FLASH_OTP_BASE) && ((ADDRESS) <= FLASH_OTP_END)))
608 #define IS_FLASH_NBSECTORS(NBSECTORS) (((NBSECTORS) != 0U) && ((NBSECTORS) <= FLASH_SECTOR_TOTAL))
609 
610 #if (FLASH_SECTOR_TOTAL == 8)
611 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
612  ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
613  ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
614  ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7))
615 
616 #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & 0xFF00FFFFU) == 0x00000000U) && ((SECTOR) != 0x00000000U))
617 #endif /* FLASH_SECTOR_TOTAL == 8 */
618 
619 #if (FLASH_SECTOR_TOTAL == 24)
620 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
621  ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\
622  ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\
623  ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\
624  ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\
625  ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\
626  ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\
627  ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15) ||\
628  ((SECTOR) == FLASH_SECTOR_16) || ((SECTOR) == FLASH_SECTOR_17) ||\
629  ((SECTOR) == FLASH_SECTOR_18) || ((SECTOR) == FLASH_SECTOR_19) ||\
630  ((SECTOR) == FLASH_SECTOR_20) || ((SECTOR) == FLASH_SECTOR_21) ||\
631  ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23))
632 
633 #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & 0xF000FFFFU) == 0x00000000U) && ((SECTOR) != 0x00000000U))
634 #endif /* FLASH_SECTOR_TOTAL == 24 */
635 
636 #if (FLASH_SECTOR_TOTAL == 4)
637 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\
638  ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3))
639 
640 #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & 0xFFF0FFFFU) == 0x00000000U) && ((SECTOR) != 0x00000000U))
641 #endif /* FLASH_SECTOR_TOTAL == 4 */
642 
643 #if (FLASH_SECTOR_TOTAL == 2)
644 #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1))
645 
646 #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & 0xFFFCFFFFU) == 0x00000000U) && ((SECTOR) != 0x00000000U))
647 #endif /* FLASH_SECTOR_TOTAL == 2 */
648 
649 #if defined (FLASH_OPTCR_nDBANK)
650 #define IS_OB_NDBANK(VALUE) (((VALUE) == OB_NDBANK_SINGLE_BANK) || \
651  ((VALUE) == OB_NDBANK_DUAL_BANK))
652 
653 #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \
654  ((BANK) == FLASH_BANK_2) || \
655  ((BANK) == FLASH_BANK_BOTH))
656 #endif /* FLASH_OPTCR_nDBANK */
657 
658 #if defined (FLASH_OPTCR_nDBOOT)
659 #define IS_OB_NDBOOT(VALUE) (((VALUE) == OB_DUAL_BOOT_DISABLE) || \
660  ((VALUE) == OB_DUAL_BOOT_ENABLE))
661 #endif /* FLASH_OPTCR_nDBOOT */
662 
663 #if defined (FLASH_OPTCR2_PCROP)
664 #define IS_OB_PCROP_SECTOR(SECTOR) (((SECTOR) & (uint32_t)0xFFFFFF00U) == 0x00000000U)
665 #define IS_OB_PCROP_RDP_VALUE(VALUE) (((VALUE) == OB_PCROP_RDP_DISABLE) || \
666  ((VALUE) == OB_PCROP_RDP_ENABLE))
667 #endif /* FLASH_OPTCR2_PCROP */
668 
677 /* Private functions ---------------------------------------------------------*/
681 void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange);
694 #ifdef __cplusplus
695 }
696 #endif
697 
698 #endif /* __STM32F7xx_HAL_FLASH_EX_H */
699 
700 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
FLASH_Erase_Sector
void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange)
FLASH_OBProgramInitTypeDef
FLASH Option Bytes Program structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h:69
FLASH_OBProgramInitTypeDef::USERConfig
uint32_t USERConfig
Definition: stm32f7xx_hal_flash_ex.h:88
HAL_FLASHEx_Erase
HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *SectorError)
HAL_FLASHEx_OBProgram
HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)
FLASH_OBProgramInitTypeDef::BootAddr1
uint32_t BootAddr1
Definition: stm32f7xx_hal_flash_ex.h:95
HAL_FLASHEx_OBGetConfig
void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_FLASHEx_Erase_IT
HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
FLASH_OBProgramInitTypeDef::BootAddr0
uint32_t BootAddr0
Definition: stm32f7xx_hal_flash_ex.h:92
FLASH_EraseInitTypeDef
FLASH Erase structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h:47


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53