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

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

?? ether.c

?? WinCE 5.0的PXA270Bootloader
?? C
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft 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 LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
//  File:  ether.c
//
//  Core Ethernet routines for the Intel Mainstone II bootloader.
//
//------------------------------------------------------------------------------
/* 
** INTEL CONFIDENTIAL
** Copyright 2000-2003 Intel Corporation All Rights Reserved.
**
** The source code contained or described herein and all documents
** related to the source code (Material) are owned by Intel Corporation
** or its suppliers or licensors.  Title to the Material remains with
** Intel Corporation or its suppliers and licensors. The Material contains
** trade secrets and proprietary and confidential information of Intel
** or its suppliers and licensors. The Material is protected by worldwide
** copyright and trade secret laws and treaty provisions. No part of the
** Material may be used, copied, reproduced, modified, published, uploaded,
** posted, transmitted, distributed, or disclosed in any way without Intel抯
** prior express written permission.

** No license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise. Any license under such intellectual property rights
** must be express and approved by Intel in writing.
*/

#include <windows.h>
#include <bulverde.h>
#include <mainstoneii.h>
#include <ethdbg.h>
#include <halether.h>
#include <oal_memory.h>
#include <oal_ethdrv.h>
#include <ceddk.h>
#include "loader.h"

// Miscellaneous definitions.
//
#define CARD_DETECT				0x20
#define PCMCIA_POWER			0x0F
#define PCMCIA_RESET			0x10
#define VS1						0x40
#define VS2						0x80
#define PCMCIA_VCC3V_VPP0V		0x08
#define PCMCIA_VCC5V_VPP0V		0x04
#define CIS_R0                  0x3F8
#define OSCR_OFFSET             0x10        // OSCR0


// Function pointers to the support library functions of the currently installed debug ethernet controller.
//
PFN_EDBG_INIT                     pfnEDbgInit;
PFN_EDBG_GET_FRAME                pfnEDbgGetFrame;
PFN_EDBG_SEND_FRAME               pfnEDbgSendFrame;
PFN_EDBG_ENABLE_INTS              pfnEDbgEnableInts;
PFN_EDBG_DISABLE_INTS             pfnEDbgDisableInts;
#ifdef IMGSHAREETH
PFN_EDBG_CURRENT_PACKET_FILTER    pfnCurrentPacketFilter;
PFN_EDBG_MULTICAST_LIST           pfnMulticastList;
#endif


static void Wait(UINT32 microSeconds)
{
    volatile UINT32 *TimerOSCRAddress= (volatile UINT32 *) OALPAtoVA((BULVERDE_BASE_REG_PA_OST + OSCR_OFFSET), FALSE);
    UINT32 Value, Time;

    Time   = *TimerOSCRAddress;
    Value = Time + (microSeconds * 4);
    if (Value < Time)
    {  // test for wrap.
        while (Time < *TimerOSCRAddress);
    }
    while (*TimerOSCRAddress <= Value);

}


static void msWait(UINT32 msVal) 
{
    Wait(msVal*1000);
}


VOID OALStall(UINT32 microSeconds)
{
    Wait(microSeconds);
}


BOOL LocatePCMCIACard(ETH_DEVICE_TYPE EthDevice, UINT32 SlotAddress)
{
    UINT32 SlotVoltage = PCMCIA_VCC3V_VPP0V;
    volatile UINT32 *pSRCR = NULL;
    volatile MAINSTONEII_BLR_REGS *pBLRegs = (volatile MAINSTONEII_BLR_REGS *) OALPAtoVA(MAINSTONEII_BASE_REG_PA_FPGA, FALSE);
    volatile BULVERDE_MEMCTRL_REG *pMEMCTRLRegs = (volatile BULVERDE_MEMCTRL_REG *) OALPAtoVA(BULVERDE_BASE_REG_PA_MEMC, FALSE);

    switch (EthDevice)
    {
    case ETH_DEVICE_PCMCIA0:
        pSRCR = (volatile UINT32 *)&(pBLRegs->pcmcia0_srcr);
        break;
    case ETH_DEVICE_PCMCIA1:       
        pSRCR = (volatile UINT32 *)&(pBLRegs->pcmcia1_srcr);
        break;
    default:
        break;
    }

    if (!pSRCR)
    {
        return(FALSE);
    }

    // Initialize the PCMCIA interface if a card is detected.
    //
    if (!((*pSRCR & CARD_DETECT) == CARD_DETECT))
    {
        EdbgOutputDebugString("INFO: Performing PCMCIA NIC initialization.  Please wait...\r\n");

        // Configure the MAX1602EE power supply based on the voltage requirement of the card.
        //
        if (((*pSRCR & VS1) == VS1) && ((*pSRCR & VS2) == VS2))
        {
            // 5 volt card detected.
            //
            SlotVoltage = PCMCIA_VCC5V_VPP0V;
        }
        else
        {
            // 3.3 volt card detected.
            //
            SlotVoltage = PCMCIA_VCC3V_VPP0V;
        }

        *pSRCR &= ~(PCMCIA_POWER | PCMCIA_RESET);
        msWait(50);

        *pSRCR |= SlotVoltage;
        msWait(50);

        *pSRCR |= PCMCIA_RESET;
        msWait(50);

        *pSRCR &= ~PCMCIA_RESET;
        msWait(50);

        pMEMCTRLRegs->mecr = 0x3;          
        msWait(50);         

        return (TRUE);
    }

    return (FALSE);
}


