说明.txt

来自「WINCE 下电池驱动的源代码」· 文本 代码 · 共 27 行

TXT
27
字号
1.    将样本代码拷到BSP的DRIVERS目录下。
2.    修改DRIVERS目录下dirs文件,加上Battdrvr目录。
3.    修改FILES目录下的platform.reg文件,增加如下
IF BSP_NOBATTERY !
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\System\Events]
  "SYSTEM/BatteryAPIsReady"="Battery Interface APIs"
; END HIVE BOOT SECTION
; 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}"
ENDIF BSP_NOBATTERY !
4.    修改FILE目录下的platform.dat文件,增加如下:
battdrvr.dll            $(_FLATRELEASEDIR)\battdrvr.dll            NK    SH
5.修改battif.c文件,在BatteryPDDGetStatus函数中增加获取电池状态的相关代码。

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?