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

📄 1601driver.h

📁 44b0+PDIUSBD12开发的U盘源码
💻 H
📖 第 1 页 / 共 3 页
字号:
   U32 DestBuf = Dst;   int  ReturnStatus;	//  Issue the Sector Erase command to 39VF160X	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(0x5555) = 0x0080;     // write data 0x0080 to device addr 0x5555	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(DestBuf) = 0x0030;    // write data 0x0030 to device sector addr   ReturnStatus = Check_Toggle_Ready(DestBuf);	// wait for TOGGLE bit ready   return ReturnStatus;}/************************************************************************//* PROCEDURE:   Erase_Block                                        	    *//*                                                                      *//* This procedure can be used to erase a total of 32K U16s.             *//*                                                                      *//* Input:                                                               *//*      Dst     DESTINATION address where the erase operation starts    *//*                                                                      *//* Output:                                                              *//*          return TRUE:  indicates success in block-erase              *//*          return FALSE: indicates failure in block-erase              *//************************************************************************/int Erase_Block (U32 Dst){   U32 DestBuf = Dst;   int ReturnStatus;    //  Issue the Block Erase command to 39VF160X	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(0x5555) = 0x0080;     // write data 0x0080 to device addr 0x5555	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(DestBuf) = 0x0050;    // write data 0x0050 to device sector addr   ReturnStatus = Check_Toggle_Ready(DestBuf);	  	// wait for TOGGLE bit ready   return ReturnStatus;}/************************************************************************//* PROCEDURE:   Erase_Entire_Chip                                       *//*                                                                      *//* This procedure can be used to erase the entire chip.                 *//*                                                                      *//* Input:                                                               *//*      NONE                                                            *//*                                                                      *//* Output:                                                              *//*      NONE                                                            *//************************************************************************/void Erase_Entire_Chip(void){   //  Issue the Chip Erase command to 39VF160X	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(0x5555) = 0x0080;     // write data 0x0080 to device addr 0x5555	*sysAddress(0x5555) = 0x00AA;     // write data 0x00AA to device addr 0x5555	*sysAddress(0x2AAA) = 0x0055;     // write data 0x0055 to device addr 0x2AAA	*sysAddress(0x5555) = 0x0010;     // write data 0x0010 to device addr 0x5555   Delay_50_Milli_Seconds();       	// Delay Tsce time}/************************************************************************//* PROCEDURE:   Program_One_U16                                        *//*                                                                      *//* This procedure can be used to program ONE U16 of data to the        *//* 39VF160X.                                                            *//*                                                                      *//* NOTE:  It is necessary to first erase the sector containing the      *//*        U16 to be programmed.                                	*//*                                                                      *//* Input:                                                               *//*           SrcU16 The U16 which will be written to the 39VF160X     *//*           Dst     DESTINATION address which will be written with the *//*                   data passed in from Src                            *//*                                                                      *//* Output:                                                              *//*          return TRUE:  indicates success in U16-program             *//*          return FALSE: indicates failure in U16-program             *//************************************************************************/int Program_One_U16 (U16 *SrcU16,   U32 Dst){    U32 DestBuf = Dst;    U16 *SourceBuf = SrcU16;    int ReturnStatus;    *sysAddress(0x5555) = 0x00AA; // write data 0x00AA to device addr 0x5555    *sysAddress(0x2AAA) = 0x0055; // write data 0x0055 to device addr 0x2AAA    *sysAddress(0x5555) = 0x00A0; // write data 0x00A0 to device addr 0x5555    *sysAddress(DestBuf) = *SourceBuf; // transfer the U16 to destination    ReturnStatus = Check_Toggle_Ready(DestBuf); // wait for TOGGLE bit ready    return ReturnStatus;}/************************************************************************//* PROCEDURE:   Program_Sector                                      	*//*                                                                      *//* This procedure can be used to program a total of 2048 U16s of data   *//* to the SST39VF160X.                                                  *//*                                                                      *//* NOTES: 1. It is necessary to first erase the sector before the		*//*        programming.                                					*//*        2. This sample code assumes the destination address passed	*//*        from the calling function is the starting address of the		*//*        sector.														*//*                                                                      *//* Input:                                                               *//*           Src     SOURCE address containing the data which will be   *//*                   written to the 39VF160X                            *//*           Dst     DESTINATION address which will be written with the *//*                   data passed in from Src                            *//*                                                                      *//* Output:                                                              *//*          return TRUE:  indicates success in sector-program           *//*          return FALSE: indicates failure in sector-program           *//************************************************************************/int Program_Sector (U16 *Src, U32 Dst){    U16 *SourceBuf;    U32 DestBuf;    int Index, ReturnStatus;    SourceBuf = Src;    DestBuf = Dst;    ReturnStatus = Erase_Sector(DestBuf);	// erase the sector first    if (!ReturnStatus)    	return ReturnStatus;    for (Index = 0; Index < SECTOR_SIZE_1601; Index++)    { 	// transfer data from source to destination		ReturnStatus = Program_One_U16( SourceBuf, DestBuf);		++DestBuf;		++SourceBuf;        if (!ReturnStatus)    	   return ReturnStatus;    }    return ReturnStatus;}/************************************************************************//* PROCEDURE:   Program_Block                                      	    *//*                                                                      *//* This procedure can be used to program a total of 32k U16s of data    *//* to the SST39VF160X.                                                  *//*                                                                      *//* NOTES: 1. It is necessary to first erase the block before the		*//*        programming.                                					*//*        2. This sample code assumes the destination address passed	*//*        from the calling function is the starting address of the	 	*//*        block.														*//*																		*//* Input:                                                               *//*           Src     SOURCE address containing the data which will be   *//*                   written to the 39VF160X                            *//*           Dst     DESTINATION address which will be written with the *//*                   data passed in from Src                            *//*                                                                      *//* Output:                                                              *//*          return TRUE:  indicates success in block-program            *//*          return FALSE: indicates failure in block-program            *//************************************************************************/int Program_Block (U16 *Src, U32 Dst){    U16 *SourceBuf;    U32 DestBuf;    int Index, ReturnStatus;    SourceBuf = Src;    DestBuf = Dst;    ReturnStatus = Erase_Block(DestBuf);	// erase the block first    if (!ReturnStatus)    	return ReturnStatus;    for (Index = 0; Index < BLOCK_SIZE; Index++)    { 	// transfer data from source to destination	ReturnStatus = Program_One_U16( SourceBuf, DestBuf);	++DestBuf;	++SourceBuf;        if (!ReturnStatus)    	return ReturnStatus;    }    return ReturnStatus;}/************************************************************************//* PROCEDURE:   SecID_Lock_Status                                       *//*                                                                      *//* This procedure should be used to check the Lock Status of SecID		*//*                                                                      *//* Input:                                                               *//*          None                                                        *//*                                                                      *//* Output:                                                              *//*          return TRUE:  indicates SecID is Locked  					*//*          return FALSE: indicates SecID is Unlocked  	  				*//************************************************************************/int SecID_Lock_Status(void)

⌨️ 快捷键说明

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