static BOOL VerifyEthernetPCMCIACard(UINT32 SlotAddress)
{
    UINT8 Attribute;
    UINT8 *pAttribute = (UINT8 *) SlotAddress;
    UINT8 *pLastAttribute;


    // End of the PCMCIA attribute list.
    //
    pLastAttribute = pAttribute + 0x200;

    //
    Attribute = *pAttribute;
    if (Attribute != (UINT8) 0x01)
    {
        EdbgOutputDebugString("ERROR: Invalid PCMCIA configuration data 0x%x.\r\n", Attribute);
        return (FALSE);
    }

    // Look for tuple.
    //
    while ((Attribute != (UINT8) 0x21) && (pAttribute < pLastAttribute))
    {
        pAttribute += sizeof(UINT16);                      // Step to tuple length.
        Attribute = *pAttribute;
        pAttribute += sizeof(UINT16) + (sizeof(UINT16) * Attribute);    // Step over tuple.
        Attribute = *pAttribute;
    }

    // Find a valid tuple?
    //
    if (pAttribute < pLastAttribute)
    {
        pAttribute += sizeof(UINT16);                     // Defined tuple length.
        if ((Attribute = *pAttribute) == 2)
        {
            pAttribute += sizeof(UINT16);
            Attribute = *pAttribute;

            // Found an Ethernet card...
            //
            if (Attribute == 0x06)
            {
                return (TRUE);
            }
        }
    }

    return (FALSE);

}


// EthDevice == 0 --> Try to initialize PCMCIA Slot 0.
// EthDevice == 1 --> Try to initialize PCMCIA Slot 1.
// EthDevice == 2 --> Try to initialize SMSC.
UINT32 InitSpecifiedEthDevice(OAL_KITL_ARGS *pKITLArgs, UINT32 EthDevice)
{
    UINT32 EbootDeviceAddress = 0;
    UINT32 Offset;      
    UINT8 *pAttribute = NULL;
    UINT8 uByte;
    UINT32 SlotAddress = 0;

    volatile MAINSTONEII_BLR_REGS *pBLRegs = (volatile MAINSTONEII_BLR_REGS *) OALPAtoVA(MAINSTONEII_BASE_REG_PA_FPGA, FALSE);

    
    // Determine the NIC's address.
    //
    switch (EthDevice)
    {
    case ETH_DEVICE_PCMCIA0: 
        SlotAddress = (UINT32) OALPAtoVA(BULVERDE_BASE_REG_PA_PCMCIA_S0_ATTR, FALSE);
        EdbgOutputDebugString("INFO: Trying to locate/initialize PCMCIA NIC in slot 0...\r\n");
        break;
    case ETH_DEVICE_PCMCIA1:
        SlotAddress = (UINT32) OALPAtoVA(BULVERDE_BASE_REG_PA_PCMCIA_S1_ATTR, FALSE);
        EdbgOutputDebugString("INFO: Trying to locate/initialize PCMCIA NIC in slot 1...\r\n");
        break;
    case ETH_DEVICE_SMSC:
    default:
        SlotAddress = (UINT32) OALPAtoVA(MAINSTONEII_BASE_REG_PA_SMSC_ETHERNET, FALSE);
        EdbgOutputDebugString("INFO: Trying to initialize the built-in SMSC NIC...\r\n");
        break;
    }

    // PCMCIA NIC?
    //
    if ((EthDevice == ETH_DEVICE_PCMCIA0) || (EthDevice == ETH_DEVICE_PCMCIA1))
    {
        // Locate the NIC card in the specified slot.
        //
        if (LocatePCMCIACard(EthDevice, SlotAddress))
        {
            // Determine the PCMCIA card type.
            //
            if (VerifyEthernetPCMCIACard(SlotAddress))
            {
                if ((((pBLRegs->pcmcia0_srcr & PCMCIA_POWER) == PCMCIA_VCC5V_VPP0V) && (EthDevice == ETH_DEVICE_PCMCIA0)) ||
                    (((pBLRegs->pcmcia1_srcr & PCMCIA_POWER) == PCMCIA_VCC5V_VPP0V) && (EthDevice == ETH_DEVICE_PCMCIA1)))
                {
                    EdbgOutputDebugString("INFO: 5.0V Card detected in slot %d.\r\n", ((EthDevice == ETH_DEVICE_PCMCIA0)?0:1));

                    uByte       = 0x21;
                    Offset      = CIS_R0;
                    pAttribute  = (UINT8 *) SlotAddress;
                    pAttribute += Offset; 
                    *pAttribute = uByte;

                    uByte       = 0x1;            
                    Offset      = CIS_R0 + 2;
                    pAttribute  = (UINT8 *) SlotAddress;
                    pAttribute += Offset; 
                    *pAttribute = uByte;
                }
                else
                {
                    EdbgOutputDebugString("INFO: 3.3V Card detected in slot %d.\r\n", ((EthDevice == ETH_DEVICE_PCMCIA0)?0:1));

                    uByte       = 0x20;           
                    Offset      = CIS_R0;
                    pAttribute  = (UINT8 *) SlotAddress;
                    pAttribute += Offset; 
                    *pAttribute = uByte;
                }

                EbootDeviceAddress = (EthDevice == ETH_DEVICE_PCMCIA0) ? (UINT32) OALPAtoVA(BULVERDE_BASE_REG_PA_PCMCIA_S0_IO, FALSE) + 0x300 : \
                                                                         (UINT32) OALPAtoVA(BULVERDE_BASE_REG_PA_PCMCIA_S1_IO, FALSE) + 0x300;

                // Only supported PCMCIA NIC is an NE2000-compatible NIC.  Initialize it.
                //
                if (NE2000Init((BYTE *) EbootDeviceAddress, 1, pKITLArgs->mac))
                {
                    pfnEDbgInit            = NE2000Init;
                    pfnEDbgGetFrame        = NE2000GetFrame;       
                    pfnEDbgSendFrame       = NE2000SendFrame;      
                    pfnEDbgEnableInts      = NE2000EnableInts;     
                    pfnEDbgDisableInts     = NE2000DisableInts;    
#ifdef IMGSHAREETH
                    pfnCurrentPacketFilter = NULL;
                    pfnMulticastList       = NULL;
#endif

                    // Save the device location information for later use.
                    //
                    pKITLArgs->devLoc.IfcType     = Internal;
                    pKITLArgs->devLoc.BusNumber   = 0;
                    pKITLArgs->devLoc.PhysicalLoc = (PVOID)((EthDevice == ETH_DEVICE_PCMCIA0) ? (BULVERDE_BASE_REG_PA_PCMCIA_S0_IO + 0x300) : (BULVERDE_BASE_REG_PA_PCMCIA_S1_IO + 0x300));
                    pKITLArgs->devLoc.LogicalLoc  = (DWORD)pKITLArgs->devLoc.PhysicalLoc;

                    EdbgOutputDebugString("INFO: NE2000 Ethernet controller initialized.\n");
                    return(EDBG_ADAPTER_NE2000);
                }
                else
                {
                    EdbgOutputDebugString("ERROR: Failed to initialize NE2000 Ethernet controller.\n");
                }
            }
        }

        return (-1);
    }
    else
    {
        // Use the SMSC LAN91C111 NIC.
        //
        EbootDeviceAddress = (SlotAddress + 0x300);

        if (LAN91CInit((UINT8 *) EbootDeviceAddress, 0, pKITLArgs->mac))
        {
            pfnEDbgInit            = (PFN_EDBG_INIT)        LAN91CInit;
            pfnEDbgGetFrame        = (PFN_EDBG_GET_FRAME)   LAN91CGetFrame;       
            pfnEDbgSendFrame       = (PFN_EDBG_SEND_FRAME)  LAN91CSendFrame;      
            pfnEDbgEnableInts      = (PFN_EDBG_ENABLE_INTS) LAN91CEnableInts;     
            pfnEDbgDisableInts     = (PFN_EDBG_DISABLE_INTS)LAN91CDisableInts;    
#ifdef IMGSHAREETH
            pfnCurrentPacketFilter = (PFN_EDBG_CURRENT_PACKET_FILTER) LAN91CCurrentPacketFilter;
            pfnMulticastList       = (PFN_EDBG_MULTICAST_LIST) LAN91CMulticastList;
#endif

            // Save the device location information for later use.
            //
            pKITLArgs->devLoc.IfcType     = Internal;
            pKITLArgs->devLoc.BusNumber   = 0;
            pKITLArgs->devLoc.PhysicalLoc = (PVOID)(MAINSTONEII_BASE_REG_PA_SMSC_ETHERNET + 0x300);
            pKITLArgs->devLoc.LogicalLoc  = (DWORD)pKITLArgs->devLoc.PhysicalLoc;

            EdbgOutputDebugString("INFO: SMSC LAN91C111 Ethernet controller initialized.\r\n");
            return(EDBG_ADAPTER_SMC9000);
        }
        else
        {
            EdbgOutputDebugString("ERROR: Failed to initialize SMSC LAN91C111 Ethernet controller.\n");
        }
    }

    return (-1);

}


BOOL OEMEthGetFrame(BYTE *pData,       // OUT - Receives frame data
                    UINT16 *pwLength)  // IN  - Length of Rx buffer
{
    return (pfnEDbgGetFrame(pData, pwLength));
}


BOOL OEMEthSendFrame(BYTE *pData,     // IN - Data buffer
                     DWORD dwLength)  // IN - Length of buffer
{
    int retries = 0;

    // Let's be persistant here
    while (retries++ < 4)
    {
        if (!pfnEDbgSendFrame(pData, dwLength))
            return (TRUE);
        EdbgOutputDebugString("!OEMEthSendFrame failure, retry %u\n",retries);
    }
    return (FALSE);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清免费在线| 婷婷综合在线观看| 欧美日韩免费高清一区色橹橹| 日韩精品国产精品| 国产精品国产三级国产有无不卡 | 国产精品久久久久婷婷二区次| 一道本成人在线| 久久精品国产亚洲高清剧情介绍 | 日韩欧美二区三区| k8久久久一区二区三区| 久久福利视频一区二区| 一区二区三区在线播| 国产三级精品在线| 日韩三级中文字幕| 色噜噜狠狠成人中文综合| 国产在线观看一区二区| 天天爽夜夜爽夜夜爽精品视频| 国产精品污污网站在线观看| 欧美sm极限捆绑bd| 这里是久久伊人| 在线亚洲人成电影网站色www| 国产成人精品aa毛片| 日韩福利视频网| 亚洲国产一区在线观看| 亚洲人成网站色在线观看| 国产欧美久久久精品影院| 精品少妇一区二区三区在线视频| 欧美偷拍一区二区| 在线中文字幕不卡| 在线免费不卡电影| 色激情天天射综合网| 91视频com| thepron国产精品| 成人av免费观看| 成人成人成人在线视频| 国产精品18久久久| 国产成人精品一区二区三区四区| 精品一区二区精品| 国产在线精品视频| 国产福利91精品一区二区三区| 久久国产精品第一页| 久久精品二区亚洲w码| 蜜臀a∨国产成人精品| 日韩av高清在线观看| 日韩av一级电影| 久久99热狠狠色一区二区| 久久成人麻豆午夜电影| 久久se精品一区精品二区| 激情综合网最新| 国模娜娜一区二区三区| 国产精品白丝jk黑袜喷水| 国产传媒一区在线| va亚洲va日韩不卡在线观看| 99精品国产99久久久久久白柏| 不卡视频免费播放| av中文字幕亚洲| 欧美亚洲高清一区| 91精品国产综合久久久久| 日韩你懂的在线播放| 久久久蜜桃精品| 亚洲欧洲av另类| 洋洋成人永久网站入口| 首页国产欧美久久| 国产一区二区电影| 91麻豆免费视频| 51久久夜色精品国产麻豆| 精品国产免费一区二区三区香蕉| 国产欧美日韩中文久久| 一区二区三区中文字幕精品精品| 午夜视频在线观看一区| 激情综合色综合久久综合| 国产91精品一区二区| 色偷偷一区二区三区| 91精品国产乱| 国产精品丝袜久久久久久app| 亚洲乱码国产乱码精品精可以看 | 国产精品538一区二区在线| 波多野结衣亚洲一区| 欧美日韩国产首页在线观看| 久久午夜老司机| 一区二区免费在线| 久久国产福利国产秒拍| 91麻豆精东视频| 日韩三级在线观看| 亚洲视频每日更新| 男人的天堂亚洲一区| 99久久免费精品高清特色大片| 欧美巨大另类极品videosbest| 国产性天天综合网| 五月婷婷综合网| 99久久免费视频.com| 欧美一级精品大片| 亚洲天堂免费看| 国内精品国产成人国产三级粉色| 色综合色综合色综合| 精品免费国产一区二区三区四区| 亚洲欧洲综合另类| 久久精品av麻豆的观看方式| 色偷偷久久人人79超碰人人澡| 精品国产髙清在线看国产毛片| 一区二区在线电影| 国产成人亚洲综合a∨婷婷| 欧美日韩在线不卡| 中文字幕视频一区| 国产精品影视在线观看| 91精品国产免费| 亚洲免费av高清| 懂色av一区二区在线播放| 91精品国产综合久久国产大片| 亚洲欧洲99久久| 国产91精品免费| 欧美www视频| 日韩电影免费在线看| 91黄色小视频| 亚洲人成在线播放网站岛国 | 日韩黄色免费网站| 在线视频你懂得一区| 中文字幕免费不卡在线| 精品一区二区三区的国产在线播放| 欧美日韩色综合| 亚洲综合色婷婷| 91一区在线观看| 中文字幕色av一区二区三区| 国产精品1024| 久久亚洲综合色一区二区三区| 免费人成在线不卡| 3d动漫精品啪啪1区2区免费| 亚洲图片欧美综合| 在线亚洲一区二区| 一区二区三区国产精华| 色狠狠一区二区三区香蕉| 中文字幕一区二区在线播放| 成人黄色777网| 日本一区二区三区久久久久久久久不| 激情综合网最新| 久久久久高清精品| 国产精品18久久久久久久久 | 亚洲免费在线视频一区 二区| 成人一级黄色片| 国产精品久久久久一区| 成人91在线观看| 亚洲天堂成人网| 在线亚洲+欧美+日本专区| 亚洲欧美日本韩国| 在线观看www91| 视频一区二区中文字幕| 91精品国产91久久久久久一区二区| 日韩精品成人一区二区三区| 91精品国产色综合久久不卡蜜臀| 日韩黄色一级片| 精品国产乱码91久久久久久网站| 激情小说欧美图片| 国产免费久久精品| www.亚洲精品| 亚洲福中文字幕伊人影院| 欧美一区二区在线观看| 久久99精品国产.久久久久| 久久精品一区八戒影视| 99视频在线精品| 亚洲电影中文字幕在线观看| 欧美一级在线视频| 国产精品一品二品| 亚洲欧美日韩在线| 91精品蜜臀在线一区尤物| 精品一区二区久久久| 亚洲欧美怡红院| 欧美日韩精品一区二区天天拍小说 | 精品嫩草影院久久| 成人小视频免费在线观看| 国产高清无密码一区二区三区| 久久精品欧美日韩精品| 色综合一区二区| 视频一区国产视频| 中文字幕欧美三区| 9191成人精品久久| 成人免费视频国产在线观看| 伊人婷婷欧美激情| 欧美mv日韩mv国产网站app| av影院午夜一区| 美女视频免费一区| 日韩理论片一区二区| 日韩精品中文字幕在线不卡尤物| 成人精品免费看| 蜜桃av一区二区三区电影| 中文字幕一区二区不卡| 日韩免费在线观看| 一本一道综合狠狠老| 美腿丝袜亚洲一区| 最好看的中文字幕久久| 欧美mv日韩mv国产网站| 在线视频亚洲一区| 国产传媒久久文化传媒| 天堂久久久久va久久久久| 欧美国产成人在线| 日韩欧美你懂的| 91久久免费观看| 国产精品一区二区在线播放 | 在线影院国内精品| 国产乱码精品一区二区三区av | 国产婷婷色一区二区三区|