Network functions in WinCE eboot

Source: Internet
Author: User
Tags bool port number

General use Eboot Download wince image is through the network, refers to Ethernet, of course, there are also downloaded through the USB, but the network download is the most commonly used. In fact, the download work is done in the Blcommon module, it will call the Oemreaddata function to download the data, oemreaddata by the user to achieve, generally if the network download, Will call the Ebootetherreaddata function directly in Oemreaddata to read data from the network, which is implemented by Microsoft, which calls the Oemethgetframe function to read the data from the NIC. This function is to the user according to their use of the network card chip implementation of the network card driver.

I don't know, I said it. No, actually in Eboot, Blcommon is the top-level, and in order to implement the download, we need to implement the relevant OEM download functions, and these OEM functions will invoke the network functions provided by wince, which are "\wince600\public\ Common\oak\drivers\ethdbg\eboot "below, the code below this directory will be compiled into a eboot.lib library to provide a small TCP/IP stack and TFTP service. Eboot.lib will call the underlying network card driver functions to achieve data transmission on the network card, and the underlying network card driver function is actually some OEM functions to the user to achieve.

Let's first introduce the related OEM functions for eboot downloads:

1. Lpbyte oemmapmemaddr (DWORD Dwimagestart, DWORD dwaddr)

This function mainly makes flash to ram address innuendo. WinCE image is downloaded while downloading is written, because the slow write flash, may affect the download, so the function implemented a buffer of RAM, that is, the flash address map to ram, so that the downloaded data is placed in the RAM buffer, And then write to flash inside. The function is called by Oemwriteflash. Dwimagestart is the starting address of the written wince image in Flash, dwaddr as the starting address of the bin file being written, and the return value is the address in the mapped RAM.

2. BOOL Oemreaddata (DWORD cbdata, Lpbyte pbdata)

This function is used to download wince image when downloading data, general network download, call Ebootetherreaddata function directly in this function. Of course, you can also add other ways of reading and writing to the function, such as reading from an SD card. Cbdata for the number of bytes to read, Pbdata is a buffer and returns true for success.

3. void oemshowprogress (DWORD dwpacketnum)

This function is used to display the download progress, primarily to give the user a message. You can print the serial port information in the function or manipulate the led to tell the user the status of the current download. Dwpacketnum is the number of packet that are currently downloaded.

The following is a brief introduction to the network control functions:

1. BOOL Ebootetherreaddata (DWORD cbdata, Lpbyte pbdata)

Read data from the network, it will be called by Oemreaddata, cbdata for the number of bytes to read, Pbdata is a buffer, return true for success.

2. BOOL Ebootinitethertransport (edbg_addr* pedbgaddr, Lpdword pdwsubnetmask, bool* pfjumping, DWORD* pdwDHCPLeaseTime, U CHAR VersionMajor, Uchar VersionMinor, char* szplatformstring, char* szdevicename, Uchar CPUId, DWORD dwbootflags)

This function is used to initialize the network transport, which is called by the Oempredownload function. PEDBGADDR is a network card address structure, which includes the IP address, MAC address, and port number. Pdwsubnetmask is the subnet mask. Pfjumping is a jump mark that is used to decide whether to download or direct jump execution. Pdwdhcpleasetime is the duration of the DHCP. VersionMajor and VersionMinor are version numbers. Szplatformstring is the platform name. Szdevicename is the device name that will be displayed in the Platform Builder when downloading. CPUID is the ID of the processor. The dwbootflags should be set to 0.

3. edbg_os_config_data* Ebootwaitforhostconnect (edbg_addr* pdevaddr, edbg_addr* phostaddr)

This function is used to wait for the Platform Builder connection on the PC side and to receive information about the IP address and port number for the associated service, including the KITL tag bit, which is called by the Oemlaunch function. PDEVADDR is the address information for the device side, including the IP address, MAC address, and port number. PHOSTADDR is the host-side address information, including the IP address, MAC address, and port number. Returns a edbg_os_config_data structure that contains information about the address information configuration and user settings for each service.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.