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

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

?? amd.cpp

?? Ep93XX TionProV2 BSP
?? CPP
?? 第 1 頁 / 共 3 頁
字號:

    ULONG	nResult = 0 ;

#ifdef READ_FROM_REGISTRY
    BYTE cTempBuffer[SECTOR_SIZE];
#endif

   
	RETAILMSG(ZONE_TEST, (TEXT("FMD_WriteSector: startAdd =%x num=%x)  sector_add=%x sectorinfo_add=%x.\r\n"),startSectorAddr,dwNumSectors,
							pSectorBuff,pSectorInfoBuff));


    //----- 1. Check the input parameters -----
    //         NOTE: The FAL insures that the starting sector address is in the allowable range.
    if((dwNumSectors == 0) || ((pSectorBuff == NULL) && (pSectorInfoBuff == NULL)))
    {
        return(FALSE);
    }

    //----- 2. Process the write request(s)... -----

    bLastMode = SetKMode(TRUE);
    
    for(i = startSectorAddr; i < (startSectorAddr + dwNumSectors); i++)
    {
        //----- Determine the block this physical sector resides in -----
        blockID = (i / g_FMDInfo.SectorsPerBlock);

        //----- Compute the physical address for the requested sector -----
        // Note we do this differently based on whether the caller wants us to write the sector information structure as well.  Since we're
        // dealing with a NOR flash which is XIP-able, one might want to use this function to write an XIP region (i.e., no sector information
        // structures in flash).
        //
        if (!g_bXIPMode)
            physicalSectorAddr = g_FMDInfo.BaseAddress + i*(SECTOR_SIZE + sizeof(SectorInfo)) 
								+ (blockID * g_FMDInfo.UnusedBytesPerBlock);
        else
            physicalSectorAddr = g_FMDInfo.BaseAddress + (i*SECTOR_SIZE);

        // Compute the block address for this sector write.
        //
        ulBlockAddress = (ULONG)(physicalSectorAddr - (physicalSectorAddr % g_FMDInfo.BlockSize));
        
        //----- Write the necessary sector data -----       
        if(pSectorBuff)
        {
            
#ifdef READ_FROM_REGISTRY                
            // Check for unaligned pointer.  Only need to do this if the FMD is being used as 
            // a block driver (and therefore READ_FROM_REGISTRY is set)
            if ((DWORD)pSectorBuff & (dwBusWidth - 1))
            {
                RETAILMSG(ZONE_TEST, (TEXT("FMD_WriteSector: Unaligned pointer - using internal buffer\r\n")));
                memcpy(cTempBuffer, pSectorBuff, SECTOR_SIZE);
                pBuffer = cTempBuffer;
            }
            else
#endif
            {
                pBuffer = pSectorBuff;
            }


            // from Intel: if the sector is not aligned modulo write buffer size - 
            // performance can be enhanced my doing a partial write to align the buffer 
            // for the rest of the writes to complete the sector.  If you are doing 
            // partial writes to align the buffer address, and a single word 
            // (or DWORD of x32) is being written, it is faster to use the flash's WORD  
            // write command instead of the buffered write.
			k = DoBufferedWrite(ulBlockAddress, physicalSectorAddr , pBuffer, SECTOR_SIZE);
			if (!k)
				goto exit;

			nResult=1;

			pSectorBuff += SECTOR_SIZE;
        }

        //----- Write the necessary sector info data (metadata) -----
        //      NOTE: Notice that the 6 metadata bytes are just stored after the sector data...
        if((!g_bXIPMode && pSectorInfoBuff)&&(nResult))
        {
          	RETAILMSG(ZONE_TEST, (TEXT("FMD_WriteSector: write info\r\n")));
			
            if (!DoBufferedWrite(ulBlockAddress, physicalSectorAddr+SECTOR_SIZE, (PUCHAR)pSectorInfoBuff, sizeof(SectorInfo)))
                goto exit;

            pSectorInfoBuff += sizeof(SectorInfo);
        }
    }

    fRet = TRUE;

