阅读:1049回复:1
一个DMA的奇怪现象,请大侠出手。
我的开发环境是win2000,2000DDK.
我用的是DIRECT_IO方式,并且使用common buffer来进行DMA传输。在start_device 分配1M的common buffer。(在128M的win2000上可以成功),保存返回的物理地址和虚拟地址。然后,我对大块的read和write请求进行分块DMA传输,以便达到较快的传输速度。 但是,我看一些文章上说一次DMA传输的请求不能超过map register的数量。一般来说不可能超过32K.但是,ddk的文档中说: AllocateCommonBuffer does the following: 1.Allocates memory that can be reached from both the processor and the device This memory appears contiguous to the device. 2.Allocates map registers to map the buffer, if required by the system. 3.Sets up a translation for the device, including loading map registers if necessary. 这是不是意味着,我分配common buffer的时候,它会自动分配一些map register? 如果这样的话,我的推论:DMA传输不一定非要物理连续的内存。只要逻辑连续,并且有足够的map register来完成logic address到物理地址的转化便可以了。 这样好像有点不太对劲,不知道大侠怎么理解!多谢 |
|
沙发#
发布于:2002-02-05 17:16
大虾,把你分配common buffer的代码给我看看吧,我的代码总是造成死机!!
PULONG AmccBaseRegisterAddress1; // Adapter\'s memory phisycal address for dma PPHYSICAL_ADDRESS AmccDmaPhAddress1; DevExt->AmccBaseRegisterAddress1 = (unsigned long *) DevExt->ReadAdapter->DmaOperations->AllocateCommonBuffer( DevExt->ReadAdapter, //IN PDMA_ADAPTER DmaAdapter, OSR_PCI_MAX_TXFER, //IN ULONG Length, DevExt->AmccDmaPhAddress1, //OUT PPHYSICAL_ADDRESS LogicalAddress, FALSE//IN BOOLEAN CacheEnabled ); if (DevExt->AmccDmaPhAddress1 == NULL) { return(STATUS_UNSUCCESSFUL); } [编辑 - 2/5/02 作者: Over] |
|
|