⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_flash.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 4 页
字号:
    683          /*******************************************************************************
    684          * Function Name  : FLASH_GetReadOutProtectionStatus
    685          * Description    : Checks whether the FLASH Read Out Protection Status is set 
    686          *                  or not.
    687          * Input          : None
    688          * Output         : None
    689          * Return         : FLASH ReadOut Protection Status(SET or RESET)
    690          *******************************************************************************/
    691          FlagStatus FLASH_GetReadOutProtectionStatus(void)
    692          {
    693            FlagStatus readoutstatus = RESET;
    694          
    695            if ((FLASH->OBR & RDPRT_Mask) != (u32)RESET)
    696            {
    697              readoutstatus = SET;
    698            }
    699            else
    700            {
    701              readoutstatus = RESET;
    702            }
    703            return readoutstatus;
    704          }
    705          
    706          /*******************************************************************************
    707          * Function Name  : FLASH_GetPrefetchBufferStatus
    708          * Description    : Checks whether the FLASH Prefetch Buffer status is set or not.
    709          * Input          : None
    710          * Output         : None
    711          * Return         : FLASH Prefetch Buffer Status (SET or RESET).
    712          *******************************************************************************/
    713          FlagStatus FLASH_GetPrefetchBufferStatus(void)
    714          {
    715            FlagStatus bitstatus = RESET;
    716            
    717            if ((FLASH->ACR & ACR_PRFTBS_Mask) != (u32)RESET)
    718            {
    719              bitstatus = SET;
    720            }
    721            else
    722            {
    723              bitstatus = RESET;
    724            }
    725            /* Return the new state of FLASH Prefetch Buffer Status (SET or RESET) */
    726            return bitstatus; 
    727          }
    728          
    729          /*******************************************************************************
    730          * Function Name  : FLASH_ITConfig
    731          * Description    : Enables or disables the specified FLASH interrupts.
    732          * Input          : - FLASH_IT: specifies the FLASH interrupt sources to be 
    733          *                    enabled or disabled.
    734          *                    This parameter can be any combination of the following values:
    735          *                       - FLASH_IT_ERROR: FLASH Error Interrupt
    736          *                       - FLASH_IT_EOP: FLASH end of operation Interrupt
    737          * Output         : None
    738          * Return         : None 
    739          *******************************************************************************/
    740          void FLASH_ITConfig(u16 FLASH_IT, FunctionalState NewState)
    741          {
    742            /* Check the parameters */
    743            assert_param(IS_FLASH_IT(FLASH_IT)); 
    744            assert_param(IS_FUNCTIONAL_STATE(NewState));
    745          
    746            if(NewState != DISABLE)
    747            {
    748              /* Enable the interrupt sources */
    749              FLASH->CR |= FLASH_IT;
    750            }
    751            else
    752            {
    753              /* Disable the interrupt sources */
    754              FLASH->CR &= ~(u32)FLASH_IT;
    755            }
    756          }
    757          
    758          /*******************************************************************************
    759          * Function Name  : FLASH_GetFlagStatus
    760          * Description    : Checks whether the specified FLASH flag is set or not.
    761          * Input          : - FLASH_FLAG: specifies the FLASH flag to check.
    762          *                     This parameter can be one of the following values:
    763          *                    - FLASH_FLAG_BSY: FLASH Busy flag           
    764          *                    - FLASH_FLAG_PGERR: FLASH Program error flag       
    765          *                    - FLASH_FLAG_WRPRTERR: FLASH Write protected error flag      
    766          *                    - FLASH_FLAG_EOP: FLASH End of Operation flag           
    767          *                    - FLASH_FLAG_OPTERR:  FLASH Option Byte error flag     
    768          * Output         : None
    769          * Return         : The new state of FLASH_FLAG (SET or RESET).
    770          *******************************************************************************/
    771          FlagStatus FLASH_GetFlagStatus(u16 FLASH_FLAG)
    772          {
    773            FlagStatus bitstatus = RESET;
    774          
    775            /* Check the parameters */
    776            assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
    777          
    778            if(FLASH_FLAG == FLASH_FLAG_OPTERR) 
    779            {
    780              if((FLASH->OBR & FLASH_FLAG_OPTERR) != (u32)RESET)
    781              {
    782                bitstatus = SET;
    783              }
    784              else
    785              {
    786                bitstatus = RESET;
    787              }
    788            }
    789            else
    790            {
    791             if((FLASH->SR & FLASH_FLAG) != (u32)RESET)
    792              {
    793                bitstatus = SET;
    794              }
    795              else
    796              {
    797                bitstatus = RESET;
    798              }
    799            }
    800            /* Return the new state of FLASH_FLAG (SET or RESET) */
    801            return bitstatus;
    802          }
    803          
    804          /*******************************************************************************
    805          * Function Name  : FLASH_ClearFlag
    806          * Description    : Clears the FLASH抯 pending flags.
    807          * Input          : - FLASH_FLAG: specifies the FLASH flags to clear.
    808          *                    This parameter can be any combination of the following values:
    809          *                    - FLASH_FLAG_BSY: FLASH Busy flag           
    810          *                    - FLASH_FLAG_PGERR: FLASH Program error flag       
    811          *                    - FLASH_FLAG_WRPRTERR: FLASH Write protected error flag      
    812          *                    - FLASH_FLAG_EOP: FLASH End of Operation flag           
    813          * Output         : None
    814          * Return         : None
    815          *******************************************************************************/
    816          void FLASH_ClearFlag(u16 FLASH_FLAG)
    817          {
    818            /* Check the parameters */
    819            assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)) ;
    820            
    821            /* Clear the flags */
    822            FLASH->SR = FLASH_FLAG;
    823          }
    824          
    825          /*******************************************************************************
    826          * Function Name  : FLASH_GetStatus
    827          * Description    : Returns the FLASH Status.
    828          * Input          : None
    829          * Output         : None
    830          * Return         : FLASH Status: The returned value can be: FLASH_BUSY, 
    831          *                  FLASH_ERROR_PG, FLASH_ERROR_WRP or FLASH_COMPLETE
    832          *******************************************************************************/
    833          FLASH_Status FLASH_GetStatus(void)
    834          {
    835            FLASH_Status flashstatus = FLASH_COMPLETE;
    836            
    837            if((FLASH->SR & FLASH_FLAG_BSY) == FLASH_FLAG_BSY) 
    838            {
    839              flashstatus = FLASH_BUSY;
    840            }
    841            else 
    842            {  
    843              if(FLASH->SR & FLASH_FLAG_PGERR)
    844              { 
    845                flashstatus = FLASH_ERROR_PG;
    846              }
    847              else 
    848              {
    849                if(FLASH->SR & FLASH_FLAG_WRPRTERR)
    850                {
    851                  flashstatus = FLASH_ERROR_WRP;
    852                }
    853                else
    854                {
    855                  flashstatus = FLASH_COMPLETE;
    856                }
    857              }
    858            }
    859            /* Return the Flash Status */
    860            return flashstatus;
    861          }
    862          
    863          /*******************************************************************************
    864          * Function Name  : FLASH_WaitForLastOperation
    865          * Description    : Waits for a Flash operation to complete or a TIMEOUT to occur.
    866          * Input          : - Timeout: FLASH progamming Timeout
    867          * Output         : None
    868          * Return         : FLASH Status: The returned value can be: FLASH_BUSY, 
    869          *                  FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or 
    870          *                  FLASH_TIMEOUT.
    871          *******************************************************************************/
    872          FLASH_Status FLASH_WaitForLastOperation(u32 Timeout)
    873          { 
    874            FLASH_Status status = FLASH_COMPLETE;
    875             
    876            /* Check for the Flash Status */
    877            status = FLASH_GetStatus();
    878          
    879            /* Wait for a Flash operation to complete or a TIMEOUT to occur */
    880            while((status == FLASH_BUSY) && (Timeout != 0x00))
    881            {
    882              delay();
    883              status = FLASH_GetStatus();
    884              Timeout--;
    885            }
    886          
    887            if(Timeout == 0x00 )
    888            {
    889              status = FLASH_TIMEOUT;
    890            }
    891          
    892            /* Return the operation status */
    893            return status;
    894          }
    895          
    896          /*******************************************************************************
    897          * Function Name  : delay
    898          * Description    : Inserts a time delay.
    899          * Input          : None
    900          * Output         : None
    901          * Return         : None
    902          *******************************************************************************/
    903          static void delay(void)
    904          {
    905            vu32 i = 0;
    906          
    907            for(i = 0xFF; i != 0; i--)
    908            {
    909            }
    910          }
    911          #endif
    912          
    913          /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/

   Maximum stack usage in bytes:

     Function                 CSTACK
     --------                 ------
     FLASH_HalfCycleAccessCmd     0
     FLASH_PrefetchBufferCmd      0
     FLASH_SetLatency             0


   Segment part sizes:

     Function/Label           Bytes
     --------------           -----
     FLASH_SetLatency           18
     FLASH_HalfCycleAccessCmd   18
     FLASH_PrefetchBufferCmd    18
     ??DataTable2                4

 
 58 bytes in segment CODE
 
 58 bytes of CODE memory

Errors: none
Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -