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 |
---|---|
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. |
|
Reads data directly from a NIC through the pfnEDbgGetFrame pointer. This function can be copied from an existing hardware platform. |
|
Writes data directly to the NIC through the pfnEDbgSendFrame pointer. This function can be copied from an existing hardware platform. |
|
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. |
To implement Ethernet controller-related functions
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 ); }