guigen80
驱动牛犊
驱动牛犊
  • 注册日期2004-09-01
  • 最后登录2014-12-03
  • 粉丝0
  • 关注0
  • 积分104分
  • 威望11点
  • 贡献值0点
  • 好评度9点
  • 原创分0分
  • 专家分0分
阅读:1139回复:0

关于Ds的Scatter/gatter Dma

楼主#
更多 发布于:2005-03-17 10:20
本人在做5064的驱动,要求一次性要读取128M的数据,所以选则了Scatter gatter 模式.
以下为一些相关代码
VOID Ad65MDevice::OnDmaReady(KDmaTransfer* pXfer, KIrp I)
{

if(pXfer->BytesRemaining()==0)
{
// If there are no bytes left to transfer, the callback must call
// Terminate(). Then it completes the IRP with STATUS_SUCCESS.
t << \"Dma Terminate\" <<EOL;

pXfer->Terminate();
// t << \" Dma Remaining \" << m_MemoryRange0.ind(0x0c)<<EOL;
I.Information() = I.ReadSize(CURRENT);

I.Status() = STATUS_SUCCESS;

// m_MemoryRange0.outd(0x1800,0);

PnpNextIrp(I);


m_CurrentTransfer = NULL;
delete pXfer;
return;
}

// We must get the descriptor for the physical memory location for
// the DMA transfer.

PTRANSFER_DESCRIPTOR ptd;

/*while (pXfer->SequenceTransferDescriptors(&ptd))
{
// program the h/w using  ppTD
t << \" Physical address 0x\" << ptd->td_PhysAddr.LowPart << \". Length is 0x\"
 << ptd->td_Length << \".\"  << EOL;
}
*/
ULONG nTds = pXfer->GetTransferDescriptors(&ptd);

t << \"nTds = \" << nTds  << EOL;
for (ULONG ii=0; ii < nTds; ii++)
{
t << \" Physical address 0x\" << ptd[ii].td_PhysAddr.LowPart << \". Length is 0x\"
<< ptd[ii].td_Length << \".\" << EOL;
}
// If this is the first time through, then start the DMA going.
// We only want to do this ONCE for a given Read transfer.  That
// way, our data will be collected smoothly, without interruptions
// or dropouts.

t << \" Read Size \" << I.ReadSize(CURRENT) <<EOL;
t << \" remain size\" << (ULONG) pXfer->BytesRemaining() <<EOL;

if ((ULONG) pXfer->BytesRemaining() == I.ReadSize(CURRENT))
{
StartDMA(ptd->td_PhysAddr.LowPart,I.ReadSize(CURRENT));

}
}
问题是一读取DMA就死机,请各位高手赐教
游客

返回顶部