阅读:8308回复:29
电池驱动的代码
前一段时间完成电池驱动,下面是一点心得,贴出来供大家参考:
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函数中增加获取电池状态的相关代码。 |
|
|
沙发#
发布于:2007-04-16 16:32
GPF7,是检测 是否在充电的
|
|
板凳#
发布于:2007-04-17 15:46
在DdsiTouchPanelEnable函数中增加
if(ghBattTouchMutex == NULL ) { ghBattTouchMutex = CreateMutex( NULL, FALSE, BATTERY_TOUCH_MUTEX ); } 在PddpTouchPanelDeallocateVm函数中增加 if(ghBattTouchMutex) { CloseHandle( ghBattTouchMutex ); ghBattTouchMutex = NULL ; } 在DdsiTouchPanelGetPoint函数中读触摸屏采样之前加上 if(ghBattTouchMutex ) { WaitForSingleObject(ghBattTouchMutex, 5000); } 在读完之后加上 if(ghBattTouchMutex ) { ReleaseMutex(ghBattTouchMutex); } |
|
地板#
发布于:2007-04-20 13:47
没有啊,我试了一下。都正常
|
|
地下室#
发布于:2007-04-22 15:14
我也是这样作的,没有问题.你检查一下你的触摸屏驱动
|
|
5楼#
发布于:2007-09-05 09:26
我没有看过2410的代码,不过有没有无关紧要。只要你在驱动退出的时候释放互斥量就可以了
|
|
6楼#
发布于:2007-09-05 12:02
第三个参数就是一个UNICODE字符串
|
|