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

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

?? device.c

?? intel strata flash TE28Fxx系列的源代碼 nor flash
?? C
?? 第 1 頁 / 共 3 頁
字號:
 * TMPL_GetBlockAddress
 *
 * Description:   
 *
 *    This procedure is called to get the flash starting address for the
 *    specified block number.
 *
 * Parameters:
 *
 *    IN      blocknum - the block number on the device.
 *
 *    OUT     address  - the starting flash address for the specified
 *                       block.
 *
 * Returns:   
 *
 *    TMPL_Status - includes function return status defined by enum 
 *                  TMPL_CommandStat.
 *
 * Assumptions:
 *
 *    NONE
 *
 ***************************************************************************/
TMPL_Status TMPL_GetBlockAddress ( UINT16 blocknum, 
                                   UINT32 *address )
{

	TMPL_Status stat;

	if ( blocknum < TMPL_TOTAL_NUMBLOCKS )
	{
		*address = TMPL_BASE_FLASH_ADDRESS + ( blocknum * TMPL_BLOCK_NUMBYTES );
	}
	else
	{
		stat.Result = StatBadBlock;
		return( stat );  
	}

	stat.Result = StatCompleted;

	return( stat );

}


/****************************************************************************
 *
 * TMPL_LockBlock
 *
 * Description:   
 *
 *    This procedure is called to lock the specified block on the flash
 *    device.  See the flash device datasheet for specific details on this 
 *    command.
 *
 * Parameters:
 *
 *    IN      blocknum - the block number on the device.
 *
 *    IN      returnSR - flag to indicate whether the device status register
 *                       value should be returned by this function.
 *
 * Returns:   
 *
 *    TMPL_Status - includes function return status defined by enum 
 *                  TMPL_CommandStat and optionally the flash device 
 *                  status register value.
 *
 * Assumptions:
 *
 *    NONE
 *
 ***************************************************************************/
TMPL_Status TMPL_LockBlock ( UINT16 blocknum, 
                             UINT8  returnSR )
{

	TMPL_Status stat;
	UINT32      blockaddr;
   
	stat = TMPL_GetBlockAddress( blocknum, &blockaddr );

	if ( stat.Result != StatCompleted )
	{
		return( stat );
	}

	if ( returnSR )
	{
		TMPL_ClearStatus();
	}

	TMPL_WriteF( blockaddr, TMPL_CONFIG_SETUP );

	TMPL_WriteF( blockaddr, TMPL_LOCK_BIT_SET );

	if ( !TMPL_WaitUntilReady( TMPL_PROGRAM_TIMEOUT ) )
	{
		stat.Result = StatTimeout;
	}
	else
	{
		stat.Result = StatCompleted;
	}

	if ( returnSR )
	{
		stat.SR = TMPL_ReadStatus();
	}

	/* return device to read array mode */
	TMPL_WriteF( TMPL_BASE_FLASH_ADDRESS, TMPL_READ_ARRAY );

	return( stat ); 

}


/****************************************************************************
 *
 * TMPL_LockProtection
 *
 * Description:   
 *
 *    This procedure is called to program the protection register user lock
 *    bit on the flash device.  See the flash device datasheet for specific
 *    details on this command.
 *
 * Parameters:
 *
 *    IN      returnSR - flag to indicate whether the device status register
 *                       value should be returned by this function.
 *
 * Returns:   
 *
 *    TMPL_Status - includes function return status defined by enum
 *                  command_stat and optionally the flash device status
 *                  register value.
 *
 * Assumptions:
 *
 *    NONE
 *
 ***************************************************************************/
TMPL_Status TMPL_LockProtection ( UINT8 returnSR )
{

	UINT32      baseadd;
	UINT32      location;
	UINT32      address;
	TMPL_Status stat;

	location = TMPL_PROTECTION_LOCK_LOCATION;

	baseadd = TMPL_BASE_FLASH_ADDRESS;

	address = TMPL_OTP_BASE + TMPL_BASE_FLASH_ADDRESS;

	address += ( location * sizeof(TMPL_FDATA) );

	if ( returnSR )
	{
		TMPL_ClearStatus();
	}

	TMPL_WriteF(baseadd, TMPL_OTP_PROGRAM );

	TMPL_WriteF(address, TMPL_OTP_LOCK);

	if ( !TMPL_WaitUntilReady( TMPL_PROGRAM_TIMEOUT ) )
	{
		stat.Result = StatTimeout;
	}
	else
	{
		stat.Result = StatCompleted;
	}

	if ( returnSR )
	{
		stat.SR = TMPL_ReadStatus();
	}

	/* return device to read array mode */
	TMPL_WriteF(TMPL_BASE_FLASH_ADDRESS, TMPL_READ_ARRAY );

	return( stat );

}


/****************************************************************************
 *
 * TMPL_PageMode 
 *
 * Description:   
 *
 *    This procedure is called to enable or disable page mode read to
 *    the device.
 *
 * Parameters:
 *
 *    IN    enable - flag "1" to indicate the page mode is anable and 
 *                   flag "0" to indicate the page mode is disable to 
 *                   the device.
 *
 * Returns:   
 *
 *    TMPL_Status - includes function return status defined by enum 
 *                  TMPL_CommandStat and optionally the flash device 
 *                  status register value.
 *
 * Assumptions:
 *
 *    NONE 
 *
 ***************************************************************************/
TMPL_Status TMPL_PageMode ( UINT16 enable )
{

	TMPL_Status stat;
	UINT32      address; /* contains the address to load the 
	                        Read Configuration Register with */
	if ( enable )
	{
		address = TMPL_PAGE_READ_MODE;
	}
	else
	{
		address = TMPL_STD_READ_MODE;
	}

#if ( X_8 || X_16 )
		address = address << 1;  /* shift so address is on A16..A1 */
#else
		address = address << 2;  /* shift so address is on A16..A1 */
#endif
	address += TMPL_BASE_FLASH_ADDRESS; /* offset by base flash mem */ 

	/* write Read Configuration command */
	TMPL_WriteF( TMPL_BASE_FLASH_ADDRESS, TMPL_CONFIG_SETUP );
	TMPL_WriteF( address, TMPL_SET_READ_CONFIG );

	stat.Result = StatCompleted;

	return( stat );

}	


#if X_16
/****************************************************************************
 *
 * TMPL_ProgramFlashBuffered
 *
 * Description:   
 *
 *    This procedure is called to program the flash device at the specified 
 *    starting address contiguously with the specified buffer data.  See
 *    the flash device datasheet for specific details on the write to buffer 
 *    command.
 *
 * Parameters:
 *
 *    IN      address  - the flash address to be programmed.
 *
 *    IN      buffer   - the buffer containing data to be programmed.
 *
 *    IN      numbytes - the number of bytes of data contained in the buffer.
 *
 *    IN      returnSR - flag to indicate whether the device status register
 *                       value should be returned by this function.
 *
 * Returns:   
 *
 *    TMPL_Status - includes function return status defined by enum
 *                  TMPL_CommandStat and optionally the flash device
 *                  status register value.
 *
 * Assumptions:
 *
 *    NONE 
 *
 ***************************************************************************/
