How to use the DMA engine

Any technical questions about the Epiphany chip and Parallella HW Platform.

Moderator: aolofsson

How to use the DMA engine

Postby Richardye » Wed Nov 11, 2015 2:34 pm

Hi Guys,

Here I got quite confused about the DMA control in the epiphany side. Hope someone could help me ...

typedef struct
unsigned config;
unsigned inner_stride;
unsigned count;
unsigned outer_stride;
void *src_addr;
void *dst_addr;
} e_dma_desc_t;

Above is the declaration for the e_dma_desc_t.

The questions are ,

1. What does the inner & outer stride, count stands for ? If I would like to copy a char array of size 1024, how whould I set these values ?

2. How can I start the DMA transfer ? Using int e_dma_start(e_dma_desc_t *descriptor, e_dma_id_t chan) or e_dma_copy(void *dst, void *src, size_t bytes) ?

Hope some one could help me, this really bothers me !!!!

Posts: 8
Joined: Mon Sep 07, 2015 6:30 pm

Re: How to use the DMA engine

Postby jar » Thu Nov 12, 2015 3:43 pm

I can point you to a couple examples of different complexity. The simplest case should solve your problem: ... pi_tfunc.c

If you're just copying a linear array in memory like you described, you only need to use e_dma_copy(). You give it the address if your destination and sources, and how many bytes.
Code: Select all
char dst[1024];
char *src; // Pointer to data
e_dma_copy((void*)dst, (void*)src, 1024);

Everything else you mentioned is only required if you want to do something more complicated. For example, if you want to copy a 2D block from a 2D array of data, you may find an example here: ... pi_tfunc.c

You must use the e_dma_set_desc(), e_dma_start(), and e_dma_wait() routines.
User avatar
Posts: 295
Joined: Mon Dec 17, 2012 3:27 am

Re: How to use the DMA engine

Postby Richardye » Sun Nov 15, 2015 9:51 pm

Hi Jar,

Thank you very much! Now the DMA thing is much clearer. Thank you :D
Posts: 8
Joined: Mon Sep 07, 2015 6:30 pm

Return to Epiphany and Parallella Q & A

Who is online

Users browsing this forum: No registered users and 16 guests