Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 5 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32f1xx_hal_flash_ex.h |
3 | * @file stm32f1xx_hal_flash_ex.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.0.1 |
5 | * @version V1.0.4 |
| 6 | * @date 31-July-2015 |
6 | * @date 29-April-2016 |
| 7 | * @brief Header file of Flash HAL Extended module. |
7 | * @brief Header file of Flash HAL Extended module. |
| 8 | ****************************************************************************** |
8 | ****************************************************************************** |
| 9 | * @attention |
9 | * @attention |
| 10 | * |
10 | * |
| 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| 12 | * |
12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without modification, |
13 | * Redistribution and use in source and binary forms, with or without modification, |
| 14 | * are permitted provided that the following conditions are met: |
14 | * are permitted provided that the following conditions are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright notice, |
15 | * 1. Redistributions of source code must retain the above copyright notice, |
| 16 | * this list of conditions and the following disclaimer. |
16 | * this list of conditions and the following disclaimer. |
| Line 232... | Line 232... | ||
| 232 | IWDG / STOP / STDBY |
232 | IWDG / STOP / STDBY |
| 233 | This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP, |
233 | This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP, |
| 234 | @ref FLASHEx_OB_nRST_STDBY */ |
234 | @ref FLASHEx_OB_nRST_STDBY */ |
| 235 | #endif /* FLASH_BANK2_END */ |
235 | #endif /* FLASH_BANK2_END */ |
| 236 | 236 | ||
| 237 | uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be prgrammed |
237 | uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed |
| 238 | This parameter can be a value of @ref FLASHEx_OB_Data_Address */ |
238 | This parameter can be a value of @ref FLASHEx_OB_Data_Address */ |
| 239 | 239 | ||
| 240 | uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA |
240 | uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA |
| 241 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ |
241 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ |
| 242 | - | ||
| 243 | } FLASH_OBProgramInitTypeDef; |
242 | } FLASH_OBProgramInitTypeDef; |
| 244 | 243 | ||
| 245 | /** |
244 | /** |
| 246 | * @} |
245 | * @} |
| 247 | */ |
246 | */ |
| Line 304... | Line 303... | ||
| 304 | 303 | ||
| 305 | /** @defgroup FLASHEx_OptionByte_Constants Option Byte Constants |
304 | /** @defgroup FLASHEx_OptionByte_Constants Option Byte Constants |
| 306 | * @{ |
305 | * @{ |
| 307 | */ |
306 | */ |
| 308 | 307 | ||
| 309 | /** @defgroup FLASHEx_OB_WRP_State Option Byte WRP State |
- | |
| 310 | * @{ |
- | |
| 311 | */ |
- | |
| 312 | #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/ |
- | |
| 313 | #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/ |
- | |
| 314 | - | ||
| 315 | /** |
- | |
| 316 | * @} |
- | |
| 317 | */ |
- | |
| 318 | - | ||
| 319 | /** @defgroup FLASHEx_OB_Type Option Bytes Type |
308 | /** @defgroup FLASHEx_OB_Type Option Bytes Type |
| 320 | * @{ |
309 | * @{ |
| 321 | */ |
310 | */ |
| 322 | #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/ |
311 | #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/ |
| 323 | #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/ |
312 | #define OPTIONBYTE_RDP ((uint32_t)0x02) /*!<RDP option byte configuration*/ |
| Line 326... | Line 315... | ||
| 326 | 315 | ||
| 327 | /** |
316 | /** |
| 328 | * @} |
317 | * @} |
| 329 | */ |
318 | */ |
| 330 | 319 | ||
| 331 | - | ||
| 332 | /** @defgroup FLASHEx_OB_Read_Protection Option Byte Read Protection |
- | |
| 333 | * @{ |
- | |
| 334 | */ |
- | |
| 335 | #define OB_RDP_LEVEL_0 ((uint8_t)0xA5) |
- | |
| 336 | #define OB_RDP_LEVEL_1 ((uint8_t)0x00) |
- | |
| 337 | /** |
- | |
| 338 | * @} |
- | |
| 339 | */ |
- | |
| 340 | - | ||
| 341 | /** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP |
- | |
| 342 | * @{ |
- | |
| 343 | */ |
- | |
| 344 | #define OB_STOP_NO_RST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */ |
- | |
| 345 | #define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */ |
- | |
| 346 | /** |
- | |
| 347 | * @} |
- | |
| 348 | */ |
- | |
| 349 | - | ||
| 350 | /** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY |
320 | /** @defgroup FLASHEx_OB_WRP_State Option Byte WRP State |
| 351 | * @{ |
- | |
| 352 | */ |
- | |
| 353 | #define OB_STDBY_NO_RST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */ |
- | |
| 354 | #define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */ |
- | |
| 355 | /** |
- | |
| 356 | * @} |
- | |
| 357 | */ |
- | |
| 358 | - | ||
| 359 | /** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog |
- | |
| 360 | * @{ |
321 | * @{ |
| 361 | */ |
322 | */ |
| 362 | #define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */ |
323 | #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/ |
| 363 | #define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */ |
324 | #define OB_WRPSTATE_ENABLE ((uint32_t)0x01) /*!<Enable the write protection of the desired pagess*/ |
| 364 | /** |
- | |
| 365 | * @} |
- | |
| 366 | */ |
- | |
| 367 | - | ||
| 368 | #if defined(FLASH_BANK2_END) |
- | |
| 369 | /** @defgroup FLASHEx_OB_BOOT1 Option Byte BOOT1 |
- | |
| 370 | * @{ |
- | |
| 371 | */ |
- | |
| 372 | #define OB_BOOT1_RESET ((uint16_t)0x0000) /*!< BOOT1 Reset */ |
- | |
| 373 | #define OB_BOOT1_SET ((uint16_t)0x0008) /*!< BOOT1 Set */ |
- | |
| 374 | /** |
- | |
| 375 | * @} |
- | |
| 376 | */ |
- | |
| 377 | #endif /* FLASH_BANK2_END */ |
- | |
| 378 | 325 | ||
| 379 | /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address |
- | |
| 380 | * @{ |
- | |
| 381 | */ |
- | |
| 382 | #define OB_DATA_ADDRESS_DATA0 ((uint32_t)0x1FFFF804) |
- | |
| 383 | #define OB_DATA_ADDRESS_DATA1 ((uint32_t)0x1FFFF806) |
- | |
| 384 | /** |
326 | /** |
| 385 | * @} |
327 | * @} |
| 386 | */ |
328 | */ |
| 387 | 329 | ||
| 388 | /** @defgroup FLASHEx_OB_Write_Protection Option Bytes Write Protection |
330 | /** @defgroup FLASHEx_OB_Write_Protection Option Bytes Write Protection |
| Line 515... | Line 457... | ||
| 515 | 457 | ||
| 516 | /** |
458 | /** |
| 517 | * @} |
459 | * @} |
| 518 | */ |
460 | */ |
| 519 | 461 | ||
| - | 462 | /** @defgroup FLASHEx_OB_Read_Protection Option Byte Read Protection |
|
| - | 463 | * @{ |
|
| - | 464 | */ |
|
| - | 465 | #define OB_RDP_LEVEL_0 ((uint8_t)0xA5) |
|
| - | 466 | #define OB_RDP_LEVEL_1 ((uint8_t)0x00) |
|
| - | 467 | /** |
|
| - | 468 | * @} |
|
| - | 469 | */ |
|
| - | 470 | ||
| - | 471 | /** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog |
|
| - | 472 | * @{ |
|
| - | 473 | */ |
|
| - | 474 | #define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */ |
|
| - | 475 | #define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */ |
|
| - | 476 | /** |
|
| - | 477 | * @} |
|
| - | 478 | */ |
|
| - | 479 | ||
| - | 480 | /** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP |
|
| - | 481 | * @{ |
|
| - | 482 | */ |
|
| - | 483 | #define OB_STOP_NO_RST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */ |
|
| - | 484 | #define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */ |
|
| - | 485 | /** |
|
| - | 486 | * @} |
|
| - | 487 | */ |
|
| - | 488 | ||
| - | 489 | /** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY |
|
| - | 490 | * @{ |
|
| - | 491 | */ |
|
| - | 492 | #define OB_STDBY_NO_RST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */ |
|
| - | 493 | #define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */ |
|
| - | 494 | /** |
|
| - | 495 | * @} |
|
| - | 496 | */ |
|
| - | 497 | ||
| - | 498 | #if defined(FLASH_BANK2_END) |
|
| - | 499 | /** @defgroup FLASHEx_OB_BOOT1 Option Byte BOOT1 |
|
| - | 500 | * @{ |
|
| - | 501 | */ |
|
| - | 502 | #define OB_BOOT1_RESET ((uint16_t)0x0000) /*!< BOOT1 Reset */ |
|
| - | 503 | #define OB_BOOT1_SET ((uint16_t)0x0008) /*!< BOOT1 Set */ |
|
| - | 504 | /** |
|
| - | 505 | * @} |
|
| - | 506 | */ |
|
| - | 507 | #endif /* FLASH_BANK2_END */ |
|
| - | 508 | ||
| - | 509 | /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address |
|
| - | 510 | * @{ |
|
| - | 511 | */ |
|
| - | 512 | #define OB_DATA_ADDRESS_DATA0 ((uint32_t)0x1FFFF804) |
|
| - | 513 | #define OB_DATA_ADDRESS_DATA1 ((uint32_t)0x1FFFF806) |
|
| - | 514 | /** |
|
| - | 515 | * @} |
|
| - | 516 | */ |
|
| - | 517 | ||
| 520 | /** |
518 | /** |
| 521 | * @} |
519 | * @} |
| 522 | */ |
520 | */ |
| 523 | 521 | ||
| 524 | /** @addtogroup FLASHEx_Constants |
522 | /** @addtogroup FLASHEx_Constants |
| Line 588... | Line 586... | ||
| 588 | 586 | ||
| 589 | 587 | ||
| 590 | /** |
588 | /** |
| 591 | * @} |
589 | * @} |
| 592 | */ |
590 | */ |
| 593 | - | ||
| 594 | 591 | ||
| 595 | /* Exported macro ------------------------------------------------------------*/ |
592 | /* Exported macro ------------------------------------------------------------*/ |
| 596 | /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros |
593 | /** @defgroup FLASHEx_Exported_Macros FLASHEx Exported Macros |
| 597 | * @{ |
594 | * @{ |
| 598 | */ |
595 | */ |
| Line 603... | Line 600... | ||
| 603 | */ |
600 | */ |
| 604 | 601 | ||
| 605 | #if defined(FLASH_BANK2_END) |
602 | #if defined(FLASH_BANK2_END) |
| 606 | /** |
603 | /** |
| 607 | * @brief Enable the specified FLASH interrupt. |
604 | * @brief Enable the specified FLASH interrupt. |
| 608 | * @param __INTERRUPT__ : FLASH interrupt |
605 | * @param __INTERRUPT__ FLASH interrupt |
| 609 | * This parameter can be any combination of the following values: |
606 | * This parameter can be any combination of the following values: |
| 610 | * @arg FLASH_IT_EOP_BANK1: End of FLASH Operation Interrupt on bank1 |
607 | * @arg @ref FLASH_IT_EOP_BANK1 End of FLASH Operation Interrupt on bank1 |
| 611 | * @arg FLASH_IT_ERR_BANK1: Error Interrupt on bank1 |
608 | * @arg @ref FLASH_IT_ERR_BANK1 Error Interrupt on bank1 |
| 612 | * @arg FLASH_IT_EOP_BANK2: End of FLASH Operation Interrupt on bank2 |
609 | * @arg @ref FLASH_IT_EOP_BANK2 End of FLASH Operation Interrupt on bank2 |
| 613 | * @arg FLASH_IT_ERR_BANK2: Error Interrupt on bank2 |
610 | * @arg @ref FLASH_IT_ERR_BANK2 Error Interrupt on bank2 |
| 614 | * @retval none |
611 | * @retval none |
| 615 | */ |
612 | */ |
| 616 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) do { \ |
613 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) do { \ |
| 617 | /* Enable Bank1 IT */ \ |
614 | /* Enable Bank1 IT */ \ |
| 618 | SET_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFF)); \ |
615 | SET_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFF)); \ |
| Line 620... | Line 617... | ||
| 620 | SET_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16)); \ |
617 | SET_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16)); \ |
| 621 | } while(0) |
618 | } while(0) |
| 622 | 619 | ||
| 623 | /** |
620 | /** |
| 624 | * @brief Disable the specified FLASH interrupt. |
621 | * @brief Disable the specified FLASH interrupt. |
| 625 | * @param __INTERRUPT__ : FLASH interrupt |
622 | * @param __INTERRUPT__ FLASH interrupt |
| 626 | * This parameter can be any combination of the following values: |
623 | * This parameter can be any combination of the following values: |
| 627 | * @arg FLASH_IT_EOP_BANK1: End of FLASH Operation Interrupt on bank1 |
624 | * @arg @ref FLASH_IT_EOP_BANK1 End of FLASH Operation Interrupt on bank1 |
| 628 | * @arg FLASH_IT_ERR_BANK1: Error Interrupt on bank1 |
625 | * @arg @ref FLASH_IT_ERR_BANK1 Error Interrupt on bank1 |
| 629 | * @arg FLASH_IT_EOP_BANK2: End of FLASH Operation Interrupt on bank2 |
626 | * @arg @ref FLASH_IT_EOP_BANK2 End of FLASH Operation Interrupt on bank2 |
| 630 | * @arg FLASH_IT_ERR_BANK2: Error Interrupt on bank2 |
627 | * @arg @ref FLASH_IT_ERR_BANK2 Error Interrupt on bank2 |
| 631 | * @retval none |
628 | * @retval none |
| 632 | */ |
629 | */ |
| 633 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { \ |
630 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) do { \ |
| 634 | /* Disable Bank1 IT */ \ |
631 | /* Disable Bank1 IT */ \ |
| 635 | CLEAR_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFF)); \ |
632 | CLEAR_BIT(FLASH->CR, ((__INTERRUPT__) & 0x0000FFFF)); \ |
| Line 637... | Line 634... | ||
| 637 | CLEAR_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16)); \ |
634 | CLEAR_BIT(FLASH->CR2, ((__INTERRUPT__) >> 16)); \ |
| 638 | } while(0) |
635 | } while(0) |
| 639 | 636 | ||
| 640 | /** |
637 | /** |
| 641 | * @brief Get the specified FLASH flag status. |
638 | * @brief Get the specified FLASH flag status. |
| 642 | * @param __FLAG__: specifies the FLASH flag to check. |
639 | * @param __FLAG__ specifies the FLASH flag to check. |
| 643 | * This parameter can be one of the following values: |
640 | * This parameter can be one of the following values: |
| 644 | * @arg FLASH_FLAG_EOP_BANK1 : FLASH End of Operation flag on bank1 |
641 | * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1 |
| 645 | * @arg FLASH_FLAG_WRPERR_BANK1: FLASH Write protected error flag on bank1 |
642 | * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1 |
| 646 | * @arg FLASH_FLAG_PGERR_BANK1 : FLASH Programming error flag on bank1 |
643 | * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1 |
| 647 | * @arg FLASH_FLAG_BSY_BANK1 : FLASH Busy flag on bank1 |
644 | * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1 |
| 648 | * @arg FLASH_FLAG_EOP_BANK2 : FLASH End of Operation flag on bank2 |
645 | * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2 |
| 649 | * @arg FLASH_FLAG_WRPERR_BANK2: FLASH Write protected error flag on bank2 |
646 | * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2 |
| 650 | * @arg FLASH_FLAG_PGERR_BANK2 : FLASH Programming error flag on bank2 |
647 | * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2 |
| 651 | * @arg FLASH_FLAG_BSY_BANK2 : FLASH Busy flag on bank2 |
648 | * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2 |
| 652 | * @arg FLASH_FLAG_OPTVERR : Loaded OB and its complement do not match |
649 | * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match |
| 653 | * @retval The new state of __FLAG__ (SET or RESET). |
650 | * @retval The new state of __FLAG__ (SET or RESET). |
| 654 | */ |
651 | */ |
| 655 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ |
652 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ |
| 656 | (FLASH->OBR & FLASH_OBR_OPTERR) : \ |
653 | (FLASH->OBR & FLASH_OBR_OPTERR) : \ |
| 657 | ((((__FLAG__) & SR_FLAG_MASK) != RESET)? \ |
654 | ((((__FLAG__) & SR_FLAG_MASK) != RESET)? \ |
| 658 | (FLASH->SR & ((__FLAG__) & SR_FLAG_MASK)) : \ |
655 | (FLASH->SR & ((__FLAG__) & SR_FLAG_MASK)) : \ |
| 659 | (FLASH->SR2 & ((__FLAG__) >> 16)))) |
656 | (FLASH->SR2 & ((__FLAG__) >> 16)))) |
| 660 | 657 | ||
| 661 | /** |
658 | /** |
| 662 | * @brief Clear the specified FLASH flag. |
659 | * @brief Clear the specified FLASH flag. |
| 663 | * @param __FLAG__: specifies the FLASH flags to clear. |
660 | * @param __FLAG__ specifies the FLASH flags to clear. |
| 664 | * This parameter can be any combination of the following values: |
661 | * This parameter can be any combination of the following values: |
| 665 | * @arg FLASH_FLAG_EOP_BANK1 : FLASH End of Operation flag on bank1 |
662 | * @arg @ref FLASH_FLAG_EOP_BANK1 FLASH End of Operation flag on bank1 |
| 666 | * @arg FLASH_FLAG_WRPERR_BANK1: FLASH Write protected error flag on bank1 |
663 | * @arg @ref FLASH_FLAG_WRPERR_BANK1 FLASH Write protected error flag on bank1 |
| 667 | * @arg FLASH_FLAG_PGERR_BANK1 : FLASH Programming error flag on bank1 |
664 | * @arg @ref FLASH_FLAG_PGERR_BANK1 FLASH Programming error flag on bank1 |
| 668 | * @arg FLASH_FLAG_BSY_BANK1 : FLASH Busy flag on bank1 |
665 | * @arg @ref FLASH_FLAG_BSY_BANK1 FLASH Busy flag on bank1 |
| 669 | * @arg FLASH_FLAG_EOP_BANK2 : FLASH End of Operation flag on bank2 |
666 | * @arg @ref FLASH_FLAG_EOP_BANK2 FLASH End of Operation flag on bank2 |
| 670 | * @arg FLASH_FLAG_WRPERR_BANK2: FLASH Write protected error flag on bank2 |
667 | * @arg @ref FLASH_FLAG_WRPERR_BANK2 FLASH Write protected error flag on bank2 |
| 671 | * @arg FLASH_FLAG_PGERR_BANK2 : FLASH Programming error flag on bank2 |
668 | * @arg @ref FLASH_FLAG_PGERR_BANK2 FLASH Programming error flag on bank2 |
| 672 | * @arg FLASH_FLAG_BSY_BANK2 : FLASH Busy flag on bank2 |
669 | * @arg @ref FLASH_FLAG_BSY_BANK2 FLASH Busy flag on bank2 |
| 673 | * @arg FLASH_FLAG_OPTVERR : Loaded OB and its complement do not match |
670 | * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match |
| 674 | * @retval none |
671 | * @retval none |
| 675 | */ |
672 | */ |
| 676 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ |
673 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ |
| 677 | /* Clear FLASH_FLAG_OPTVERR flag */ \ |
674 | /* Clear FLASH_FLAG_OPTVERR flag */ \ |
| 678 | if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ |
675 | if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ |
| Line 693... | Line 690... | ||
| 693 | } \ |
690 | } \ |
| 694 | } while(0) |
691 | } while(0) |
| 695 | #else |
692 | #else |
| 696 | /** |
693 | /** |
| 697 | * @brief Enable the specified FLASH interrupt. |
694 | * @brief Enable the specified FLASH interrupt. |
| 698 | * @param __INTERRUPT__ : FLASH interrupt |
695 | * @param __INTERRUPT__ FLASH interrupt |
| 699 | * This parameter can be any combination of the following values: |
696 | * This parameter can be any combination of the following values: |
| 700 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
697 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
| 701 | * @arg FLASH_IT_ERR: Error Interrupt |
698 | * @arg @ref FLASH_IT_ERR Error Interrupt |
| 702 | * @retval none |
699 | * @retval none |
| 703 | */ |
700 | */ |
| 704 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
701 | #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__)) |
| 705 | 702 | ||
| 706 | /** |
703 | /** |
| 707 | * @brief Disable the specified FLASH interrupt. |
704 | * @brief Disable the specified FLASH interrupt. |
| 708 | * @param __INTERRUPT__ : FLASH interrupt |
705 | * @param __INTERRUPT__ FLASH interrupt |
| 709 | * This parameter can be any combination of the following values: |
706 | * This parameter can be any combination of the following values: |
| 710 | * @arg FLASH_IT_EOP: End of FLASH Operation Interrupt |
707 | * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt |
| 711 | * @arg FLASH_IT_ERR: Error Interrupt |
708 | * @arg @ref FLASH_IT_ERR Error Interrupt |
| 712 | * @retval none |
709 | * @retval none |
| 713 | */ |
710 | */ |
| 714 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(__INTERRUPT__)) |
711 | #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(__INTERRUPT__)) |
| 715 | 712 | ||
| 716 | /** |
713 | /** |
| 717 | * @brief Get the specified FLASH flag status. |
714 | * @brief Get the specified FLASH flag status. |
| 718 | * @param __FLAG__: specifies the FLASH flag to check. |
715 | * @param __FLAG__ specifies the FLASH flag to check. |
| 719 | * This parameter can be one of the following values: |
716 | * This parameter can be one of the following values: |
| 720 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
717 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
| 721 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
718 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
| 722 | * @arg FLASH_FLAG_PGERR : FLASH Programming error flag |
719 | * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag |
| 723 | * @arg FLASH_FLAG_BSY : FLASH Busy flag |
720 | * @arg @ref FLASH_FLAG_BSY FLASH Busy flag |
| 724 | * @arg FLASH_FLAG_OPTVERR : Loaded OB and its complement do not match |
721 | * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match |
| 725 | * @retval The new state of __FLAG__ (SET or RESET). |
722 | * @retval The new state of __FLAG__ (SET or RESET). |
| 726 | */ |
723 | */ |
| 727 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ |
724 | #define __HAL_FLASH_GET_FLAG(__FLAG__) (((__FLAG__) == FLASH_FLAG_OPTVERR) ? \ |
| 728 | (FLASH->OBR & FLASH_OBR_OPTERR) : \ |
725 | (FLASH->OBR & FLASH_OBR_OPTERR) : \ |
| 729 | (FLASH->SR & (__FLAG__))) |
726 | (FLASH->SR & (__FLAG__))) |
| 730 | /** |
727 | /** |
| 731 | * @brief Clear the specified FLASH flag. |
728 | * @brief Clear the specified FLASH flag. |
| 732 | * @param __FLAG__: specifies the FLASH flags to clear. |
729 | * @param __FLAG__ specifies the FLASH flags to clear. |
| 733 | * This parameter can be any combination of the following values: |
730 | * This parameter can be any combination of the following values: |
| 734 | * @arg FLASH_FLAG_EOP : FLASH End of Operation flag |
731 | * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag |
| 735 | * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag |
732 | * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag |
| 736 | * @arg FLASH_FLAG_PGERR : FLASH Programming error flag |
733 | * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag |
| 737 | * @arg FLASH_FLAG_OPTVERR : Loaded OB and its complement do not match |
734 | * @arg @ref FLASH_FLAG_OPTVERR Loaded OB and its complement do not match |
| 738 | * @retval none |
735 | * @retval none |
| 739 | */ |
736 | */ |
| 740 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ |
737 | #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) do { \ |
| 741 | /* Clear FLASH_FLAG_OPTVERR flag */ \ |
738 | /* Clear FLASH_FLAG_OPTVERR flag */ \ |
| 742 | if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ |
739 | if ((__FLAG__) == FLASH_FLAG_OPTVERR) \ |
| Line 751... | Line 748... | ||
| 751 | 748 | ||
| 752 | #endif |
749 | #endif |
| 753 | 750 | ||
| 754 | /** |
751 | /** |
| 755 | * @} |
752 | * @} |
| 756 | */ |
753 | */ |
| 757 | 754 | ||
| 758 | /** |
755 | /** |
| 759 | * @} |
756 | * @} |
| 760 | */ |
757 | */ |
| 761 | 758 | ||
| 762 | /* Exported functions --------------------------------------------------------*/ |
759 | /* Exported functions --------------------------------------------------------*/ |
| 763 | /** @addtogroup FLASHEx_Exported_Functions |
760 | /** @addtogroup FLASHEx_Exported_Functions |
| 764 | * @{ |
761 | * @{ |
| 765 | */ |
762 | */ |
| 766 | 763 | ||
| 767 | /** @addtogroup FLASHEx_Exported_Functions_Group1 |
764 | /** @addtogroup FLASHEx_Exported_Functions_Group1 |
| 768 | * @{ |
765 | * @{ |
| 769 | */ |
766 | */ |
| 770 | /* IO operation functions *****************************************************/ |
767 | /* IO operation functions *****************************************************/ |
| 771 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); |
768 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); |
| 772 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); |
769 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); |
| 773 | 770 | ||
| 774 | /** |
771 | /** |
| 775 | * @} |
772 | * @} |
| 776 | */ |
773 | */ |
| 777 | 774 | ||
| 778 | /** @addtogroup FLASHEx_Exported_Functions_Group2 |
775 | /** @addtogroup FLASHEx_Exported_Functions_Group2 |
| 779 | * @{ |
776 | * @{ |
| 780 | */ |
777 | */ |
| 781 | /* Peripheral Control functions ***********************************************/ |
778 | /* Peripheral Control functions ***********************************************/ |
| 782 | HAL_StatusTypeDef HAL_FLASHEx_OBErase(void); |
779 | HAL_StatusTypeDef HAL_FLASHEx_OBErase(void); |
| 783 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); |
780 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); |
| 784 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); |
781 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); |
| - | 782 | uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress); |
|
| 785 | /** |
783 | /** |
| 786 | * @} |
784 | * @} |
| 787 | */ |
785 | */ |
| 788 | 786 | ||
| 789 | /** |
787 | /** |