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

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

?? amd.cpp

?? Ep93XX TionProV2 BSP
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(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;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品麻豆久久久| 亚洲欧美综合另类在线卡通| 成人国产在线观看| 香蕉成人伊视频在线观看| 国产欧美日韩不卡免费| 欧美日韩国产成人在线91| 国产69精品久久久久毛片| 亚洲高清免费在线| 国产精品亲子伦对白| 日韩一级免费观看| 91久久国产最好的精华液| 国产精品123区| 亚洲成人精品一区二区| 最新国产成人在线观看| ww久久中文字幕| 这里只有精品视频在线观看| 色94色欧美sute亚洲线路一久| 国产伦精一区二区三区| 青娱乐精品在线视频| 亚洲男人的天堂av| 国产精品国产三级国产aⅴ原创| 成人美女视频在线观看18| 日本成人在线一区| 久久久91精品国产一区二区精品 | 欧美视频你懂的| 国产精品一区二区无线| 日韩av在线发布| 亚洲成人激情自拍| 欧美精品在线一区二区三区| 麻豆精品久久精品色综合| 亚洲一区在线电影| 一区二区在线观看视频| 国产精品不卡视频| 日本一区二区成人| 中文字幕精品在线不卡| 337p粉嫩大胆色噜噜噜噜亚洲| 91精品国产91久久久久久一区二区 | a级精品国产片在线观看| 国产精品99久久久久| 国产精品影视天天线| 国产综合久久久久久鬼色| 91麻豆精品国产自产在线观看一区| 亚洲欧美另类久久久精品 | 亚洲成人黄色小说| 一区二区三区在线免费观看| 91精品国产91综合久久蜜臀| 欧美午夜一区二区| 欧美日韩在线精品一区二区三区激情| 欧美色精品在线视频| 欧美在线制服丝袜| 在线视频中文字幕一区二区| 日本高清视频一区二区| 欧美性大战久久久| 欧美视频完全免费看| 在线综合+亚洲+欧美中文字幕| 精品视频一区二区三区免费| 欧美色精品天天在线观看视频| 欧美精选一区二区| 精品久久一区二区| 久久久久久久性| 国产午夜精品久久久久久久| 中文字幕精品—区二区四季| 国产精品久久久久久久浪潮网站| 中文字幕制服丝袜一区二区三区| 日韩一区在线免费观看| 亚洲伊人伊色伊影伊综合网| 秋霞电影一区二区| 国产一区二三区好的| 99精品一区二区三区| 日韩不卡免费视频| 99久久精品国产导航| 免费日本视频一区| 国产乱对白刺激视频不卡| 国产91对白在线观看九色| 一本久道久久综合中文字幕| 欧美日韩成人综合| 26uuu精品一区二区三区四区在线| 中文字幕 久热精品 视频在线| 亚洲欧美一区二区三区孕妇| 日韩精品三区四区| 成人免费毛片a| 欧美视频中文字幕| 精品乱码亚洲一区二区不卡| 亚洲四区在线观看| 美女视频一区在线观看| 成人av网在线| 日韩视频在线一区二区| 国产精品乱码一区二区三区软件| 亚洲国产裸拍裸体视频在线观看乱了 | 中文字幕巨乱亚洲| 午夜亚洲国产au精品一区二区| 久久精品国产999大香线蕉| 波多野结衣视频一区| 日韩亚洲欧美综合| 17c精品麻豆一区二区免费| 日本免费新一区视频| 成人午夜私人影院| 777奇米四色成人影色区| 国产精品视频麻豆| 美洲天堂一区二卡三卡四卡视频| 91丨九色丨国产丨porny| 在线欧美日韩国产| 一区二区三区成人在线视频| 国产一区二区三区日韩| 日韩一级二级三级| 日韩激情视频网站| 欧美一区二区视频在线观看2020| 日韩激情在线观看| 久久综合九色综合欧美就去吻| 国产精品一区二区三区四区| 日本一二三四高清不卡| 91麻豆123| 亚洲欧美日韩国产中文在线| 亚洲精品美国一| 国产在线精品国自产拍免费| 在线视频一区二区三| 欧美激情一区二区三区不卡 | 亚洲蜜臀av乱码久久精品蜜桃| 欧美综合视频在线观看| 久久精品欧美日韩| 久久国产综合精品| 欧美美女一区二区在线观看| 91影院在线观看| 色综合一个色综合| 中文一区在线播放| 国产伦精品一区二区三区免费迷| 9191成人精品久久| 亚洲黄色在线视频| 国产精品123区| 欧美tickling挠脚心丨vk| 一区二区在线电影| 91丨九色丨尤物| 中文字幕精品—区二区四季| 美女在线视频一区| 国产综合色产在线精品| 精品国产乱码久久久久久1区2区 | 另类人妖一区二区av| 欧美主播一区二区三区| 国产亚洲精品超碰| 亚洲国产综合色| 色94色欧美sute亚洲线路一ni | 国产性做久久久久久| 蜜臀久久久久久久| 欧美老年两性高潮| 亚洲v日本v欧美v久久精品| 欧美性色综合网| 中文字幕一区二区三区不卡| 丰满白嫩尤物一区二区| 久久久国产午夜精品| 国产综合色在线| 日本一区二区三区电影| 国产一区二区精品久久| 欧美成人a在线| 美国十次了思思久久精品导航| 色香色香欲天天天影视综合网| 亚洲精品中文字幕乱码三区| 成人av集中营| 国产精品国产三级国产专播品爱网 | 免费一级片91| 欧美一级久久久| 极品美女销魂一区二区三区免费 | 精品福利一二区| 丁香婷婷综合激情五月色| 国产色产综合产在线视频| 国产精品一区二区无线| 欧美韩国日本不卡| 成人av资源站| 亚洲综合久久av| 欧美狂野另类xxxxoooo| 麻豆精品在线视频| 精品国产自在久精品国产| 成人晚上爱看视频| 日韩理论片中文av| 欧美日韩在线亚洲一区蜜芽| 日本不卡视频在线观看| 精品国产髙清在线看国产毛片| 成a人片亚洲日本久久| 亚洲综合免费观看高清完整版在线| 久久精品视频免费观看| 91玉足脚交白嫩脚丫在线播放| 天天av天天翘天天综合网色鬼国产 | 日韩久久久久久| 国产黄人亚洲片| 中文字幕一区二区三区不卡| 欧美喷潮久久久xxxxx| 韩日av一区二区| 亚洲欧洲精品天堂一级| 99国产精品国产精品久久| 亚洲综合色成人| 日韩一级大片在线| 不卡的av在线| 美女mm1313爽爽久久久蜜臀| 国产精品卡一卡二卡三| 欧美日韩久久不卡| 国产一区视频网站| 午夜日韩在线电影| 国产亚洲精品免费| 欧美日韩综合不卡| 国产成人av电影在线观看| 亚洲欧洲精品一区二区三区不卡|