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

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

?? c2312.c

?? flash programer driver
?? C
?? 第 1 頁 / 共 5 頁
字號:
/**************** STFL-I Flash Memory Driver ***********************************

   Filename:    c2312.c
   Description: Library routines for the M29DW640F
                64Mb (8Mb x 8 or 4Mb x 16,Page,Boot Block) Flash Memory drivers
                in different configurations.

   Version:     $Id: c2312.c,v 1.0 2006/05/10 
   Author:     Ze-Yu He, MSAC,STMicroelectronics, Shanghai (China)
               Wiley Xu, MSAC,STMicroelectronics, Shanghai (China)
               Echo Chen,MSAC,STMicroelectronics, Beijing  (China)
   Copyright (c) 2006 STMicroelectronics.

   THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
   EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTY
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
   AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
   PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
   REPAIR OR CORRECTION.
********************************************************************************

   Version History.

   Ver.   Date        Comments

   0.0    2006/02/20  Initial Release of the software (Alpha)
   1.0    2006/05/10  Qualified Release of the softwar

********************************************************************************

   This source file provides library C code for using the M29DW640F flash devices.
   The following device is supported in the code: M29DW640

   This file can be used to access the devices in 8bit and 16bit mode.

   The following functions are available in this library:

      Flash(BlockErase, ParameterType)            to erase one block
      Flash(CheckBlockProtection, ParameterType)  to check whether a given block is protected
      Flash(CheckCompatibility, ParameterType)    to check the compatibility of the flash 
      Flash(ChipErase, ParameterType)             to erase the whole chip
      Flash(ChipUnprotect, ParameterType)         to unprotect the whole chip
      Flash(GroupProtect, ParameterType)          to unprotect a blocks group
      Flash(Program, ParameterType)               to program an array of elements
      Flash(Read, ParameterType)                  to read from the flash device
      Flash(ReadCfi, ParameterType)               to read CFI information from the flash
      Flash(ReadDeviceId, ParameterType)          to get the Device ID from the device 
      Flash(ReadManufacturerCode, ParameterType)  to get the Manufacture Code from the device
      Flash(Reset, ParameterType)                 to reset the flash for normal memory access 
      Flash(Resume, ParameterType)                to resume a suspended erase
      Flash(SingleProgram, ParameterType)         to program a single element
      Flash(Suspend, ParameterType)               to suspend an erase
      Flash(Write, ParameterType)                 to write a value to the flash device

      FlashDoubleProgram()                        to program two elements
      FlashEnterExtendedBlock()                   to issue the enter extended mode command
      FlashErrorStr()                             to return an error description (define VERBOSE)
      FlashExitExtendedBlock()                    to issue the exit extended mode command
      FlashMultipleBlockErase()                   to erase some blocks in same bank
      FlashPause()                                for timing short pauses (in micro seconds) 
      FlashQuadProgram()                          to program four elements
      FlashOctProgram()                           to program eight elements
      FlashReadExtendedBlockVerifyCode()    to read the lock/unlock status of the
                                                     Extended Memory Block
      FlashReadProtectionRegister()               to read a protection register location
      FlashReadStatusRegister()                   to read the Status Register
      FlashStatusPinConfig()                      to configure the Status/(Ready/Busy) pin
      FlashTimeOut()                              to return after function timeouts 
      FlashUnlockBypass()                         to issue the unlock bypass command
      FlashUnlockBypassProgram()                  to program in unlock bypass mode
      FlashUnlockBypassReset()                    to issue the unlock bypass reset command

   For further information consult the Data Sheet and the Application Note.
   The Application Note gives information about how to modify this code for
   a specific application.

   The hardware specific functions which may need to be modified by the user are:

      FlashWrite() for writing an element (uCPUBusType) to the flash
      FlashRead()  for reading an element (uCPUBusType) from the flash

   A list of the error conditions can be found at the end of the header file.

*******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "c2312.h" /* Header file with global prototypes */

#ifdef TIME_H_EXISTS
   #include <time.h>
#endif 

/******************************************************************************
    Global variables
*******************************************************************************/ 
ErrorInfoType eiErrorInfo;


