our swiss φθηνα ρολογια are all in now.
Enhancing BusEnum to improve perceived time to boot Windows CE
Yuqun Cao, SDE, Windows CE JDP of Microsoft, released a whitepaper on enhancing BusEnum a few months ago. I finally had a chance to read it yesterday and was impressed by the additions that he made to BusEnum. The changes allow for drivers to be loaded asynchronously. This change can be used to speed up the perceived time to boot a Windows CE system to the desktop or a kiosk application.
The BusEnum that comes with Platform Builder loads drivers one at a time. It loads the drivers using ActivateDeviceEx() and waits for each to load before loading the next driver. This approach works, but the desktop doesn’t display until after each has loaded and GWES is loaded and starts the display driver. So the changes that Yuqun Cao makes gives us the ability to delay driver loading so that the system can get a display shown to the customer earlier.
I will leave it to you to read the whitepaper for more information, but I want to add to it. The whitepaper states that the changes work for both Windows CE 5.0 and 6.0, but the download is for Windows CE 6.0.
So I downloaded the example and tried to use it with Windows CE 5.0. The first thing that I noticed was that it doesn’t compile. Now that should have been a sign to me, but I ignored it and made a few changes to get it to compile. But when I tested it, it failed miserably with several Data Aborts, which is when I noticed that the download is for Windows CE 6.0.
Not ready for failure, I quit for the night and decided to try it again in the morning. When I started working on it this morning I set out to integrate the changes into the CE 5.0 BusEnum. The following is what I did to integrate the changes:
1. Copy $(WINCEROOT)\Public\Common\OAK\Drivers\BusEnum to my platform’s Drivers folder.
2. Add BusEnum to Drivers\Dirs
3. Edit BusEnum\BusEnum\Sources to:
a. Delete DOSYSGEN=1
b. Add RELEASETYPE=PLATFORM
Because we want to link with defbuslib.lib that we are changing.
4. Edit BusEnum\BusDef\Sources to:
a. Add CDEFINES=$(CDEFINES) -DBUSENUM2=1
5. Copy Public\Common\OAK\inc\defbus.h to BusEnum\BusEnum
6. Then Search for:
#ifdef BUSENUM2 ... #endif
In the Windows CE 6.0 example source and integrate only those changes into the Windows CE 5.0 source code that you copied in step 1. This is much easier than it may sound, so I won't detail those changes.
I did do a couple of things different; I put the defbus.h file in a different folder and I did not change the name of busdef.dll, so this drops in easier, but of course it doesn’t stand out that it is different.
After building and seeing that even with this new busdef in the OS that drivers still load. With success and the debug output, I looked through the drivers that had loaded and added keys the ones that I knew were not needed at initial system boot to the end of my platform.reg and set them to load after 10 seconds per the instructions in the whitepaper. The result was that the desktop was displayed about 2 seconds sooner.
So I cut down the time from reset to display of the desktop by about 2 seconds, not bad. I say not bad because I invested about 30 minutes in this over about an hour while I was also doing other things. Imagine if I spend a little more time on this and figured out which drivers could be loaded earlier, but could load asynchronously.
Note: This article is written by Bruce Eitman, and is posted to the Embedded101 site with Bruce’s permission.
Copyright © 2010 – Bruce Eitman – All Rights Reserved