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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? c2312.c

?? flash programer driver
?? C
?? 第 1 頁 / 共 5 頁
字號:
   ReturnType  rRetVal; /* Holds the return value */
   uCPUBusType ucProtStatus; /* Holds the protection status */

   /* Step 1: Check that the block number exists */
   if ( ublBlockNr >= NUM_BLOCKS )
      return Flash_BlockNrInvalid;

   /* Step 2: Send the AutoSelect command */
   FlashWrite( ConvAddr(0x00555), (uCPUBusType)CMD(0x00AA) ); /* 1st Cycle */
   FlashWrite( ConvAddr(0x002AA), (uCPUBusType)CMD(0x0055) ); /* 2nd Cycle */
   FlashWrite( BlockOffset[ublBlockNr] + ConvAddr(0x00555), (uCPUBusType)CMD(0x0090) ); /* 3rd Cycle */

   /* Step 3: Read Protection Status */
   ucProtStatus=FlashRead( BlockOffset[ublBlockNr] + ShAddr(0x02));
   if ( (ucProtStatus & CMD(0x00ff)) == 0)
      rRetVal = Flash_BlockUnprotected;
   else if ( (ucProtStatus & CMD(0x00ff)) == CMD(0x0001) )
      rRetVal = Flash_BlockProtected;
      else
         rRetVal = Flash_BlockProtectionUnclear;

   /* Step 4: Return to Read mode */
   FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
   return rRetVal;

} /* EndFunction FlashCheckBlockProtection */





/******************************************************************************* 
Function:      ReturnType FlashCheckCompatibility( void ) 
Arguments:     None
Return Values: The function returns the following conditions:  
   Flash_Success
   Flash_WrongType
Description:   This function checks the compatibility of the device with
   the SW driver.
 
Pseudo Code: 
   Step 1:  Read the Device Id 
   Step 2:  Read the Manufacturer Code
   Step 3:  Check the results
*******************************************************************************/ 
ReturnType FlashCheckCompatibility( void ) { 
   ReturnType  rRetVal, rCheck1, rCheck2; /* Holds the results of the Read operations */ 
   uCPUBusType ucDeviceId, ucManufacturerCode; /* Holds the values read */ 

   rRetVal =  Flash_WrongType;

   /* Step 1:  Read the Device Id */
   rCheck1 =  FlashReadDeviceId( &ucDeviceId ); 

   /* Step 2:  Read the ManufactureCode */
   rCheck2 =  FlashReadManufacturerCode( &ucManufacturerCode ); 

   /* Step 3:  Check the results */
   if (    (rCheck1 == Flash_Success) && (rCheck2 == Flash_Success)   
      && (ucDeviceId == EXPECTED_DEVICE)  && (ucManufacturerCode == MANUFACTURER_ST)  )  
      rRetVal = Flash_Success; 
   return rRetVal; 
} /* EndFunction FlashCheckCompatibility */ 





/*******************************************************************************
Function:     ReturnType FlashCheckBlockEraseError( uBlockType  ublBlock )
Arguments:    ublBlock specifies the block to be checked
Return Value: 
         Flash_Success
         FlashBlockEraseFailed

Description:  This function can only be called after an erase operation which
   has failed the FlashDataPoll() function. It must be called before the reset
   is made. The function reads bit 2 of the Status Register to check if the block
   has erased successfully or not. Successfully erased blocks should have DQ2
   set to 1 following the erase. Failed blocks will have DQ2 toggle.

Pseudo Code:
   Step 1: Read DQ2 in the block twice
   Step 2: If they are both the same then return Flash_Success
   Step 3: Else return Flash_BlockEraseFailed
*******************************************************************************/
static ReturnType FlashCheckBlockEraseError( uBlockType ublBlock ){

   uCPUBusType ucFirstRead, ucSecondRead; /* Two variables used for clarity*/
   
   /* Step 1: Read DQ2 in the block twice */
   ucFirstRead  = FlashRead( BlockOffset[ublBlock] ) & CMD(0x0004);
   ucSecondRead = FlashRead( BlockOffset[ublBlock] ) & CMD(0x0004);
   /* Step 2: If they are the same return Flash_Success */
   if( ucFirstRead == ucSecondRead )
      return Flash_Success;
   /* Step 3: Else return Flash_BlockEraseFailed */
   return Flash_BlockEraseFailed;
} /*EndFunction FlashCheckBlockEraseError*/





