2011-06-08 09:41:06     issues with 2D DMA and Interrupts

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-08 09:41:06     issues with 2D DMA and Interrupts

Peter Lindner (AUSTRIA)

Message: 101080   


hi there...


currently i'm using a custom board with a cm-bf527 coremodule from bluetechnix.


at the moment i'm writing a module for sending data via DMA over the SPORT. things are working as expected at the moment.


but i want to implement interrupt handling, so that after every "row" of the 2D DMA an interrupt is thrown. and here is the big problem.


it turns out, that if i call set_dma_callback function interrupts are thrown constantly. also if i haven't activated DI_EN and DI_SEL in DMA config.


can anybody tell me, where is my failure?




thank you for your help


greets peter




here is the configuration section for dma  and the interrupt handler...




        // Request tx dma and set irq handler

        ret = request_dma(dev->dma_tx_chan, "sport_tx_dma_chan");

        if (ret) {

            pr_err("unable to request sport tx dma channel\n");

            return ret;


        set_dma_callback(dev->dma_tx_chan, dma_tx_irq_handler, dev);


        // calculate how many bytes are the given number of bits (sport word_len)

        word_bytes = (config->word_len + 7) / 8;

        if (word_bytes == 3)

            word_bytes = 4;


        num_of_dataelements = config->data_len/word_bytes;


        flush_dcache_range((unsigned long)config->sine_data,

                   (unsigned long)(config->sine_data + num_of_dataelements));


        xcount = 4;

        xmodify = num_of_dataelements / xcount;


        ycount = num_of_dataelements / xcount;

        ymodify = ((1-xcount)*num_of_dataelements/xcount + 1);


        dmaconfig = (DMAFLOW_AUTO | DMA2D | RESTART | sport_wordsize(config->word_len));


        set_dma_start_addr(dev->dma_tx_chan, (unsigned long)config->sine_data);

        set_dma_x_count(dev->dma_tx_chan, xcount);

        set_dma_x_modify(dev->dma_tx_chan, xmodify*word_bytes);

        set_dma_y_count(dev->dma_tx_chan, ycount);

        set_dma_y_modify(dev->dma_tx_chan, ymodify*word_bytes);


        set_dma_config(dev->dma_tx_chan, dmaconfig);






static irqreturn_t dma_tx_irq_handler(int irq, void *dev_id)


   unsigned short mystat;

   struct sport_dev *dev = dev_id;

   mystat = get_dma_curr_irqstat(dev->dma_tx_chan);


   printk("mystat: %u\n",mystat);


   while (mystat & DMA_RUN){

       mystat = get_dma_curr_irqstat(dev->dma_tx_chan);



  return IRQ_HANDLED;





2011-06-08 09:48:22     Re: issues with 2D DMA and Interrupts

Mike Frysinger (UNITED STATES)

Message: 101081   


sport interrupts route through the dma channel.  you sure you're not seeing those ?




2011-06-08 09:56:16     Re: issues with 2D DMA and Interrupts

Peter Lindner (AUSTRIA)

Message: 101082   


nope... not sure... don't know if i see those


how can i chek this?


thank you for your help




2011-06-16 09:37:08     Re: issues with 2D DMA and Interrupts

Peter Lindner (AUSTRIA)

Message: 101324   


nobody any idea...?


i really stuck within this problem and i'm extremely helpless...


greets peter