DSPRelated.com
Forums

2-d to 2-d edma transfer.

Started by Manika Vasagam April 13, 2005

Hello,
I am trying to do 2-d to 2 -d edma transfer in TMS320DM642
Block-synchronized 2-D.
My source is at src_addr
My destination is at dst_addr
I am unable to do edma transfer to get the array in my dst_array.
I am sending the code also.

please help in the missing point.
thanks
manik
#include <std.h>
#include "testedmacfg.h"

#define SIZE 0x04

#define QOPT 0x01a00000
#define QSRC (QOPT + 4)
#define QCNT (QOPT + 8)
#define QFNT (QOPT + 10)
#define QDST (QOPT + 12)
#define QFRMIDX (QOPT + 18)
#define ESR 0x01a0fffc int src_addr[SIZE][SIZE];
int dst_addr[SIZE][SIZE];

void setEdmaReg();
void enableEdma();

void main()
{
int i,j;

for(j=0;j<SIZE;j++)
{
for (i=0; i< SIZE; i++)
{
src_addr[i][j] =i;
}
}

for(j=0;j<SIZE;j++)
{
for (i=0; i< SIZE; i++)
{
dst_addr[i][j] =0;
}
} setEdmaReg();
enableEdma();

}

void enableEdma()
{
int eventset;
eventset = *(volatile unsigned int *)ESR;
eventset |= 0x01;
*(volatile unsigned int *)ESR= eventset;
LOG_printf(&trace,"enableEdma****1");
LOG_printf(&trace,"enableEdma****2");
LOG_printf(&trace,"enableEdma****3");
}

void setEdmaReg()
{

*(volatile unsigned int *)QOPT = 0x45A00001;
*(volatile unsigned int *)QSRC = (unsigned int) src_addr;
*(volatile unsigned int *)QCNT = SIZE;
*(volatile unsigned int *)QFNT = SIZE;
*(volatile unsigned int *)QDST = (unsigned int) dst_addr;
*(volatile unsigned int *)QFRMIDX =SIZE;

}




Hi,

I think it might be easier to use the CSL-functions instead of writing to
the EDMA registers... I think starting the transfer is missing in your case.

With the EDMA-csl functions, the following should do the job:
#include <csl.h>
#include <csl_edma.h>

EDMA_Handle hEdma;
Uint32 opt,src,cnt,dst,idx,rld;

hEdma = EDMA_open(EDMA_CHA_ANY, EDMA_OPEN_RESET|EDMA_OPEN_ENABLE);

opt = anything; src = .... /*your options*/

EDMA_configArgs(hEdma, opt, src, cnt, dst, idx, rld);

EDMA_setChannel(hEdma); // trigger EDMA-Channel

Take care about the Cache-writeback/invalidate story. If your source memory
is in cacheable external RAM, writeback cache for the cachelines that are
touched by your source before starting the transfer. If your destination is
in cacheable external RAM, invalidate cache for the cachelines that are
touched by the destination after the transfer is finished...

best regards,

thomas

>
>
> Hello,
> I am trying to do 2-d to 2 -d edma transfer in TMS320DM642
> Block-synchronized 2-D.
> My source is at src_addr
> My destination is at dst_addr
> I am unable to do edma transfer to get the array in my dst_array.
> I am sending the code also.
>
> please help in the missing point.
> thanks
> manik >
> #include <std.h>
> #include "testedmacfg.h"
>
> #define SIZE 0x04
>
> #define QOPT 0x01a00000
> #define QSRC (QOPT + 4)
> #define QCNT (QOPT + 8)
> #define QFNT (QOPT + 10)
> #define QDST (QOPT + 12)
> #define QFRMIDX (QOPT + 18)
> #define ESR 0x01a0fffc > int src_addr[SIZE][SIZE];
> int dst_addr[SIZE][SIZE];
>
> void setEdmaReg();
> void enableEdma();
>
> void main()
> {
> int i,j;
>
> for(j=0;j<SIZE;j++)
> {
> for (i=0; i< SIZE; i++)
> {
> src_addr[i][j] =i;
> }
> }
>
> for(j=0;j<SIZE;j++)
> {
> for (i=0; i< SIZE; i++)
> {
> dst_addr[i][j] =0;
> }
> } > setEdmaReg();
> enableEdma();
>
> }
>
> void enableEdma()
> {
> int eventset;
> eventset = *(volatile unsigned int *)ESR;
> eventset |= 0x01;
> *(volatile unsigned int *)ESR= eventset;
> LOG_printf(&trace,"enableEdma****1");
> LOG_printf(&trace,"enableEdma****2");
> LOG_printf(&trace,"enableEdma****3");
> }
>
> void setEdmaReg()
> {
>
> *(volatile unsigned int *)QOPT = 0x45A00001;
> *(volatile unsigned int *)QSRC = (unsigned int) src_addr;
> *(volatile unsigned int *)QCNT = SIZE;
> *(volatile unsigned int *)QFNT = SIZE;
> *(volatile unsigned int *)QDST = (unsigned int) dst_addr;
> *(volatile unsigned int *)QFRMIDX =SIZE;
>
> } >
>

--
+++ GMX - Die erste Adresse f Mail, Message, More +++

1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail