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

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

?? amd.cpp

?? Ep93XX TionProV2 BSP
?? CPP
?? 第 1 頁 / 共 3 頁
字號(hào):
//**********************************************************************
//                                                                      
// Filename: amd.cpp
//                                                                      
// Description: FLASH Media Driver Interface for AMD StrataFlash Chip
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Use of this source code is subject to the terms of the Cirrus end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to 
// use this source code. For a copy of the EULA, please see the 
// EULA.RTF on your install media.
//
// Copyright(c) Cirrus Logic Corporation 2005, All Rights Reserved
//                                                                      
//**********************************************************************

#include <fmd.h>
#include <ceddk.h>
#ifdef READ_FROM_REGISTRY
#include <ddkreg.h>
#endif    // READ_FROM_REGISTRY.
#include <hwdefs.h>
#include "strata.h"

/*----------------------------------------------------------------------------------------------------*/
static BOOL g_bPairedFlash = TRUE;        // Indicates whether or not two flash parts are paired to create a 32-bit data interface.
static BOOL g_bXIPMode = FALSE;
static SysRegionInfo_t    g_FlashRegion[IntelRegionNUM];
/*---------------------------------------------------------------------------------------------------*/
BOOLEAN InitializeFlash(volatile ULONG * pChipBaseAddress, ULONG ChipFlashLength,volatile ULONG * pBaseAddress, ULONG FlashLength);

DWORD DoBufferedWrite(volatile ULONG ulBlockAddress,
                      volatile SECTOR_ADDR physicalSectorAddr,
                      PUCHAR pBuffer,
                      USHORT NumWriteBytes);



BOOL  GetEraseFlashSectorIndex(ULONG dwStartAddr)
{
   DWORD i,j,dwEraseLen;

   dwEraseLen = dwStartAddr;

	if(dwEraseLen==0)
	{
		return TRUE;
	}

	for(i = 0; i <g_FMDInfo.Geometry.NumEraseBlocks; i++) 
	{
		for(j = 0; j< g_FlashRegion[i].blocks; j++) 
		{

			if(dwEraseLen > g_FlashRegion[i].block_size) 
			{
				dwEraseLen = dwEraseLen - g_FlashRegion[i].block_size;
			} 
			else if(dwEraseLen ==g_FlashRegion[i].block_size)
			{
				g_FMDInfo.gdwCurEraseRegion = i;
				g_FMDInfo.gdwCurEraseBlock   = j;
				//RETAILMSG(ZONE_TEST, (TEXT(" = block_size =%x.i=%x,j=%x\r\n"),g_FlashRegion[i].block_size,i,j));
				return TRUE;
			}
			else 
			{
				g_FMDInfo.gdwCurEraseRegion = i;
				g_FMDInfo.gdwCurEraseBlock   = j;
				RETAILMSG(ZONE_TEST, (TEXT(" < block_size =%x.i=%x,j=%x\r\n"),g_FlashRegion[i].block_size,i,j));
				return FALSE;
			}

		}
    }

   return FALSE;

}


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:       FMD_Init()

Description:    Initializes the Flash memory device.

Returns:        Boolean indicating success.
------------------------------------------------------------------------------*/
PVOID FMD_Init(LPCTSTR lpActiveReg, PPCI_REG_INFO pRegIn, PPCI_REG_INFO pRegOut)
{
    volatile ULONG * pBaseAddress = NULL;
	volatile ULONG * pChipBaseAddress = NULL;
    ULONG FlashLength = 0,ChipFlashLength=0;

    BOOL bLastMode;
	
    RETAILMSG(1, (TEXT("INFO: FMD_Init. amd like\r\n")));
	
#ifdef READ_FROM_REGISTRY
    if (lpActiveReg != NULL)
    {
        DDKWINDOWINFO dwi;
        HKEY hConfig;

        // Get flash information from the registry.
        hConfig = OpenDeviceKey((LPCTSTR)lpActiveReg);        
        if (hConfig == NULL)
        {
            RETAILMSG(ZONE_TEST, (TEXT("ERROR: FMD_Init: OpenDeviceKey failed.\r\n")));
            return(NULL);
        }
        dwi.cbSize = sizeof(dwi);
        if (DDKReg_GetWindowInfo(hConfig, &dwi) != ERROR_SUCCESS)
        {
            RETAILMSG(ZONE_TEST, (TEXT("ERROR: FMD_Init: DDKReg_GetWindowInfo() failed.\r\n")));
            return(NULL);
        }
        // The first memory window contains the base address and length of our flash part.
        if (dwi.dwNumMemWindows)
        {
            pBaseAddress = (volatile ULONG *)(dwi.memWindows[1].dwBase);
            FlashLength  = (ULONG)(dwi.memWindows[1].dwLen);

            pChipBaseAddress = (volatile ULONG *)(dwi.memWindows[0].dwBase);
            ChipFlashLength  = (ULONG)(dwi.memWindows[0].dwLen);
        }
    }
#else
    // Get flash base address and length from caller.
    if (!pRegIn || !pRegIn->MemBase.Num || !pRegIn->MemLen.Num)
    {
        RETAILMSG(ZONE_TEST, (TEXT("ERROR: FMD_Init: invalid flash memory base and/or length specified by caller.\r\n")));
        return(NULL);
    }
    else
    {
        pBaseAddress = (volatile ULONG *)pRegIn->MemBase.Reg[1];
        FlashLength  = pRegIn->MemLen.Reg[1];

        pChipBaseAddress = (volatile ULONG *)pRegIn->MemBase.Reg[0];
        ChipFlashLength  = pRegIn->MemLen.Reg[0];
    }
#endif    // READ_FROM_REGISTRY.

    // Run in kernel mode.
    bLastMode = SetKMode(TRUE);

//
//resetting the smc interface
//
//	SetSMCInterface();

    // Identify the flash part and collect device information.
    //
	
    if (!InitializeFlash(pChipBaseAddress,ChipFlashLength,pBaseAddress, FlashLength))
    {
        RETAILMSG(ZONE_TEST, (TEXT("ERROR: FMD_Init: Failed to initialize flash.\r\n")));
        SetKMode(bLastMode);
        return(NULL);
    }

    RETAILMSG(ZONE_TEST, (TEXT("INFO: FMD_Init: Flash Address=0x%x  Length=0x%x.\r\n"), (ULONG)pBaseAddress, FlashLength));

    SetKMode(bLastMode);
    return((PVOID)pBaseAddress);
}


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:       FMD_ReadSector()

Description:    Reads the requested sector data and/or sector metadata from the
                Flash media.

Notes:          Notice that although each byte of a NOR Flash block is individually
                addressable, the media is still logically broken up into sectors.  
                Thus, for each sector request, we must determine where this data
                resides in the respective Flash block (see note above).

                By default, the NOR Flash is configured in READ ARRAY MODE so there
                is no need to set any control lines to access the media.  The data
                can just be read directly from the media (like RAM).
                