TMPL_Status TMPL_ProgramFlashBuffered ( UINT32    address, 
                                        UINT8_PTR buffer, 
                                        UINT32    numbytes,
                                        UINT8     returnSR )
{

   TMPL_Status    stat;
   TMPL_FDATA_PTR fptr;
   TMPL_FDATA     writedata;
   UINT16         numitems; 
   UINT32         cmndaddress; 
   UINT32         numwritebytes;
   UINT32         byteswritten;

   cmndaddress = address;

   if ( ( address + numbytes ) > TMPL_TOTAL_SIZE )
   {
      stat.Result = StatBadAddress;

      return( stat );
   }

   if ( cmndaddress & 0x01 )
   {
      cmndaddress --;
   }

   if ( !TMPL_WaitUntilReady( TMPL_PROGRAM_TIMEOUT ) )
   {
      stat.Result = StatTimeout;
      if ( returnSR )
      {
         stat.SR = TMPL_ReadStatus();
      }

      return( stat );
   }
   else
   {

      if ( returnSR )
      {
         TMPL_ClearStatus();
      }


      /* if (start address is not TMPL_BUFFER_SIZE-byte aligned ) */

      if ( ( address % TMPL_BUFFER_SIZE ) != 0 )
      {
         /* if ( buffer size is > TMPL_BUFFER_SIZE ) or 
            ( buffer crosses block boundary ) */
         if ( ( numbytes > TMPL_BUFFER_SIZE ) ||
		      ( ( address & 0x1 ) && ( numbytes >= TMPL_BUFFER_SIZE ) ) ||
              ( ( address + numbytes -1 ) > ( address | TMPL_BLOCK_MASK) ) 
            )
		 {
		    /* write partial buffer */
		    numwritebytes = ( TMPL_BUFFER_SIZE - ( address % TMPL_BUFFER_SIZE ) );
         }
		 else
		 {
		    /* write all remaining bytes */
		    numwritebytes = numbytes;
		 }

         byteswritten = numwritebytes;

		 TMPL_WriteF( cmndaddress, TMPL_WRITE_TO_BUFFER );
	
		 numitems = numwritebytes / sizeof(TMPL_FDATA);

		 if ( ( ( numwritebytes % sizeof(TMPL_FDATA) ) != 0 ) ||
		        ( ( numwritebytes > 0x01 ) && ( address & 0x01 ) ) )
		 {
	        numitems++;
		 }

		 TMPL_WriteF( cmndaddress, numitems-1 );
	
		 if ( numwritebytes > 0 ) /* while more data to write */ 
		 {
		    while ( numwritebytes > 0 ) /* if more bytes still to write */ 
			{
			   if ( ( address & 0x1 ) != 0 ) /* if destination address is odd */ 
			   {
                      address--;
#if (BIG_ENDIAN_ARCHITECTURE)
					  writedata = (TMPL_FDATA) *buffer;
					  writedata |= 0xff00;
#else /* little endian */ 
					  writedata = *((TMPL_FDATA_PTR)buffer);
					  writedata = ( writedata << 8 ) | 0x00ff;
#endif
					  numwritebytes--;
					  buffer++;
			   }
			   else /* destination address is even */ 
			   {
#if BIG_ENDIAN_ARCHITECTURE
				      /* grab first byte */	
					  writedata = (TMPL_FDATA)( *buffer );
					  writedata = ( ( writedata << 8 ) & 0xff00 );
					  /* grab second byte */	
					  writedata = writedata | ( (TMPL_FDATA) *(buffer+1) );
#else /* little endian architecture */
					  /* grab 2 bytes */
					  writedata = *( (TMPL_FDATA_PTR)buffer ); 
#endif /* BIG_ENDIAN_ARCHITECTURE */ 

					  if ( numwritebytes == 1 ) 
					  {
#if BIG_ENDIAN_ARCHITECTURE
					     writedata |= 0x00ff;
#else
						 writedata |= 0xff00;
#endif
						 numwritebytes--;
					  }
					  else
					  {
					     numwritebytes -= sizeof(TMPL_FDATA);
					  }

					  buffer += sizeof(TMPL_FDATA);
			   }

			   fptr = TMPL_GetFptr(address);
			   *fptr = writedata; 
			   address += sizeof(TMPL_FDATA);
		    }
		 }

		 TMPL_WriteF( cmndaddress, TMPL_CONFIRM );

         if ( !TMPL_WaitUntilReady( TMPL_PROGRAM_TIMEOUT ) )
         {
            stat.Result = StatTimeout;
            if ( returnSR )
            {
               stat.SR = TMPL_ReadStatus();
            }

            return( stat );
         }

         numbytes -= byteswritten;

      } /* end if  ( ( address % TMPL_BUFFER_SIZE )  != 0 ) ) */

      /* while bytes remain */
      while ( numbytes != 0 )
	  {
         /* if TMPL_BUFFER_SIZE bytes remain */
         if ( numbytes > TMPL_BUFFER_SIZE )
		 {
		    /* write full TMPL_BUFFER_SIZE-byte buffer */
		    numwritebytes = TMPL_BUFFER_SIZE;
		 }
		 /* else */
		 else
		 {
		    /* write partial buffer */
		    numwritebytes = numbytes;
         }
         /* end if */

         byteswritten = numwritebytes;

         cmndaddress = address;

		 TMPL_WriteF( cmndaddress, TMPL_WRITE_TO_BUFFER );
	
		 numitems = numwritebytes / sizeof(TMPL_FDATA);

		 if ( ( numwritebytes % sizeof(TMPL_FDATA) ) != 0 )
		 {
	        numitems++;
		 }

		 TMPL_WriteF( cmndaddress, numitems-1 );
	
		 if ( numwritebytes > 0 ) /* while more data to write */ 
		 {
		    while ( numwritebytes > 0 ) /* if more bytes still to write */ 
			{ /* address is known even at this point */
#if BIG_ENDIAN_ARCHITECTURE
		       /* grab first byte */	
			   writedata = (TMPL_FDATA)( *buffer );
			   writedata = ( ( writedata << 8 ) & 0xff00 );
			   /* grab second byte */	
			   writedata = writedata | ( (TMPL_FDATA) *(buffer+1) );
#else /* little endian architecture */
			   /* grab 2 bytes */
			   writedata = *( (TMPL_FDATA_PTR)buffer ); 
#endif /* BIG_ENDIAN_ARCHITECTURE */ 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品福利视频网站| 欧美国产一区二区| 国产毛片精品视频| 亚洲三级免费观看| 日韩欧美国产精品| 一本色道久久综合狠狠躁的推荐| 日韩影院免费视频| 亚洲欧洲日韩综合一区二区| 日韩一卡二卡三卡四卡| 99精品久久只有精品| 日韩激情中文字幕| 亚洲精品免费看| 久久久综合视频| 69久久夜色精品国产69蝌蚪网| 国产98色在线|日韩| 麻豆国产精品视频| 亚洲狠狠爱一区二区三区| 国产欧美一二三区| 欧美精品一区二区三区在线| 欧美伊人久久久久久久久影院| 国产不卡一区视频| 精品中文字幕一区二区小辣椒 | 成人av高清在线| 一区二区三区在线视频播放| 国产精品进线69影院| 欧美成人精品福利| 欧美喷水一区二区| 91官网在线观看| 成人免费不卡视频| 国产精品资源网| 狠狠色综合色综合网络| 日韩一区二区精品葵司在线| 欧美综合在线视频| 成人午夜激情视频| 国产精品一区二区免费不卡| 免费观看一级特黄欧美大片| 亚洲第一av色| 亚洲v精品v日韩v欧美v专区| 一区二区三区中文免费| 亚洲三级电影网站| 国产精品福利电影一区二区三区四区| 久久婷婷国产综合精品青草| 欧美一区日本一区韩国一区| 欧美日本一区二区| 欧美日本精品一区二区三区| 欧美主播一区二区三区美女| 91精品办公室少妇高潮对白| 97se亚洲国产综合在线| 一本一道久久a久久精品| 色综合 综合色| 色爱区综合激月婷婷| 色欧美乱欧美15图片| 欧洲av一区二区嗯嗯嗯啊| 色国产精品一区在线观看| 欧美最猛黑人xxxxx猛交| 欧美日本免费一区二区三区| 3751色影院一区二区三区| 欧美一区二区视频在线观看| 91精品国产欧美一区二区成人| 欧美一区二区二区| 欧美精品一区二区三区蜜桃| 亚洲精品一区二区三区在线观看| 精品噜噜噜噜久久久久久久久试看| 欧美α欧美αv大片| 久久久久久久久久久久久夜| 国产日韩一级二级三级| 日韩毛片一二三区| 亚洲国产一区二区视频| 男女性色大片免费观看一区二区 | 男男gaygay亚洲| 美女视频第一区二区三区免费观看网站| 美女诱惑一区二区| 国产成人精品www牛牛影视| av亚洲产国偷v产偷v自拍| 在线观看91视频| 日韩免费在线观看| 国产精品免费免费| 亚洲一区二区三区影院| 久久黄色级2电影| 成人网在线免费视频| 色欧美片视频在线观看在线视频| 欧美日韩国产美女| 久久九九国产精品| ●精品国产综合乱码久久久久| 亚洲风情在线资源站| 久久国产精品露脸对白| fc2成人免费人成在线观看播放| 色偷偷88欧美精品久久久| 337p亚洲精品色噜噜狠狠| 国产亚洲一区二区三区四区| 亚洲啪啪综合av一区二区三区| 日韩专区在线视频| 成人国产精品免费网站| 欧美精三区欧美精三区| 日本一区二区三区免费乱视频 | 免费人成在线不卡| 不卡的av在线| 欧美一级日韩免费不卡| 国产精品国产a级| 日韩 欧美一区二区三区| 99久久综合99久久综合网站| 日韩一区二区三区av| 亚洲人成人一区二区在线观看| 青青草原综合久久大伊人精品 | 久久久蜜臀国产一区二区| 一区二区三区免费网站| 精品在线你懂的| 在线观看免费亚洲| 国产精品成人网| 久久精品国产99久久6| 在线观看视频一区二区欧美日韩| 337p日本欧洲亚洲大胆色噜噜| 亚洲午夜久久久久中文字幕久| 国产传媒一区在线| 日韩三区在线观看| 亚洲一区二区三区在线| 91丨porny丨蝌蚪视频| 久久综合99re88久久爱| 午夜精品久久久久久久99樱桃| 久久婷婷色综合| 日韩欧美专区在线| 亚洲国产va精品久久久不卡综合 | 日韩精品免费视频人成| 99re成人精品视频| 国产网站一区二区| 精品在线一区二区三区| 日韩欧美一区二区不卡| 亚洲成av人片在线| 欧美在线视频全部完| 亚洲欧洲日本在线| 成人99免费视频| 欧美极品另类videosde| 欧美日韩国产一区| 成人欧美一区二区三区小说 | 4438成人网| 亚洲免费在线视频| 亚洲国产精品精华液ab| 在线视频中文字幕一区二区| 国产精品五月天| 国产99久久久国产精品潘金网站| 欧美一区二区三区啪啪| 精品免费一区二区三区| 日韩和欧美一区二区| 欧美三级日本三级少妇99| 欧美一区二区在线免费播放| 国产成人免费9x9x人网站视频| 国产资源在线一区| 日韩欧美你懂的| 久久国产精品区| 国产亚洲欧美中文| 成人在线视频一区二区| 中文一区二区完整视频在线观看| 国产精品白丝jk黑袜喷水| 国产亚洲欧美在线| 懂色av一区二区三区免费看| 亚洲国产精品激情在线观看| 成人av在线网站| 亚洲精选视频免费看| 欧美在线观看你懂的| 五月婷婷综合网| 日韩欧美久久久| 国产成人在线看| 亚洲色大成网站www久久九九| 在线视频综合导航| 免费在线一区观看| 久久久一区二区三区捆绑**| 高清国产一区二区| 亚洲天堂网中文字| 欧美性色综合网| 青青草97国产精品免费观看 | 欧美日韩一区不卡| 秋霞国产午夜精品免费视频| 欧美日韩午夜影院| 日韩欧美成人午夜| 国产在线精品一区二区三区不卡| 欧美日韩精品一二三区| 蜜臀av在线播放一区二区三区| 欧美一区二区日韩一区二区| 国内精品国产成人| 国产午夜精品一区二区三区四区| 99久久精品国产一区| 天天做天天摸天天爽国产一区| 欧美成人午夜电影| 91在线国内视频| 蜜桃久久久久久久| 国产精品久久三区| 538在线一区二区精品国产| 激情图片小说一区| 伊人色综合久久天天人手人婷| 日韩一区二区中文字幕| 成人av中文字幕| 日韩中文字幕亚洲一区二区va在线| 国产目拍亚洲精品99久久精品| 欧美性大战xxxxx久久久| 国产一区二区91| 午夜视频久久久久久| 日本一二三四高清不卡| 91麻豆精品国产91久久久久| 成人av片在线观看| 久久不见久久见免费视频7|