The optional function in WinCE eboot

Source: Internet
Author: User
Tags bool time limit

In the eboot of wince, there are some functions that belong to the OEM function of optional, which is optionally implemented. These functions are called in the Blcommon module, we need to implement them in the Eboot, and then assign the implemented function to the corresponding function pointer in Blcommon, so that the Blcommon module, when invoking these optional functions, Will first check whether they are null or not, if NULL, and run the functions if they are not null.

You can take a look at the code for the Blcommon module, which is defined in BLCOMMON.C as follows:

PFN_OEMVERIFYMEMORY   g_pOEMVerifyMemory;
PFN_OEMREPORTERROR    g_pOEMReportError;
PFN_OEMCHECKSIGNATURE  g_pOEMCheckSignature;
PFN_OEMMULTIBINNOTIFY  g_pOEMMultiBINNotify;

These 4 optional function pointers generally correspond to the following functions in Eboot:

BOOL OEMVerifyMemory(DWORD dwStartAddr, DWORD dwLength)
BOOL OEMReportError(DWORD dwReason, DWORD dwReserved)
BOOL OEMCheckSignature(DWORD dwImageStart, DWORD dwROMOffset, DWORD dwLaunchAddr, BOOL bDownloaded)
void OEMMultiBINNotify(const PMultiBINInfo pInfo)

Some of these OEM functions are described below:

1. BOOL Oemverifymemory (DWORD dwstartaddr, DWORD dwlength)

This function is primarily used to authenticate the storage device to be downloaded wince image, which is invoked in the Downloadimage function in the Blcommon module to verify the storage device before downloading. DWSTARTADDR is the starting address of the downloaded image in the memory, Dwlength is the length of the image, and returns true successfully.

2. BOOL Oemreporterror (DWORD Dwreason, DWORD dwreserved)

This function is used to report errors, and the user can print them through a serial port. In the Blcommon module, it is called by the halt function, and the halt function is invoked to report an error when an error occurs in the Bootloadermain function in the Blcommon module. Dwreason for the wrong reason, dwreserved is reserved and is not currently in use.

3. BOOL Oemchecksignature (DWORD Dwimagestart, DWORD Dwromoffset, DWORD dwlaunchaddr, BOOL bdownloaded)

This function is used to validate the signature in WinCE image and check its validity. It is called in the Downloadimage in the Blcommon module, which verifies the wince image after downloading. Dwimagestart is the storage starting address of the downloaded image, Dwromoffset is the value of the Romoffset defined in the Config.bib file, dwlaunchaddr to the address being loaded, bdownloaded is the image file that is downloaded for the ture. In fact, a generic signature check function has been provided in the Blcommon module Checksignature (..) In the signimage.c file, you can call this function in the function to verify the signature of the image.

4. void oemmultibinnotify (const pmultibininfo pinfo)

This function is used to tell users the area information for each file when downloading multiple bin files. It will be called by the Downloadimage function of the Blcommon module. Platform Builder itself is a support for downloading multiple bin files at a time, so when eboot downloads, the number of bin files to download and the starting address and length of each bin file can be downloaded from the function, which is reflected in pinfo.

These OEM functions above are implemented by the user according to their own needs, and if they want them to be called by the Blcommon module, they also need to assign them to the corresponding function pointers as follows:

g_pOEMVerifyMemory = OEMVerifyMemory(..)
g_pOEMReportError = OEMReportError(..)
g_pOEMCheckSignature = OEMCheckSignature(..)
g_pOEMMultiBINNotify = OEMMultiBINNotify(..)

The above assignment operation is best done in the Oemdebuginit function.

Finally, we want to mention a function in Eboot, which should not be a optional OEM function, but it can also be chosen according to Eboot's needs:

DWORD oemethgetsecs (void):

The function is actually a timer function that returns the current number of seconds. It is mainly used in eboot for timeout judgment in polling mode and is generally invoked in the Oemplatforminit function. In Oemplatforminit, it often waits for the user to enter information from the serial port to decide whether to load the running wince directly or to enter the Bootloader menu to set. This waits for user input with a certain amount of time limit by calling the function in the while loop until the timeout time elapses to automatically jump out.

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.