Part Number: TMDSLCDK6748
Other Parts Discussed in Thread: OMAP-L138
Tool/software: Code Composer Studio
Hello TI Community;
I have this LCDK C6748 Kit,I am following a book by Donald Raey.
The Book has an example on EDMA3 Transfer,Before executing the Example i started understanding EDMA3 Peripheral Implemented in the C6748 processor.The example uses EDMA3 to copy input ADC samples to DAC without processing ,which makes it a loop Back program with EDMA method. The Code is given below
******************************************************************Code for copying audio Samples from input to output using EDMA3******************************************************************************
#include "L138_LCDK_aic3106_init.h"
extern int16_t *pingIN,*pingOUT,*pongIN,*pongOUT;
volatile int buffer_full =0;
int procBuffer;
interrupt void interrupt4(void)
{
switch(EDMA_3CC_IPR)
{
case 1 : //TCC =0
procBuffer = PING;
EDMA_3CC_ICR= 0x0001;
break;
case 2 : //TCC = 1
procBuffer = PONG;
EDMA_3CC_ICR = 0x0002;
break;
default: // incase interrupt missed
EDMA_3CC_ICR = 0x0003;
break;
}
EVTCLR0 = 0x00000100;
buffer_full = 1;
return;
}
void processbuffer(void)
{
int16_t *inBuf,*outBuf;
int16_t leftsample,rightsample;
int i;
if(procBuffer == PING)
{
inBuf= pingIN;
outBuf= pongOUT;
}
if(procBuffer==PONG)
{
inBuf = pongIN;
outBuf = pongOUT;
}
for(i=0;i<(BUFCOUNT/2);i++)
{
leftsample= *inBuf++;
rightsample=* inBuf++;
*outBuf++ = leftsample;
*outBuf++ = rightsample;
}
buffer_full =0;
return;
}
int main (void)
{
L138_initialise_edma(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
{
while(1)
{
while(!buffer_full);
processbuffer();
}
}
****************************************************************************************End*********************************************************
My understanding of EDMA3 is that ,we can trigger the EDMA manually also by Setting up the corresponding bits in ESR register which in turn sets the Events manually and Same thing my program is trying to perform.Setting up all the Parameters in PaRAM entry 0,and the OPT field with TCINTEN bit Set and TCC = 0 for one input buffer and TCC =1 for other input buffer when first one fills up. THis TCC is the Transfer Complete Code which is returned to Set the IPR register in EDMA3's corresponding bit.
IPR is a 32 bit register ,so as far my understanding the first two bits are used for MCASP0 transmit and Recieve interrupts.
As this code interrupts the CPU at when buffer fills up not at when output buffers get Empty.So why we use TCC =1 ,as this sets the interrupt associated with the MCASP0 Recieve.(forgive me if i am wrong)
Also in L138_LCDK_aic3106_init.c the IPR register is cleared as
EDMA_3CC_ICR = 0x0007
it should clear the first three bits but we are concerned with only first two bits why to clear the third bit.
