WINCE驱动的概念及框架

来源:互联网 发布:捕鱼游戏源码下载 编辑:程序博客网 时间:2024/05/01 10:54

 

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 insense that they can be named and are accessible through functions.that areinteract with the file system. Calling CreateFile with  a device namereturns a hander make it possible to access a driver by using both a standardAPI(ReadFile / WriteFile/SetFilePointer) and so-called worker been of threaddrivers---DeviceIoControl.
The Device Manager registers the following three different file namespaces inthe 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 thedevice prefix and its index.The prefix and the index are taken from theregistry 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 accessiblethrough a legacy namespace.

A device namespace ($device ) is similar to a legacy space but the former hasno index restriction . A device name is built by adding a device prefix and itsindex separated by a back slash( / ), to the $device space identifier, precededby a back slash. A device namespace makes it possible call more than 10 deviceswith the same index.

The bus namespace($bus) provicers additional possibilities for working withbus-based device drivers. It is implemented by both the Device Manager and thedriver. A device name is built by adding a bus name to the $bus namespaceidentifier and preceded by a back slash(/), underscore bus number underscoredevice number and underscore function number.The handle is returned by making acall via bus name has additional characteristics as opposed to the handles thatare obtained by making a call via a legacy space or a deriver space, with makesit 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

原创粉丝点击