Subject: [question] some question about the residue

From: [email-masked] (Elen Song)
Date: Tue, 27 Nov 2012 10:39:46 +0800

On 2012-11-26 18:40, Russell King - ARM Linux wrote:
> On Mon, Nov 26, 2012 at 06:37:28PM +0800, Elen Song wrote:
>> So residue actually means current active descriptor remain, it should
> No, not the current active descriptor - the transfer identified by the
> cookie, and only that transfer.
Hi Russell King:

     Thank you for your explanations.
     Here I got an example, perhaps you can help me figure out if it is 
correct.

//allocate a cyclic transfer with 2 descriptors, a cookie identify 
current transfer.
desc = dmaengine_prep_dma_cyclic(chan,
                                 sg_dma_address,
                                 sg_dma_len,
                                 sg_dma_len/2,
                                 DMA_DEV_TO_MEM);
cookie= dmaengine_submit(desc);

//if transfer in progress, state.residue is current transfer 
remain(sg_dma_len remain), not current descriptor remain(sg_dma_len/2 
remain).
device_tx_status(chan,cookie, &state);

     Is it right?

Best Regards