/*******************************************************************************
Function:     ReturnType Flash( CommandType cmdCommand, ParameterType *fp )
Arguments:    cmdCommand is an enum which contains all the available function
   commands of the SW driver.
              fp is a (union) parameter struct for all flash command parameters
Return Value: The function returns the following conditions: 

   Flash_AddressInvalid 
   Flash_BlockEraseFailed 
   Flash_BlockNrInvalid 
   Flash_BlockProtected 
   Flash_BlockProtectFailed 
   Flash_BlockProtectionUnclear 
   Flash_BlockUnprotected 
   Flash_CfiFailed 
   Flash_ChipEraseFailed 
   Flash_ChipUnprotectFailed 
   Flash_FunctionNotSupported
   Flash_GroupProtectFailed 
   Flash_NoInformationAvailable
   Flash_OperationOngoing 
   Flash_OperationTimeOut 
   Flash_ProgramFailed 
   Flash_ResponseUnclear 
   Flash_SpecificError
   Flash_Success 
   Flash_WrongType

Description:  This function is used to access all functions provided with the
   current flash chip.

Pseudo Code:
   Step 1: Select the right action using the cmdCommand parameter
   Step 2: Execute the Flash Function
   Step 3: Return the Error Code
*******************************************************************************/
ReturnType Flash( CommandType cmdCommand, ParameterType *fp ) { 
   ReturnType  rRetVal;
   uCPUBusType  ucDeviceId, ucManufacturerCode;

   switch (cmdCommand) {
      case BlockErase:
         rRetVal = FlashBlockErase( (*fp).BlockErase.ublBlockNr );
         break;

      case CheckBlockProtection: 
         rRetVal = FlashCheckBlockProtection( (*fp).CheckBlockProtection.ublBlockNr );  
         break; 

      case CheckCompatibility:
         rRetVal = FlashCheckCompatibility();
         break;

      case ChipErase:
         rRetVal = FlashChipErase( (*fp).ChipErase.rpResults );
         break;

      case ChipUnprotect: 
         rRetVal = FlashChipUnprotect((*fp).ChipUnprotect.rpResults ); 
         break; 

      case GroupProtect: 
         rRetVal = FlashGroupProtect( (*fp).GroupProtect.ublBlockNr ); 
         break; 

      case Program:
         rRetVal = FlashProgram( (*fp).Program.udMode,
                                 (*fp).Program.udAddrOff,
                                 (*fp).Program.udNrOfElementsInArray,
                                 (*fp).Program.pArray );                 

         break;

      case Read:
         (*fp).Read.ucValue = FlashRead( (*fp).Read.udAddrOff );
         rRetVal = Flash_Success;
         break;

      case ReadCfi:  
         rRetVal = FlashReadCfi( (*fp).ReadCfi.uwCfiFunc, &((*fp).ReadCfi.ucCfiValue) ); 
         break; 

      case ReadDeviceId:
         rRetVal = FlashReadDeviceId(&ucDeviceId);
         (*fp).ReadDeviceId.ucDeviceId = ucDeviceId;
         break;

      case ReadManufacturerCode:
         rRetVal = FlashReadManufacturerCode(&ucManufacturerCode);
         (*fp).ReadManufacturerCode.ucManufacturerCode = ucManufacturerCode;
         break;

      case Reset:
         rRetVal = FlashReset();
         break;

      case Resume:
         rRetVal = FlashResume();
         break;

      case SingleProgram:
         rRetVal = FlashSingleProgram( (*fp).SingleProgram.udAddrOff, (*fp).SingleProgram.ucValue );
         break;

      case Suspend:
         rRetVal = FlashSuspend();
         break;

      case Write:
         FlashWrite( (*fp).Write.udAddrOff, (*fp).Write.ucValue ); 
         rRetVal = Flash_Success;
         break;

      default:
         rRetVal = Flash_FunctionNotSupported;
         break;

   } /* EndSwitch */
   return rRetVal;
} /* EndFunction Flash */