Returns:        Boolean indicating success.
------------------------------------------------------------------------------*/
BOOL  FMD_ReadSector(SECTOR_ADDR startSectorAddr, LPBYTE pSectorBuff, PSectorInfo pSectorInfoBuff, DWORD dwNumSectors)
{
    volatile SECTOR_ADDR  physicalSectorAddr = 0;
    volatile ULONG ulBlockAddress = 0;
    BLOCK_ID blockID = 0;
    DWORD i = 0;
    unsigned int j;
    BOOL bLastMode;

	RETAILMSG(ZONE_TEST, (TEXT("FMD_ReadSector: (startAdd =%x num=%x) sectot_addr=%x,sector_info %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 read 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 -----
        // Note we do this differently based on whether the caller wants us to read 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 read from 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);
		
        ulBlockAddress = (ULONG)(physicalSectorAddr - (physicalSectorAddr % g_FMDInfo.BlockSize));

		if(GetEraseFlashSectorIndex(ulBlockAddress-g_FMDInfo.ChipBaseAddress)==FALSE)
		{
			  RETAILMSG(ZONE_TEST, (TEXT("ERASE Block error,not aligned\r\n")));
			return FALSE;
		}
		
		RETAILMSG(ZONE_TEST, (TEXT("blockID=%x,physicalSectorAddr=%x,g_bXIPMode=%x,ulBlockAddress=%x,g_FMDInfo.gdwCurEraseRegion=%x,gdwCurEraseBlock=%x.\r\n"),
							blockID,physicalSectorAddr,g_bXIPMode,ulBlockAddress,g_FMDInfo.gdwCurEraseRegion,g_FMDInfo.gdwCurEraseBlock));

		if(g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].block_size==g_FMDInfo.BlockSize)
		{  
			RETAILMSG(ZONE_TEST, (TEXT("1 \r\n")));

			WRITE_COMMAND(g_FMDInfo.ChipBaseAddress, AMD_RESET);


			RETAILMSG(ZONE_TEST, (TEXT("2 \r\n")));

			//----- Read the necessary sector data -----
			if(pSectorBuff)
			{
				memcpy(pSectorBuff, (CONST PVOID)physicalSectorAddr, SECTOR_SIZE);
				pSectorBuff += SECTOR_SIZE;
			}
				
			RETAILMSG(ZONE_TEST, (TEXT("3 \r\n")));

			//----- Read the necessary SectorInfo data (metadata) -----
			if(!g_bXIPMode && pSectorInfoBuff)
			{
				// The metadata bytes are read directly into the SectorInfo structure...
				memcpy(pSectorInfoBuff, (CONST PVOID)(physicalSectorAddr+SECTOR_SIZE), sizeof(SectorInfo));
				pSectorInfoBuff += sizeof(SectorInfo);
			}
		
			RETAILMSG(ZONE_TEST, (TEXT("read sector %x\r\n"),physicalSectorAddr,ulBlockAddress));
		}
		else
		{
			for(j = g_FMDInfo.gdwCurEraseBlock; j< g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].blocks; j++) 
			{
				WRITE_COMMAND(g_FMDInfo.ChipBaseAddress, AMD_RESET);
				ulBlockAddress = ulBlockAddress +g_FlashRegion[g_FMDInfo.gdwCurEraseRegion].block_size;
			}

			//----- Read the necessary sector data -----
			if(pSectorBuff)
			{
				memcpy(pSectorBuff, (CONST PVOID)physicalSectorAddr, SECTOR_SIZE);
				pSectorBuff += SECTOR_SIZE;
			}

			//----- Read the necessary SectorInfo data (metadata) -----
			if(!g_bXIPMode && pSectorInfoBuff)
			{
				// The metadata bytes are read directly into the SectorInfo structure...
				memcpy(pSectorInfoBuff, (CONST PVOID)(physicalSectorAddr+SECTOR_SIZE), sizeof(SectorInfo));
				pSectorInfoBuff += sizeof(SectorInfo);
			}
		}
    }
    SetKMode(bLastMode);

	RETAILMSG(ZONE_TEST, (TEXT("FMD_ReadSector: over.\r\n") ));
    return(TRUE);
}


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:       FMD_WriteSector()

Description:    Writes the requested sector data and/or sector metadata to the
                Flash media.

Notes:          Notice that although each byte of a NOR Flash block is individually
                addressable, the media is still logically broken up into sectors.
                Thus, for each sector request, we must determine where to put the
                data in each respective Flash block (see note above).

                By default, the NOR Flash is configured in READ ARRAY MODE we need
                to set some control lines to prepare for the WRITE operation.

