Programming EDMA without EDMA3LLD package

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

There have been many queries in trying to understand how to program EDMA3 hardware - a basic knowledge of the hardware peripheral and some basic instructions below should do the trick, and as you will see the task is pretty simple :)

Contents

Some assumptions made while writing these steps:

Steps:

1. EDMA3 Initialization:

2. Programming DMA Channel:

3. Triggering the Transfer and Waiting for Transfer Completion:

Note: In case of error, the corresponding bit will be SET in the EMR register.

Sample C code for demo (for DM648 platform)

/* EDMA register address and definitions */
 
#define EDMA_CC_BASE  	(0x02A00000) /* DM648. Check address for other devices. */
#define DCHMAP0     *((volatile unsigned int *)(EDMA_CC_BASE + 0x0100))
#define DMAQNUM0    *((volatile unsigned int *)(EDMA_CC_BASE + 0x0240))
#define QUEPRI      *((volatile unsigned int *)(EDMA_CC_BASE + 0x0284))
#define EMCR        *((volatile unsigned int *)(EDMA_CC_BASE + 0x0308))
#define EMCRH       *((volatile unsigned int *)(EDMA_CC_BASE + 0x030C))
#define QEMCR       *((volatile unsigned int *)(EDMA_CC_BASE + 0x0314))
#define CCERRCLR    *((volatile unsigned int *)(EDMA_CC_BASE + 0x031C))
#define QWMTHRA     *((volatile unsigned int *)(EDMA_CC_BASE + 0x0620))
#define ESR         *((volatile unsigned int *)(EDMA_CC_BASE + 0x1010))
#define IPR         *((volatile unsigned int *)(EDMA_CC_BASE + 0x1068))
#define ICR         *((volatile unsigned int *)(EDMA_CC_BASE + 0x1070))
 
#define PARAMENTRY0     (0x02A04000) /* DM648. Check address for other devices. */
#define OPT             *((volatile unsigned int *)(PARAMENTRY0 + 0x00))
#define SRC             *((volatile unsigned int *)(PARAMENTRY0 + 0x04))
#define A_B_CNT         *((volatile unsigned int *)(PARAMENTRY0 + 0x08))
#define DST             *((volatile unsigned int *)(PARAMENTRY0 + 0x0C))
#define SRC_DST_BIDX    *((volatile unsigned int *)(PARAMENTRY0 + 0x10))
#define LINK_BCNTRLD    *((volatile unsigned int *)(PARAMENTRY0 + 0x14))
#define SRC_DST_CIDX    *((volatile unsigned int *)(PARAMENTRY0 + 0x18))
#define CCNT            *((volatile unsigned int *)(PARAMENTRY0 + 0x1C))
 
/* Allocate srcBuff and dstBuff. Do a cache flush and cache invalidate,if required. */
static signed char srcBuff[512];
static signed char dstBuff[512];
 
/* Step 1: EDMA initialization */
QUEPRI=0x10;
QWMTHRA =(16<<8u)|(16 & 0xFF);
EMCR =  0xFFFFFFFF;
CCERRCLR = 0xFFFFFFFF;
 
/* Step 2: Programming DMA Channel (and Param set) */
DCHMAP0=0x0;
DMAQNUM0=0x0;
OPT = 0x00100000;  /* only TCINTEN is set */
SRC = (unsigned int)srcBuff;
A_B_CNT = ((1 << 16u) | (512 & 0xFFFFu));    /* ACNT = 512, BCNT = 1 */
DST = (unsigned int)dstBuff;
SRC_DST_BIDX = (512 << 16u) | (512 & 0xFFFFu);    /* SRC_BIDX = 512, DST_BIDX = 512 */
LINK_BCNTRLD = (1 << 16u) | 0xFFFFu;    /* LINK = 0xFFFF, BCNTRLD = 1 */
SRC_DST_CIDX = 0;
CCNT = 1;
 
/* Step 3: Triggering the Transfer and Waiting for Transfer Completion */
ESR = 0x1;
while(((IPR) & 0x1) == 0);
 
/* Transfer has completed, clear the status register. */
ICR=0x01;
 
/* Transfer is complete. Compare the srcBuff and dstBuff */
E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Programming EDMA without EDMA3LLD package here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox