亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stm32f10x_flash.c

?? STM32SDCardSourceCodeFATFS.rar
?? C
?? 第 1 頁 / 共 2 頁
字號:
/**
  ******************************************************************************
  * @file    stm32f10x_flash.c
  * @author  MCD Application Team
  * @version V3.1.2
  * @date    09/28/2009
  * @brief   This file provides all the FLASH firmware functions.
  ******************************************************************************
  * @copy
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
  */ 

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_flash.h"

/** @addtogroup STM32F10x_StdPeriph_Driver
  * @{
  */

/** @defgroup FLASH 
  * @brief FLASH driver modules
  * @{
  */ 

/** @defgroup FLASH_Private_TypesDefinitions
  * @{
  */

/**
  * @}
  */ 

/** @defgroup FLASH_Private_Defines
  * @{
  */ 

/* Flash Access Control Register bits */
#define ACR_LATENCY_Mask         ((uint32_t)0x00000038)
#define ACR_HLFCYA_Mask          ((uint32_t)0xFFFFFFF7)
#define ACR_PRFTBE_Mask          ((uint32_t)0xFFFFFFEF)

/* Flash Access Control Register bits */
#define ACR_PRFTBS_Mask          ((uint32_t)0x00000020) 

/* Flash Control Register bits */
#define CR_PG_Set                ((uint32_t)0x00000001)
#define CR_PG_Reset              ((uint32_t)0x00001FFE) 
#define CR_PER_Set               ((uint32_t)0x00000002)
#define CR_PER_Reset             ((uint32_t)0x00001FFD)
#define CR_MER_Set               ((uint32_t)0x00000004)
#define CR_MER_Reset             ((uint32_t)0x00001FFB)
#define CR_OPTPG_Set             ((uint32_t)0x00000010)
#define CR_OPTPG_Reset           ((uint32_t)0x00001FEF)
#define CR_OPTER_Set             ((uint32_t)0x00000020)
#define CR_OPTER_Reset           ((uint32_t)0x00001FDF)
#define CR_STRT_Set              ((uint32_t)0x00000040)
#define CR_LOCK_Set              ((uint32_t)0x00000080)

/* FLASH Mask */
#define RDPRT_Mask               ((uint32_t)0x00000002)
#define WRP0_Mask                ((uint32_t)0x000000FF)
#define WRP1_Mask                ((uint32_t)0x0000FF00)
#define WRP2_Mask                ((uint32_t)0x00FF0000)
#define WRP3_Mask                ((uint32_t)0xFF000000)

/* FLASH Keys */
#define RDP_Key                  ((uint16_t)0x00A5)
#define FLASH_KEY1               ((uint32_t)0x45670123)
#define FLASH_KEY2               ((uint32_t)0xCDEF89AB)

/* Delay definition */   
#define EraseTimeout             ((uint32_t)0x00000FFF)
#define ProgramTimeout           ((uint32_t)0x0000000F)

/**
  * @}
  */ 

/** @defgroup FLASH_Private_Macros
  * @{
  */

/**
  * @}
  */ 

/** @defgroup FLASH_Private_Variables
  * @{
  */

/**
  * @}
  */ 

/** @defgroup FLASH_Private_FunctionPrototypes
  * @{
  */

static void delay(void);
/**
  * @}
  */

/** @defgroup FLASH_Private_Functions
  * @{
  */

/**
  * @brief  Sets the code latency value.
  * @param  FLASH_Latency: specifies the FLASH Latency value.
  *   This parameter can be one of the following values:
  *     @arg FLASH_Latency_0: FLASH Zero Latency cycle
  *     @arg FLASH_Latency_1: FLASH One Latency cycle
  *     @arg FLASH_Latency_2: FLASH Two Latency cycles
  * @retval None
  */
void FLASH_SetLatency(uint32_t FLASH_Latency)
{
  uint32_t tmpreg = 0;
  
  /* Check the parameters */
  assert_param(IS_FLASH_LATENCY(FLASH_Latency));
  
  /* Read the ACR register */
  tmpreg = FLASH->ACR;  
  
  /* Sets the Latency value */
  tmpreg &= ACR_LATENCY_Mask;
  tmpreg |= FLASH_Latency;
  
  /* Write the ACR register */
  FLASH->ACR = tmpreg;
}

