📄 stm32f10x_flash.s79
字号:
// 569 }
// 570 else
// 571 {
// 572 OB->RDP = RDP_Key;
// 573 }
// 574
// 575 /* Wait for last operation to be completed */
// 576 status = FLASH_WaitForLastOperation(EraseTimeout);
// 577
// 578 if(status != FLASH_BUSY)
// 579 {
// 580 /* if the program operation is completed, disable the OPTPG Bit */
// 581 FLASH->CR &= CR_OPTPG_Reset;
// 582 }
// 583 }
// 584 else
// 585 {
// 586 if(status != FLASH_BUSY)
// 587 {
// 588 /* Disable the OPTER Bit */
// 589 FLASH->CR &= CR_OPTER_Reset;
// 590 }
// 591 }
// 592 }
// 593 /* Return the protection operation Status */
// 594 return status;
// 595 }
// 596
// 597 /*******************************************************************************
// 598 * Function Name : FLASH_UserOptionByteConfig
// 599 * Description : Programs the FLASH User Option Byte: IWDG_SW / RST_STOP /
// 600 * RST_STDBY.
// 601 * Input : - OB_IWDG: Selects the IWDG mode
// 602 * This parameter can be one of the following values:
// 603 * - OB_IWDG_SW: Software IWDG selected
// 604 * - OB_IWDG_HW: Hardware IWDG selected
// 605 * - OB_STOP: Reset event when entering STOP mode.
// 606 * This parameter can be one of the following values:
// 607 * - OB_STOP_NoRST: No reset generated when entering in STOP
// 608 * - OB_STOP_RST: Reset generated when entering in STOP
// 609 * - OB_STDBY: Reset event when entering Standby mode.
// 610 * This parameter can be one of the following values:
// 611 * - OB_STDBY_NoRST: No reset generated when entering in STANDBY
// 612 * - OB_STDBY_RST: Reset generated when entering in STANDBY
// 613 * Output : None
// 614 * Return : FLASH Status: The returned value can be: FLASH_BUSY,
// 615 * FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or
// 616 * FLASH_TIMEOUT.
// 617 *******************************************************************************/
// 618 FLASH_Status FLASH_UserOptionByteConfig(u16 OB_IWDG, u16 OB_STOP, u16 OB_STDBY)
// 619 {
// 620 FLASH_Status status = FLASH_COMPLETE;
// 621
// 622 /* Check the parameters */
// 623 assert_param(IS_OB_IWDG_SOURCE(OB_IWDG));
// 624 assert_param(IS_OB_STOP_SOURCE(OB_STOP));
// 625 assert_param(IS_OB_STDBY_SOURCE(OB_STDBY));
// 626
// 627 /* Authorize the small information block programming */
// 628 FLASH->OPTKEYR = FLASH_KEY1;
// 629 FLASH->OPTKEYR = FLASH_KEY2;
// 630
// 631 /* Wait for last operation to be completed */
// 632 status = FLASH_WaitForLastOperation(ProgramTimeout);
// 633
// 634 if(status == FLASH_COMPLETE)
// 635 {
// 636 /* Enable the Option Bytes Programming operation */
// 637 FLASH->CR |= CR_OPTPG_Set;
// 638
// 639 OB->USER = ( OB_IWDG | OB_STOP |OB_STDBY) | (u16)0xF8;
// 640
// 641 /* Wait for last operation to be completed */
// 642 status = FLASH_WaitForLastOperation(ProgramTimeout);
// 643
// 644 if(status != FLASH_BUSY)
// 645 {
// 646 /* if the program operation is completed, disable the OPTPG Bit */
// 647 FLASH->CR &= CR_OPTPG_Reset;
// 648 }
// 649 }
// 650 /* Return the Option Byte program Status */
// 651 return status;
// 652 }
// 653
// 654 /*******************************************************************************
// 655 * Function Name : FLASH_GetUserOptionByte
// 656 * Description : Returns the FLASH User Option Bytes values.
// 657 * Input : None
// 658 * Output : None
// 659 * Return : The FLASH User Option Bytes values:IWDG_SW(Bit0), RST_STOP(Bit1)
// 660 * and RST_STDBY(Bit2).
// 661 *******************************************************************************/
// 662 u32 FLASH_GetUserOptionByte(void)
// 663 {
// 664 /* Return the User Option Byte */
// 665 return (u32)(FLASH->OBR >> 2);
// 666 }
// 667
// 668 /*******************************************************************************
// 669 * Function Name : FLASH_GetWriteProtectionOptionByte
// 670 * Description : Returns the FLASH Write Protection Option Bytes Register value.
// 671 * Input : None
// 672 * Output : None
// 673 * Return : The FLASH Write Protection Option Bytes Register value
// 674 *******************************************************************************/
// 675 u32 FLASH_GetWriteProtectionOptionByte(void)
// 676 {
// 677 /* Return the Falsh write protection Register value */
// 678 return (u32)(FLASH->WRPR);
// 679 }
// 680
// 681 /*******************************************************************************
// 682 * Function Name : FLASH_GetReadOutProtectionStatus
// 683 * Description : Checks whether the FLASH Read Out Protection Status is set
// 684 * or not.
// 685 * Input : None
// 686 * Output : None
// 687 * Return : FLASH ReadOut Protection Status(SET or RESET)
// 688 *******************************************************************************/
// 689 FlagStatus FLASH_GetReadOutProtectionStatus(void)
// 690 {
// 691 FlagStatus readoutstatus = RESET;
// 692
// 693 if ((FLASH->OBR & RDPRT_Mask) != (u32)RESET)
// 694 {
// 695 readoutstatus = SET;
// 696 }
// 697 else
// 698 {
// 699 readoutstatus = RESET;
// 700 }
// 701 return readoutstatus;
// 702 }
// 703
// 704 /*******************************************************************************
// 705 * Function Name : FLASH_GetPrefetchBufferStatus
// 706 * Description : Checks whether the FLASH Prefetch Buffer status is set or not.
// 707 * Input : None
// 708 * Output : None
// 709 * Return : FLASH Prefetch Buffer Status (SET or RESET).
// 710 *******************************************************************************/
// 711 FlagStatus FLASH_GetPrefetchBufferStatus(void)
// 712 {
// 713 FlagStatus bitstatus = RESET;
// 714
// 715 if ((FLASH->ACR & ACR_PRFTBS_Mask) != (u32)RESET)
// 716 {
// 717 bitstatus = SET;
// 718 }
// 719 else
// 720 {
// 721 bitstatus = RESET;
// 722 }
// 723 /* Return the new state of FLASH Prefetch Buffer Status (SET or RESET) */
// 724 return bitstatus;
// 725 }
// 726
// 727 /*******************************************************************************
// 728 * Function Name : FLASH_ITConfig
// 729 * Description : Enables or disables the specified FLASH interrupts.
// 730 * Input : - FLASH_IT: specifies the FLASH interrupt sources to be
// 731 * enabled or disabled.
// 732 * This parameter can be any combination of the following values:
// 733 * - FLASH_IT_ERROR: FLASH Error Interrupt
// 734 * - FLASH_IT_EOP: FLASH end of operation Interrupt
// 735 * Output : None
// 736 * Return : None
// 737 *******************************************************************************/
// 738 void FLASH_ITConfig(u16 FLASH_IT, FunctionalState NewState)
// 739 {
// 740 /* Check the parameters */
// 741 assert_param(IS_FLASH_IT(FLASH_IT));
// 742 assert_param(IS_FUNCTIONAL_STATE(NewState));
// 743
// 744 if(NewState != DISABLE)
// 745 {
// 746 /* Enable the interrupt sources */
// 747 FLASH->CR |= FLASH_IT;
// 748 }
// 749 else
// 750 {
// 751 /* Disable the interrupt sources */
// 752 FLASH->CR &= ~(u32)FLASH_IT;
// 753 }
// 754 }
// 755
// 756 /*******************************************************************************
// 757 * Function Name : FLASH_GetFlagStatus
// 758 * Description : Checks whether the specified FLASH flag is set or not.
// 759 * Input : - FLASH_FLAG: specifies the FLASH flag to check.
// 760 * This parameter can be one of the following values:
// 761 * - FLASH_FLAG_BSY: FLASH Busy flag
// 762 * - FLASH_FLAG_PGERR: FLASH Program error flag
// 763 * - FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
// 764 * - FLASH_FLAG_EOP: FLASH End of Operation flag
// 765 * - FLASH_FLAG_OPTERR: FLASH Option Byte error flag
// 766 * Output : None
// 767 * Return : The new state of FLASH_FLAG (SET or RESET).
// 768 *******************************************************************************/
// 769 FlagStatus FLASH_GetFlagStatus(u16 FLASH_FLAG)
// 770 {
// 771 FlagStatus bitstatus = RESET;
// 772
// 773 /* Check the parameters */
// 774 assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
// 775
// 776 if(FLASH_FLAG == FLASH_FLAG_OPTERR)
// 777 {
// 778 if((FLASH->OBR & FLASH_FLAG_OPTERR) != (u32)RESET)
// 779 {
// 780 bitstatus = SET;
// 781 }
// 782 else
// 783 {
// 784 bitstatus = RESET;
// 785 }
// 786 }
// 787 else
// 788 {
// 789 if((FLASH->SR & FLASH_FLAG) != (u32)RESET)
// 790 {
// 791 bitstatus = SET;
// 792 }
// 793 else
// 794 {
// 795 bitstatus = RESET;
// 796 }
// 797 }
// 798 /* Return the new state of FLASH_FLAG (SET or RESET) */
// 799 return bitstatus;
// 800 }
// 801
// 802 /*******************************************************************************
// 803 * Function Name : FLASH_ClearFlag
// 804 * Description : Clears the FLASH抯 pending flags.
// 805 * Input : - FLASH_FLAG: specifies the FLASH flags to clear.
// 806 * This parameter can be any combination of the following values:
// 807 * - FLASH_FLAG_BSY: FLASH Busy flag
// 808 * - FLASH_FLAG_PGERR: FLASH Program error flag
// 809 * - FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
// 810 * - FLASH_FLAG_EOP: FLASH End of Operation flag
// 811 * Output : None
// 812 * Return : None
// 813 *******************************************************************************/
// 814 void FLASH_ClearFlag(u16 FLASH_FLAG)
// 815 {
// 816 /* Check the parameters */
// 817 assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)) ;
// 818
// 819 /* Clear the flags */
// 820 FLASH->SR = FLASH_FLAG;
// 821 }
// 822
// 823 /*******************************************************************************
// 824 * Function Name : FLASH_GetStatus
// 825 * Description : Returns the FLASH Status.
// 826 * Input : None
// 827 * Output : None
// 828 * Return : FLASH Status: The returned value can be: FLASH_BUSY,
// 829 * FLASH_ERROR_PG, FLASH_ERROR_WRP or FLASH_COMPLETE
// 830 *******************************************************************************/
// 831 FLASH_Status FLASH_GetStatus(void)
// 832 {
// 833 FLASH_Status flashstatus = FLASH_COMPLETE;
// 834
// 835 if((FLASH->SR & FLASH_FLAG_BSY) == FLASH_FLAG_BSY)
// 836 {
// 837 flashstatus = FLASH_BUSY;
// 838 }
// 839 else
// 840 {
// 841 if(FLASH->SR & FLASH_FLAG_PGERR)
// 842 {
// 843 flashstatus = FLASH_ERROR_PG;
// 844 }
// 845 else
// 846 {
// 847 if(FLASH->SR & FLASH_FLAG_WRPRTERR)
// 848 {
// 849 flashstatus = FLASH_ERROR_WRP;
// 850 }
// 851 else
// 852 {
// 853 flashstatus = FLASH_COMPLETE;
// 854 }
// 855 }
// 856 }
// 857 /* Return the Flash Status */
// 858 return flashstatus;
// 859 }
// 860
// 861 /*******************************************************************************
// 862 * Function Name : FLASH_WaitForLastOperation
// 863 * Description : Waits for a Flash operation to complete or a TIMEOUT to occur.
// 864 * Input : - Timeout: FLASH progamming Timeout
// 865 * Output : None
// 866 * Return : FLASH Status: The returned value can be: FLASH_BUSY,
// 867 * FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or
// 868 * FLASH_TIMEOUT.
// 869 *******************************************************************************/
// 870 FLASH_Status FLASH_WaitForLastOperation(u32 Timeout)
// 871 {
// 872 FLASH_Status status = FLASH_COMPLETE;
// 873
// 874 /* Check for the Flash Status */
// 875 status = FLASH_GetStatus();
// 876
// 877 /* Wait for a Flash operation to complete or a TIMEOUT to occur */
// 878 while((status == FLASH_BUSY) && (Timeout != 0x00))
// 879 {
// 880 delay();
// 881 status = FLASH_GetStatus();
// 882 Timeout--;
// 883 }
// 884
// 885 if(Timeout == 0x00 )
// 886 {
// 887 status = FLASH_TIMEOUT;
// 888 }
// 889
// 890 /* Return the operation status */
// 891 return status;
// 892 }
// 893
// 894 /*******************************************************************************
// 895 * Function Name : delay
// 896 * Description : Inserts a time delay.
// 897 * Input : None
// 898 * Output : None
// 899 * Return : None
// 900 *******************************************************************************/
// 901 static void delay(void)
// 902 {
// 903 vu32 i = 0;
// 904
// 905 for(i = 0xFF; i != 0; i--)
// 906 {
// 907 }
// 908 }
// 909 #endif
// 910
// 911 /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
//
// 38 bytes in segment CODE
//
// 38 bytes of CODE memory
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -