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

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

?? flash.c

?? ebd9307開發板wince bsp源碼,包括cs8900,lcd,nand,serial,touch,usb,gpio,wd等驅動
?? C
字號:
//**********************************************************************
//                                                                      
// Filename: flash.c 
//                                                                      
// Description: Contains the CE flash routines.
//
// 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 <windows.h>
#include <memorymap.h>
#include <hwdefs.h>
#include <halether.h>
#ifdef EP93XX_16BIT
    #include "intel_j3_1x16.h"
#else
    #include "intel_j3_2x16.h"
#endif
#include "flash.h"


//
// Function pointer to Flash routines.
//
static PFN_START_ERASE_FLASH     pfnStartErase     = 0;
static PFN_CONTINUE_ERASE_FLASH  pfnContinueErase  = 0;
static PFN_FINISH_ERASE_FLASH    pfnFinishErase    = 0;
static PFN_WRITE_FLASH           pfnWriteFlash     = 0;


//****************************************************************************
// OEMIsFlashAddr
//****************************************************************************
// dwAddr  - Address of a BIN file record. This is the address checked to see 
//           whether it lies in flash or RAM.  
//
// return    TRUE  - SUCESS
//           FALSE - ERROR
//
BOOL OEMIsFlashAddr (DWORD dwAddr)
{
    BOOL    bReturnValue = FALSE;

    if(PHYSICAL_ADDR_FLASH_INTEL <= dwAddr  &&
        dwAddr < (PHYSICAL_ADDR_FLASH_INTEL + SIZE_FLASH_INTEL))
    {
        bReturnValue = TRUE;
    }
    
    return bReturnValue;
}



//****************************************************************************
//  OEMMapMemAddr
//****************************************************************************
// dwImageStart  -  Start address of image. 
//
// dwAddr        -  Address of a BIN record. If this address lies in a 
//                  platforms flash address space, typically the offset 
//                  from dwImageStart is computed and added to a RAM-based file 
//                  cache area. 
//
// Return Values    Address at which the BIN record should be copied to 
//                  provide file caching before and during the flash update 
//                  process.
//
LPBYTE OEMMapMemAddr
(
    DWORD dwImageStart,
    DWORD dwAddr
)
{
    LPBYTE  pReturnValue;

    if(OEMIsFlashAddr(dwImageStart))
    {
        pReturnValue = (LPBYTE)( (dwAddr - FLASH_VIRTUAL_MEMORY) + FLASH_CACHE_PHYSICAL_MEMORY ); 
    }
    //  
    // Hack hack hack.  Looks like eboot thinks that this is the wrong address.
    //
    else if((0x80000000  < dwAddr) &&  (dwAddr < 0x84000000 ))
    {
        pReturnValue = (LPBYTE)(dwAddr & 0x7FFFFFFF);
    }
    else
    {
        pReturnValue = (LPBYTE)(dwAddr); 
    }

//    EdbgOutputDebugString
//    (
//        "OEMMapMemAddr: dwImageStart = 0x%x, dwAddr= 0x%x,  pReturnValue = 0x%x\n",
//        dwImageStart,
//        dwAddr,
//        (ULONG)pReturnValue
//    );
        
    return pReturnValue; 
}

