Chinaunix首页 | 论坛 | 博客
  • 博客访问: 919589
  • 博文数量: 96
  • 博客积分: 10071
  • 博客等级: 上将
  • 技术积分: 1118
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-20 17:54
文章分类

全部博文(96)

文章存档

2011年(3)

2010年(3)

2009年(29)

2008年(54)

2007年(7)

分类: WINDOWS

2009-01-08 23:30:10

wince电池驱动程序

creawtor
sz111@126.com

今天晚上在参考各方面程序和请教了几个高手之后,wince的电池驱动终于搞好了。不敢独享,特别奉献。
主要是参考了wince_lover大侠的文章。http://bbs.driverdevelop.com/htm_data/48/0704/100877.html
以下是引用他的文章:
电池驱动的代码
前一段时间完成电池驱动,下面是一点心得,贴出来供大家参考:
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函数中增加获取电池状态的相关代码。

     我主要是对BatteryPDDGetStatus做了点修改,去掉了AC的检测。AD的设定。
参考附件:备注:程序版权为wince_lover所有,我仅仅是在他的基础上改了一点点。下次我对这个程序做个分析。
文件:Battdrvr.rar
大小:17KB
下载:下载
阅读(3701) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

afei88562013-08-06 11:37:02

我也刚刚做电池这块,楼主的硬件电路是怎么来控制充放电的,用的专用的电源管理芯片?电量信息如何读取的呢?

sz198804122009-07-16 10:19:06

请问楼主这个硬件电路是怎么连接的,使用的是什么芯片?谢谢