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

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

?? ethdown.c

?? 這個是嵌入式arm系列的一個bootloader程序。對需要編寫bootloader的很有參考價值
?? C
?? 第 1 頁 / 共 2 頁
字號:
				EdbgOutputDebugString( "%B ", pbData[i] );
			}
			break;

		default:
			EdbgOutputDebugString( "EthDown::Illegal Operation Code %u\r\n", Operation );
			return 1;
			break;

	} // switch
	return 0;
}

UINT16 FlashErase(DWORD dwPhysStart, DWORD dwPhysLen) 
{
    int FLASH_SIZE = 16777216 * 2;
    int ERASE_BLOCKS = 128;
    int BLOCK_SIZE = FLASH_SIZE / ERASE_BLOCKS;
    DWORD i,j;
    DWORD num_blocks;
    volatile DWORD *pdwFlash;
	int status;

    // Determine the number of blocks to erase.
	num_blocks = (dwPhysLen / (BLOCK_SIZE));
	if (dwPhysLen % (BLOCK_SIZE))
		num_blocks++;

    if (num_blocks < 1)
    {
        num_blocks = 1;
        EdbgOutputDebugString("Calculation error.  Erase blocks = %d\n\r", num_blocks);
    } 

	else if (num_blocks > 128)
    {
        num_blocks = 128;
        EdbgOutputDebugString("Calculation error.  Erase blocks = %d\n\r", num_blocks);
    }

    pdwFlash = (volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);

	//Issue the clear lock bits and confirm command.
	*pdwFlash = 0x00600060;
	*pdwFlash = 0x00d000d0;

	i = 0;
	while((i & 0x00800080) != 0x00800080)
	{
		i = *pdwFlash;
	}
	
	if ((i & 0x00000008) == 0x00000008)
		EdbgOutputDebugString("\r\nVoltage Range Error ... Lower flash.\r\n");
	if ((i & 0x00080000) == 0x00080000)
		EdbgOutputDebugString("\r\nVoltage Range Error ... Upper flash.\r\n");

	if ((i & 0x00000030) == 0x00000030)
		EdbgOutputDebugString("\r\nCommand Sequence Error ... Lower flash.\r\n");
	if ((i & 0x00300000) == 0x00300000)
		EdbgOutputDebugString("\r\nCommand Sequence Error ... Upper flash.\r\n");

	if ((i & 0x00000020) == 0x00000020)
		EdbgOutputDebugString("\r\nClear Lock Bits Error ... Lower flash.\r\n");
	if ((i & 0x00200000) == 0x00200000)
		EdbgOutputDebugString("\r\nClear Lock Bits Error ... Upper flash.\r\n");

	if (i != 0x00800080)
	{
		EdbgOutputDebugString("Status register returned 0x%X\r\n", i);
		EdbgOutputDebugString("Unrecoverable failure encountered while erasing flash.  System halted!\r\n");
		while(1);
	}


	// Clear the status register
	*pdwFlash = 0x00500050;

	EdbgOutputDebugString("\r\nErasing Flash %X to %X: Please wait ... \r\n", dwPhysStart, dwPhysStart + (num_blocks*256*1024) - 1);

	// Erase each block.  
    for(j = 0; j < num_blocks; j++)
    {
		//EdbgOutputDebugString("Erasing 0x%X\r\n", pdwFlash);

		// Issue erase and confirm command
		*pdwFlash = 0x00200020;
		*pdwFlash = 0x00d000d0;
		while((*pdwFlash & 0x00800080) != 0x00800080);
		
		// Check if the flash block erased successfully.  
		// Was either block locked?
		status = *pdwFlash;
		if ((status & 0x00200000) || (status & 0x00000020))
		{
			if (status & 0x00200000)
			{
				EdbgOutputDebugString("\n\rBlock erase failure.  Lock bit upper flash set!\r\n");
			}

			if (status & 0x00000020)
			{
				EdbgOutputDebugString("\n\rBlock erase failure.  Lock bit lower flash set!\r\n");
			}
			
		 	EdbgOutputDebugString("Unrecoverable failure encountered while erasing flash.  System halted!\r\n");
			while(1);
		}
		EdbgOutputDebugString(".");
		pdwFlash += (BLOCK_SIZE / 4); 
        
    }

    // Put flash back into read mode
    pdwFlash = (volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);
    *pdwFlash = 0x00FF00FF;

    EdbgOutputDebugString("\r\nPerforming erase verification ... \r\n");
	for(i = 0; i < dwPhysLen / 4; i++)
	{
		if (*pdwFlash++ != 0xFFFFFFFF)
		{
			EdbgOutputDebugString("\r\nErase verification failure at address 0x%X Data 0x%X. \r\n", pdwFlash-1, *(pdwFlash-1));
		 	EdbgOutputDebugString("Unrecoverable failure encountered while erasing flash.  System halted!\r\n");
			while(1);
		}
	}

	EdbgOutputDebugString("\r\nFlash erasing complete. \r\n");
	return 0;
}

