How to Create a Device Driver (Windows CE 5.0)

Windows CE 5.0
Send Feedback

After you create an OS design, you can create a device driver for a specific target device to operate under the Windows CE operating system (OS). You create your driver once you have identified the hardware that you want use with the OS.

Hardware and Software Assumptions

  • The sample driver code demonstrated in the following steps is merely a starting point and does not actually work with specific hardware. You must modify the driver code in order for it to function correctly for your target device.
  • You are creating a power-managed stream interface driver. For more information about stream interface drivers, see Stream Interface Driver Development Concepts. For more information about power management, see Power Management.
  • You are familiar with using the Platform Builder command line build tool. For more information, see Build Tool.
  • You are familiar with the driver development tools for Windows CE. For more information, see Driver Development Tools.

To track your progress in the following table, select the check box next to each step.

 StepTopic
1. Familiarize yourself with the code structure for Windows CE device drivers.Layered Drivers vs. Monolithic Drivers
2. Familiarize yourself with driver development for Windows CE.Developing a Device Driver
3. If you have not already done so, in the Platform Builder integrated development environment (IDE), create an OS design.Creating an OS Design
4. Copy the power management development sample driver to your OS design.

For example, copy %_WINCEROOT%\Public\Common\Oak\Drivers\PM\Test\Devsample to %_WINCEROOT%\Platform\<your OS design>\drivers\<your driver name>.

Not applicable
5. Rename the power management development sample driver files to names that correspond with the intended functionality of your driver.Not applicable
6. Edit the TARGETNAME and SOURCES values in the sources file for your driver to correspond with your new file names.Not applicable
7. Add WINCEOEM=1 to the sources file for your driver to allow your driver access to %_WINCEROOT%\Public. For more information on sources files, see Sources File.Not applicable
8. Modify the source code for your driver to implement the correct stream interface functions.

The power management development sample includes support for the stream interface functions. The XXX prefix for these functions has been replaced with PDX.

Stream Interface Driver Implementation
9. If your driver requires functionality in addition to the functionality provided by the stream interface functions, you may choose to implement custom I/O control codes.I/O Control Codes
10. Modify the source code for your driver to implement the correct power management functions for your driver.

Because you previously created your driver, proceed to step 2 in the corresponding topic.

How to Add Power Management to a Device Driver
11. Verify that the entry points for your driver are exposed correctly. The functions should either be declared using a .def file or by using the extern "C" declarator.

The sample .def file for the power management development sample driver is located at %_WINCEROOT%\Public\Common\Oak\Drivers\PM\Test\Devsample\Pmdevsample.def.

For more information on the extern "C" declarator, see Stream Interface Driver Implementation.

Not applicable
12. Add registry information for your driver to the Platform.reg file for your OS design.

For example, you can add the following code example to the Platform.reg file to specify the correct registry information for your driver.

#include "$(_winceroot)\platform\<your OS design>\drivers\<your driver name>\<your driver name>.reg"
Registry File
13. Modify the Platform.bib file for your OS design to include your driver.

For example, you can add the following code example to the Modules section of the Platform.bib file to specify the correct location of your driver.

MyDriver.dll    $(_FLATRELEASEDIR)\<your driver name>.dll          NK SH
Binary Image Builder File
14. Edit the dirs file for your OS design to include your driver.Dirs File
15. From %_WINCEROOT%\Platform\<your OS design>\Drivers\<your driver name> in your OS design, build your driver.Building a Device Driver from the Command Line
16. In the IDE, build your run-time image to include your driver.Building a Run-Time Image
17. Debug the source code for your driver.How to Debug a Device Driver
18. Test your driver using the Windows CE Test Kit (CETK).How to Use the CETK to Test a Driver

See Also

Device Driver Development Overview | Troubleshooting a Device Driver | Layered Drivers vs. Monolithic Drivers | How-to Topics | Stream Interface Driver Development Concepts | Build Tool | Sources File


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: