阅读:1345回复:2
请教各位大侠USB驱动,在写数据时重起的问题!!!
直接用DS生成的USB驱动,在往批量管道写一个数据时就死机了,具体跟踪了一下,是在
status = m_Endpoint2OUT.SubmitUrb(I, pUrb, LinkTo(WriteComplete), pCompInfo, 0);重起的 可能的原因会是什么呢,拜托各位朋友帮忙看看!!!!!! 而且这个驱动在偶然的一次写数据时没重起,可接着又恢复重起的状态了????? 具体的写进程如下: NTSTATUS Test1Device::Write(KIrp I) { t << "Entering Test1Device::Write, " << I << EOL; // Always ok to write 0 elements. if (I.WriteSize() == 0) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } ULONG dwTotalSize = I.WriteSize(CURRENT); ULONG dwMaxSize = m_Endpoint2OUT.MaximumTransferSize(); // If the total requested read size is greater than the Maximum Transfer // Size for the Pipe, request to read only the Maximum Transfer Size since // the bus driver will fail an URB with a TransferBufferLength of greater // than the Maximum Transfer Size. if (dwTotalSize > dwMaxSize) { ASSERT(dwMaxSize); dwTotalSize = dwMaxSize; } // Declare a memory object KMemory Mem(I.Mdl()); // Allocate a new context structure for Irp completion USB_COMPLETION_INFO* pCompInfo = new (NonPagedPool) USB_COMPLETION_INFO; if (pCompInfo == NULL) { I.Information() = 0; return I.PnpComplete(this, STATUS_INSUFFICIENT_RESOURCES); } // TODO: Select the correct pipe to write to // Create an URB to do actual Bulk write to the pipe PURB pUrb = m_Endpoint2OUT.BuildBulkTransfer( Mem, // Where is data coming from? dwTotalSize, // How much data to read? FALSE, // direction (FALSE = OUT) NULL // Link to next URB ); if (pUrb == NULL) { delete pCompInfo; I.Information() = 0; return I.PnpComplete(this, STATUS_INSUFFICIENT_RESOURCES); } // Initialize context structure pCompInfo->m_pClass = this; pCompInfo->m_pUrb = pUrb; // Submit the URB to our USB device NTSTATUS status; status = m_Endpoint2OUT.SubmitUrb(I, pUrb, LinkTo(WriteComplete), pCompInfo, 0); return status; } |
|
沙发#
发布于:2004-10-29 09:38
可能会有两个原因:
1。ds2.5和ds2.6在usb 批量传输时有bug,请参阅 解 |
|
板凳#
发布于:2004-10-29 10:37
非常感谢楼上朋友的指点。
你说的两个原因中,第二个也有可能吧,因为我的硬件是支持批量传输的,但是由于固件程序我直接用的开发板,只是在进行驱动的编写,也许驱动和固件某些地方冲突吧!!!但我确实想不明白会是什么冲突,如果管道初始化时定义的最大传输量不一样,会引起这样的问题吗?? 第一个原因,我用的就是DS2.6,但该怎么改呢?我再搜搜吧, 多谢指点了,继续帮忙哦!! |
|