I'm using the OMAPL-137 and I have code working for the McASP, w/ EDMA and the AIC3106. In trying to fully understand the mechanisms I have two versions of the EDMA setup. One will work the other one will not. I one method my source for TX is a single array for both the left and the right channel and the version of the code that works simply has two src arrays, one for the left and one for the right channel.
This is at the start of my task:
for ( sample = 0 ; sample < 48 ; sample++ )
{
datatx[sample]=datatx[sample]<<16 | 0;
xmt_ping_L[sample]=datatx[sample];
xmt_pong_L[sample]=datatx[sample];
xmt_ping_R[sample]=datatx[sample];
xmt_pong_R[sample]=datatx[sample];
}
and here are the two functions:
the one that does not work
int Edma3_Setup_McASP_XMT(void *src, void *dst, unsigned int bytes, unsigned int samples)
{
CSL_Edma3ccParamSetRegs param;
param.OPT = (EDMA_XMT_PING_TCC << 12) | (1 << 20); // transfer complete interrupt enabled, A Synch Mode
param.SRC = (Uint32)src;
param.A_B_CNT = (2 << 16) | bytes; // actual format: BCNT|ACNT ACnt is 2 bytes or 16 bit word
param.DST = (Uint32)dst;
param.SRC_DST_BIDX = (0 << 16) | 0; // actual format: DSTBIDX|SCRBIDX
param.LINK_BCNTRLD = (2 << 16) | (EDMA_XMTPING * 0x20); // actual format: BCNTRLD|LINK
param.SRC_DST_CIDX = (0 << 16) | (bytes & 0x0000FFFF); // actual format: DSTCIDX|SRCCIDX
param.CCNT = samples; // our array has 48 samples for single 48 KHz period
Edma3_Write_PaRAM(EDMA_MCASPTXCH, ¶m);
// 2. setup ping PaRAM set (to be reloaded later)
Edma3_Write_PaRAM(EDMA_XMTPING, ¶m);
return 0;
}
and the one that works
void setup_edma_ping_xmt(void *src_ping_L, void *src_ping_R,
void *dst,
Uint32 bytes, Uint32 samples)
{
CSL_Edma3ccParamSetRegs param;
Uint32 ping_offset = (Uint32)src_ping_R - (Uint32)src_ping_L;
Int32 ping_c_idx = -ping_offset + bytes;
// 1. setup channel PaRAM slot
param.OPT = (EDMA_XMT_PING_TCC << 12) | (1 << 20); // transfer complete interrupt enabled
param.SRC = (Uint32)src_ping_L;
param.A_B_CNT = (2 << 16) | bytes; // actual format: BCNT|ACNT
param.DST = (Uint32)dst;
param.SRC_DST_BIDX = (0 << 16) | ping_offset; // actual format: DSTBIDX|SCRBIDX
param.LINK_BCNTRLD = (2 << 16) | (EDMA_XMTPING * 0x20); // actual format: BCNTRLD|LINK
param.SRC_DST_CIDX = (0 << 16) | (ping_c_idx & 0x0000FFFF); // actual format: DSTCIDX|SRCCIDX
param.CCNT = samples;
Edma3_Write_PaRAM(EDMA_MCASPTXCH, ¶m);
// 2. setup ping PaRAM set (to be reloaded later)
Edma3_Write_PaRAM(EDMA_XMTPING, ¶m);
}
I bolded the lines that should be different.