/*******************************************************************************
Function:     ReturnType FlashChipErase( ReturnType *rpResults )
Arguments:    rpResults is a pointer to an array where the results will be 
   stored. If rpResults == NULL then no results have been stored.
Return Value: The function returns the following conditions:
   Flash_Success              
   Flash_ChipEraseFailed

Description: The function can be used to erase the whole flash chip. Each Block
   is erased in turn. The function only returns when all of the Blocks have
   been erased. If rpResults is not NULL, it will be filled with the error
   conditions for each block.

Pseudo Code:
   Step 1: Check if some blocks are protected
   Step 2: Send Chip Erase Command
   Step 3: Check for blocks erased correctly
   Step 4: Return to Read mode (if an error occurred)
*******************************************************************************/
ReturnType FlashChipErase( ReturnType *rpResults ) {

   ReturnType rRetVal = Flash_Success, /* Holds return value: optimistic initially! */
              rProtStatus; /* Holds the protection status of each block */
   uBlockType ublCurBlock; /* Used to tack current block in a range */

   /* Step 1: Check if some blocks are protected */
   for (ublCurBlock=0; ublCurBlock < NUM_BLOCKS;ublCurBlock++) {
      if (FlashCheckBlockProtection(ublCurBlock)==Flash_BlockProtected) {
         rProtStatus = Flash_BlockProtected;
	 rRetVal = Flash_ChipEraseFailed;
      } else
         rProtStatus =Flash_Success;
      if (rpResults != NULL)
         rpResults[ublCurBlock] = rProtStatus;
   } /* Next ublCurBlock */

   /* Step 2: Send Chip Erase Command */
   FlashWrite( ConvAddr(0x00555), (uCPUBusType)CMD(0x00AA) );
   FlashWrite( ConvAddr(0x002AA), (uCPUBusType)CMD(0x0055) );
   FlashWrite( ConvAddr(0x00555), (uCPUBusType)CMD(0x0080) );
   FlashWrite( ConvAddr(0x00555), (uCPUBusType)CMD(0x00AA) );
   FlashWrite( ConvAddr(0x002AA), (uCPUBusType)CMD(0x0055) );
   FlashWrite( ConvAddr(0x00555), (uCPUBusType)CMD(0x0010) );

   /* Step 3: Check for blocks erased correctly */
   if( FlashDataToggle(ANY_ADDR)!=Flash_Success){
      rRetVal= Flash_ChipEraseFailed;
      if (rpResults != NULL){
         for (ublCurBlock=0;ublCurBlock < NUM_BLOCKS;ublCurBlock++)
            if (rpResults[ublCurBlock]==Flash_Success)
               rpResults[ublCurBlock] = FlashCheckBlockEraseError(ublCurBlock);
      } /* EndIf */
         /* Step 4: Return to Read mode (if an error occurred) */
         FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
   } /* EndIf */
   return rRetVal;

} /* EndFunction FlashChipErase */