exit:
    //----- 3. Put the Flash back into READ ARRAY mode -----

    SetKMode(bLastMode);

	RETAILMSG(ZONE_TEST, (TEXT("FMD_WriteSector: over %x \r\n"),fRet ));

    return fRet;
}


DWORD DoBufferedWrite(volatile ULONG ulBlockAddress,
                      volatile SECTOR_ADDR physicalSectorAddr,
                      PUCHAR pBuffer,
                      USHORT NumWriteBytes)
{
    DWORD k = 0;
    ULONG ulCount,ulCount1=0;
    DWORD dwBusWidth = g_bPairedFlash ? sizeof(ULONG) : sizeof(USHORT);
    DWORD dwWordCount = (NumWriteBytes / dwBusWidth);
    PULONG pLongBuffer = (PULONG)pBuffer;
    PUSHORT pShortBuffer = (PUSHORT)pBuffer;

    int iResult = FLASH_ERR_OK;


	volatile USHORT *   pusDest16;
	volatile ULONG  *   pusDest32;

	DWORD m_offset=0;

//RETAILMSG(1, (TEXT("WRITE: ).\r\n")));
    if (g_bPairedFlash)
    {
		pusDest32= (volatile ULONG *)g_FMDInfo.ChipBaseAddress;

		WRITE_COMMAND(pusDest32+ AMD_SETUP_ADDR1,AMD_SETUP_CODE1);
		WRITE_COMMAND(pusDest32+ AMD_SETUP_ADDR2,AMD_SETUP_CODE2);
		WRITE_COMMAND(pusDest32+ AMD_SETUP_ADDR1,0x0020);
	}
	else
	{
		pusDest16= (volatile USHORT*)g_FMDInfo.ChipBaseAddress;

		WRITE_COMMAND(pusDest16+ AMD_SETUP_ADDR1,AMD_SETUP_CODE1);
		WRITE_COMMAND(pusDest16+ AMD_SETUP_ADDR2,AMD_SETUP_CODE2);
		WRITE_COMMAND(pusDest16+ AMD_SETUP_ADDR1,0x0020);
	}
	m_offset=physicalSectorAddr-g_FMDInfo.ChipBaseAddress;

	for(k = 0 ; k < dwWordCount ; k ++)
	{
		if (g_bPairedFlash)
		{
            pusDest32= (volatile ULONG *)g_FMDInfo.ChipBaseAddress;
	
			WRITE_COMMAND(pusDest32+ 0x00000,0x00a0);
	
			*(pusDest32+(m_offset>>2)+k)=*(pLongBuffer+k) ;	
			  
			DelayInuSec(100);
			ulCount = 0;

			while ( *(pusDest32+(m_offset>>2)+k) != *(pLongBuffer+k)   )
	        {
		    	DelayInuSec(1);
				
		    	if ( ulCount++== 1000)
		    	{
		        	RETAILMSG(ZONE_TEST, (TEXT("DoWordWrite: %x  %x\r\n"),*(pusDest32+(m_offset>>2)+k),*(pLongBuffer+k) ));
					iResult = FLASH_ERR_DRV_TIMEOUT;		
		        	//return 0;
		        	break;
		    	}
			}
		}
		else
		{
			pusDest16= (PUSHORT)g_FMDInfo.ChipBaseAddress;
		     
			WRITE_COMMAND(pusDest16+ 0x00000,0x00a0);
			  
			*(pusDest16+(m_offset>>1)+k)=*(pShortBuffer+k) ;	
				
			DelayInuSec(1);
	    	ulCount = 0;
			
			while ( *(pusDest16+(m_offset>>1)+k) != *(pShortBuffer+k)   )
	        {
		    	DelayInuSec(1);
				
		    	if ( ulCount++== 1000 )
		    	{
		        	RETAILMSG(ZONE_TEST, (TEXT("DoWordWrite: Timed out writing buffered data 1\r\n")));
					iResult = FLASH_ERR_DRV_TIMEOUT;		
		        	break;
		    	}
			}
		}
	    DelayInuSec(1);
	    ulCount = 0;
	}

    if (g_bPairedFlash)
	{
		pusDest32= (volatile ULONG *)g_FMDInfo.ChipBaseAddress;
		WRITE_COMMAND(pusDest32+ AMD_SETUP_ADDR1,0x0090);
		WRITE_COMMAND(pusDest32+ AMD_SETUP_ADDR2,0x0000);
     }

	else
	{
		pusDest16= (volatile USHORT *)g_FMDInfo.ChipBaseAddress;
		WRITE_COMMAND(pusDest16+ AMD_SETUP_ADDR1,0x0090);
		WRITE_COMMAND(pusDest16+ AMD_SETUP_ADDR2,0x0000);
	}
//RETAILMSG(1, (TEXT("--WRITE: ).\r\n")));
    return NumWriteBytes;
}


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:       FMD_EraseBlock()

Description:    Erases the specified Flash block.

Returns:        Boolean indicating success.
------------------------------------------------------------------------------*/
BOOL  FMD_EraseBlock(BLOCK_ID blockID)
{
    volatile ULONG ulBlockAddress = 0;
    ULONG ulStatus = 0;
    BOOL bLastMode = SetKMode(TRUE);
	unsigned int  j;
	ULONG ulCount=0;

	volatile USHORT  *  pusDest16;
	volatile ULONG   *  pusDest32;
	DWORD m_offset=0;

	RETAILMSG(ZONE_TEST, (TEXT("FMD_EraseBlock: id =%x ).\r\n"), blockID));
    // Determine the address for the specified block.
	ulBlockAddress  =  g_FMDInfo.BaseAddress + (blockID * g_FMDInfo.BlockSize);

	pusDest16= (PUSHORT)ulBlockAddress;
	pusDest32= (PULONG)ulBlockAddress;

	if(GetEraseFlashSectorIndex(ulBlockAddress-g_FMDInfo.ChipBaseAddress)==FALSE)
	{
		RETAILMSG(ZONE_TEST, (TEXT("ERASE Block error,not aligned\r\n")));
		return FALSE;
	}
	if(g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].block_size==g_FMDInfo.BlockSize)
	{
 		if (g_bPairedFlash)
 		{
			m_offset=ulBlockAddress-g_FMDInfo.ChipBaseAddress;
			// Issue erase and confirm command.
			// Note: eventually this should be changed to issue mass block erases, then loop to
			// verify each completes.
			pusDest32= (volatile ULONG *)g_FMDInfo.ChipBaseAddress;

			WRITE_COMMAND(pusDest32+AMD_SETUP_ADDR1, AMD_SETUP_CODE1);
			WRITE_COMMAND(pusDest32+AMD_SETUP_ADDR2, AMD_SETUP_CODE2);
			WRITE_COMMAND(pusDest32+AMD_SETUP_ADDR1, AMD_SETUP_ERASE);
			WRITE_COMMAND(pusDest32+AMD_SETUP_ADDR1, AMD_SETUP_CODE1);
			WRITE_COMMAND(pusDest32+AMD_SETUP_ADDR2, AMD_SETUP_CODE2);

			*(pusDest32+(m_offset>>2))= (AMD_BLOCK_ERASE<<16)|AMD_BLOCK_ERASE;

			ulCount = 0;

			while ((*(pusDest32+(m_offset>>2)) &AMD_SECTOR_ERASE_TIMER)!=AMD_SECTOR_ERASE_TIMER)
			{
				DelayInuSec(1);
				if ( ulCount++ == 10000 )
				//Sleep(1);
				//if ( ulCount++ == 10 )
				{
					RETAILMSG(ZONE_TEST, (TEXT("erase: Timed out writing buffered data 1\r\n")));
					return 0;
				}
			}
 		}
		else
		{
//			m_offset=ulBlockAddress-g_FMDInfo.ChipBaseAddress;

			pusDest16=(volatile USHORT *)g_FMDInfo.ChipBaseAddress;
			// Issue erase and confirm command.
			// Note: eventually this should be changed to issue mass block erases, then loop to
			// verify each completes.
			*(pusDest16+ AMD_SETUP_ADDR1)= AMD_SETUP_CODE1;	
			*(pusDest16+ AMD_SETUP_ADDR2)= AMD_SETUP_CODE2;	
			*(pusDest16+ AMD_SETUP_ADDR1)= AMD_SETUP_ERASE;		
			*(pusDest16+ AMD_SETUP_ADDR1)= AMD_SETUP_CODE1;	
			*(pusDest16+ AMD_SETUP_ADDR2)=AMD_SETUP_CODE2;	

//			*(pusDest16+(m_offset>>1))= AMD_BLOCK_ERASE;

			Sleep(5);
//			DelayInuSec(5000);
			
			pusDest16=(PUSHORT)ulBlockAddress;
			*pusDest16 = AMD_BLOCK_ERASE;

			Sleep(10);
//			DelayInuSec(10000);

			ulCount = 0;

			while (!CHECK_STATUS(ulBlockAddress, AMD_SECTOR_ERASE_TIMER))
			{
				//DelayInuSec(1);
				//if ( ulCount++ == 10000 )
				Sleep(1);
				if ( ulCount++ == 10 )
	    		{
	        		RETAILMSG(1, (TEXT("erase: Timed out writing buffered data 1\r\n")));
	        		return 0;
	    		}
			}
		}
		DelayInuSec(100);
	} //g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].block_size==g_FMDInfo.BlockSize
	else
	{
   		for(j = g_FMDInfo.gdwCurEraseBlock; 
			j< g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].blocks; j++)
		{
		 	if (g_bPairedFlash)
		 	{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久蜜臀| 一区av在线播放| 日韩免费一区二区| 在线综合+亚洲+欧美中文字幕| 日韩高清欧美激情| 亚洲成人免费观看| 肉色丝袜一区二区| 1000精品久久久久久久久| 国产精品国产三级国产普通话99| 欧美精品tushy高清| 欧美日本一道本在线视频| 欧美男男青年gay1069videost| 成人国产精品免费观看动漫 | 国产精品日韩成人| 欧美极品aⅴ影院| 综合色天天鬼久久鬼色| 亚洲综合一区在线| 视频在线在亚洲| 久久99久久精品欧美| 极品销魂美女一区二区三区| 亚洲蜜臀av乱码久久精品| 精品少妇一区二区三区日产乱码| 色琪琪一区二区三区亚洲区| 欧美亚洲另类激情小说| 欧美婷婷六月丁香综合色| 这里是久久伊人| 精品久久久三级丝袜| 欧美日韩视频在线一区二区| 91精品福利在线一区二区三区| 91啪亚洲精品| 成人国产一区二区三区精品| 国产一区二区在线影院| 不卡免费追剧大全电视剧网站| 国产一区二区伦理| 不卡高清视频专区| 成人福利视频在线| 欧美日韩一区二区三区在线看 | 日韩欧美国产一区二区在线播放| 欧美专区日韩专区| 91理论电影在线观看| 欧美精品久久天天躁| 欧美在线色视频| 日韩欧美国产系列| 中文字幕av一区二区三区免费看 | 亚洲精品免费播放| 久久精品99国产精品| 日韩精品欧美精品| 成人免费毛片片v| 成人ar影院免费观看视频| 欧美精选在线播放| 亚洲国产精品ⅴa在线观看| 亚洲在线中文字幕| 亚洲国产视频一区| 国产在线视频一区二区| 国产宾馆实践打屁股91| 欧洲国内综合视频| 国产欧美日韩综合精品一区二区| 国产日产欧美一区二区三区| 午夜a成v人精品| 成人av资源网站| 精品久久久久久久久久久久包黑料| 日韩一区二区三区在线| 亚洲欧洲99久久| 精品在线一区二区三区| 91传媒视频在线播放| 国产丝袜欧美中文另类| 17c精品麻豆一区二区免费| 蜜桃视频第一区免费观看| 一本一本大道香蕉久在线精品 | 国产精品二三区| 美美哒免费高清在线观看视频一区二区 | 国产精品一卡二卡在线观看| 欧美色偷偷大香| 国产精品视频看| 亚洲三级在线观看| 国产精品69毛片高清亚洲| 6080日韩午夜伦伦午夜伦| 国产精品久久三区| 国产成人综合亚洲网站| 99久久免费国产| 久久精品一区四区| 激情综合色综合久久综合| 91麻豆精品国产综合久久久久久| 精品欧美乱码久久久久久 | 中文字幕中文字幕一区二区 | 99久久伊人精品| 久久久久久久综合日本| 日韩成人av影视| 欧美日韩一本到| 亚洲一区免费视频| 91黄视频在线观看| 亚洲欧美日韩人成在线播放| 蜜臀av一区二区三区| 欧美日韩精品一区二区三区四区| 久久久久久99精品| 激情五月播播久久久精品| 91精品国产免费| 日本成人在线看| 大尺度一区二区| 久久久综合精品| 韩国av一区二区三区四区| 在线播放欧美女士性生活| 亚洲综合激情小说| 在线影视一区二区三区| 一区二区三区四区亚洲| 日本精品一级二级| 亚洲免费成人av| 91国产免费看| 一区二区三区 在线观看视频| 久久99久久久久| 精品欧美一区二区久久| 国产在线观看一区二区| 欧美主播一区二区三区美女| 一区二区三区精品视频| 国产精品综合一区二区| 亚洲国产精品精华液2区45| 成人一区二区三区视频在线观看| 欧美精品电影在线播放| 麻豆成人在线观看| 久久婷婷成人综合色| 亚洲高清视频中文字幕| 欧美一区二区免费| 黄网站免费久久| 中文字幕va一区二区三区| 91丨porny丨国产入口| 精品国产电影一区二区| 国产综合色在线视频区| 国产日韩视频一区二区三区| 不卡av在线网| 亚洲二区在线观看| 日韩一区二区三区高清免费看看| 亚洲黄色性网站| 欧美精品三级日韩久久| 国产在线播放一区二区三区| 国产偷国产偷精品高清尤物 | 亚洲一区二区欧美日韩| 欧美一区二区播放| 风间由美一区二区av101| 精品欧美一区二区三区精品久久| 亚洲尤物在线视频观看| 日韩欧美国产电影| 成人免费毛片高清视频| 一区二区三区欧美久久| 日韩精品一区二区三区四区视频| 亚洲成人一区二区| 久久一区二区视频| 一本久久精品一区二区| 蜜臀精品一区二区三区在线观看 | 中文一区在线播放| 国产成a人亚洲| 亚洲精品ww久久久久久p站| 日韩视频一区二区三区在线播放| 午夜私人影院久久久久| 久久久久久麻豆| 欧美视频三区在线播放| 狠狠色丁香久久婷婷综| 一区二区国产视频| 久久综合国产精品| 欧美亚洲一区二区在线| 国产一区二区三区免费播放 | xnxx国产精品| 国产在线视频精品一区| 久久久亚洲高清| 国产尤物一区二区| 亚洲国产日产av| 国产婷婷色一区二区三区| 欧美日韩国产不卡| 成人一二三区视频| 美洲天堂一区二卡三卡四卡视频| 日韩欧美一区在线观看| 99精品视频中文字幕| 综合久久给合久久狠狠狠97色 | 日韩美女视频在线| 91美女片黄在线观看| 国产在线播放一区| 日本aⅴ免费视频一区二区三区| 这里只有精品免费| 色婷婷av一区二区三区软件| 夜夜精品浪潮av一区二区三区| 欧美性极品少妇| av在线不卡免费看| 国产一本一道久久香蕉| 性久久久久久久| 一区二区三区蜜桃| 欧美国产欧美综合| 精品久久久网站| 欧美一区二区在线免费观看| 欧美伊人久久久久久久久影院| 日日夜夜免费精品| 亚洲成人免费av| 一区二区三区中文字幕精品精品 | 中文字幕在线不卡国产视频| 精品成人在线观看| 欧美一级久久久| 欧美人动与zoxxxx乱| 91久久国产最好的精华液| 蜜臀精品久久久久久蜜臀| 天天影视网天天综合色在线播放 | 国产精品毛片无遮挡高清| 久久久精品天堂|