Hardware Dev Center

Common Buffer DMA in AVStream

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:

  1. 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.

  2. 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:

  1. The minidriver sets up its common buffer transfers.

  2. The kernel calls the ISR that the vendor has previously registered. In the ISR, the minidriver queues a deferred procedure call (DPC).

  3. When the common buffer is full, the minidriver calls KsPinAttemptProcessing from the DPC.

  4. 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:

  1. Call KsPinGetLeadingEdgeStreamPointer:

    KSSTREAM_POINTER *Leading = KsPinGetLeadingEdgeStreamPointer (
  2. Copy frame data to Leading->StreamHeader->Data and set the necessary flags and time stamp information in the appropriate KSSTREAM_HEADER.

  3. 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.



Send comments about this topic to Microsoft

© 2015 Microsoft