Common buffer direct memory access (DMA) occurs when the device does not write directly to the capture buffers; instead it copies data to and from a common buffer.
To use common buffer DMA in your AVStream minidriver:
Acquire a DMA adapter by calling IoGetDmaAdapter, as in packet-based DMA. Do not specify KSPIN_FLAG_GENERATE_MAPPINGS in the Flags member of the KSPIN_DESCRIPTOR_EX structure, and do not register your DMA adapter with AVStream. You might need to implement your own private buffer/copy scheme.
Register an interrupt service routine (ISR) as described in Writing AVStream Minidrivers for Hardware
If the Flags member of KSPIN_DESCRIPTOR_EX sets KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, the following steps take place before AVStream calls AVStrMiniPinProcess:
The minidriver sets up its common buffer transfers.
The kernel calls the ISR that the vendor has previously registered. In the ISR, the minidriver queues a deferred procedure call (DPC).
When the common buffer is full, the minidriver calls KsPinAttemptProcessing from the DPC.
AVStream calls the process dispatch if conditions specified by the Flags member of KSPIN_DESCRIPTOR_EX are met.
Within the vendor-supplied AVStrMiniPinProcess callback routine, one possible course of action is as follows:
KSSTREAM_POINTER *Leading = KsPinGetLeadingEdgeStreamPointer ( Pin, State );
Copy frame data to Leading->StreamHeader->Data and set the necessary flags and time stamp information in the appropriate KSSTREAM_HEADER.
Call KsStreamPointerUnlock with Eject set to TRUE. (This value of Eject causes the stream pointer to advance.)
AVStream then manages the queue based on the flags set by the minidriver in the KSPIN_DESCRIPTOR_EX structure.