⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ether.c

📁 i.Mx31 bootloader(for WinCE6.0)
💻 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.
//
//-----------------------------------------------------------------------------
//
//  Copyright (C) 2004-2007, Freescale Semiconductor, Inc. All Rights Reserved.
//  THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
//  AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//-----------------------------------------------------------------------------
//
//  File:  ether.c
//
//  EBOOT ethernet routines
//
//-----------------------------------------------------------------------------
#include "bsp.h"
#include "loader.h"

//-----------------------------------------------------------------------------
// External Functions


//-----------------------------------------------------------------------------
// External Variables



//-----------------------------------------------------------------------------
// Defines


//-----------------------------------------------------------------------------
// Types


//-----------------------------------------------------------------------------
// Global Variables

// 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;
PFN_EDBG_GET_PENDING_INTS         pfnEDbgGetPendingInts;
PFN_EDBG_READ_EEPROM              pfnEDbgReadEEPROM;
PFN_EDBG_WRITE_EEPROM             pfnEDbgWriteEEPROM;
PFN_EDBG_SET_OPTIONS              pfnEDbgSetOptions;


//-----------------------------------------------------------------------------
// Local Variables


//------------------------------------------------------------------------------
// Local Functions
//

//-----------------------------------------------------------------------------
//
// Function: InitSpecifiedEthDevice
//
// Initializes the specified Ethernet device to be used for download and 
// KITL services.
//
// Parameters:
//      pKITLArgs
//          [in/out] Points to the KITL argument structure.
//
//      EthDevice
//          [in] Ethernet device to be initialized.
//
// Returns:
//      Returns Ethernet adapter type intialized on success, otherwise 
//      returns -1.
//
//-----------------------------------------------------------------------------
UINT32 InitSpecifiedEthDevice(OAL_KITL_ARGS *pKITLArgs, UINT32 EthDevice)
{
    UINT32 rc = (UINT32)-1;
    
    switch(EthDevice)
    {
    case ETH_DEVICE_CS8900A:

        if (CS8900AInit((PBYTE) OALPAtoUA(BSP_BASE_REG_PA_CS8900A_IOBASE), 0, pKITLArgs->mac))
        {
            pfnEDbgInit         = (PFN_EDBG_INIT) CS8900AInit;
            pfnEDbgGetFrame     = (PFN_EDBG_GET_FRAME) CS8900AGetFrame;
            pfnEDbgSendFrame    = (PFN_EDBG_SEND_FRAME) CS8900ASendFrame;
            pfnEDbgEnableInts   = (PFN_EDBG_ENABLE_INTS) CS8900AEnableInts;     
            pfnEDbgDisableInts  = (PFN_EDBG_DISABLE_INTS)CS8900ADisableInts;    
            
            // Save the device location information for later use.
            //
            pKITLArgs->devLoc.IfcType     = Internal;
            pKITLArgs->devLoc.BusNumber   = 0;
            pKITLArgs->devLoc.PhysicalLoc = (PVOID)(BSP_BASE_REG_PA_CS8900A_IOBASE);
            pKITLArgs->devLoc.LogicalLoc  = (DWORD)pKITLArgs->devLoc.PhysicalLoc;

            KITLOutputDebugString("INFO: CS8900A Ethernet controller initialized.\r\n");
            rc = EDBG_ADAPTER_OEM;
        }
        else
        {
            KITLOutputDebugString("ERROR: Failed to initialize CS8900A Ethernet controller.\n");
        }
        break;

    }


    return rc;
}

//------------------------------------------------------------------------------
//
//  Function:  OALKitlInitEthIrq
//
//  This function is called by OAL_KITLETH_INIT function to configure
//  the IRQ line for the Ethernet controller.
//
//  Parameters:
//      None.
//
//  Returns:
//      TRUE if successful, otherwise returns FALSE.
//
//------------------------------------------------------------------------------
BOOL OALKitlInitEthIrq(void)
{
    return TRUE;
}


//------------------------------------------------------------------------------
//
//  Function:  OALKitlClearEthIrq
//
//  This function is called by OAL_KITLETH_GET_FRAME function to clear
//  the IRQ from the Ethernet controller.
//
//  Parameters:
//      None.
//
//  Returns:
//      None.
//
//------------------------------------------------------------------------------
void OALKitlClearEthIrq(void)
{
}


//------------------------------------------------------------------------------
//
//  Function:  OALKitlSendEthSelfReset
//
//  This function is called by OAL_KITLETH_INIT function to determine if
//  the Ethernet self reset should be issued to the controller.
//
//  Parameters:
//      None.
//
//  Returns:
//      TRUE if self reset should be issued, otherwise returns FALSE.
//
//------------------------------------------------------------------------------
BOOL OALKitlSendEthSelfReset(void)
{
    return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -