WINCE 驱动按结构可以为:
1. 分层驱动
a) 分层驱动由 MDD 层驱动和 PDD 层驱动组成。 MDD 层主要负责提供应用层的接口( DDI ), 而 PDD 层驱动主要为 MDD 层提供接口( DDSI )。 PDD 层驱动为 MDD 层驱动隐藏了具体的硬件实现。
2. 单片驱动
a) 单片驱动不仅直接为系统提供接口, 也直接操作硬件。相比分层驱动它可以提更高的效率。
3. 杂合驱动
a)
WINCE 驱动按装入模块可以分为:
1. 设备管理器( Device.dll )加载的驱动
a) 由设备管理器加载的驱动实现了流驱动的接口。流驱动的接口就是预先定义的一组 函数以提供给设备设备管理器来调用。在以流驱动方式来实现的驱动没有设备类型的限制。
b) 流驱动的函数接口:
i. XXX_Init() , XXX_PreDeinit(), XXX_Deinit()……
c) 流驱动的加载
ii.
Stream drivers are unique in sense that they can be named and are accessible through functions.that are interact with the file system. Calling CreateFile with a device name returns a hander make it possible to access a driver by using both a standard API(ReadFile / WriteFile/SetFilePointer) and so-called worker been of thread drivers---DeviceIoControl.
The Device Manager registers the following three different file namespaces in the file system for accessing named stream drivers:
1: legacy(DEV1:)
2: Device-base(/$device/DEV1);
3:Bus-based(/$bus/PCI_0_1_0)
The file system recognizes device calls and reroutes to the device manager.
The legacy namespace is userd first in CE. A device name is build from the device prefix and its index.The prefix and the index are taken from the registry and the driver-load-parameters. An index value can be between 0 and 9. Therefore , only 10 devices with the same name and prefix can be accessible through a legacy namespace.
A device namespace ($device ) is similar to a legacy space but the former has no index restriction . A device name is built by adding a device prefix and its index separated by a back slash( / ), to the $device space identifier, preceded by a back slash. A device namespace makes it possible call more than 10 devices with the same index.
The bus namespace($bus) provicers additional possibilities for working with bus-based device drivers. It is implemented by both the Device Manager and the driver. A device name is built by adding a bus name to the $bus namespace identifier and preceded by a back slash(/), underscore bus number underscore device number and underscore function number.The handle is returned by making a call via bus name has additional characteristics as opposed to the handles that are obtained by making a call via a legacy space or a deriver space, with makes it possible to preform bus architecture-specific opreations.
iii.
注意的地方: WINCE 打开流设备的时候要注意 CreateFile 的设备名称。设备名的后面一定要有一个冒号 “ : ” , 不然的话找不到对应的设备会产生一个错误。这个小的地方没有注意导致我费了很久的时间。 其实这也不是什么小的地方, 是我看书的时候没有仔细。 在设备名的一般格式是 "LED1" ( 我就用 LED 来表示吧!前面是三个字母, 大不大小定等一个我再试一试。 ) 前面 的有一个字母是注册表里面的 PREFIX, 后面的数字 1 是 INDEX.
(重新测试了书上的一句话, 其实前面的字母并不是要全部大写, 我 'Led1' 也能够使用。)
WINCE 驱动按加载进的地址可以分为用户模式驱动和内核模式驱动。
WINCE 驱动按加载的时间可以分为启动加载的驱动和请求加载的驱动。
2. GWES(GWES.dll) 加载的驱动
a) 由 GWES 加载的驱动主要是系统使用。它们为用户提供接口, 比如:键盘, 鼠标, 触摸屏等。 有的时候它们也称为本机驱动。它们在 GWES 中都有自己的接口。
3. 文件系统( FileSys.dll )加载的驱动
a) 文件系统驱动被实现成 dll 的方式, 它预先实现了一组函数和 IO 控制的函数。这些函数被标准的文件系统 API 调用。如上图所示。
关于以上提到的WINCE驱动方面的东西很大一部份都是参考CE Fundamentals eBook.pdf这本书上的内容, 这本书真的不错, 感谢该书的作者!THANKS THE AUTHOR OF THE BOOK--- CE Fundamentals eBook