WdfDmaTransactionDmaCompletedFinal does not set the correct transfer length

Hi,

I have a problem with the WdfDmaTransactionDmaCompletedFinal function. I’m using it to report an underrun / timeout situation for a particular DMA engine. On a timeout i’m calling the WdfDmaTransactionDmaCompletedFinal function with finalTransferredLength set to 0. The problem is that any subsequent calls to WdfDmaTransactionGetBytesTransferred returns the original requested number of bytes.
For example if I requested 1024 bytes but the transfer timed out and WdfDmaTransactionDmaCompletedFinal was used to report 0 bytes, a call to WdfDmaTransactionGetBytesTransferred will return 1024 bytes.
I have checked that WdfDmaTransactionDmaCompletedFinal returns TRUE.

Any ideas?

I’m using KMDF version 1.1.

Thanks,
Thomas

WdfDmaTransactionDmaCompletedFinal doesn’t work this way. FinalTransferredLength appears to be ignored and the total transfer count is updated by adding the current transfer amount to it. I don’ know enough of the dma transaction object to know if what you want to do is possible or not, i have to read more of the code…

d

Hi Doron,

Thanks for the answer.
I’m not sure why FinalTransferredLength should be ignored. I thought WdfDmaTransactionDmaCompletedFinal function was to flag underrun and stop any further program DMA events, and ignoring the actual amount of data would leave the DMA transaction total count wrong?
My transactions can get pretty big so it may span several transfers. I’m leaving it up to the transaction object to keep track of the total count. However it’s only on the last DMA transfer (the last chain) that i may get an underrun so maybe i can solve this easy by first doing WdfDmaTransactionGetBytesTransferred and add that to the aggregated byte count in the last chain before i do the WdfDmaTransactionDmaCompletedFinal? I’m using the DmaCompletedWithLength in any previous iterations.
Do i always need to complete a transaction before i delete the object?

Thanks
Thomas