Returns:        Boolean indicating success.
------------------------------------------------------------------------------*/
BOOL  FMD_WriteSector(SECTOR_ADDR startSectorAddr, LPBYTE pSectorBuff, PSectorInfo pSectorInfoBuff, DWORD dwNumSectors)
{
    volatile SECTOR_ADDR physicalSectorAddr = 0;
    BLOCK_ID blockID = 0;
    DWORD i = 0;
    DWORD j = 0;
    DWORD k = 0;
    volatile ULONG ulBlockAddress = 0;
    BOOL bLastMode;
    DWORD dwBusWidth = g_bPairedFlash ? sizeof(ULONG) : sizeof(USHORT);
    LPBYTE pBuffer = pSectorBuff;
    USHORT usBufferSize = g_bPairedFlash ? (1 << g_FMDInfo.Geometry.WriteBuffSize) * 2 : (1 << g_FMDInfo.Geometry.WriteBuffSize);
    BOOL fRet = FALSE;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品中文av资源站在线观看| 国产精品久久久久天堂| 91色在线porny| 日韩美一区二区三区| 激情图片小说一区| 中文字幕一区二区三区蜜月| 欧美日本乱大交xxxxx| 国产麻豆视频精品| 在线不卡a资源高清| 日本高清不卡aⅴ免费网站| 成人精品亚洲人成在线| 国产真实乱子伦精品视频| 午夜精品久久久久影视| 一区二区三区日韩| 国产麻豆精品theporn| 捆绑变态av一区二区三区| 日本网站在线观看一区二区三区| 夜夜爽夜夜爽精品视频| 亚洲免费av网站| 国产欧美一区在线| 欧美精品一区二区在线观看| 欧美一级欧美一级在线播放| 56国语精品自产拍在线观看| 在线不卡免费欧美| 欧美一区二区免费| 91精品国产综合久久久久久久| 欧美日本高清视频在线观看| 99精品久久只有精品| 不卡视频在线看| www.亚洲人| 日本道色综合久久| 91麻豆精品一区二区三区| 99国产精品国产精品久久| 91亚洲午夜精品久久久久久| 色综合天天综合网国产成人综合天 | 中文字幕在线一区免费| 综合欧美一区二区三区| 一区二区三区日韩| 天堂在线亚洲视频| 麻豆视频观看网址久久| 狠狠色狠狠色综合系列| 高清成人免费视频| 91蜜桃婷婷狠狠久久综合9色| 成人午夜激情影院| 色婷婷综合久色| 欧美久久久久久久久中文字幕| 日韩三级在线免费观看| 69堂国产成人免费视频| 久久久久国产精品麻豆ai换脸 | 日韩视频一区二区| 精品国产99国产精品| 中文字幕制服丝袜成人av| 亚洲欧洲www| 亚洲国产精品综合小说图片区| 免费在线看一区| 高潮精品一区videoshd| 在线看日韩精品电影| 日韩三级在线观看| 国产精品久久久久一区二区三区| 国产精品福利一区| 日韩中文字幕亚洲一区二区va在线 | 日韩视频在线永久播放| 精品奇米国产一区二区三区| 国产精品视频免费看| 午夜欧美电影在线观看| 国产高清不卡一区| 欧美亚洲高清一区二区三区不卡| 日韩欧美国产综合在线一区二区三区| 国产亚洲欧美色| 麻豆精品一区二区综合av| 欧美亚洲综合久久| 亚洲美女屁股眼交| 国产成人8x视频一区二区| 欧美成人精品福利| 午夜久久久影院| 欧美在线观看一区二区| 国产精品电影一区二区三区| 国产自产2019最新不卡| 欧美大片一区二区三区| 日韩国产在线观看一区| 日本精品一区二区三区高清| 中文字幕欧美一区| 国产99一区视频免费| 久久伊人蜜桃av一区二区| 免费不卡在线观看| 91.麻豆视频| 午夜一区二区三区视频| 在线看日本不卡| 一区二区三国产精华液| 一本色道久久综合精品竹菊| 国产精品久久久久久久久免费桃花 | 亚洲一区二区三区不卡国产欧美| jiyouzz国产精品久久| 国产日韩精品一区| 国产精品69毛片高清亚洲| 久久综合九色综合久久久精品综合| 麻豆91免费看| 日韩欧美国产一区二区三区 | 欧美日韩亚洲综合在线 | 久久女同精品一区二区| 毛片不卡一区二区| 精品奇米国产一区二区三区| 日韩不卡一二三区| 欧美顶级少妇做爰| 日产欧产美韩系列久久99| 欧美性三三影院| 午夜婷婷国产麻豆精品| 欧美精品三级在线观看| 日韩专区欧美专区| 日韩视频免费观看高清完整版在线观看 | 麻豆精品一区二区| 欧美一区三区四区| 免费人成在线不卡| 久久综合久久综合久久| 成人亚洲一区二区一| 中文字幕日韩精品一区 | 亚洲国产精品黑人久久久| 成人国产电影网| 亚洲精品福利视频网站| 欧美日韩在线综合| 在线免费亚洲电影| 亚洲chinese男男1069| 欧美一区二区三区视频在线| 极品少妇xxxx精品少妇偷拍 | 国产麻豆成人传媒免费观看| 亚洲国产激情av| 色哟哟一区二区| 日韩avvvv在线播放| 久久久欧美精品sm网站| www.在线欧美| 视频一区免费在线观看| 久久免费电影网| 99精品久久99久久久久| 亚洲专区一二三| 欧美tk丨vk视频| 不卡av在线网| 天天av天天翘天天综合网色鬼国产 | 91精品久久久久久蜜臀| 国产成人综合视频| 亚洲最新视频在线观看| 欧美成人欧美edvon| 色综合色综合色综合| 日本成人在线网站| 中文字幕亚洲欧美在线不卡| 欧美精品在线观看播放| 国产·精品毛片| 偷窥国产亚洲免费视频| 欧美韩日一区二区三区四区| 欧美巨大另类极品videosbest| 国产九色sp调教91| 亚洲另类在线制服丝袜| 亚洲精品在线一区二区| 色av成人天堂桃色av| 狠狠色伊人亚洲综合成人| 亚洲在线视频一区| 国产日本欧美一区二区| 777久久久精品| 99久久精品免费精品国产| 日韩成人av影视| 亚洲精品成人悠悠色影视| 久久影院电视剧免费观看| 欧美日本国产视频| 91麻豆免费观看| 国产精品伊人色| 日韩国产在线一| 一区二区三区四区五区视频在线观看 | 久久精品视频一区二区三区| 欧美吻胸吃奶大尺度电影 | 国产亚洲一区二区三区在线观看| 欧美熟乱第一页| av亚洲精华国产精华精华| 狠狠色2019综合网| 日欧美一区二区| 亚洲精品菠萝久久久久久久| 国产日韩精品一区二区三区在线| 日韩欧美国产一区在线观看| 精品视频全国免费看| 色婷婷综合久久久久中文| 成人小视频在线| 国产美女在线观看一区| 另类小说色综合网站| 天堂va蜜桃一区二区三区漫画版| 亚洲精品视频一区| 亚洲欧洲精品一区二区三区 | 99久久夜色精品国产网站| 国产精品1024| 激情图片小说一区| 美国一区二区三区在线播放| 日韩综合在线视频| 亚洲国产成人精品视频| 亚洲精品国产成人久久av盗摄| 国产精品久久久久9999吃药| 久久久99久久| 久久久久九九视频| 久久视频一区二区| 国产亚洲精品久| 欧美激情艳妇裸体舞| 亚洲国产精品精华液ab| 国产精品免费视频一区| 亚洲国产精品99久久久久久久久 |