/*******************************************************************************
Function:     ReturnType FlashChipUnprotect( ReturnType *rpResults )
Arguments:    rpResults, if not NULL, it contains the status of every block.
              This device does not support this functionality. If rpResults == NULL
              then no results are stored. Otherwise the Flash_NoInformationAvailable
              is written to the array.

Return Value: The function returns the following conditions:  
   Flash_Success
   Flash_ChipUnprotectFailed

Description:  This function unprotects the whole flash chip implementing the
              In-System Unprotection procedure (see the device datasheet).

Pseudo Code:
   Step 1: filling of rpResults
   Step 2: protect all blocks
   Step 3: setup phase
   Step 4: unprotect phase
   Step 5: verify phase
   Step 6: if verified and the current block isn't last block, increment current
           block number and repeat from step 3; else return Flash_Success
   Step 7: if not verified and if attempts number is < 1000, repeat from step 2,
   	   else return Flash_ChipUnprotectFailed

*******************************************************************************/
ReturnType FlashChipUnprotect( ReturnType *rpResults ) {

   uBlockType ublCurBlockNr;
   uCPUBusType ucReadData;
   word wAttempt; 
   udword udAddrOff,i;

   /* Step 1: filling of rpResults */
   if (rpResults !=NULL) {
      for (ublCurBlockNr=0; ublCurBlockNr<NUM_BLOCKS; ublCurBlockNr++)
         rpResults[ublCurBlockNr]=Flash_NoInformationAvailable;
   } /* EndIf */

   /* Step 2: protect all blocks */
  i = 0;
   for (ublCurBlockNr=0; ublCurBlockNr<NUM_BLOCKS; ublCurBlockNr+=BlockGroupOffset[i++]){
      if (FlashGroupProtect(ublCurBlockNr) == Flash_GroupProtectFailed)
         return  Flash_ChipUnprotectFailed;
   } /* Next ublCurBlockNr */

   /* Reset command */
   FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
   wAttempt = 0;
   ublCurBlockNr = 0;
   udAddrOff = ANY_ADDR & 0x11111100;
    i = 0;

   /* Step 3: setup phase */
   FlashWrite( (udAddrOff | ShAddr(0x00000002)), CMD(0x0060) );
   do {
      FlashWrite( (udAddrOff | ShAddr(0x00000042)), CMD(0x0060) );
      FlashPause(10000);
      do {      
         /* Step 4: unprotect phase */
	 FlashWrite( (BlockOffset[ublCurBlockNr] | ShAddr(0x00000042)), CMD(0x0040) );
	 FlashPause(4);
	 ucReadData = FlashRead( BlockOffset[ublCurBlockNr] | ShAddr(0x00000042) );  
	 /* Step 5: verify phase */
	 if ( ucReadData == CMD(0x0000) ){
	    /* Step 6: if verified, if the current block isn't last block increment current block 
   	       number and repeat step from 3 else return Flash_Success */
            ublCurBlockNr += BlockGroupOffset[i++]; /* Next group */
            if ( ublCurBlockNr < NUM_BLOCKS ) {	
                continue;
            }
            else {
               /* Reset command  */
	           FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
	           return Flash_Success;
            } 
	    } /* EndIf */
         else
            break;
      } while (1);
      /* Step 7: if not verified and if attempts number is < 1000, repeat step from 2,
                 else return Flash_ChipUnprotectFailed */
   } while (++wAttempt < 1000 );  

   FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
   return Flash_ChipUnprotectFailed;

} /* EndFunction FlashChipUnprotect */





