다음을 통해 공유


Implementing the Ethernet Controller-Related Functions (Windows Embedded CE 6.0)

1/5/2010

The BLCOMMON library and the Eboot.lib support library, which assists with DHCP, UDP, and TFTP services, call Ethernet controller-related functions. These functions are typically wrappers for the access primitive routines exposed in the Ethernet debug libraries. For more information, see BLCOMMON Code Library and Eboot Code Library.

The following table shows the Ethernet controller-related functions that you need to implement.

Function Description

OEMReadData

Called by the BLCOMMON framework and reads data from the transport during the download process. This function typically turns around and calls EbootEtherReadData in Eboot.lib, which in turn calls OEMEthGetFrame.

This function can be copied from an existing hardware platform.

OEMEthGetFrame

Reads data directly from a NIC through the pfnEDbgGetFrame pointer.

This function can be copied from an existing hardware platform.

OEMEthSendFrame

Writes data directly to the NIC through the pfnEDbgSendFrame pointer.

This function can be copied from an existing hardware platform.

OEMEthGetSecs

Returns the number of seconds that have passed since a certain fixed time. The absolute value is not important, but relative count should be per-second accurate.

  • Edit the file Main.c by adding the code necessary to fully implement the Ethernet controller-related functions.

    The following code example shows the implementation of the Ethernet controller-related functions for the hardware platform used in this boot loader example.

    BOOL OEMReadData(DWORD dwData, PUCHAR pData)
    {
        return(EbootEtherReadData(dwData, pData));
    }
    
    BOOL OEMEthGetFrame(PUCHAR pData, PUSHORT pwLength)
    {
        return pfnEDbgGetFrame(pData, pwLength);
    }
    
    BOOL OEMEthSendFrame(PUCHAR pData, DWORD dwLength)
    {
        BYTE Retries = 0;
    
        while(Retries++ < 4)
        {
            if (!pfnEDbgSendFrame(pData, dwLength))
                    return(TRUE);
    
            EdbgOutputDebugString("INFO: OEMEthSendFrame: retrying send (%u)\r\n", Retries);
        }
    
        return(FALSE);
    }
    
    DWORD OEMEthGetSecs(void)
    {
        return( (*(volatile DWORD *)RTC_RDCR) & RTC_SECONDS_MASK );
    }
    

See Also

Tasks

How to Develop a Boot Loader