對 Battery Driver 有了更深的了解
http://blog.csdn.net/pk666666/archive/2010/12/17/6082762.aspx
是很好的文章
一.概述
Windows CE电池驱动属于分层驱动,由MDD层和PDD层组成。驱动示例代码位于%_WINCEROOT%\Public\Common\Oak\Drivers\Battdrvr。其中battdrvr.c是MDD层代码,sbattif.c是PDD层代码。MDD层代码微软已经搭好架构,一般不需要修改,我们要实现的是PDD层的代码。
在Au1200 BSP中 sbattiff.c 被 battpdd.c 取代
二.MDD层
电池驱动对外接口函数没有“BAT_”前缀,因为HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Battery\Flags注册表项设置了DEVFLAGS_NAKEDENTRIES属性,表示“Init”代替“BAT_Init”,这样修改注册表“Prefix”项的值时不需要修改驱动代码。
DEVFLAGS_NAKEDENTRIES 重要,其值為 8
在 battdrvr.reg 中
; These registry entries load the battery driver. The IClass value must match
; the BATTERY_DRIVER_CLASS definition in battery.h -- this is how the system
; knows which device is the battery driver. Note that we are using
; DEVFLAGS_NAKEDENTRIES with this driver. This tells the device manager
; to instantiate the device with the prefix named in the registry but to look
; for DLL entry points without the prefix. For example, it will look for Init
; instead of BAT_Init. This allows the prefix to be changed in the registry (if
; desired) without editing the driver code.
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Battery]
"Prefix"="BAT"
"Dll"="battdrvr.dll"
"Flags"=dword:8 ; DEVFLAGS_NAKEDENTRIES
"Order"=dword:0
"IClass"="{DD176277-CD34-4980-91EE-67DBEF3D8913}"
沒有留言:
張貼留言