/*******************************************************************************
Function:     ReturnType FlashDataToggle( void )
Arguments:    none
Return Value: The function returns Flash_Success if the Program/Erase Controller
   is successful or Flash_SpecificError if there is a problem.In this case
   the field eiErrorInfo.sprRetVal will be filled with FlashSpec_ToggleFailed value.
   If the Program/Erase Controller do not finish before time-out expired
   the function return Flash_OperationTimeout.

Description:  The function is used to monitor the Program/Erase Controller during
   erase or program operations. It returns when the Program/Erase Controller has
   completed. In the Data Sheets, the Data Toggle Flow Chart shows the operation
   of the function.

Pseudo Code:
   Step 1: Read DQ5 and DQ6 (into word)
   Step 2: Read DQ6 (into  another a word)
   Step 3: If DQ6 did not toggle between the two reads then return Flash_Success
   Step 4: Else if DQ5 is zero then operation is not yet complete, goto 1
   Step 5: Else (DQ5 != 0), read DQ6 again
   Step 6: If DQ6 did not toggle between the last two reads then return 
            Flash_Success
   Step 7: Else return Flash_ToggleFail
*******************************************************************************/
static ReturnType FlashDataToggle( udword udAddrOff ){

   uCPUBusType ucVal1, ucVal2; /* hold values read from any address offset within 
                                  the Flash Memory */

   FlashTimeOut(0); /* Initialize TimeOut Counter */     
   while(FlashTimeOut(120) != Flash_OperationTimeOut) {   
      /* TimeOut: If, for some reason, the hardware fails then this
         loop exit and the function return flash_OperationTimeOut.  */
            
      /* Step 1: Read DQ5 and DQ6 (into  word) */
      ucVal2 = FlashRead( udAddrOff); /* Read DQ5 and DQ6 from the Flash (any 
                                         address) */

      /* Step 2: Read DQ6 (into another a word) */
      ucVal1 = FlashRead( udAddrOff); /* Read DQ6 from the Flash (any address) */


      /* Step 3: If DQ6 did not toggle between the two reads then return 
                 Flash_Success */
      if( (ucVal1&CMD(0x0040)) == (ucVal2&CMD(0x0040)) ) /* DQ6 == NO Toggle */
         return Flash_Success;

      /* Step 4: Else if DQ5 is zero then operation is not yet complete */
      if( (ucVal2&CMD(0x0020)) != CMD(0x0020) )
         continue;

      /* Step 5: Else (DQ5 == 1), read DQ6 twice */
      ucVal1 = FlashRead(udAddrOff); /* Read DQ6 from the Flash (any address) */
      ucVal2 = FlashRead(udAddrOff);
      /* Step 6: If DQ6 did not toggle between the last two reads then
                 return Flash_Success */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三级| 亚洲女女做受ⅹxx高潮| 欧美中文一区二区三区| 免费成人在线观看| 久久久精品一品道一区| 99久久99久久精品国产片果冻| 美女爽到高潮91| 亚洲国产成人av| 午夜精品久久久久久久| 一区二区三区欧美日韩| 亚洲欧美一区二区在线观看| 中文字幕国产精品一区二区| 国产精品天美传媒沈樵| 国产亚洲精久久久久久| 久久久99久久| 欧美国产激情一区二区三区蜜月 | 国产精品高潮呻吟| 综合分类小说区另类春色亚洲小说欧美| 日韩欧美国产系列| 欧美性生活大片视频| 色婷婷精品大在线视频 | 国产在线一区二区| 国产精品99久久久久久久女警| 国产不卡一区视频| 成人性生交大片免费看在线播放 | 欧美xxxxxxxx| 中文字幕不卡在线播放| 欧美激情中文字幕| 亚洲精品一二三| 久久99久久99| 91成人在线精品| 欧美日韩一区二区电影| 久久久亚洲午夜电影| 亚洲一区二区三区四区在线免费观看 | 亚洲国产日韩a在线播放性色| 亚洲bt欧美bt精品| 美美哒免费高清在线观看视频一区二区| av资源站一区| 大白屁股一区二区视频| 91视视频在线直接观看在线看网页在线看| 色综合一个色综合| 欧美mv和日韩mv国产网站| 亚洲视频在线一区| 色菇凉天天综合网| 亚洲黄色小视频| 91年精品国产| 亚洲成人高清在线| 欧美高清视频一二三区| 日本成人在线不卡视频| 精品国产乱码久久久久久图片| 日韩av成人高清| 欧美精品一区男女天堂| 国产精品亚洲第一| 亚洲精选视频免费看| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲欧美日韩在线| 欧美一级艳片视频免费观看| 风流少妇一区二区| 亚洲国产综合91精品麻豆| 欧美一级一区二区| 国产不卡一区视频| 午夜电影一区二区三区| 亚洲国产高清不卡| 6080日韩午夜伦伦午夜伦| 福利电影一区二区| 免费精品视频最新在线| 亚洲欧美在线高清| 久久综合色天天久久综合图片| 99re8在线精品视频免费播放| 男男视频亚洲欧美| 一区二区欧美视频| 中文字幕在线一区二区三区| 7777精品伊人久久久大香线蕉完整版| 国产裸体歌舞团一区二区| 午夜精彩视频在线观看不卡| 1024成人网| 亚洲欧美二区三区| 国产精品久久毛片| 欧美国产1区2区| 久久伊人中文字幕| 久久精品一二三| 久久久另类综合| 国产欧美精品一区二区色综合 | 三级在线观看一区二区| 国产精品欧美一区喷水| 日本一区二区三区在线不卡| 久久久久久综合| 国产精品午夜久久| 樱花草国产18久久久久| 亚洲一二三区视频在线观看| 午夜成人免费视频| 亚洲国产精品一区二区www在线| 亚洲欧美怡红院| 亚洲一区二区四区蜜桃| 亚洲国产一区二区三区| 免费在线观看视频一区| 精品无码三级在线观看视频| 国产成人在线影院| 色婷婷激情久久| 日韩三级视频在线观看| 精品乱码亚洲一区二区不卡| 久久精品人人爽人人爽| 成人免费在线播放视频| 亚洲综合久久av| 国产一区二区在线免费观看| aaa欧美色吧激情视频| 日韩视频中午一区| 亚洲人成精品久久久久久| 水野朝阳av一区二区三区| 国产69精品一区二区亚洲孕妇| 欧美自拍丝袜亚洲| 国产精品成人午夜| 韩国成人在线视频| 欧美日本在线一区| 欧美高清一级片在线观看| 另类调教123区| 欧美视频在线一区二区三区 | 免费在线欧美视频| 在线免费观看一区| 国产精品久久一卡二卡| 国产美女精品在线| 精品久久久影院| 日韩一区精品视频| 欧美日韩一区成人| 国产一区二区视频在线| 亚洲一区二区精品久久av| 午夜精品影院在线观看| 成人免费va视频| 欧美国产精品中文字幕| 国产精品小仙女| 久久精品在线免费观看| 国产不卡视频一区| 中文字幕av资源一区| 成人精品亚洲人成在线| 久久精品男人天堂av| a亚洲天堂av| 亚洲午夜一二三区视频| 在线精品视频一区二区三四| 一区二区三区电影在线播| 欧美三级韩国三级日本三斤| 免费久久99精品国产| 久久精品男人的天堂| 色综合久久久久| 亚洲成人黄色影院| 久久久久久日产精品| 一本到不卡精品视频在线观看 | 豆国产96在线|亚洲| 国产精品国产三级国产a| 欧美在线影院一区二区| 日本不卡123| 亚洲人123区| 久久亚洲综合色一区二区三区| 色呦呦国产精品| 蜜桃在线一区二区三区| 亚洲免费色视频| 国产日产亚洲精品系列| 精品视频全国免费看| 成人app软件下载大全免费| 亚洲高清视频的网址| 中文字幕av资源一区| 日韩三级视频中文字幕| 一本一本久久a久久精品综合麻豆| 美女精品自拍一二三四| 一区二区三区免费网站| 国产精品久久网站| 国产性天天综合网| 91精品国产色综合久久不卡蜜臀| www.日本不卡| av一区二区三区四区| 国产精品亚洲综合一区在线观看| 日韩成人一区二区三区在线观看| 亚洲欧美综合在线精品| 国产精品视频九色porn| 国产亚洲人成网站| 国产日韩在线不卡| 中文字幕电影一区| 欧美国产乱子伦| 亚洲免费观看高清完整版在线观看 | 精品少妇一区二区三区在线播放| 欧美精品色综合| 欧美一级在线免费| 久久久久久毛片| 国产精品毛片高清在线完整版| 中文一区一区三区高中清不卡| 国产人成亚洲第一网站在线播放| 久久久综合视频| 国产精品久久久久久久久免费丝袜 | 亚洲尤物视频在线| 毛片不卡一区二区| 国产成人亚洲综合a∨婷婷图片| 成人国产精品免费观看| 在线亚洲人成电影网站色www| 欧美性感一区二区三区| 欧美一区三区四区| 国产精品美女一区二区三区| 亚洲国产视频网站| 成人妖精视频yjsp地址| 欧美一级日韩一级| 亚洲欧美经典视频| 国产精品一区2区|