element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development DMA Driver problem
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 4 replies
  • Subscribers 315 subscribers
  • Views 389 views
  • Users 0 members are here
Related

DMA Driver problem

Former Member
Former Member over 9 years ago

Hi,
I am writing a driver for my application which use a DMA and XADC IP in PL and I have some problem.

I connected the Stream port of XADC IP on AXIS_S2MM port of DMA and I writed a driver.

When the driver is waiting for the transfert to complete :
timeout = wait_for_completion_timeout(&rx_cmp, timeout);
I have a time out (timeout = 0).

I tried with a loopback on AXIS_S2MM and AXIS_MM2S but I have the problem.

I compared my driver with an other that I found on Xilinx Forum ant they look like same.

Have you any why I have this problem ?

Thanks
Jo

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Hi,



    I writed a simple program in order to read DMA register with /dev/mem :


    #include <stdio.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <fcntl.h>
    #include <string.h>
    #include <sys/mman.h>

    #define         DMA_BASEADDR            0xB0000000

    #define         MM2S_DMACR              0x0
    #define         MM2S_DMASR              0x4
    #define         MM2S_SA                 0X18
    #define         MM2S_LENGTH             0x28

    #define         S2MM_DMACR              0x30
    #define         S2MM_DMASR              0x34
    #define         S2MM_DA                 0X48
    #define         S2MM_LENGTH             0x58

    int main()
    {
            int fd = 0, page_size = 0;
            unsigned int *dma_addr = NULL;

            if((fd = open("/dev/mem",O_RDWR)) < 1)
            {
                    printf("Open failed
    ");
                    return 0;
            }

            page_size = sysconf(_SC_PAGESIZE);

            dma_addr = (unsigned int*)mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, DMA_BASEADDR);
            if(dma_addr == NULL)
            {
                    printf("dma_addr failed
    ");
                    close(fd);
                    return 0;
            }

            unsigned int reg = *(dma_addr + MM2S_DMACR / sizeof(unsigned int));
            printf("MM2S_DMACR 0x%08x
    ",reg);
            reg = *(dma_addr + MM2S_DMASR / sizeof(unsigned int));
            printf("MM2S_DMASR 0x%08x
    ",reg);
            reg = *(dma_addr + MM2S_SA / sizeof(unsigned int));
            printf("MM2S_SA 0x%08x
    ",reg);
            reg = *(dma_addr + MM2S_LENGTH / sizeof(unsigned int));
            printf("MM2S_LENGTH 0x%08x
    ",reg);
            reg = *(dma_addr + S2MM_DMACR / sizeof(unsigned int));
            printf("S2MM_DMACR 0x%08x
    ",reg);
            reg = *(dma_addr + S2MM_DMASR / sizeof(unsigned int));
            printf("S2MM_DMASR 0x%08x
    ",reg);
            reg = *(dma_addr + S2MM_DA / sizeof(unsigned int));
            printf("S2MM_DA 0x%08x
    ",reg);
            reg = *(dma_addr + S2MM_LENGTH / sizeof(unsigned int));
            printf("S2MM_LENGTH 0x%08x
    ",reg / sizeof(unsigned int));

            close(fd);
            return 0;
    }



    And I have an unexpected result after starting the driver :

    S2MM_DMACR : 0x17003

    S2MM_DMASR : 0x0

    S2MM_DA : 0x0

    S2MM_LENGTH : 0x0



    MM2S_DMACR : 0x17003

    MM2S_DMASR : 0x0

    MM2S_SA : 0x0

    MM2S_LENGTH : 0x0



    I really lost, I don't what's going wrong the returns values of statues are set to zero.



    Jo

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Hi,

    Nobody can help me ?

    Jo

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    Hi,



    Is it possible to have one VDMA and one DMA at the same time in the PL and use xilinx_vdma.c module for the VDMA and xilinx_axidma.c for the DMA ?



    Thanks

    Jo

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    And if I use DMA controller in PS and I add a DMA IP in PL, is it going to work ?

    Jo

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube