02-03-2013 11:00 AM
Hello ,
I am using a Spartan 6 Sp601 evaluation platform . I am trying to write 5 numbers in to the DDR Ram using the MPMC and this data must be transfered to a peripheral (Created) by DMA and the result in printed .
Here's my code :
//void XDmaCentral_Transfer(XDmaCentral *InstancePtr, void *SourcePtr, void *DestinationPtr, u32 ByteCount);
#include "xmpmc_hw.h"
#include "xmpmc.h"
#include "xparameters.h"
#include "xdmacentral.h"
#include "xdmacentral_l.h"
#include<stdio.h>
#include "plb_periph.h"
/*****************************************************************************/
void delay()
{
int x,y;
for (x = 0; x <20000; x++)
{
for (y = 0;y<10; y++)
{
}
}
}
int main()
{
/* Defining the variables */
Xuint32 var;
Xuint32 i;
Xuint32 a[10];
//global declarations for DMA
XDmaCentral MyDMA;
xil_printf("Process Starting \n\r");
xil_printf("Writing Data1 \n\r");
for(i=0;i<5;i++)
{
a[i]=i;
XMpmc_WriteReg(XPAR_MCB_DDR2_MPMC_BASEADDR+(i*4),0,a[i]);
delay();
}
XDmaCentral_Transfer(&MyDMA, (u32*)(XPAR_MPMC_0_MPMC_BASEADDR), (u32*)(XPAR_PLB_PERIPH_0_BASEADDR), 40);
for(i=0;i<5;i++)
{
var = PLB_PERIPH_mReadMemory(XPAR_PLB_PERIPH_0_BASEADDR+(i*4));
delay();
xil_printf(" The written values into the memory are %d\n",var);
}
xil_printf("Hurray its done");
return(0);
}
The problem is that the data isnt being transfered using DMA ie. this command //void XDmaCentral_Transfer(XDmaCentral *InstancePtr, void *SourcePtr, void *DestinationPtr, u32 ByteCount); has some error in it when given as
XDmaCentral_Transfer(&MyDMA, (u32*)(XPAR_MPMC_0_MPMC_BASEADDR), (u32*)(XPAR_PLB_PERIPH_0_BASEADDR), 40);
Kindly , help me with this issue .
Thanking You.