#if defined ( RTECH_FLAG )
UINT16 FlashWrite( DWORD dwPhysStart, DWORD dwFlashCache, DWORD dwPhysLen) 
{
    volatile DWORD *pdwFlash;
    volatile DWORD *pdwBlockAddress;
    volatile DWORD *pdwDeviceAddress;
    volatile DWORD *pdwFlashCache;
	volatile DWORD *pdwFlashStart;
	volatile DWORD *pdwRamStart;
	DWORD dwLength = dwPhysLen;
	DWORD i,j,b;
	DWORD val = 0;
	DWORD count;

	// If we are loading a .BIN file into FLASH, we'll need to write it above EBOOT
	// so that EBOOT is not written over by this file.  Then, when the system next boots,
	// EBOOT can allow the user to choose whether to copy the flashed image into RAM,
	// or continue with normal EBOOT image loading services.  

	pdwFlash =			(volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);
    pdwBlockAddress =	(volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);
    pdwDeviceAddress =	(volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);
	pdwFlashCache =		(volatile DWORD *)(dwFlashCache | CACHED_TO_UNCACHED_OFFSET);

	EdbgOutputDebugString("FStartAddr = 0x%x , FCacheAddr = 0x%x.\r\n", pdwFlash, pdwFlashCache );
	
	FlashErase((DWORD)pdwFlash, dwPhysLen);

	b = 0;

	EdbgOutputDebugString("\n\rNow programming Flash ... \r\n");
    while( dwPhysLen > 0)
    {
        // The Flash can write BLOCK_WRITE_SIZE (16) WORDS at a time (32 bytes) into each Flash device.
        // Calculate the number of DWORDS to program in each iteration.
        if (dwPhysLen > 64)
            count = 16;
        else
            count = dwPhysLen / 4;

        // Issue Write to Buffer Command
        *pdwBlockAddress = 0x00E800E8;

        // Check that the write buffer is available.
        // Read the Extended Status Register and
        // wait for the assertion of XSR[7] before continuing.
        while( (*pdwBlockAddress & 0x00800080) != 0x00800080)
        {
            *pdwBlockAddress = 0x00E800E8;
        }
        
        // Configure the size of the buffer that we will write.
        // Write the word count (device expects a 0 based number)
        *pdwBlockAddress = ((count - 1) << 16 | (count - 1));

		pdwFlashStart = pdwDeviceAddress;
		pdwRamStart = pdwFlashCache;

        // Write up to 16 DWORDS into the Flash memory staging area
		for(i = 0; i < count; i++)
        {
            *pdwDeviceAddress++ = *pdwFlashCache++;
	    }

		// increment the number of 64 byte segments written.
		b++;

        // Now program the buffer into Flash
        *pdwBlockAddress = 0x00D000D0;
        
        i = 0;
        while((i & 0x00800080) != 0x00800080)
        {
            i = *pdwBlockAddress;
        }

        dwPhysLen -= count << 2;

		// Read back the segment just written
	    *pdwFlash = 0x00FF00FF;
		for (i = 0; i < count; i++)
		{
			if(*pdwFlashStart++ != *pdwRamStart++)
			{
				EdbgOutputDebugString( "\r\nFlash programming failure at address\r\n%X: Ideal %X Actual %X\r\n", pdwFlashStart-1, *(pdwRamStart-1), *(pdwFlashStart-1) );
				return 1;
			}
		}

        if ((b % 4096) == 0) // every 64 * 4096 bytes (256K bytes) (128K each device)
		{
			EdbgOutputDebugString(".");
		}
    }
	
	pdwFlash =	(volatile DWORD *)( dwPhysStart | CACHED_TO_UNCACHED_OFFSET);

	// Put Flash into read mode.
    *pdwFlash = 0x00FF00FF;

	EdbgOutputDebugString( "\r\nComparing Flash vs RAM image ...\n\r");

	pdwFlashCache = (volatile DWORD *)( dwFlashCache | CACHED_TO_UNCACHED_OFFSET);
	
    for( j = 0; j < dwLength/4; j++ ) 
    {

		if(*pdwFlash++ != *pdwFlashCache++)
        {
			EdbgOutputDebugString( "\r\nBeat!\r\n%X: Ideal %X Actual %X\r\n", pdwFlash-1, *(pdwFlashCache-1), *(pdwFlash-1) );
			return 1;
		}
	}
	EdbgOutputDebugString( "Flash programmed successfully!\r\n" );

    return 0;
}

