【平台:】 2440+wince5.0
【目的】:实现CE 设备在USB与PC连线的情况下显示为 移动设备(U盘)的功能! 因为我的BSP中的usb function的driver只有serial的功能 无法通过简单的注册表更改实现切换!所以不得不自己移植sb function driver!(我是从samsug 官方bsp下的usbfn 移植到当前BSP下,)因为他的release note 有说明:
The USB Mass Storage Function driver was implemented.
The USB driver was updated to support the USB Mass Storage Function. And, the usbmsfn.dll was added in the files folder. So, it can support both the Serial and the Mass Storage Function Class.
【现象:】
用 usb view 软件查看CE DEVICE 得到如下信息:
- C/C++ code
/*Device Descriptor:bcdUSB: 0x0000bDeviceClass: 0x00bDeviceSubClass: 0x00bDeviceProtocol: 0x00bMaxPacketSize0: 0x00 (0)idVendor: 0x0000idProduct: 0x0000bcdDevice: 0x0000iManufacturer: 0x00iProduct: 0x00iSerialNumber: 0x00bNumConfigurations: 0x00ConnectionStatus: [color=#FF0000]DeviceFailedEnumeration[/color]Current Config Value: 0x00Device Bus Speed: LowDevice Address: 0x00Open Pipes: 0*/
DeviceFailedEnumeration 说明是枚举失败了!
-------------------------------------
下面是在function 的功能为mass storage的时候的打印信息:
UsbFnMdd!DllEntry: Attach
-->UfnPdd_DllEntry()
->UfnPdd_Init()
SC2440UsbFn!UfnPdd_Init: ++
pdd->unVersion=0x50000
RegOpenKeyEx success 0, 1, Mass_Storage_Class, 38
RegQueryValueEx success
USB MSF Function Class Enabled : Mass_Storage_Class
no sysintr index specified
SC2440UsbFn!UfnPdd_Init: Using irq 0x19
SC2440UsbFn!UfnPdd_Init: Using IO Base 0xb1200000
SC2440UsbFn!UfnPdd_Init: Using SysIntr 0x28
SC2440UsbFn!UfnPdd_Init: Using IST priority 0d100
MapRegisterSett
SC2440UsbFn!MapRegisterSet: ++
SC2440UsbFn!MapRegisterSet: VirtualCopy Succeeded, pVMem:400000
SC2440UsbFn!MapRegisterSet: --
SC2440UsbFn!ResetDevice: ++
SC2440UsbFn!ResetEndpoint: ++
SC2440UsbFn!ResetEndpoint: --
SC2440UsbFn!ResetEndpoint: ++
SC2440UsbFn!DisableEndpointInterrupt: ++
SC2440UsbFn!DisableEndpointInterrupt: --
SC2440UsbFn!ResetEndpoint: --
SC2440UsbFn!ResetEndpoint: ++
SC2440UsbFn!DisableEndpointInterrupt: ++
SC2440UsbFn!DisableEndpointInterrupt: --
SC2440UsbFn!ResetEndpoint: --
SC2440UsbFn!ResetEndpoint: ++
SC2440UsbFn!DisableEndpointInterrupt: ++
SC2440UsbFn!DisableEndpointInterrupt: --
SC2440UsbFn!ResetEndpoint: --
SC2440UsbFn!ResetEndpoint: ++
SC2440UsbFn!DisableEndpointInterrupt: ++
SC2440UsbFn!DisableEndpointInterrupt: --
SC2440UsbFn!ResetEndpoint: --
SC2440UsbFn!ResetDevice: --
SC2440UsbFn!UfnPdd_Init: --
judge->UFN_PDD_INTERFACE_VERSION=0x50000
UsbFnMdd!UFN_Init: PDD has 5 endpoints
UsbFnMdd!UFN_Init: PDD supports speeds 0x1
SC2440UsbFn!UfnPdd_IOControl: ++
SC2440UsbFn!UfnPdd_IOControl: --
UsbFnMdd!CUfnBus::GetDefaultClientName: Using default client key named "DefaultClientDriver"
UsbFnMdd!CUfnBus::CreateChild: Using client driver key "\Drivers\USB\FunctionDrivers\Mass_Storage_Class"
UsbMsFn!DllEntry: Attached
bot.cpp-->Init()
-->BOT_InternalInit
UsbMsFn!BOT_InternalInit: ++
UsbMsFn!BOT_Configure: ++
UsbMsFn!BOT_ReadConfigurationValue: ++
UsbMsFn!BOT_ReadConfigurationValue: --
UsbMsFn!BOT_Configure: --
SC2440UsbFn!UfnPdd_IsConfigurationSupportable: ++
SC2440UsbFn!UfnPdd_IsConfigurationSupportable: --
SC2440UsbFn!UfnPdd_IsEndpointSupportable: ++
SC2440UsbFn!UfnPdd_IsEndpointSupportable: --
SC2440UsbFn!UfnPdd_IsEndpointSupportable: ++
SC2440UsbFn!UfnPdd_IsEndpointSupportable: --
UsbFnMdd!IsInterfaceSupportable: Endpoint index 0 can be supported by physical endpoint 1
SC2440UsbFn!UfnPdd_IsEndpointSupportable: ++