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

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

?? c2374.c

?? M29W320E flash驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
*******************************************************************************/
ReturnType FlashCheckBlockProtection( uBlockType ublBlockNr ) {
   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( 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(0x00000042)), 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( udword udAddrOff )
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) */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本欧美肥老太交大片| 自拍偷拍亚洲综合| 精品国精品国产尤物美女| 91国产免费看| 精品日韩欧美在线| 精品盗摄一区二区三区| 日韩午夜激情免费电影| 日韩一级视频免费观看在线| 日韩欧美高清dvd碟片| 国产日产欧美一区二区视频| 中文字幕久久午夜不卡| 亚洲天堂免费看| 成人午夜在线视频| 6080国产精品一区二区| 欧美激情一区在线| 国产精品久久综合| 亚洲超碰97人人做人人爱| 亚洲福中文字幕伊人影院| 久久99国产精品尤物| 91色.com| 国产精品久久久久婷婷| 日韩成人午夜电影| 国产成人无遮挡在线视频| 日本电影亚洲天堂一区| ●精品国产综合乱码久久久久 | 亚洲一区二区三区四区的| 国产黄人亚洲片| 欧美一区二区三区在线电影| 亚洲欧美乱综合| 9久草视频在线视频精品| 久久蜜桃一区二区| 日韩主播视频在线| 91黄色激情网站| 国产精品视频在线看| 日日夜夜免费精品| 欧美三区在线视频| 亚洲一二三四区| 欧美日韩一区二区三区不卡| 综合色中文字幕| 在线一区二区三区做爰视频网站| 亚洲动漫第一页| 欧美日韩一级片网站| 丝袜诱惑亚洲看片| 精品伦理精品一区| 国产91在线观看丝袜| 中文字幕一区二区三中文字幕| 国产麻豆成人传媒免费观看| 国产欧美日韩在线看| 成人性视频免费网站| 亚洲人成在线播放网站岛国| 色婷婷综合久色| 日本不卡的三区四区五区| 91精品国产色综合久久ai换脸| 国产成人aaa| 香港成人在线视频| 欧美国产日韩一二三区| 在线观看av一区| 国产一区在线不卡| 亚洲视频在线观看一区| 在线播放91灌醉迷j高跟美女| 日本伊人午夜精品| 一区二区中文视频| 91精品国产乱| 在线免费av一区| 九色综合狠狠综合久久| 亚洲最新在线观看| 一色桃子久久精品亚洲| 日韩午夜av电影| 99久久精品国产观看| 国产精一区二区三区| 亚洲免费看黄网站| 国产欧美日韩综合精品一区二区| 欧美一区二区三区免费大片| 91丨porny丨国产| 国产精品影视网| 久久精品国产久精国产爱| 亚洲曰韩产成在线| 一区二区三区在线视频播放| 国产日韩欧美在线一区| 日韩三级中文字幕| 亚洲精品在线三区| 久久久久综合网| 日韩午夜av一区| 2017欧美狠狠色| 久久综合久久综合久久综合| 欧美xingq一区二区| 26uuu色噜噜精品一区二区| 精品久久五月天| 久久一区二区三区四区| 久久精品日韩一区二区三区| 久久久影院官网| 国产精品免费视频观看| 一区二区三区蜜桃网| 久久国产免费看| 成人黄色在线网站| 国产视频在线观看一区二区三区 | 欧美日韩aaaaa| 欧美日本在线播放| 欧美一区二区三区播放老司机| 2023国产精华国产精品| 亚洲三级免费观看| 午夜视黄欧洲亚洲| 久久精品国产一区二区三区免费看 | 日韩成人免费电影| 成人激情文学综合网| 欧美撒尿777hd撒尿| 欧美国产一区二区在线观看| 午夜亚洲福利老司机| 国产成人av电影在线播放| 欧洲激情一区二区| 偷拍日韩校园综合在线| av一二三不卡影片| 日韩欧美成人激情| 亚洲福利视频三区| 成人美女视频在线观看| 日韩一级免费观看| 亚洲国产综合人成综合网站| www.欧美日韩| 国产欧美日产一区| 精品亚洲成a人| 26uuu久久综合| 麻豆国产欧美日韩综合精品二区| 国产99久久久久久免费看农村| 久久综合视频网| 成人综合在线观看| 亚洲视频在线一区| 欧美亚洲国产bt| 香蕉加勒比综合久久| 欧美私人免费视频| 日韩国产欧美在线观看| 欧美mv和日韩mv国产网站| 日日欢夜夜爽一区| 久久综合久久久久88| 美洲天堂一区二卡三卡四卡视频| 这里是久久伊人| 国内精品在线播放| 亚洲日本免费电影| 欧美亚洲一区二区在线观看| 亚洲一区二区影院| 国产亚洲成av人在线观看导航 | 欧美日韩在线免费视频| 麻豆91在线观看| 国产精品污污网站在线观看| 91丝袜美女网| 免费观看在线综合| 国产精品免费视频一区| 欧美日韩国产影片| 国产91丝袜在线播放0| 亚洲视频精选在线| 欧美精品自拍偷拍动漫精品| 国产一区二区在线影院| 亚洲国产视频一区| 国产精品久久久久三级| 日韩一区二区在线看片| 99综合电影在线视频| 成人激情小说网站| 国产成人精品免费网站| 日韩国产一二三区| 亚洲精品老司机| 欧美激情一区不卡| 国产婷婷一区二区| 精品久久久久久亚洲综合网| 欧美日韩中字一区| 色欧美日韩亚洲| 99v久久综合狠狠综合久久| 国内精品伊人久久久久av一坑| 亚洲高清免费观看| 婷婷开心激情综合| 丝袜国产日韩另类美女| 日韩高清不卡一区| 青草av.久久免费一区| 卡一卡二国产精品| 蜜臀国产一区二区三区在线播放| 亚洲成在人线在线播放| 日韩电影在线观看电影| 麻豆精品视频在线观看视频| 九九九久久久精品| 国产精品一区二区你懂的| 不卡一区在线观看| 欧美日韩在线播放| 91精品福利在线一区二区三区| 日韩一区二区电影| 久久精品网站免费观看| 亚洲人一二三区| 日本在线不卡视频| 丁香啪啪综合成人亚洲小说| 日本道在线观看一区二区| 欧美久久久久久久久| 欧美激情一区二区三区全黄| 亚洲制服丝袜av| 粉嫩蜜臀av国产精品网站| 精品视频1区2区| 国产精品成人免费 | 欧美日韩一区中文字幕| 久久亚洲二区三区| 亚洲色图欧美偷拍| 懂色av一区二区三区蜜臀 | 亚洲大片在线观看| av一区二区三区黑人| 精品剧情v国产在线观看在线|