Port the Sample Stream Driver (Compact 2013)

3/26/2014

Because most Windows Embedded Compact 2013 device drivers are stream drivers, you can use several different example stream drivers to begin developing your device driver. To port the example stream driver:

  1. If you have not already done so, use the integrated development environment (IDE) in Platform Builder to create an OS design. For more information about creating an OS design, see Create Your First OS.

  2. Copy the example stream driver to your OS design. The example stream driver is the wavedev driver located at %_WINCEROOT%\platform\CEPC\src\drivers\VirtualPC\wavedev2_sb16.

  3. Rename the example stream driver source files to names that correspond with the functionality you intended for your device driver. You can rename the SDT prefix of each function to a prefix that you choose for your device driver.

  4. Edit the TARGETNAME and SOURCES values in the sources file so that your driver corresponds with your new file names.

  5. Verify that your driver entry points are correctly exposed to the build system. As shown in the example stream driver source, you should include each function in the .def file and preface each function with an extern "C" declaration in the .cpp file.

    Note

    After you complete steps 1-5 and have a basic driver shell, verify that you can build your device driver, include it in a run-time image, and access it from a simple test application before adding more functionality in steps 6-9.

  6. Modify the source code for your driver to implement the stream interface functions. You can start by implementing code to manage open and device contexts. For more information about managing context, see Manage Device Driver Context.

  7. Add functionality to control your hardware, including interrupt handling, DMA processing, data marshaling, device interface support, and power management as required. We recommend that you first create header files with constants and data structures that represent your hardware before writing hardware-specific code. Note that adding functionality to control your hardware is typically the bulk of the process to implement your device driver.

  8. Add code to connect the functionality you implement in step 7 to the stream interfaces of your driver.

  9. If your driver must support additional functionality beyond that which the stream interface functions expose, you can choose to implement custom I/O control codes in the IOControl function of your driver.

When you are ready to build your device driver, see Build and Test Your Device Driver for information about how to add registry information for your driver to the Platform.reg file, how to modify Platform.bib and build system files so that the OS design includes your driver, how to build a run-time image with your device driver, and how to test your device driver.

See Also

Concepts

Implement Your Device Driver