/**
  * @brief  Enables or disables the Half cycle flash access.
  * @param  FLASH_HalfCycleAccess: specifies the FLASH Half cycle Access mode.
  *   This parameter can be one of the following values:
  *     @arg FLASH_HalfCycleAccess_Enable: FLASH Half Cycle Enable
  *     @arg FLASH_HalfCycleAccess_Disable: FLASH Half Cycle Disable
  * @retval None
  */
void FLASH_HalfCycleAccessCmd(uint32_t FLASH_HalfCycleAccess)
{
  /* Check the parameters */
  assert_param(IS_FLASH_HALFCYCLEACCESS_STATE(FLASH_HalfCycleAccess));
  
  /* Enable or disable the Half cycle access */
  FLASH->ACR &= ACR_HLFCYA_Mask;
  FLASH->ACR |= FLASH_HalfCycleAccess;
}

/**
  * @brief  Enables or disables the Prefetch Buffer.
  * @param  FLASH_PrefetchBuffer: specifies the Prefetch buffer status.
  *   This parameter can be one of the following values:
  *     @arg FLASH_PrefetchBuffer_Enable: FLASH Prefetch Buffer Enable
  *     @arg FLASH_PrefetchBuffer_Disable: FLASH Prefetch Buffer Disable
  * @retval None
  */
void FLASH_PrefetchBufferCmd(uint32_t FLASH_PrefetchBuffer)
{
  /* Check the parameters */
  assert_param(IS_FLASH_PREFETCHBUFFER_STATE(FLASH_PrefetchBuffer));
  
  /* Enable or disable the Prefetch Buffer */
  FLASH->ACR &= ACR_PRFTBE_Mask;
  FLASH->ACR |= FLASH_PrefetchBuffer;
}

/**
  * @brief  Unlocks the FLASH Program Erase Controller.
  * @param  None
  * @retval None
  */
void FLASH_Unlock(void)
{
  /* Authorize the FPEC Access */
  FLASH->KEYR = FLASH_KEY1;
  FLASH->KEYR = FLASH_KEY2;
}

/**
  * @brief  Locks the FLASH Program Erase Controller.
  * @param  None
  * @retval None
  */
void FLASH_Lock(void)
{
  /* Set the Lock Bit to lock the FPEC and the FCR */
  FLASH->CR |= CR_LOCK_Set;
}

/**
  * @brief  Erases a specified FLASH page.
  * @param  Page_Address: The page address to be erased.
  * @retval FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
  */
FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
{
  FLASH_Status status = FLASH_COMPLETE;
  /* Check the parameters */
  assert_param(IS_FLASH_ADDRESS(Page_Address));
  /* Wait for last operation to be completed */
  status = FLASH_WaitForLastOperation(EraseTimeout);
  
  if(status == FLASH_COMPLETE)
  { 
    /* if the previous operation is completed, proceed to erase the page */
    FLASH->CR|= CR_PER_Set;
    FLASH->AR = Page_Address; 
    FLASH->CR|= CR_STRT_Set;
    
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(EraseTimeout);
    if(status != FLASH_TIMEOUT)
    {
      /* if the erase operation is completed, disable the PER Bit */
      FLASH->CR &= CR_PER_Reset;
    }
  }
  /* Return the Erase Status */
  return status;
}

/**
  * @brief  Erases all FLASH pages.
  * @param  None
  * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
  */
FLASH_Status FLASH_EraseAllPages(void)
{
  FLASH_Status status = FLASH_COMPLETE;
  /* Wait for last operation to be completed */
  status = FLASH_WaitForLastOperation(EraseTimeout);
  
  if(status == FLASH_COMPLETE)
  {
    /* if the previous operation is completed, proceed to erase all pages */
     FLASH->CR |= CR_MER_Set;
     FLASH->CR |= CR_STRT_Set;
    
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(EraseTimeout);
    if(status != FLASH_TIMEOUT)
    {
      /* if the erase operation is completed, disable the MER Bit */
      FLASH->CR &= CR_MER_Reset;
    }
  }	   
  /* Return the Erase Status */
  return status;
}

/**
  * @brief  Erases the FLASH option bytes.
  * @note   This functions erases all option bytes and then deactivates the Read
  *         protection. If the user needs to keep the Read protection activated,
  *         he has to enable it after this function call (using
  *         FLASH_ReadOutProtection function)
  * @param  None
  * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
  */
FLASH_Status FLASH_EraseOptionBytes(void)
{
  FLASH_Status status = FLASH_COMPLETE;
  
  /* Wait for last operation to be completed */
  status = FLASH_WaitForLastOperation(EraseTimeout);
  if(status == FLASH_COMPLETE)
  {
    /* Authorize the small information block programming */
    FLASH->OPTKEYR = FLASH_KEY1;
    FLASH->OPTKEYR = FLASH_KEY2;
    
    /* if the previous operation is completed, proceed to erase the option bytes */
    FLASH->CR |= CR_OPTER_Set;
    FLASH->CR |= CR_STRT_Set;
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(EraseTimeout);
    
    if(status == FLASH_COMPLETE)
    {
      /* if the erase operation is completed, disable the OPTER Bit */
      FLASH->CR &= CR_OPTER_Reset;
       
      /* Enable the Option Bytes Programming operation */
      FLASH->CR |= CR_OPTPG_Set;
      /* Disable the Read protection */
      OB->RDP= RDP_Key; 
      /* Wait for last operation to be completed */
      status = FLASH_WaitForLastOperation(ProgramTimeout);
 
      if(status != FLASH_TIMEOUT)
      {
        /* if the program operation is completed, disable the OPTPG Bit */
        FLASH->CR &= CR_OPTPG_Reset;
      }
    }
    else
    {
      if (status != FLASH_TIMEOUT)
      {
        /* Disable the OPTPG Bit */
        FLASH->CR &= CR_OPTPG_Reset;
      }
    }  
  }
  /* Return the erase status */
  return status;
}

/**
  * @brief  Programs a word at a specified address.
  * @param  Address: specifies the address to be programmed.
  * @param  Data: specifies the data to be programmed.
  * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. 
  */
FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
{
  FLASH_Status status = FLASH_COMPLETE;
  __IO uint32_t tmp = 0;

  /* Check the parameters */
  assert_param(IS_FLASH_ADDRESS(Address));
  /* Wait for last operation to be completed */
  status = FLASH_WaitForLastOperation(ProgramTimeout);
  
  if(status == FLASH_COMPLETE)
  {
    /* if the previous operation is completed, proceed to program the new first 
    half word */
    FLASH->CR |= CR_PG_Set;
  
    *(__IO uint16_t*)Address = (uint16_t)Data;
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(ProgramTimeout);
 
    if(status == FLASH_COMPLETE)
    {
      /* if the previous operation is completed, proceed to program the new second 
      half word */
      tmp = Address + 2;

      *(__IO uint16_t*) tmp = Data >> 16;
    
      /* Wait for last operation to be completed */
      status = FLASH_WaitForLastOperation(ProgramTimeout);
        
      if(status != FLASH_TIMEOUT)
      {
        /* Disable the PG Bit */
        FLASH->CR &= CR_PG_Reset;
      }
    }
    else
    {
      if (status != FLASH_TIMEOUT)
      {
        /* Disable the PG Bit */
        FLASH->CR &= CR_PG_Reset;
      }
     }
  }
  /* Return the Program Status */
  return status;
}

/**
  * @brief  Programs a half word at a specified address.
  * @param  Address: specifies the address to be programmed.
  * @param  Data: specifies the data to be programmed.
  * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. 
  */
FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
{
  FLASH_Status status = FLASH_COMPLETE;
  /* Check the parameters */
  assert_param(IS_FLASH_ADDRESS(Address));
  /* Wait for last operation to be completed */
  status = FLASH_WaitForLastOperation(ProgramTimeout);
  
  if(status == FLASH_COMPLETE)
  {
    /* if the previous operation is completed, proceed to program the new data */
    FLASH->CR |= CR_PG_Set;
  
    *(__IO uint16_t*)Address = Data;
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(ProgramTimeout);
    if(status != FLASH_TIMEOUT)
    {
      /* if the program operation is completed, disable the PG Bit */
      FLASH->CR &= CR_PG_Reset;
    }
  } 
  /* Return the Program Status */
  return status;
}

/**
  * @brief  Programs a half word at a specified Option Byte Data address.
  * @param  Address: specifies the address to be programmed.
  *   This parameter can be 0x1FFFF804 or 0x1FFFF806. 
  * @param  Data: specifies the data to be programmed.
  * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
  *   FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT. 
  */
FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
{
  FLASH_Status status = FLASH_COMPLETE;
  /* Check the parameters */
  assert_param(IS_OB_DATA_ADDRESS(Address));
  status = FLASH_WaitForLastOperation(ProgramTimeout);
  if(status == FLASH_COMPLETE)
  {
    /* Authorize the small information block programming */
    FLASH->OPTKEYR = FLASH_KEY1;
    FLASH->OPTKEYR = FLASH_KEY2;
    /* Enables the Option Bytes Programming operation */
    FLASH->CR |= CR_OPTPG_Set; 
    *(__IO uint16_t*)Address = Data;
    
    /* Wait for last operation to be completed */
    status = FLASH_WaitForLastOperation(ProgramTimeout);
    if(status != FLASH_TIMEOUT)
    {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久蜜桃一区二区| 欧美色爱综合网| 久久精品免费在线观看| 一区二区三区蜜桃网| 91传媒视频在线播放| 亚洲综合成人在线| 欧美日本韩国一区| 久久国产精品99精品国产 | 色婷婷久久综合| 一区二区三区在线观看欧美| 欧美亚洲日本一区| 首页亚洲欧美制服丝腿| 日韩午夜激情视频| 国产91对白在线观看九色| 亚洲人成影院在线观看| 欧美老肥妇做.爰bbww视频| 美女在线视频一区| 国产精品久久久久久亚洲伦| 日本韩国欧美一区| 美女视频免费一区| 国产精品传媒视频| 欧美日韩视频在线观看一区二区三区 | 秋霞影院一区二区| 国产欧美日韩在线看| 91色porny| 日日嗨av一区二区三区四区| 精品盗摄一区二区三区| 91美女福利视频| 日日摸夜夜添夜夜添精品视频| 久久精品一区蜜桃臀影院| 91国偷自产一区二区三区成为亚洲经典 | 国产欧美一区二区三区沐欲| 色综合视频在线观看| 男女男精品网站| 日韩伦理免费电影| 日韩美女一区二区三区| 日本乱码高清不卡字幕| 免费成人在线观看| 亚洲综合一区在线| 国产欧美一区二区在线观看| 欧美剧情片在线观看| 粉嫩av亚洲一区二区图片| 免费欧美日韩国产三级电影| 亚洲欧美一区二区在线观看| 精品国产a毛片| 欧美久久久影院| 91蜜桃传媒精品久久久一区二区| 久久99国产精品久久99果冻传媒| 一区二区三区免费| 国产精品国产三级国产aⅴ原创| 91精品国产综合久久精品app| av一二三不卡影片| 国产在线不卡一卡二卡三卡四卡| 亚洲成人av在线电影| 国产精品国产三级国产普通话99 | 亚洲一区二区在线观看视频| 精品国产区一区| 91麻豆精品国产91久久久久久久久 | 久久精品国产99久久6| 一区二区三区四区视频精品免费| 国产午夜亚洲精品理论片色戒| 欧美日韩不卡视频| 欧美亚洲高清一区二区三区不卡| 9i看片成人免费高清| 国产一区二区免费在线| 免费成人美女在线观看.| 性欧美疯狂xxxxbbbb| 亚洲在线视频免费观看| 亚洲免费大片在线观看| 亚洲欧美国产77777| 最新热久久免费视频| 国产精品视频九色porn| 久久久久久久久免费| 久久综合九色综合欧美就去吻| 日韩欧美色综合| 欧美一级欧美三级在线观看| 7777精品伊人久久久大香线蕉的| 欧美性生活一区| 欧美日韩中文字幕一区| 欧美日韩一区小说| 制服.丝袜.亚洲.另类.中文 | 波多野结衣中文字幕一区| 国产激情一区二区三区四区| 国产精品一区二区视频| 成人永久免费视频| 91在线精品一区二区三区| av男人天堂一区| 欧美亚洲高清一区二区三区不卡| 欧美在线观看一区| 欧美日韩大陆在线| 精品久久人人做人人爰| 久久久久久久久久久久电影| 欧美激情综合五月色丁香| 国产精品久久久久久妇女6080| 综合激情网...| 亚洲午夜久久久| 免费一级片91| 福利视频网站一区二区三区| 北条麻妃一区二区三区| 91精彩视频在线| 日韩欧美国产电影| 国产片一区二区| 亚洲自拍偷拍欧美| 久久精品国内一区二区三区| 国产精品综合网| 一本在线高清不卡dvd| 欧美日韩视频在线第一区| 日韩视频免费观看高清完整版在线观看 | 国产91富婆露脸刺激对白| 91亚洲国产成人精品一区二区三| 欧美午夜精品免费| 欧美zozo另类异族| 亚洲欧洲日韩在线| 日韩黄色在线观看| 成人午夜电影久久影院| 欧美怡红院视频| 精品久久人人做人人爱| 成人免费在线视频| 免费久久99精品国产| 成人免费av网站| 91精品国产高清一区二区三区 | 日本高清不卡视频| 91麻豆精品91久久久久久清纯| 国产性天天综合网| 亚洲福利视频一区二区| 国产精品99久久久久久久女警| 色噜噜偷拍精品综合在线| 欧美成人乱码一区二区三区| 亚洲欧美日韩小说| 国产一区二区三区在线观看免费| 91久久线看在观草草青青| 国产欧美日韩综合精品一区二区| 亚洲国产综合人成综合网站| 国产精品亚洲一区二区三区在线| 在线看国产一区| 久久精品夜色噜噜亚洲aⅴ| 亚洲五月六月丁香激情| 懂色av中文字幕一区二区三区| 7777精品伊人久久久大香线蕉| 国产精品色呦呦| 久久se这里有精品| 欧美军同video69gay| 亚洲欧美日韩一区| 国产aⅴ综合色| 日韩一区二区三区免费观看| 亚洲黄色小视频| 成人sese在线| 欧美激情一区二区三区蜜桃视频| 日本美女一区二区| 欧美性大战久久久久久久 | 91黄色激情网站| 亚洲日本欧美天堂| 国产成人av一区二区| 精品黑人一区二区三区久久 | 欧美丝袜自拍制服另类| 国产精品无码永久免费888| 激情文学综合插| 欧美成人aa大片| 美脚の诱脚舐め脚责91| 欧美猛男gaygay网站| 亚洲综合丝袜美腿| 欧美在线综合视频| 亚洲一区二区在线免费观看视频 | 欧美伦理影视网| 亚洲综合在线视频| 欧美亚洲国产bt| 亚洲线精品一区二区三区| 欧美综合天天夜夜久久| 一卡二卡三卡日韩欧美| 欧洲av在线精品| 亚洲444eee在线观看| 欧美日韩一级视频| 蜜桃久久av一区| 久久精品亚洲一区二区三区浴池| 国产乱子伦一区二区三区国色天香| 欧美不卡一区二区| 国产精品一品视频| 国产精品国产三级国产普通话三级| 99精品欧美一区二区蜜桃免费 | 国产三级精品三级| 国产99精品视频| 日韩一区在线看| 欧美日韩精品专区| 久久成人18免费观看| 久久精品日产第一区二区三区高清版| 国产一区二区三区香蕉| 中文字幕av资源一区| 91老师国产黑色丝袜在线| 午夜视频一区二区| 日韩情涩欧美日韩视频| 在线电影欧美成精品| 日韩成人av影视| 久久久99精品免费观看不卡| caoporn国产一区二区| 亚洲一区二区欧美日韩| 日韩一区二区三区四区五区六区| 久久99久久久久久久久久久| 国产欧美一区二区精品仙草咪 | 成人激情电影免费在线观看| 亚洲欧洲韩国日本视频|