Thursday, July 11, 2013

WaitForMultipleObjects

Please take care while using WaitForMultipleObjects

Today I was trying one of the example given by Microsoft on Windows CE. 

Basically the code is written for Windows Desktop and the code can be seen at the following URL: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686927(v=vs.85).aspx.

In the above given example the main function is creating two threads and waiting for the threads to close using WaitForMultipleObjects API. 

As this example is for desktop in WaitForMultipleObjects API the third parameter fWaitAll is set to TRUE.

I made some modifications such as printf is changed to RETAILMSG and on entry and exit of main, thread function we have enable more RETAIL Messages.

After running the application we are not seeing any messages that are being printed from the worker threads. All we see is the main function entry and exit messages.

After debugging, we came to know that fWaitAll in WaitForMultipleObjects API shall be set to FALSE in Windows CE 6.0.

Hope This Helps.

Thursday, March 28, 2013

Forcing a device driver to a power state for a power manager state

Many of you might already know that in Windows CE 6.0 one can set the device power state to a required power state other than default power state for a particular power manager state.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\useridle] 
"Default"=dword:1
The above entry will keep all the devices in D1 state while entering into User Idle power manager state 


In Windows CE 6.0 we have following default power manager states

ON, UserIdle, SystemIdle, Resuming, Suspend, Coldreboot and reboot.

Let's say one would like to set a stream interface driver XYZ to D4 while entering into D4 state.

Hence the below registry key has to be specified in platform.reg

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\useridle] 
"xyz1:"=dword:4



Please note that in PM the case for the entry is sensitive. Hence if you set XYZ1 inplace of xyz1 then it will not work. 

Thank You for reading the post.



Friday, January 18, 2013

How to flash images onto production hardware

This article discusses about the ways to flash binaries in production stage to hardware.

As of now I can think of three possibilities for updating binaries to Flash present on Hardware. 

SD Boot
  • Copy all the images to SD Card .
  • Implement boot-loader in such a way that whenever the system boots from SD Card to update the boot-loader images and Kernel image to Flash present on Hardware.
To have this feature the hardware shall support SD Card boot and the boot-loader shall support some file system handling code.

In this method at production stage the only requirement is one SD Card with production images copied onto it.

Using Platform Builder 

  • Flash the boot-loader images onto hardware using JTAG
  • Disconnect the JTAG and boot from Flash. 
  • Connect the hardware using ethernet cable or USB cable.
  • Download the image from Platform builder onto target and flash it.
The drawback of this is at production stage Host PC shall be supplied with Platform Builder Installed and expensive JTAG's might need to be purchased. More over the flashing procedure is a two step procedure.

Using CEDownloader
  • Flash the boot-loader images onto hardware using JTAG
  • Disconnect the JTAG and boot from Flash. 
  • Connect the hardware using ethernet cable or USB cable.
  • Instead of PB the user can install CEDownloader utility (Search for it in Google / Sourceforge.net)
In this method installation of PB onto production Host PC can be avoided.


Happy Flashing.