BusEnum2 and a Minor Bug Fix

Posted by Kate Moss' Open Space on Geeks with Blogs See other posts from Geeks with Blogs or by Kate Moss' Open Space
Published on Thu, 30 Jun 2011 04:42:03 GMT Indexed on 2011/06/30 8:23 UTC
Read the original article Hit count: 271

Filed under:

The default root bus driver, BusEnum, enumerate and active drivers one by one in synchronized manner. It is not only slowing the boot time but in the even if any of driver's init function (XXX_init) get hanged, the whole system won't boot at all.
There is a sample of enhanced root bus driver, BusEnum2, on the
http://msdn.microsoft.com/en-us/library/dd187254.aspx
The page provides the sample code and the detail explanation of the design concept.
With multi-threaded BusEnum2 on CE7 with SMP enabled system, the scalability is even more significant. Since you have more than one processor and it can load drivers in parallel!


Everything looks good so far, except to there is a small bug in the sample code.
Fortunately, it is easy to fix. But hard to trace if you ever enc outer it!
The BUSENUM2 flag only defined in BUSENUM2\BUSDEF\sources but not in BUSENUM2\BUSENUM\sources.
The DeviceFolder is implemented in BUSENUM2\BUSDEF but the instance is created in BUSENUM2\BUSENUM\busenum.cpp, so the result is it allocates less memory than actual need.
 
Add
 
CDEFINES=$(CDEFINES) -DBUSENUM2
 
into BUSENUM2\BUSENUM\sources and the problem fixed!

© Geeks with Blogs or respective owner