No, you do not need a common buffer. The DMA transaction object will take care of the mapping through its EvtProgramDma callback and staging the transaction in cooperation with your calls to WdfDmaTRansactionDmaCompletedxxx calls- this is true for both scatter / gather and for packet (single mapping at a time) devices.
As for “any buffer will do”, the answer is “usually”.
I think the exceptions depend upon your device. For instance, if your device must transfer a set amount of data and has limited scatter / gather capability [say it must transfer 64K, only allows 4 SG elements, and only interrupts when all 64K is transferred], it is possible pool allocations will be too fragmented for you to use them. My experience tells me that this is an unusual restriction [but experience varies, after all].
Most of my DMA work has been audio and parallel port (ECP or FIFO), neither of which has such restrictions.
Common buffer makes the programming easy, however- there’s only a single entry to program. So it reduces complexity at the cost of having the buffer harder to get [contiguous memory, particularly when they physical address range is constrained, being an additional allocation burden].
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@ddc-web.com
Sent: Monday, July 30, 2007 9:06 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] DMA implementation using KMDF
Igor,
I did not see your post… I apologize. Our implementations are very similiar. My initial code looks almost exactly to your call sequence. I am starting feel a lot better since you have this working. Right now I encountering an error on IoAllocateMdl for the WdfCommonBuffers I created. I am sure it is something very silly.
Bob ,
Based on Igor’s call sequence(and mine) there is no need for the buffer source to be a WDFCommonBuffer? Any buffer will do as long as I feed it to IoAllocateMdl andMmBuildMdlForNonPagedPool ?