AnsweredAssumed Answered

system services dma callback

Question asked by molm on Sep 23, 2009
Latest reply on Nov 23, 2009 by CraigG

hello,

 

I am using the system services and driver model to write a driver for the AD5663 DAC. I am building it upon the ADI sport driver with DMA using a two dimensional "ping pong" buffer. The idea is to fill one subbuffer, while the DMA transfere the other. This works fine, but I see a potensial problem in the way I get DMA events in my interrupt callback. The only event i get is the ADI_DEV_EVENT_SUB_BUFFER_PROCESSED. I never see the ADI_DEV_EVENT_BUFFER_PROCESSED. I had hoped to be able to determine which subbuffer the DMA had completed this way. My next approch was to use the pointer to the buffer received in the callback, but this pointer allways points to the start of the whole buffer, so there is no indication of what buffer that is actually processed. By examining system services source (adi_dma.c) I see the the following statements which I belive confirms my observation:

 

        // CASE (circular)
        case ADI_DMA_MODE_CIRCULAR:

 

            // determine if it's an inner loop interrupt or an outer loop interrupt
            if (pChannel->Config->b_DI_SEL == ADI_DMA_DI_SEL_OUTER_LOOP) {
                Event = ADI_DMA_EVENT_OUTER_LOOP_PROCESSED;
            } else {
                Event = ADI_DMA_EVENT_INNER_LOOP_PROCESSED;
            }

 

            // override the pArg callback parameter to be the buffer start address
            pArg = pChannel->StartAddr;
            break;

 

Should i use another DMA model in my case? Is there a way to be absolutely sure that my program is syncronized to the DMA buffer handling? When I stop the transfere, will the DMA be re-initialised to start with a clean buffer structure or may it start in the subbuffer?

 

mads-l

Outcomes