Adding Support for Download Progress Indication (Windows Embedded CE 6.0)
1/5/2010
To add support for download progress indication, you need to implement the OEMShowProgress function.
The OEMShowProgress function is called on a per-.bin record basis and is provided the record number that was just downloaded.
You can implement this function to compute the number of bytes downloaded by tracking it in the OEMReadData routine. The computed value should not increment consistently because record sizes can differ.
The OEMShowProgress function can then display the download progress to the user through some visual indication such as a LED display.
To implement the OEMShowProgress function
Edit the file Main.c.
Add the code necessary to fully implement the OEMShowProgress function.
The following code example shows the implementation of the OEMShowProgress function for the hardware platform used in this boot loader example.
void OEMShowProgress(DWORD dwPacketNum) { static BYTE PrevPercentComplete = -1; BYTE PercentComplete; // g_dwBytesRead and g_dwTotalBytes are global variables. // g_dwBytesRead is updated during a data packet read. // g_dwTotalBytes is determined from the size of the download image // (which is obtained from the .bin file header for example). PercentComplete = ((g_dwBytesRead * 100) / g_dwTotalBytes); // Update the display only when the percent complete changes. if (PercentComplete != PrevPercentComplete) { // // Write PercentComplete to board LEDs here. // PrevPercentComplete = PercentComplete; } return; }