/*******************************************************************************
Function:     ReturnType FlashBlockErase( uBlockType ublBlockNr )
Arguments:    ublBlockNr is the number of the Block to be erased.
Return Value: The function returns the following conditions:
   Flash_Success
   Flash_BlockEraseFailed
   Flash_BlockNrInvalid
   Flash_BlockProtected
   Flash_OperationTimeOut

Description:  This function can be used to erase the Block specified in ublBlockNr.
   The function checks that the block nr is within the valid range and not protected
   before issuing the erase command, otherwise the block will not be erased and an
   error code will be returned.
   The function returns only when the block is erased. During the Erase Cycle the
   Data Toggle Flow Chart of the Datasheet is followed. The polling bit, DQ7, is not
   used.
   
Pseudo Code:
   Step 1:  Check that the block number exists
   Step 2:  Check if the block is protected
   Step 3:  Write Block Erase command
   Step 4:  Wait for the timer bit to be set
   Step 5:  Follow Data Toggle Flow Chart until the Program/Erase Controller is
            finished
   Step 6:  Return to Read mode (if an error occurred)
*******************************************************************************/
ReturnType FlashBlockErase( uBlockType ublBlockNr) {

   ReturnType rRetVal = Flash_Success; /* Holds return value: optimistic initially! */

   /* Step 1: Check for invalid block. */
   if( ublBlockNr >= NUM_BLOCKS ) /* Check specified blocks <= NUM_BLOCKS */
      return Flash_BlockNrInvalid;

   /* Step 2: Check if the block is protected */
   if ( FlashCheckBlockProtection(ublBlockNr) == Flash_BlockProtected)
      return Flash_BlockProtected;

   /* Step 3: Write Block 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( BlockOffset[ublBlockNr], (uCPUBusType)CMD(0x0030) );

   /* Step 4: Wait for the Erase Timer Bit (DQ3) to be set */
   FlashTimeOut(0); /* Initialize TimeOut Counter */
   while( !(FlashRead( BlockOffset[ublBlockNr] ) & CMD(0x0008) ) ){
      if (FlashTimeOut(5) == Flash_OperationTimeOut) {
         FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
         return Flash_OperationTimeOut;
      } /* EndIf */
   } /* EndWhile */

   /* Step 5: Follow Data Toggle Flow Chart until Program/Erase Controller completes */
   if( FlashDataToggle(BlockOffset[ublBlockNr] ) !=  Flash_Success ) {
      /* Step 6: Return to Read mode (if an error occurred) */
      FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */
      rRetVal=Flash_BlockEraseFailed;
   } /* EndIf */
   return rRetVal;
} /* EndFunction FlashBlockErase */





