This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM365: Userspace EDMA Stall

I've gotten a successful application working on the DM365, utilizing the H.264/MPEG4/MJPEG codecs for video streaming purposes. However, recently I've had to do some DMA work from user-space to shuttle some data between buffers. Using the dm365mmap kernel driver as my base, I've been able to do DMA with limited success.

Scenario A:
Using the scenario where I request a dma channel once during application startup (davinci_request_dma), I'm able to do fault-free DMA while the H.264 codec is running. I've verified the DMA actually runs by inspecting the output of the transfer. When I run the MPEG4 encoder, the DMA stalls after the first successful run (the registered callback for the DMA completion doesn't trigger). The same happens for MJPEG.

Scenario B:
In this case, I request a DMA channel and free it after each and every memory transfer operation  - the cycle of request, transfer, free happens over and over again. In this scenario, the DMA continues without stalling for MPEG4 as well as MJPEG, but occasionally, once in a blue moon, it would stall on startup.

I've debugged the edmak.ko (which is the interface to the MJCP when it requests DMA channels for codecs), and verified that there is no collision in terms of DMA channel allocations. Does anyone have a clue why I'm getting these stalls?

Here's my code for the core of the DMA driver (taken from dm365mmap)

init_completion (&edmacompletion);
davinci_set_dma_src_params(master_ch, (unsigned long) edmaparams.src, edmaparams.srcmode, edmaparams.srcfifowidth);
davinci_set_dma_dest_params(master_ch, (unsigned long) edmaparams.dst, edmaparams.dstmode, edmaparams.dstfifowidth);
davinci_set_dma_src_index (master_ch, edmaparams.srcbidx, edmaparams.srccidx);
davinci_set_dma_dest_index (master_ch, edmaparams.dstbidx, edmaparams.dstcidx);
davinci_set_dma_transfer_params (master_ch, edmaparams.acnt, edmaparams.bcnt, edmaparams.ccnt, edmaparams.bcntrld, edmaparams.syncmode);
davinci_get_dma_params (master_ch, &paramentry);

/* Enable final transfer compleition interrupt */
paramentry.opt |= TCINTEN;
paramentry.opt |= ITCINTEN;   
paramentry.opt |= SYNCDIM;
paramentry.opt |= STATIC;   

davinci_set_dma_params (master_ch, &paramentry);

err = davinci_start_dma (master_ch);
if (err != 0) {
    printk("Problem starting DMA, ret:%d\n", err);
    return -EINVAL;
}

wait_for_completion (&edmacompletion);
davinci_stop_dma (master_ch); 

 

Thank you,

Jerry