|
UFN_Init
pContext->pUfnBus = new CUfnBus(pszContext, pContext);
pContext->pUfnBus->Init
//这里不知道总线驱动如何调用的BusIoControl
"BusIoctl"=dword:2a0048
CUfnBus::PostInit
dwRet = GetDefaultClientName(szClientName, dim(szClientName));
dwRet = CreateChild(szClientName, &pDevice);
CUfnBusDevice *pDevice = new CUfnBusDevice
pDevice->Init
DeviceFolder::Init()
//编译SerialUSBFn的时候使用了-DUSE_NEW_SERIAL_MODEL定义
//SerialUSBFn导出了一堆COM_XXX函数
源码Cserpdd.cpp (e:\ce60\public\common\oak\drivers\serial\serpddcm)
COM_INIT
SerInit
CSerialPDD * CreateSerialObject
pSerialPDD = new USBSerialFn(lpActivePath,pMdd, pHwObj);
pSerialPDD->Init()
CUsbFn::Init()
UfnInitializeInterface
fSuccess = BusChildIoControl(hBusAccess, IOCTL_UFN_GET_CLIENT_DATA_EX, &ucd, sizeof(ucd));
GetClientFunctions
UfnMdd_RegisterDevice
pdescClient = new CDescriptors;
CDescriptors::RegisterDevice
dwRet = pContext->PddInfo.pfnRegisterDevice(
UfnPdd_RegisterDevice
fErr = ActivateChild(m_szClientBusName);
UFN_MDD_INTERFACE_INFO MddInterfaceInfo = {
UFN_PDD_INTERFACE_VERSION, &UfnMdd_Notify
};
dwErr = UfnPdd_Init(pszContext, pContext, &MddInterfaceInfo, &pContext->PddInfo);
在CUsbFn::Init()已经调用
StartUSBFunction
******dwRet = m_pUfnFuncs->lpStart(m_hDevice, DeviceNotifyStub, this, &m_hDefaultPipe);
UfnMdd_Start
dwRet = pContext->PddInfo.pfnStart(pContext->PddInfo.pvPddContext);
UfnPdd_Start
启动IST_MAIN
初始化之后插入USB线之前,只有IST_MAIN中使能了SusPend Mode 和 EP0的中断
系统启动,插不插USB线USB_SUSPEND_INTR都会触发两次
插入USB线,中断就是没反应,ep0中断不触发
HandleUSBEvent
UfnMdd_Notify
UFN_MSG_SETUP_PACKET:
UFN_MSG_PREPROCESSED_SETUP_PACKET:
ProcessRequest
//整个USBFN代码里只有ProcessSetConfiguration函数发出了UFN_MSG_CONFIGURED的通知
//而pdd的driver里没有发现设置udr为USB_REQUEST_SET_CONFIGURATION的位置
//不清楚如何才能触发CableAttached
//如果有通知了,应该走下面
USB_REQUEST_SET_CONFIGURATION
ProcessSetConfiguration
SendDeviceNotification(pContext->lpDeviceNotify, pContext->pvDeviceNotifyParameter, dwMsg, dwParam);
DeviceNotifyStub
CUsbFn::DeviceNotify
UFN_MSG_CONFIGURED
CableAttached
OpenBulkIn
OpenBulkOut
OpenInterruptIn
CUsbFuncPipe::OpenPipe
m_pUfnFuncs->lpOpenPipe
UfnMdd_OpenPipe pPipe = FindPipe(pContext, dwEndpointAddress);
dwRet = pPipe->Open(pContext->Speed, NULL);
CPipeBase::Open
UfnPdd_InitEndpoint |
|