Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15497880
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类:

2009-03-24 15:42:17

How to Create a Device Driver

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 . For more information about power management, see .
  • 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.

Clear Step Topic
1. Familiarize yourself with the code structure for Windows CE device 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.

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.
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 .

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

阅读(1674) | 评论(1) | 转发(0) |
0

上一篇:CE5.0 - Build Tool

下一篇:CE5.0 - SDK Development

给主人留下些什么吧!~~