Best Practices for Portable Device Drivers (Windows CE 5.0)

Send Feedback

Following certain best practices can facilitate migrating a device driver from one version of the OS to another, from one device to another, or from one hardware platform to another.

The following list shows best practices for portability:

  • Begin device driver development with an existing Windows CE-based production-quality device driver.

    Choose a device driver for a device that is similar to your device.

  • Comment the code clearly, especially the code that other users of your device driver might have to modify to allow the device driver to function with their device or hardware platform.

  • Minimize the amount of code that is specific to a particular hardware platform.

  • Store configuration information for a device driver in the registry.

    If a device driver cannot access the registry, store the configuration information for the device driver in a header file. As a last resort, store the configuration information for a device driver in a separate library or source file.

  • If a device driver is bus independent, allow for the use of an installable interrupt service routine (ISR).

    Have an appropriate alternative, if an installable ISR is not listed in the registry.

    Check for the IsrDll and IsrHandler strings in the registry, and then verify that the IRQ and SYSINTR values are valid. IRQ_UNSPECIFIED is the invalid IRQ value, and SYSINTR_NOP is the invalid SYSINTR value. If both of these values are invalid, a device driver should not load the installable ISR. If the SYSINTR is invalid, request a SYSINTR value by passing IOCTL_HAL_REQUEST_SYSINTR to the KernelIoControl function.

  • Use the registry helper functions where applicable.

  • Obtain physical addresses from the registry.

  • Allow thread priorities to be configured in the registry.

See Also

Device Driver Libraries | Layered Drivers vs. Monolithic Drivers | Registry Helper Functions | Windows CE Drivers

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.