2008-07-11 09:55:59     interrupt

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

2008-07-11 09:55:59     interrupt

vijai ragavan (INDIA)

Message: 58682   

 

How to configure the interrupt for DMA.

QuoteReplyEditDelete

 

 

2008-07-13 22:46:10     Re: interrupt

Yi Li (CHINA)

Message: 58734   

 

There are kernel function:  set_dma_callback(). And you can refer to blackfin linux drivers, e.g: http://docs.blackfin.uclinux.org/doku.php?id=sample_ppi_driver

QuoteReplyEditDelete

 

 

2008-07-14 09:19:48     Re: interrupt

vijai ragavan (INDIA)

Message: 58759   

 

Yi Li,

 

      my driver side functions are pasted below.here i configured the interrupt for Sport Tx .

 

#include<asm/irq.h>

 

#define Audio_Tx_Isr IRQ_DMA2_1

 

module_init(JAS_CALoader_init);

module_exit(JAS_CALoader_exit);

 

JAS_CALoader_init(void)

{

        misc_register(&CoreADev);

        if(request_irq(Audio_Tx_Isr, AudioTx_ISR, 0, "JAS_CoreA", NULL))

        {

 

        printk(KERN_ERR "Audio: IRQ %d is not free.\n", Audio_Tx_Isr);

        return(-EIO);

        }

        else

        {

        printk(KERN_ERR "Audio: IRQ %d is installed successfully.\n", Audio_Tx_Isr);

        }

        printk(KERN_INFO "*****************Core A AUDIO Module enabled**********************\n");

        enable_irq(Audio_Tx_Isr);

        return(0);

}

 

JAS_CALoader_exit(void)

{

        misc_deregister(&CoreADev);

        disable_irq(Audio_Tx_Isr);

        free_irq(Audio_Tx_Isr, NULL);

        printk(KERN_INFO "Core A AUDIO Module exited\n");

        return(0);

}

 

 

 

 

 

 

my teraterm output is,

 

 

 

 

 

Audio: IRQ 31 is installed successfully.

*****************Core A AUDIO Module enabled**********************

Unbalanced enable for IRQ 31

BUG: warning at kernel/irq/manage.c:118/enable_irq()

Hardware Trace:

0 Target : <0x0000460c> { _dump_stack + 0x0 }

   Source : <0x00025e34> { _enable_irq + 0x7c }

1 Target : <0x00025e34> { _enable_irq + 0x7c }

   Source : <0x0000cd82> { _printk + 0x16 }

2 Target : <0x0000cd7e> { _printk + 0x12 }

   Source : <0x0000cc0c> { _vprintk + 0x1b0 }

3 Target : <0x0000cc00> { _vprintk + 0x1a4 }

   Source : <0x0000cbf2> { _vprintk + 0x196 }

4 Target : <0x0000cbec> { _vprintk + 0x190 }

   Source : <0x0000cfaa> { _release_console_sem + 0x42 }

5 Target : <0x0000cfa2> { _release_console_sem + 0x3a }

   Source : <0x0000d16a> { _release_console_sem + 0x202 }

6 Target : <0x0000d14a> { _release_console_sem + 0x1e2 }

   Source : <0x0000d13c> { _release_console_sem + 0x1d4 }

7 Target : <0x0000d132> { _release_console_sem + 0x1ca }

   Source : <0x0000d124> { _release_console_sem + 0x1bc }

8 Target : <0x0000d104> { _release_console_sem + 0x19c }

   Source : <0x0000cfea> { _release_console_sem + 0x82 }

9 Target : <0x0000cfba> { _release_console_sem + 0x52 }

   Source : <0x0000d0e6> { _release_console_sem + 0x17e }

10 Target : <0x0000d0e0> { _release_console_sem + 0x178 }

   Source : <0x0000c92a> { __call_console_drivers + 0x62 }

11 Target : <0x0000c924> { __call_console_drivers + 0x5c }

   Source : <0x0000c8f4> { __call_console_drivers + 0x2c }

12 Target : <0x0000c8c8> { __call_console_drivers + 0x0 }

   Source : <0x0000d0dc> { _release_console_sem + 0x174 }

13 Target : <0x0000d0d2> { _release_console_sem + 0x16a }

   Source : <0x0000d070> { _release_console_sem + 0x108 }

14 Target : <0x0000d06a> { _release_console_sem + 0x102 }

   Source : <0x0000c8c4> { ___call_console_drivers + 0x50 }

15 Target : <0x0000c8b8> { ___call_console_drivers + 0x44 }

   Source : <0x00090a0c> { _bfin_serial_console_write + 0x44 }

Stack from 03411f70:

        0008da5a 00025e38 001268bc 0000ffff 0008da66 000f4cdc 00000076 000eae60

        00001264 0011d790 00000000 00000000 00000000 00000000 00000001 00000000

        00000000 00000000 00000000 00000000 00000000 00000000 00000000 000011dc

        00000000 00001976 00000000 00000000 00000000 00000000 00000000 00000000

        00000000 00000000 ffffffff 00000036

