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

📄 etherhwinit.c

📁 freescale i.mx31 BSP CE5.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.
//
//
// etherinit.c
//

#include <bsp.h>
#include "loader.h"
//#include "board.h"

//
// Helper function for identifying PCMCIA network cards
//

static BOOL VerifyEthernetPCMCIACard(UINT32 SlotAddress)
{
    volatile UINT8 Attribute;
    volatile UINT8 *pAttribute = (UINT8 *) SlotAddress;
    volatile 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. at addr 0x%x\r\n", Attribute, pAttribute);
        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);

}


⌨️ 快捷键说明

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