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

📄 stm32f10x_flash.lst

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

   Maximum stack usage in bytes:

     Function                 .cstack
     --------                 -------
     FLASH_HalfCycleAccessCmd      0
     FLASH_PrefetchBufferCmd       0
     FLASH_SetLatency              0


   Section sizes:

     Function/Label           Bytes
     --------------           -----
     FLASH_SetLatency           24
     FLASH_HalfCycleAccessCmd   24
     FLASH_PrefetchBufferCmd    24
     ??DataTable11               4

 
 76 bytes in section .XML
 
 76 bytes of CODE memory

Errors: none
Warnings: none

⌨️ 快捷键说明

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