Call Trace:

 

 

what is meant by Unbalanced enable for IRQ 31.How to solve that issue.

 

QuoteReplyEditDelete

 

 

2008-07-14 22:40:37     Re: interrupt

Mike Frysinger (UNITED STATES)

Message: 58788   

 

request_irq() enables the irq automatically for you.  additionally calling enable_irq() without a disable_irq() before is a bug.  in the code you've shown, there is no need to call enable or disable irq.

QuoteReplyEditDelete

 

 

2008-07-14 23:05:14     Re: interrupt

Yi Li (CHINA)

Message: 58789   

 

You don't have to call "enable_irq()". request_irq() will enable the irq. And I think for most drivers, you will need "IRQF_DISABLED" flag when request_irq(), since you may want to disable local irq when the irq is being handled.

 

Also, you want want to set up DMA,you don't have to setup irq handler for that DMA channel. Here is sample code in drivers/serial/bfin_5xx.c:

 

    if (request_dma(uart->rx_dma_channel, "BFIN_UART_RX") < 0) {

        printk(KERN_NOTICE "Unable to attach Blackfin UART RX DMA channel\n");

        return -EBUSY;

    }

 

    if (request_dma(uart->tx_dma_channel, "BFIN_UART_TX") < 0) {

        printk(KERN_NOTICE "Unable to attach Blackfin UART TX DMA channel\n");

        free_dma(uart->rx_dma_channel);

        return -EBUSY;

    }

 

    set_dma_callback(uart->rx_dma_channel, bfin_serial_dma_rx_int, uart);

    set_dma_callback(uart->tx_dma_channel, bfin_serial_dma_tx_int, uart);

 

    uart->rx_dma_buf.buf = (unsigned char *)dma_alloc_coherent(NULL, PAGE_SIZE, &dma_handle, GFP_DMA);

    uart->rx_dma_buf.head = 0;

    uart->rx_dma_buf.tail = 0;

    uart->rx_dma_nrows = 0;

 

    set_dma_config(uart->rx_dma_channel,

        set_bfin_dma_config(DIR_WRITE, DMA_FLOW_AUTO,

                INTR_ON_ROW, DIMENSION_2D,

                DATA_SIZE_8,

                DMA_SYNC_RESTART));

    set_dma_x_count(uart->rx_dma_channel, DMA_RX_XCOUNT);

    set_dma_x_modify(uart->rx_dma_channel, 1);

    set_dma_y_count(uart->rx_dma_channel, DMA_RX_YCOUNT);

    set_dma_y_modify(uart->rx_dma_channel, 1);

    set_dma_start_addr(uart->rx_dma_channel, (unsigned long)uart->rx_dma_buf.buf);

    enable_dma(uart->rx_dma_channel);

QuoteReplyEditDelete

 

 

2008-07-15 02:05:54     Re: interrupt

vijai ragavan (INDIA)

Message: 58801   

 

hai mike,

 

here i pasted the Sport and Dma configuration . but there is no interrupt coming to my irq handler.

 

 

 

void Init_DMA(void)

{

        // Set up DMA2 channel 0 to Sport receive

        *pDMA2_0_PERIPHERAL_MAP = 0x1000;

 

        // Configure DMA2 channel0

        *pDMA2_0_CONFIG = 0x10D6;

        // Start address of data buffer

        *pDMA2_0_START_ADDR = &codecAutobufferRx;

        // DMA inner loop count

        *pDMA2_0_X_COUNT = 64;

        // Inner loop address increment

        *pDMA2_0_X_MODIFY       = 2;

        *pDMA2_0_Y_COUNT= 2;

        *pDMA2_0_Y_MODIFY= 2;

 

 

        // Set up DMA2 channel 1 to Sport transmit

        *pDMA2_1_PERIPHERAL_MAP = 0x2000;

 

        // Configure DMA2 channel 1

        *pDMA2_1_CONFIG = 0x10D4;

        // Start address of data buffer

        *pDMA2_1_START_ADDR = &codecAutobufferTx;

        // DMA inner loop count

        *pDMA2_1_X_COUNT = 64;

        // Inner loop address increment

        *pDMA2_1_X_MODIFY       = 0x0002;

        *pDMA2_1_Y_COUNT= 2;

        *pDMA2_1_Y_MODIFY= 2;

}

 

void Enable_DMA_Sport0(void)

{

        // enable DMAs

        *pDMA2_1_CONFIG = 0x10D5;

        *pDMA2_0_CONFIG = 0x10D7;

 

        // enable Sport0 TX and RX

        *pSPORT0_TCR1   = 0x4801;

        *pSPORT0_RCR1   = 0x4001;

}

 

 

 

 

 

 

tis is my interrupt handler function:

 

irqreturn_t AudioTx_ISR(int irq, void* dev_id, struct pt_regs* regs)

{

        printk("Audio Tx interrupt called\n");

}

Attachments

    Outcomes