#else
UINT16 FlashWrite( DWORD dwPhysStart, DWORD dwPhysLen) 
{

    volatile DWORD *pdwFlash;
    volatile DWORD *pdwBlockAddress;
    volatile DWORD *pdwDeviceAddress;
    volatile DWORD *pdwFlashCache;
	volatile DWORD *pdwFlashStart;
	volatile DWORD *pdwRamStart;
	DWORD dwLength = dwPhysLen;
	DWORD i,j,b;
	DWORD val = 0;
	DWORD count;

	pdwFlash =			(volatile DWORD *)((FLASH_START + dwEBOOT_OFFSET) | CACHED_TO_UNCACHED_OFFSET);
    pdwBlockAddress =	(volatile DWORD *)((FLASH_START + dwEBOOT_OFFSET) | CACHED_TO_UNCACHED_OFFSET);
    pdwDeviceAddress =	(volatile DWORD *)((FLASH_START + dwEBOOT_OFFSET) | CACHED_TO_UNCACHED_OFFSET);
	pdwFlashCache =		(volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);

	FlashErase((DWORD)pdwFlash, dwPhysLen);

	b = 0;

	EdbgOutputDebugString("\n\rNow programming Flash ... \r\n");
    while( dwPhysLen > 0)
    {
        // The Flash can write BLOCK_WRITE_SIZE (16) WORDS at a time (32 bytes) into each Flash device.
        // Calculate the number of DWORDS to program in each iteration.
        if (dwPhysLen > 64)
            count = 16;
        else
            count = dwPhysLen / 4;

        // Issue Write to Buffer Command
        *pdwBlockAddress = 0x00E800E8;

        // Check that the write buffer is available.
        // Read the Extended Status Register and
        // wait for the assertion of XSR[7] before continuing.
        while( (*pdwBlockAddress & 0x00800080) != 0x00800080)
        {
            *pdwBlockAddress = 0x00E800E8;
        }
        
        // Configure the size of the buffer that we will write.
        // Write the word count (device expects a 0 based number)
        *pdwBlockAddress = ((count - 1) << 16 | (count - 1));

		pdwFlashStart = pdwDeviceAddress;
		pdwRamStart = pdwFlashCache;

        // Write up to 16 DWORDS into the Flash memory staging area
		for(i = 0; i < count; i++)
        {
            *pdwDeviceAddress++ = *pdwFlashCache++;
	    }

		// increment the number of 64 byte segments written.
		b++;

        // Now program the buffer into Flash
        *pdwBlockAddress = 0x00D000D0;
        
        i = 0;
        while((i & 0x00800080) != 0x00800080)
        {
            i = *pdwBlockAddress;
        }

        dwPhysLen -= count << 2;

		// Read back the segment just written
	    *pdwFlash = 0x00FF00FF;
		for (i = 0; i < count; i++)
		{
			if(*pdwFlashStart++ != *pdwRamStart++)
			{
				EdbgOutputDebugString( "\r\nFlash programming failure at address\r\n%X: Ideal %X Actual %X\r\n", pdwFlashStart-1, *(pdwRamStart-1), *(pdwFlashStart-1) );
				return 1;
			}
		}

        if ((b % 4096) == 0) // every 64 * 4096 bytes (256K bytes) (128K each device)
		{
			EdbgOutputDebugString(".");
		}
    }
	
	pdwFlash =	(volatile DWORD *)((FLASH_START+dwEBOOT_OFFSET) | CACHED_TO_UNCACHED_OFFSET);

	// Put Flash into read mode.
    *pdwFlash = 0x00FF00FF;

	EdbgOutputDebugString( "\r\nComparing Flash vs RAM image ...\n\r");

	pdwFlashCache = (volatile DWORD *)(dwPhysStart | CACHED_TO_UNCACHED_OFFSET);
	
    for( j = 0; j < dwLength/4; j++ ) 
    {

		if(*pdwFlash++ != *pdwFlashCache++)
        {
			EdbgOutputDebugString( "\r\nBeat!\r\n%X: Ideal %X Actual %X\r\n", pdwFlash-1, *(pdwFlashCache-1), *(pdwFlash-1) );
			return 1;
		}
	}
	EdbgOutputDebugString( "Flash programmed successfully!\r\n" );

    return 0;
}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲美洲综合色网| 99精品黄色片免费大全| 亚洲精品写真福利| 亚洲制服欧美中文字幕中文字幕| 亚洲va欧美va天堂v国产综合| 亚洲午夜免费视频| 精品一区二区三区影院在线午夜| 午夜精品久久久久久不卡8050| 亚洲国产精品精华液2区45| 亚洲三级久久久| 蜜臀va亚洲va欧美va天堂 | 国产乱妇无码大片在线观看| 国产一区二区三区在线看麻豆| 91麻豆国产福利在线观看| 日韩免费一区二区| 亚洲黄色免费网站| 国产·精品毛片| 日韩午夜在线影院| 亚洲精品国产无套在线观| 国产在线播放一区二区三区| 欧美三级中文字幕在线观看| 久久蜜臀中文字幕| 亚洲综合在线第一页| 国产精品一品二品| 日韩欧美一级在线播放| 亚洲激情成人在线| 国产不卡视频在线观看| 欧美成人r级一区二区三区| 最新欧美精品一区二区三区| 国产在线视频一区二区三区| 欧美三级韩国三级日本一级| 国产精品三级在线观看| 国产一区二区三区最好精华液| 欧美一区二区三区免费视频| 亚洲欧美一区二区三区国产精品| 国产一区二区0| 日韩免费高清av| 午夜精品视频在线观看| 在线观看精品一区| 欧美国产一区在线| 国产91丝袜在线播放| 久久综合色综合88| 久久99精品国产91久久来源| 日韩午夜在线观看视频| 热久久久久久久| 欧美日韩三级一区二区| 亚洲成a人v欧美综合天堂| 在线视频欧美区| 亚洲欧美日韩国产中文在线| 国产69精品久久777的优势| 国产日韩av一区| 国产大陆精品国产| 日本一区二区免费在线| 丁香激情综合国产| 久久久久9999亚洲精品| 国产成人亚洲综合a∨婷婷 | 日韩亚洲欧美综合| 亚洲福利视频一区| 欧洲国产伦久久久久久久| 亚洲综合在线第一页| 欧美日韩国产另类不卡| 日本vs亚洲vs韩国一区三区二区 | 毛片av一区二区| 972aa.com艺术欧美| 中文字幕一区二区三区视频| 春色校园综合激情亚洲| 国产精品美女久久久久久久网站| 国产老妇另类xxxxx| 国产精品全国免费观看高清 | 久久综合一区二区| 国产成a人亚洲| 亚洲免费观看高清完整版在线观看| 色综合久久久久| 丝袜亚洲另类欧美| 久久综合九色综合久久久精品综合 | 99久久精品免费精品国产| 亚洲婷婷综合久久一本伊一区| 欧美中文字幕一区二区三区 | 99国内精品久久| 亚洲黄色片在线观看| 欧美日韩精品一区二区三区蜜桃| 亚洲国产精品久久一线不卡| 91精品国产免费| 国产大陆精品国产| 亚洲成人自拍一区| 国产午夜精品久久久久久久| av电影在线观看一区| 国产在线视频一区二区三区| 国产精品毛片无遮挡高清| 欧美三级电影在线看| 国内久久精品视频| 一个色在线综合| 精品理论电影在线| 色系网站成人免费| 黄色小说综合网站| 亚洲精品久久嫩草网站秘色| 欧美性猛片xxxx免费看久爱| 国产呦精品一区二区三区网站| 亚洲女人小视频在线观看| 91麻豆精品国产自产在线| va亚洲va日韩不卡在线观看| 日本成人在线不卡视频| 久久婷婷色综合| 欧美日韩国产一级片| 成人性生交大片免费看中文网站| 婷婷久久综合九色综合绿巨人 | 不卡一区二区中文字幕| 日韩国产一二三区| 亚洲天堂精品视频| 国产视频一区二区三区在线观看| 欧洲中文字幕精品| 成+人+亚洲+综合天堂| 国产美女在线精品| 日本美女一区二区三区视频| 亚洲精选免费视频| 欧洲一区在线观看| 免费成人av在线| 免费不卡在线视频| 国产一区不卡精品| 日韩一区二区三区三四区视频在线观看 | 日本黄色一区二区| 欧洲一区二区三区在线| 在线视频中文字幕一区二区| 欧美色国产精品| 7777精品伊人久久久大香线蕉完整版 | 五月婷婷激情综合| 日本成人在线电影网| 激情综合亚洲精品| 国产麻豆视频一区二区| 成人午夜精品在线| 99久久精品国产网站| 在线精品视频免费观看| 在线精品视频一区二区三四| 91精品国产免费| 欧美韩日一区二区三区| 一区二区三区91| 青娱乐精品视频在线| 国产成人在线观看| 色香蕉久久蜜桃| 日韩一区二区在线播放| 中文一区在线播放| 亚洲人成精品久久久久久| 日韩不卡一区二区三区| 国产自产高清不卡| 91激情五月电影| 日韩欧美在线123| 国产精品激情偷乱一区二区∴| 一区二区三区四区在线免费观看| 丝袜亚洲另类丝袜在线| 成人午夜精品一区二区三区| 色成人在线视频| 欧美成人aa大片| 亚洲日本青草视频在线怡红院 | 久久先锋影音av鲁色资源网| 欧美日韩一区中文字幕| 在线精品视频免费观看| 欧美mv和日韩mv国产网站| 一区视频在线播放| 男女视频一区二区| 色综合久久久久综合99| 欧美tickling网站挠脚心| 一区二区三区在线看| 国产高清精品网站| 欧美这里有精品| 国产亚洲一区二区在线观看| 无码av免费一区二区三区试看 | 国产午夜一区二区三区| 亚洲国产成人av| 高清不卡一二三区| 日韩欧美中文字幕制服| 亚洲国产日韩精品| 99久久精品情趣| 久久久www免费人成精品| 五月天欧美精品| 99久久国产免费看| 久久精品一区四区| 蜜臀av一级做a爰片久久| 日本高清成人免费播放| 国产精品麻豆一区二区| 国产一区二区三区观看| 5858s免费视频成人| 亚洲欧美电影一区二区| 成人午夜看片网址| 久久嫩草精品久久久久| 免费在线成人网| 51午夜精品国产| 亚洲电影在线播放| 91久久精品一区二区三| 中文字幕在线播放不卡一区| 国产成都精品91一区二区三| 久久这里只精品最新地址| 久久aⅴ国产欧美74aaa| 国产清纯白嫩初高生在线观看91| 亚洲线精品一区二区三区 | 欧美日韩精品一区二区三区 | 免费看黄色91| 欧美日韩aaaaa| 午夜精品在线视频一区| 91麻豆精品91久久久久久清纯| 亚洲自拍偷拍九九九|