How to find the address of the buffer that the request object describes by using WdfDmaTransactionInitializeUsingRequest? RRS feed

  • Question

  • I used WdfDmaTransactionInitializeUsingRequest to initialize my DMA transaction.

    status = WdfDmaTransactionInitializeUsingRequest(

    As you know, in qd41EvtProgramDma I should set a destination address register of DMA controller.

    I try to use sglist to get the address of the buffer that the request object describes,as following:

    deviceContext->Dma_address = SgList->Elements[0].Address.LowPart;
    deviceContext->Dma_length = SgList->Elements[0].Length;

    Is this a correct idea? Thanks for your help!

    NOTICE:my dma hardware does not support Scatter/Gather.

    Monday, November 2, 2015 4:39 AM

All replies

  • That is the general idea.  If you want your code to work on a 64 bit system and your device supports 64 bit dma you will want to include SgList->Elements[0].Address.HighPart as well.  As a sanity check you might want to check that SgList->NumberOfElements == 1. I guess if you set the WDF_DMA_PROFILE correctly you should only get 1 element.
    Wednesday, November 4, 2015 6:37 PM