阅读:698回复:0
同志们,帮我看看用ds 编的9054的部分分散集中dma例!!程
同志们,帮我看一看下面的程序:
这是= m_DmaTrans.Initiate(I.Mdl(),FromDeviceToMemory,LinkTo(OnDmaReady),NULL,FALSE); 的回调例程。我得整个思想是首先申请一块公共缓冲区,用来存放 9054的分散集中列表,分散集中列表是由四个单元(PCI物理地址,局部地址,尺寸,next descripter pointer)构成的链表。然后在回调例程中通过pXfer->GetTransferDescriptors来建立分散集中列表。各位帮我看看,具体实现有没有问题。m_DmaTrans.Terminate(),和m_DmaTrans.Continue()的使用方法及位置,我也不太清楚,请各位指点。我现在驱动安装以后,应用程序一运行就死机。 VOID Pci9080Device::OnDmaReady(KDmaTransfer* pXfer, KIrp I) { if(j==0) { m_PAddr=m_DmaBuffer.LogicalAddress().LowPart; m_LAddr=m_DmaBuffer.VirtualAddress(); alignshift=0x10-(ULONG)m_LAddr&0xf; plist=(ScatterGatterList *)((ULONG) m_LAddr+alignshift); m_numofdescriper=pXfer->GetTransferDescriptors(&ppTD); plist[0].physicaladdress=ppTD[0].td_PhysAddr.LowPart;// addr=m_MemoryRange0.ind(0xf4); plist[0].localaddress=addr-1; plist[0].bytelong=ppTD[0].td_Length; plist[0].descripterpointer=m_PAddr+alignshift+sizeof(ScatterGatterList); plist[0].descripterpointer|=0x0d; for( i=1;i<m_numofdescriper-1;i++) { plist.physicaladdress=ppTD.td_PhysAddr.LowPart; plist.bytelong=ppTD.td_Length; plist.localaddress=plist[i-1].localaddress+plist[i-1].bytelong; plist.descripterpointer=m_PAddr+alignshift+sizeof(ScatterGatterList)*(i+1); plist.descripterpointer|=0x0d; } plist[m_numofdescriper-1].physicaladdress=ppTD[m_numofdescriper-1].td_PhysAddr.LowPart; plist[m_numofdescriper-1].bytelong=ppTD[m_numofdescriper-1].td_Length; plist[m_numofdescriper-1].localaddress=plist[m_numofdescriper-2].localaddress+plist[m_numofdescriper-2].bytelong; plist[m_numofdescriper-1].descripterpointer|=0x0f; addr1=m_PAddr+alignshift; addr1|=0x1; m_MemoryRange0.outd(0x94,0x243); m_MemoryRange0.outd(0xa4,addr1); m_MemoryRange0.outd(0xa9,0x03); j++; } else m_DmaTrans.Terminate(); } |
|
最新喜欢:ewater...
|