I am trying to write simple code to transfer data from one memory location to another through DMA. But DMA register values are not getting updated to SRC & DST address which I give. My code is as below,
#include "USBSTK5515.h"
#include "register_dma.h"
#include "register_system.h"
#define N 128 // Transfer data elements
#define M 16 // Transfer data frames
unsigned short src[N*M];
unsigned short dst[N*M];
int i;
unsigned long srcAddr,dstAddr;
void main(void)
{
Uint16 register_value;
// Initialize source and destination memory for testing
for (i = 0; i < (N*M); i++)
{
dst[i] = 0;
src[i] = i + 1;
}
// Convert word address to byte address, DMA uses byte address
srcAddr = (unsigned long)src;
dstAddr = (unsigned long)dst;
// srcAddr <<= 1;
// dstAddr <<= 1;
PER_RESET = PER_RESET & 0xFFEF;
IDLE_PCGCR = IDLE_PCGCR & 0xFFF7;
DMA0_CH0_SRC_LSW = (short)(srcAddr & 0x0000FFFF); // here registers are not updating to source and destination address
DMA0_CH0_SRC_MSW = (short)(srcAddr >> 16);
DMA0_CH0_DST_LSW = (short)(dstAddr & 0x0000FFFF);
DMA0_CH0_DST_MSW = (short)(dstAddr >> 16);
DMA0_CH0_TC_MSW = 0x2000;
DMA0_CH0_TC_LSW = 0x0004;
DMA_IFR = 0xFFFF;
DMA_MSK = 0xFFFF;
DMA0_CH0_TC_MSW = DMA0_CH0_TC_MSW | 0x8000;
}
I am updating registers according to DMA manual for c5515.
please help.
Thanks