/*******************************************************************************
Function:      ReturnType FlashCheckBlockProtection( uBlockType ublBlockNr )
Arguments:     ublBlockNr = block number to be checked
Note: the first block is Block 0

Return Values: The function returns the following conditions: 
   Flash_BlockNrInvalid
   Flash_BlockUnprotected
   Flash_BlockProtected
   Flash_BlockProtectionUnclear

Description:   This function reads the protection status of a block.
Pseudo Code:
   Step 1:  Check that the block number exists
   Step 2:  Send the AutoSelect command
   Step 3:  Read Protection Status
   Step 4:  Return the device to Read Array mode
*******************************************************************************/
ReturnType FlashCheckBlockProtection( uBlockType ublBlockNr ) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区在线观看| 91麻豆精品国产91久久久使用方法 | 中文字幕一区二区在线播放| 欧美日韩精品欧美日韩精品一 | 欧美另类z0zxhd电影| 国产在线视频不卡二| 亚洲高清免费视频| 亚洲视频一二三区| 国产日韩欧美精品在线| 日韩午夜在线播放| 欧美日韩一区 二区 三区 久久精品| 国产成a人无v码亚洲福利| 青娱乐精品在线视频| 亚洲一区二区四区蜜桃| 中文字幕一区三区| 国产精品区一区二区三区| 2022国产精品视频| 日韩欧美www| 日韩一区和二区| 欧美日韩亚洲高清一区二区| 91麻豆自制传媒国产之光| 国产a级毛片一区| 国产精品夜夜爽| 精品在线观看视频| 美腿丝袜亚洲一区| 日韩二区在线观看| 无码av中文一区二区三区桃花岛| 亚洲激情图片qvod| 亚洲欧美视频一区| 中文字幕日韩一区二区| 国产精品视频观看| 国产日韩精品视频一区| 精品不卡在线视频| 精品国产乱码久久久久久免费| 日韩欧美一二区| 日韩一级高清毛片| 日韩午夜激情电影| 日韩三级伦理片妻子的秘密按摩| 91超碰这里只有精品国产| 欧美日韩一区二区三区高清 | 日韩视频一区二区三区在线播放| 欧美日本韩国一区| 欧美一级一级性生活免费录像| 欧美男人的天堂一二区| 欧美一区二区三区在线| 日韩欧美高清一区| 久久久久久99久久久精品网站| www国产成人免费观看视频 深夜成人网| 日韩一级大片在线| 精品欧美一区二区久久| 久久亚洲精精品中文字幕早川悠里 | 99vv1com这只有精品| 99精品视频在线免费观看| 91蝌蚪porny| 欧美日韩精品一区二区天天拍小说 | 91浏览器在线视频| 欧美嫩在线观看| 欧美sm美女调教| 国产日韩欧美高清在线| 亚洲欧美一区二区三区孕妇| 亚洲国产一区二区三区| 免费欧美高清视频| 成人精品视频一区| 欧美三级乱人伦电影| 日韩欧美不卡一区| 亚洲欧洲在线观看av| 午夜精品123| 国产米奇在线777精品观看| 99国产精品视频免费观看| 911精品产国品一二三产区| 久久久国产一区二区三区四区小说 | 精品裸体舞一区二区三区| 久久久蜜桃精品| 一区二区三区成人在线视频| 三级亚洲高清视频| 国产福利一区在线| 色欧美日韩亚洲| 精品国产乱码久久久久久夜甘婷婷 | 日本韩国欧美国产| 日韩免费成人网| 亚洲免费在线观看视频| 蜜臀av性久久久久蜜臀aⅴ| 高清国产一区二区| 制服丝袜激情欧洲亚洲| 国产精品嫩草影院com| 午夜欧美电影在线观看| 国产高清久久久| 欧美丰满美乳xxx高潮www| 久久九九国产精品| 天天影视涩香欲综合网 | 欧美成人精品二区三区99精品| 国产精品无码永久免费888| 性做久久久久久| 99免费精品视频| 精品福利视频一区二区三区| 亚洲综合999| 成人av资源在线| 精品国产制服丝袜高跟| 亚洲一区二区三区不卡国产欧美| 国产精品888| 91精品国产91热久久久做人人| 亚洲九九爱视频| 成人性色生活片免费看爆迷你毛片| 欧美日韩免费一区二区三区| 国产精品久99| 激情成人午夜视频| 8x福利精品第一导航| 亚洲精品免费在线播放| 国产sm精品调教视频网站| 日韩精品一区二区三区视频| 午夜精品成人在线视频| 在线亚洲人成电影网站色www| 国产日韩欧美不卡在线| 国产在线一区观看| 欧美一卡在线观看| 日欧美一区二区| 欧美日本高清视频在线观看| 亚洲伊人伊色伊影伊综合网| 91麻豆国产在线观看| 中文字幕在线观看不卡视频| 国产精品一区二区果冻传媒| 欧美一级黄色录像| 日本欧美加勒比视频| 91国产丝袜在线播放| 18涩涩午夜精品.www| 国产精品综合久久| 久久综合久久鬼色| 国产伦精品一区二区三区免费 | ...中文天堂在线一区| 成人污污视频在线观看| 久久精品视频一区二区三区| 韩国三级中文字幕hd久久精品| 欧美成人精品1314www| 久久黄色级2电影| 久久综合资源网| 国产成人自拍在线| 国产精品视频你懂的| 成人免费看黄yyy456| 中文字幕亚洲电影| 一本一本久久a久久精品综合麻豆| 国产精品久久久久久久蜜臀| 不卡在线观看av| 亚洲另类在线一区| 欧美日本一区二区在线观看| 青青青伊人色综合久久| 精品国产一区二区在线观看| 国产麻豆精品视频| 国产精品国产精品国产专区不片| 99热99精品| 亚洲高清免费在线| 日韩欧美二区三区| 国产v日产∨综合v精品视频| 自拍偷自拍亚洲精品播放| 欧美这里有精品| 日本成人在线不卡视频| 精品sm在线观看| gogo大胆日本视频一区| 亚洲国产成人av网| 欧美成人三级在线| 成人性生交大合| 亚洲国产精品自拍| 欧美成人一级视频| 97成人超碰视| 日本中文在线一区| 国产午夜精品一区二区三区视频| 91网页版在线| 美腿丝袜亚洲色图| 中文字幕亚洲视频| 欧美一区二区三区免费在线看| 国产精品888| 五月天视频一区| 国产精品午夜在线| 欧美日韩在线播放三区四区| 免费成人你懂的| 亚洲丝袜制服诱惑| 欧美一级免费观看| 9色porny自拍视频一区二区| 日韩高清不卡一区| 综合婷婷亚洲小说| 日韩精品一区二区三区四区 | 中文字幕欧美国产| 欧美性色综合网| 国产精品一区二区x88av| 亚洲一区二区三区视频在线播放| 欧美精品一区二区三| 欧美亚洲动漫精品| 国产精品亚洲专一区二区三区| 亚洲自拍偷拍网站| 日本一二三不卡| 日韩视频一区在线观看| 91在线看国产| 国产精品自拍毛片| 亚洲成av人片在www色猫咪| 国产欧美日韩另类一区| 3751色影院一区二区三区| 91天堂素人约啪| 国产在线精品视频| 日本亚洲三级在线| 亚洲黄色免费电影| 日本一二三不卡|