1. 将上面目录compositefn文件夹移植到bsp\src\driver下面,接着将compositefn编译成流驱动compositefn.dll,然后通过设置注册表如下:
……………………………………………………………………………………………
IF BSP_USBFNCLASS == COMPOSITEFN
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"=- ; erase previous default
"DefaultClientDriver"="CompositeFN"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"ClientDriverList"=multi_sz:"Mass_Storage_Class","Serial_Class"
"bcdDevice"=dword:0
"Prefix"="UFC"
"Dll"="compositefn.dll"
"Index"=dword:0
"Order"=dword:53
"ManufacturerString"="COMPOSITE DEVICE"
"MaxPacketSize"=dword:40
"VendorID"=dword:045E
"ProductID"=dword:00CE
"Attributes"=multi_sz:"80","81"
"xFriendlyName"="COMPOSITE"
ENDIF BSP_USBFNCLASS
;------------ USB Function Serial Driver --------------------------------------
IF BSP_USBFNCLASS == SERIAL
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"="Serial_Class"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]
"UFC_DefaultClient"=dword:1
"UFC_FriendlyName"=LOC_USBFN_SERIAL_NAME
"UFC_idVendor"=dword:0547
"UFC_Manufacturer"=LOC_USBFN_SERIAL_MANUFACTURER
"UFC_idProduct"=dword:2720
"UFC_Product"=LOC_USBFN_SERIAL_PRODUCT
"UFC_Index"=dword:5
"UFC_Configurations"=multi_sz:81
"UFC_FunctionClass"=dword:0E
"UFC_FunctionProtocol"=dword:00
"UFC_FunctionSubClass"=dword:03
"UFC_bcdDevice"=dword:0
ENDIF BSP_USBFNCLASS
;-------------------------------------------------------------------------
;------------ USB Function Mass Stroge Driver ---------------------------------
IF BSP_USBFNCLASS == MASS_STORAGE
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"="Mass_Storage_Class"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Mass_Storage_Class]
"UFC_DefaultClient"=dword:0
"Dll"="usbmsfn.dll"
"UFC_InterfaceSubClass"=dword:06
"UFC_InterfaceProtocol"=dword:50
"UFC_Configurations"=multi_sz:80
"UFC_FunctionClass"=dword:0E
"UFC_FunctionProtocol"=dword:00
"UFC_FunctionSubClass"=dword:03
"UFC_bcdDevice"=dword:0
"UFC_DeviceName"="DSK3:"
"UFC_FriendlyName"="Mass Storage"
"UFC_idVendor"=dword:045E
"UFC_Manufacturer"="Generic Manufacturer (PROTOTYPE--Remember to change idVendor)"
"UFC_idProduct"=dword:FFFF
"UFC_Product"="Generic Mass Storage (PROTOTYPE--Remember to change idVendor)"
……………………………………………………………………………………………………
在最后加入:
;CPF
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\CompositeFN]
"ClientDriverList"=multi_sz:"Mass_Storage_Class","Serial_Class"
"Prefix"="UFC"
"Dll"="compositefn.dll"
"Index"=dword:1
"Order"=dword:53
"ManufacturerString"="COMPOSITE DEVICE"
"MaxPacketSize"=dword:40
"VendorID"=dword:045E
"ProductID"=dword:00CE
"Attributes"=multi_sz:"80","81"
"xFriendlyName"="Serial on USB" ; experimenting
并改写相应的platform.BIB,SMDK6410.bat文件,并在CMD窗口下设置环境变量如下:set SYSGEN_USBFN_COMPOSITE=1。这样compositefn.dll就可以在系统启动的时候被自动加载。
通过实验,经编译通过的NK.EXE下载到我们的在ideal6410开发板上面,我们可以看到:在ideal6410上打开注册表,在driver\active\下面的23项,看到COMPOSITEFN.DLL已经被成功加载。
2通过DWN.EXE查看串口调试信息关键部分如下:
-OALIntrRequestSysIntr(irq = 96, sysIntr = 30)
compositefn1 dllentry success
UPC attach success
compositefn load success
2 success
2 success
Drivers\Active\23 1 is ActiveKey
4 success
Drivers\Active\23 2 is ActiveKey
composite init success
m_globalRegistryInfo.Init success
Drivers\Active\23 is IS UfnInitializeInterface.ActiveKey
4 success
[SDBUS] SD Card Spec Version : 2.00
[SDBUS] SD/SDHC doesn't support the high-speed mode.
[HSMMC0] Setting for 4 bit mode , Clock Rate = 25000000 Hz
[HSMMC0] Turn OFF the F/B delay control.
[HSMMC1] Setting for 4 bit mode , Clock Rate = 25000000 Hz
[HSMMC1] Turn OFF the F/B delay control.
DEBUG: CreateSerialObject 3
-OALIntrRequestSysIntr(irq = 64, sysIntr = 31)
DEBUG: CreateSerialObject 2
-OALIntrRequestSysIntr(irq = 63, sysIntr = 32)
DEBUG: CreateSerialObject 1
-OALIntrRequestSysIntr(irq = 62, sysIntr = 33)
[USBH] HcdPdd_Init(
[USBH] ++InitializeOHCI()
[USBH] --InitializeOHCI() : Success
-OALIntrRequestSysIntr(irq = 13, sysIntr = 34)
-OALIntrRequestSysIntr(irq = 14, sysIntr = 36)
[MFC POWER] Power is up.
[MFC POWER] Power is down-OALIntrRequestSysIntr(irq = 26, sysIntr = 37)
MFC Interrupt has been initialized.
[MFC IOCTL_POWER_CAPABILITIES]
[MFC IOCTL_POWER_CAPABILITIES] leaving...
[MFC POWER] Power is up.
[MFC POWER] Power is down::: SPL_Init.
-OALIntrRequestSysIntr(irq = 18, sysIntr = 38)
compositefn load success
2 success
2 success
Drivers\Active\59 1 is ActiveKey
4 success
Drivers\Active\59 2 is ActiveKey
composite init success
m_globalRegistryInfo.Init success
Drivers\Active\59 is IS UfnInitializeInterface.ActiveKey
fSuccess chu
ERROR: C:\WINCE600\PLATFORM\SMDK6410\SRC\DRIVERS\COMPOSITEFN\.\manager.cpp line 58: Composite!CCompositeManager::Init: UfnInitializeInterface failed. Error: 31
说明ActiveKey =“Drivers\Active\23”时候,能够成功加载,而ActiveKey =“Drivers\Active\59”时候,出现了错误。具体错误通过加入调试信息也可以找到最根处:
是在C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\USBFN\UFNCLIENTLIB\中的UfnClient.cpp这段程序:
xtern "C"
DWORD
UfnInitializeInterface(
LPCTSTR pszActiveKey,
UFN_HANDLE *phDevice,
PUFN_FUNCTIONS pFunctions,
PVOID *ppvInterfaceInfo
)
{
SETFNAME();
DWORD dwRet;
PUFN_CLIENT_INTERFACE pInterface = NULL;
HANDLE hBusAccess = NULL;
UFN_CLIENT_DATA ucd;
BOOL fSuccess;
if ( !pszActiveKey || !phDevice || !pFunctions || !ppvInterfaceInfo ) {
dwRet = ERROR_INVALID_PARAMETER;
DEBUGMSG(1, (_T("%s Invalid parameter.\r\n"),
pszFname));
goto EXIT;
}
pInterface = (PUFN_CLIENT_INTERFACE) LocalAlloc(LPTR, sizeof(UFN_CLIENT_INTERFACE));
if (pInterface == NULL) {
RETAILMSG(1, (_T("pInterface == NULL\r\n")));
dwRet = GetLastError();
DEBUGMSG(1, (_T("%s Could not allocate memory. Error %u\r\n"),
pszFname, dwRet));
goto EXIT;
}
RETAILMSG(1, (_T("%s is IS UfnInitializeInterface.ActiveKey \n"), pszActiveKey));
hBusAccess = CreateBusAccessHandle(pszActiveKey);
if (hBusAccess == NULL) {
RETAILMSG(1, (_T("pInterface == NULL\r\n")));
dwRet = GetLastError();
DEBUGMSG(1, (_T("%s Could not CreateBusAccessHandle. Error %u\r\n"),
pszFname, dwRet));
goto EXIT;
}
memset(&ucd, 0, sizeof(ucd));
ucd.dwVersion = UFN_CLIENT_INTERFACE_VERSION;
fSuccess = BusChildIoControl(hBusAccess, IOCTL_UFN_GET_CLIENT_DATA_EX, &ucd, sizeof(ucd));
if (!fSuccess) {
[color=#FF0000] RETAILMSG(1, (_T("fSuccess chu\r\n")));///通过上面串口调试信息我们可以看到是在此处///////////////////////////////////////////////////////////////////////出错!!![/color]
dwRet = GetLastError();
goto EXIT;
}
compositefn驱动会被加载两次呢?是不是因为复合了两个设备啊?还有串口是不是不能作为一个设备同另外一个设备符合啊?
[color=#FF0000] 请搞过复合设备的高手指点迷津!!!小弟不胜感激!!!![/color]
5 个解决方案
#1
哎,没人回帖,友情帮顶一下吧。。。
#2
怎么搞的,没人教我一下啊!!!郁闷了!
#3
复合驱动,没搞过啊,比较复杂
#4
我最近也在看这个,很多不明白的,一起学习一下。
问一下,你SMDK6410.bat文件怎么修改的,貌似修改SMDK6410.bat的UFNCLASS就直接可以加载你的驱动了。还有set SYSGEN_USBFN_COMPOSITE=1你是怎么样处理的?是sysgen还是就make一下就可以了。
我像你之前那么做的,能加载上compositefn驱动,但是想要复合的驱动加不上,在准备搞一搞
问一下,你SMDK6410.bat文件怎么修改的,貌似修改SMDK6410.bat的UFNCLASS就直接可以加载你的驱动了。还有set SYSGEN_USBFN_COMPOSITE=1你是怎么样处理的?是sysgen还是就make一下就可以了。
我像你之前那么做的,能加载上compositefn驱动,但是想要复合的驱动加不上,在准备搞一搞
#5
注册表配置增加一项:
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"DefaultPrefix"="UFC"
并删除类似"UFC_FunctionClass"的值
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"DefaultPrefix"="UFC"
并删除类似"UFC_FunctionClass"的值
#1
哎,没人回帖,友情帮顶一下吧。。。
#2
怎么搞的,没人教我一下啊!!!郁闷了!
#3
复合驱动,没搞过啊,比较复杂
#4
我最近也在看这个,很多不明白的,一起学习一下。
问一下,你SMDK6410.bat文件怎么修改的,貌似修改SMDK6410.bat的UFNCLASS就直接可以加载你的驱动了。还有set SYSGEN_USBFN_COMPOSITE=1你是怎么样处理的?是sysgen还是就make一下就可以了。
我像你之前那么做的,能加载上compositefn驱动,但是想要复合的驱动加不上,在准备搞一搞
问一下,你SMDK6410.bat文件怎么修改的,貌似修改SMDK6410.bat的UFNCLASS就直接可以加载你的驱动了。还有set SYSGEN_USBFN_COMPOSITE=1你是怎么样处理的?是sysgen还是就make一下就可以了。
我像你之前那么做的,能加载上compositefn驱动,但是想要复合的驱动加不上,在准备搞一搞
#5
注册表配置增加一项:
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"DefaultPrefix"="UFC"
并删除类似"UFC_FunctionClass"的值
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"DefaultPrefix"="UFC"
并删除类似"UFC_FunctionClass"的值