• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » DaVinci™ Video Processors » DM3x DaVinci Video Processor Forum » Working with DMA
Share
DaVinci™ Video Processors
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Working with DMA

Working with DMA

This question is not answered
Kirill Brilliantov
Posted by Kirill Brilliantov
on Nov 09 2009 04:38 AM
Genius3460 points

Hello!

Where can I find sample working with DMA on DM355? I have interest in drivers and program.

Thank you and excuse me for my bad english.

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Juan Gonzales
    Posted by Juan Gonzales
    on Nov 09 2009 14:35 PM
    Mastermind33875 points

    The DMA kernel driver is available under the kernel tree in the following location

          ...lsp/ti-davinci/arch/arm/mach-davinci/dma.c

    that said, this driver is only accessible by other kernel drivers such as MMC driver and audio driver.  You could add proprietary ioctl request to the dma driver to allow user space access to DMA resources; however, this can be dangerous as you need to uderstand which DMA channels are dedicated to which peripherals and communication between ARM and MJCP.  What do you have in mind as far as DMA usage?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Kirill Brilliantov
    Posted by Kirill Brilliantov
    on Nov 10 2009 09:03 AM
    Genius3460 points

    Thank you for your reply, Juan!

    We tried use this for dm9000 driver. That is what we have done:

    void dm9000_dmaHandler(int lch, unsigned short ch_status,void *data);

    static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
    {
    int res;

    int i;

    edmacc_paramentry_regs dmaParam;

    //writesb(reg, data, count);

    //заменить на write_DMA

    printk("start %s, data = %p,count = %d, channel = %d,tcc = %d,reg = %p\n",

    __FUNCTION__, data,count,lch,tcc,dmaTestData);

    printk(KERN_INFO "requesting dma channel\n");

    for (i = 12; i < 14; i++) {

    res = davinci_request_dma(i,"dm9000_dma_tx",dm9000_dmaHandler,

    dmaData,&lch,&tcc,0);

    if (!res)

    {

    printk(KERN_INFO "allocated dma channel %d\n",lch);

    break;

    }

    else

    {

    //printk(KERN_INFO "dma request error %d\n",res);

    }

    }

    if (res)

    printk(KERN_INFO "dma request error %d\n",res);

     

    davinci_set_dma_transfer_params(lch, count, 1, 1,

    0, ASYNC);

    davinci_set_dma_dest_params(lch,reg, 0, 0);

    davinci_set_dma_src_params(lch, data, 0, 0);

    davinci_set_dma_src_index(lch, 0, 0);

    davinci_set_dma_dest_index(lch, 0, 0);

    res = davinci_start_dma(lch);

    if (res)

    {

    printk("dm9000 dma start error\n");

    }

    printk("end %s\n",__FUNCTION__);

    }

    void dm9000_dmaHandler(int lch, unsigned short ch_status,void *data)

    {

    printk(KERN_INFO "%s, channel= %d,status = 0x%04X, data = %p\n",__FUNCTION__,lch,

    ch_status,data);

    davinci_stop_dma(lch);

    davinci_free_dma(lch);

    ch_status = ch_status;

    data = data;

    }

    But this don't works properly
    Driver output during ping command:
    # ping -c 3 192.168.15.129
    PING 192.168.15.129 (192.168.15.129)start dm9000_outblk_8bit, data = c0fc5202,count = 98, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    : 56 data bytes
    start dm9000_outblk_8bit, data = c0fc5202,count = 98, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    start dm9000_outblk_8bit, data = c0fc5202,count = 98, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    start dm9000_outblk_8bit, data = c324e0c2,count = 42, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    start dm9000_outblk_8bit, data = c324e0c2,count = 42, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    start dm9000_outblk_8bit, data = c324e0c2,count = 42, channel = 12,tcc = 12,reg = c6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    --- 192.168.15.129 ping statistics ---
    3 packets transmitted, 0 packets received, 100% packet loss
    What we do wrong?
    Thank you.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Juan Gonzales
    Posted by Juan Gonzales
    on Nov 10 2009 09:53 AM
    Mastermind33875 points

    I cannot see anything obviously wrong in the code; can you try doing a DMA transfer from DDR2 to DDR2 first...this is probrably a easy way to verify if there is something wrong with the code or not...

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Kirill Brilliantov
    Posted by Kirill Brilliantov
    on Nov 11 2009 06:04 AM
    Genius3460 points

    Testing DMA transfer from DDR2 to DDR2.

    Source:

    static unsigned char dmaTestData[1536];
    static unsigned char dmaTestSource[1536];

    static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
    {
    .........................................................................
     for (i = 0; i < 25; i++) {
    dmaTestData[i] = 0;
    dmaTestSource[i] = i + 1;
    }
    davinci_set_dma_transfer_params(lch, 25, 1, 1, 0, ASYNC);
    davinci_set_dma_dest_params(lch,(unsigned long)virt_to_phys(dmaTestData), 0, 0);
    davinci_set_dma_src_params(lch, (unsigned long)virt_to_phys(dmaTestSource), 0, 0);
    davinci_set_dma_src_index(lch, 0, 0);
    davinci_set_dma_dest_index(lch, 0, 0);
    .........................................
    }

    void dm9000_dmaHandler(int lch, unsigned short ch_status,void *data)
    {
    int i;
    ......................................
     printk(KERN_INFO "dmaTestData:");
    for (i = 0; i < 25; i++) {
    printk(KERN_INFO "%02X ", dmaTestData[i]);
    }
    printk(KERN_INFO "\n");
    ...............................
    }

    Result:

    start dm9000_outblk_8bit, data = c09c6202,count = 70, channel = 12,tcc = 12,reg = 0xC6864002
    requesting dma channel
    allocated dma channel 12
    end dm9000_outblk_8bit
    dm9000_dmaHandler, channel= 12,status = 0x0001, data = c0353c30
    dmaTestData:<6>01 <6>02 <6>03 <6>04 <6>05 <6>06 <6>07 <6>08 <6>09 <6>0A <6>0B <6>0C <6>0D <6>0E <6>0F <6>10 <6>11 <6>12 <6>13 <6>14 <6>15 <6>16 <6>17 <6>18 <6>19 <6>

    But with ping, as sample, this is don't work.

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use