2008-07-09 08:51:42     Memory DMA on the BF561

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

2008-07-09 08:51:42     Memory DMA on the BF561

Björn Höper (GERMANY)

Message: 58533   

 

Hi,

 

 

 

I am trying to get a Memory DMA from Flash into SDRAM working just to understand how it works in a little Test Program, the problem is that the transfer itself does not happen. I don't know what I am doing wrong I checked the Wiki article and the Hardware Reference but I cant get it working. So here is my code:

 

int retval;

 

u8 testDMA[10];

 

for (i = 0; i < 10; i++) {

        testDMA[i] = 0;

    }

 

retval = request_dma(CH_MEM_STREAM1_SRC, "Test");

    printk("Return Value Src DMA request: %d\n", retval);

    if (retval < 0) {      

        printk(KERN_WARNING "Could not allocate Source DMA Channel\n");

        free_irq(IRQ_MEM_DMA1, dev_id);

        return retval;

    }

 

    retval = request_dma(CH_MEM_STREAM1_DEST, "Test");

    printk("Return Value DEST DMA request: %d\n", retval);

    if (retval < 0) {

        printk(KERN_WARNING "Could not allocate Destination DMA Channel\n");

        free_irq(IRQ_MEM_DMA1, dev_id);

        free_dma(CH_MEM_STREAM1_SRC);

        return retval;

    }

  

    printk("Activity on Source Channel: %d\n", dma_channel_active(CH_MEM_STREAM1_SRC));  

 

    printk("Disabling DMA...\n");

    disable_dma(CH_MEM_STREAM1_SRC);

    disable_dma(CH_MEM_STREAM1_DEST);

 

    printk("Configuring Source DMA\n");

    set_dma_config(CH_MEM_STREAM1_SRC, (WDSIZE_8 | RESTART | NDSIZE_0 | DMAFLOW_STOP));

    set_dma_start_addr(CH_MEM_STREAM1_SRC, (unsigned long *)0x20000000);

    set_dma_x_count(CH_MEM_STREAM1_SRC, 10);

    set_dma_x_modify(CH_MEM_STREAM1_SRC, 1); 

 

    printk("Configuring Destination DMA\n");

    set_dma_config(CH_MEM_STREAM1_DEST, (WDSIZE_8 | RESTART | NDSIZE_0 | DMAFLOW_STOP | WNR));

    set_dma_start_addr(CH_MEM_STREAM1_DEST, testDMA);

    set_dma_x_count(CH_MEM_STREAM1_DEST, 10);

    set_dma_x_modify(CH_MEM_STREAM1_DEST, 1);

  

    printk("X Count Destination: %d\n", get_dma_curr_xcount(CH_MEM_STREAM1_DEST));

    printk("X Count Source: %d\n", get_dma_curr_xcount(CH_MEM_STREAM1_SRC));

    printk("Activity on Source Channel: %d\n", dma_channel_active(CH_MEM_STREAM1_SRC));

    printk("IRQ Status Word Source: %x\n", get_dma_curr_irqstat(CH_MEM_STREAM1_SRC));

 

    printk("Enabling DMA\n");

    enable_dma(CH_MEM_STREAM1_SRC);

    enable_dma(CH_MEM_STREAM1_DEST);

 

    for (i = 0; i < 10; i++) {

        printk("Value %d: %x\n",i,testDMA[i]);

    }

  

    printk("Finished\n");

    return 0;

 

 

Thanks for the help

 

 

 

Björn

TranslateQuoteReplyEditDelete

 

 

2008-07-09 09:37:29     Re: Memory DMA on the BF561

Robin Getz (UNITED STATES)

Message: 58544   

 

Björn:

 

Just to check - this is a kernel module?

 

-Robin

QuoteReplyEditDelete

 

 

2008-07-09 10:38:10     Re: Memory DMA on the BF561

Björn Höper (GERMANY)

Message: 58556   

 

Hi,

 

 

 

yes it is actually it is just a test Module for teh test of some features just to get used to the Blackfin architecture. The code listed above is actually standing in the init function of the Module.

 

 

 

Thanks for the help

 

 

 

Björn

TranslateQuoteReplyEditDelete

 

 

2008-07-15 10:49:13     Re: Memory DMA on the BF561

Mike Frysinger (UNITED STATES)

Message: 58857   

 

look at the dma functions in arch/blackfin/kernel/bfin_dma_5xx.c (and particularly dma_memcpy).  those are all known to work.

Attachments

    Outcomes