//****************************************************************************
//  OEMStartEraseFlash
//****************************************************************************
//  dwStartAddr - Start address, in flash, to start erasing from. The 
//                platform loader code needs to ensure this is a flash 
//                block-aligned address or needs to handle it specially if 
//                it is not. 
//
//  dwLength    - Number of bytes of flash to be erased. 
//
//  return      TRUE indicates success. FALSE indicates failure.
//
BOOL OEMStartEraseFlash (DWORD dwStartAddr, DWORD dwLength)
{

    ULONG   i = 0;
    ULONG   nNumBlocks = 0;
    ULONG   ulSMC;

    //
    // Make sure the start and end addresses are in flash.
    //
    if (!OEMIsFlashAddr(dwStartAddr) || !OEMIsFlashAddr(dwStartAddr + dwLength - 1))
    {
        EdbgOutputDebugString
        (
            "ERROR: OEMStartEraseFlash - not a flash address (0x%x or 0x%x).\r\n", 
            dwStartAddr, 
            (dwStartAddr + dwLength - 1)
        );
        return(FALSE);
    }

    // 
    // Make sure start address is block-aligned.
    //
    //if (dwStartAddr % FLASH_BLOCK_SIZE)
    //{
    //    EdbgOutputDebugString("ERROR: OEMStartEraseFlash - start address isn't block aligned (0x%x).\r\n", dwStartAddr);
    //    return(FALSE);
    //}
    if (dwLength & 0x03)
    {
        EdbgOutputDebugString
        (
            "ERROR: OEMStartEraseFlash - length isn't an integral number of longwords (0x%x).\r\n",
            dwLength
        );
        return(FALSE);
    }

    EdbgOutputDebugString("Erasing flash blocks: start Addr = 0x%x  length = 0x%x\r\n", dwStartAddr, dwLength);

    //
    // Clear the Flash write protect for chip select 6.
    //
    ulSMC        = *SMC_SMCBCR6;
    ulSMC       |= SMCBCR_WPERR; 
    ulSMC       &= ~SMCBCR_WP;
    *SMC_SMCBCR6 = ulSMC ;


    //
    // Fill in the pointers for the following.
    //
#ifdef EP93XX_16BIT
    pfnStartErase       = StartEraseFlashJ3_1x16;
    pfnContinueErase    = ContinueEraseFlashJ3_1x16;
    pfnFinishErase      = FinishEraseFlashJ3_1x16;
    pfnWriteFlash       = WriteFlashJ3_1x16;
#else
    pfnStartErase       = StartEraseFlashJ3_2x16;
    pfnContinueErase    = ContinueEraseFlashJ3_2x16;
    pfnFinishErase      = FinishEraseFlashJ3_2x16;
    pfnWriteFlash       = WriteFlashJ3_2x16;
#endif

    return(pfnStartErase(dwStartAddr, dwLength));
}

//****************************************************************************
// OEMContinueEraseFlash
//****************************************************************************
// 
// 
//
void OEMContinueEraseFlash (void)
{

    if(pfnContinueErase)
        pfnContinueErase();
}

//****************************************************************************
//  OEMFinishEraseFlash
//****************************************************************************
// 
// 
//
BOOL OEMFinishEraseFlash (void)
{
    BOOL    bSuccess = FALSE;

    EdbgOutputDebugString("Continue to Erase the rest of Flash.\r\n" );

    //
    // Finish erasing the flash.
    //
    if(pfnFinishErase)
    {
       bSuccess = pfnFinishErase();
    }


    if(bSuccess)
    {
        EdbgOutputDebugString("\r\nFlash Erase Successfully Finished\r\n" );
    }
    else
    {
        EdbgOutputDebugString("\r\nERROR: Error while erasing flash\r\n" );
        
    }

    return bSuccess;
}

//****************************************************************************
// OEMWriteFlash
//****************************************************************************
//  dwStartAddr  -  Address in flash where the start of the downloaded image 
//                  is to be written. Note that if this is not a flash 
//                  block-aligned address, the platform code will need 
//                  to take this into account and handle it as a special
//                  case. 
//
//  dwLength     -  Length of the image, in bytes, to be written to flash. 
// 
//
BOOL OEMWriteFlash (DWORD dwStartAddr, DWORD dwLength)
{
    ULONG   ulSMC;
    ULONG   ulCount;
    BOOL    bSuccess = TRUE; 
#ifdef EP93XX_16BIT
    PUSHORT  pulSource, pulDest;
#else
    PULONG  pulSource, pulDest;
#endif

    EdbgOutputDebugString
    (
        "Writing to flash at Address= 0x%x, Length = 0x%x\r\n",
        dwStartAddr,
        dwLength
    );

    //
    // Check to make sure that the flash routine exists.
    //
    if(!pfnWriteFlash)
    {
        bSuccess = FALSE;
    }

    //
    // Make sure the start and end addresses are in flash.
    //
    if(bSuccess)
    {
        if (!OEMIsFlashAddr(dwStartAddr) || !OEMIsFlashAddr(dwStartAddr + dwLength - 1))
        {
            EdbgOutputDebugString
            (
                "ERROR: OEMWriteFlash - not a flash address (0x%x or 0x%x).\r\n", 
                dwStartAddr, 
                (dwStartAddr + dwLength - 1)
            );
            bSuccess = FALSE;
        }
    }

    //
    // Perform a quick check to make sure that the flash is erased.
    //
    if(bSuccess)
    {
#ifdef EP93XX_16BIT
        pulDest    =(PUSHORT) dwStartAddr;
        for(ulCount = 0; ulCount < (dwLength>>1) ; ulCount++)
        {
            if(*pulDest != 0xFFFF)
            {
                EdbgOutputDebugString
                (
                    "ERROR: OEMWriteFlash - Flash not erased at location = 0x%x,  value = 0x%x \r\n",
                    (ULONG)pulDest,
                    *pulDest
                );
                bSuccess = FALSE;
                while(1);
                break;
            }
            pulDest++;
        } 
#else
        pulDest    =(PULONG) dwStartAddr;
        for(ulCount = 0; ulCount < (dwLength>>2) ; ulCount++)
        {
            if(*pulDest != 0xFFFFFFFF)
            {
                EdbgOutputDebugString
                (
                    "ERROR: OEMWriteFlash - Flash not erased at location = 0x%x,  value = 0x%x \r\n",
                    (ULONG)pulDest,
                    *pulDest
                );
                bSuccess = FALSE;
                while(1);
                break;
            }
            pulDest++;
        } 
#endif
    }


    //
    // Write the flash
    //
    if(pfnWriteFlash  && bSuccess)
    {
        bSuccess = pfnWriteFlash( dwStartAddr, FLASH_CACHE_VIRTUAL_MEMORY ,dwLength);
    }
    //
    // Clear the Flash write protect for chip select 6.
    //
    ulSMC = *SMC_SMCBCR6;
    *SMC_SMCBCR6 = ulSMC | SMCBCR_WP | SMCBCR_WPERR ;

    //
    // Check to make sure that the image has been flashed correctly.
    //
    if(bSuccess)
    {
#ifdef EP93XX_16BIT
        pulSource   = (PUSHORT) FLASH_CACHE_VIRTUAL_MEMORY;
        pulDest     = (PUSHORT) dwStartAddr;
        for(ulCount = 0; ulCount < (dwLength>>1) ; ulCount++)
        {
            if(*pulSource != *pulDest)
            {
                EdbgOutputDebugString
                (
                    "ERROR: OEMWriteFlash - Miscompare at pSource = 0x%x, pDest = 0x%x, 0x%x != 0x%x \r\n",
                    (ULONG)pulSource,
                    (ULONG)pulDest,
                    *pulSource,
                    *pulDest
                );
                bSuccess = FALSE;
                break;
            }
            pulSource++;
            pulDest++;
        } 
#else
        pulSource   = (PULONG) FLASH_CACHE_VIRTUAL_MEMORY;
        pulDest     = (PULONG) dwStartAddr;
        for(ulCount = 0; ulCount < (dwLength>>2) ; ulCount++)
        {
            if(*pulSource != *pulDest)
            {
                EdbgOutputDebugString
                (
                    "ERROR: OEMWriteFlash - Miscompare at pSource = 0x%x, pDest = 0x%x, 0x%x != 0x%x \r\n",
                    (ULONG)pulSource,
                    (ULONG)pulDest,
                    *pulSource,
                    *pulDest
                );
                bSuccess = FALSE;
                break;
            }
            pulSource++;
            pulDest++;
        } 
#endif
    }


    return bSuccess;
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品高潮久久久久无| 欧美视频三区在线播放| 91首页免费视频| 欧美日韩视频在线第一区| 欧美一区2区视频在线观看| 国产偷国产偷亚洲高清人白洁| 成人免费一区二区三区视频| 视频一区视频二区在线观看| 国产精品一级二级三级| 色哟哟精品一区| 精品久久久久久综合日本欧美| 国产精品久线在线观看| 五月婷婷激情综合| 成人免费高清在线| 在线播放亚洲一区| 国产精品久久久久久亚洲毛片| 亚洲成av人片观看| 成人永久免费视频| 欧美变态口味重另类| 亚洲美女在线国产| 国产一区二区三区国产| 欧美在线三级电影| 欧美国产日韩一二三区| 青青草原综合久久大伊人精品优势| caoporn国产精品| 日韩精品中文字幕一区二区三区| 亚洲欧美一区二区三区国产精品 | 国产精品中文字幕日韩精品| 日本高清不卡视频| 欧美国产综合一区二区| 秋霞电影网一区二区| 91香蕉视频在线| 欧美精品一区在线观看| 亚洲18影院在线观看| jiyouzz国产精品久久| 久久免费电影网| 天天综合天天综合色| 91在线小视频| 亚洲精品在线免费播放| 性感美女久久精品| 一本色道久久综合精品竹菊| 久久久亚洲午夜电影| 日日骚欧美日韩| 在线区一区二视频| 国产精品久久久久久久第一福利 | 91精品国产综合久久久久久| 亚洲欧洲成人精品av97| 国产一区999| 日韩亚洲欧美成人一区| 婷婷久久综合九色综合伊人色| 91视频com| 国产精品三级久久久久三级| 国模套图日韩精品一区二区 | 蜜臀久久99精品久久久画质超高清 | 欧美高清dvd| 亚洲欧美日韩一区二区| 成人听书哪个软件好| 精品va天堂亚洲国产| 久久成人久久鬼色| 欧美一卡二卡在线| 日本不卡不码高清免费观看| 欧美亚洲综合在线| 一区二区成人在线观看| 不卡欧美aaaaa| 国产精品久久毛片a| 高清在线不卡av| 国产婷婷色一区二区三区四区| 国产美女娇喘av呻吟久久| 精品久久人人做人人爱| 久久av中文字幕片| 精品免费视频一区二区| 美女被吸乳得到大胸91| 日韩亚洲欧美一区二区三区| 麻豆成人综合网| www成人在线观看| 国产精品一区二区在线看| 国产视频一区二区在线| 国产成人av自拍| 中文字幕免费不卡| 99久久久久久| 亚洲一区av在线| 91.com视频| 伦理电影国产精品| 久久嫩草精品久久久精品一| 国产.欧美.日韩| 亚洲日本在线a| 精品视频全国免费看| 日本伊人午夜精品| xfplay精品久久| 成人免费黄色在线| 一区二区三区四区蜜桃| 欧美日韩在线电影| 麻豆久久一区二区| 中文字幕的久久| 在线欧美日韩国产| 日本网站在线观看一区二区三区| 日韩欧美电影一二三| 国产精品99久久久久久似苏梦涵| 国产精品美女久久久久久2018| 色婷婷av一区二区三区之一色屋| 天堂午夜影视日韩欧美一区二区| 欧美成人一区二区三区片免费| 国产成人亚洲精品青草天美| 亚洲伦理在线精品| 91麻豆精品久久久久蜜臀| 精品一区二区三区欧美| 久久久www成人免费无遮挡大片| 成人av在线影院| 亚洲动漫第一页| 精品日韩在线一区| voyeur盗摄精品| 亚洲国产日产av| 久久夜色精品国产欧美乱极品| 99免费精品在线| 日韩不卡手机在线v区| 国产日韩三级在线| 欧美日韩一区二区三区视频| 精品一区二区国语对白| 亚洲免费三区一区二区| 欧美成人伊人久久综合网| 91小视频在线观看| 极品少妇xxxx偷拍精品少妇| 亚洲三级在线免费| 日韩一区二区三区在线| www.激情成人| 免费观看91视频大全| 国产精品白丝在线| 日韩三级视频在线观看| 色狠狠桃花综合| 国产麻豆精品95视频| 亚洲国产成人va在线观看天堂| 久久免费精品国产久精品久久久久 | 中文一区二区在线观看| 777亚洲妇女| 91在线观看一区二区| 美女网站色91| 夜夜夜精品看看| 久久精品人人做人人爽人人| 在线不卡欧美精品一区二区三区| 成人精品视频一区二区三区| 热久久国产精品| 一区二区三区在线视频观看| 精品动漫一区二区三区在线观看| 欧美调教femdomvk| 成人动漫视频在线| 久久av资源网| 日韩精品一级二级| 亚洲自拍欧美精品| 综合色天天鬼久久鬼色| 日韩免费电影一区| 欧美日韩中文精品| 91丨porny丨国产| 国产91丝袜在线播放0| 精品一区二区三区的国产在线播放| 亚洲国产中文字幕在线视频综合| 日韩一区欧美一区| 国产日韩欧美亚洲| 精品国产电影一区二区| 欧美一区二区三区视频| 欧美主播一区二区三区美女| 91丝袜美女网| av在线一区二区三区| 国产成人免费视频| 国产一区二区看久久| 久久国产三级精品| 老司机午夜精品| 蜜乳av一区二区三区| 亚洲第一av色| 亚洲国产中文字幕| 夜夜精品浪潮av一区二区三区| 亚洲欧美一区二区在线观看| 成人欧美一区二区三区视频网页| 国产拍揄自揄精品视频麻豆| 欧美精品一区二区在线播放| 精品毛片乱码1区2区3区| 日韩写真欧美这视频| 日韩亚洲电影在线| 精品国产一区二区三区四区四| 日韩一级大片在线| 日韩午夜在线影院| 精品久久久久久亚洲综合网 | 国产一区二区三区不卡在线观看 | 国产拍欧美日韩视频二区| 久久精品欧美一区二区三区麻豆| 久久综合色8888| 国产欧美一区在线| 国产精品久久久久一区二区三区共 | 蜜桃精品视频在线观看| 久久国产综合精品| 国产精品18久久久久久久久| 高潮精品一区videoshd| 成人短视频下载| 99在线精品观看| 99re视频精品| 色偷偷久久人人79超碰人人澡| 在线视频中文字幕一区二区| 欧美在线制服丝袜| 欧美一区二区国产| 国产欧美综合色| 亚洲精选视频免费看|