Hello everyone:
I have a problem in use QDMA in CCS3.3 DM648 board. I am using the QDMA by directly writing into the QDMA registers. I spent a long time to get it going , but it still have some problem. I just want to copy data from external memory to L2. It can copy some data ,but not all data. Then I use EDMA in DVSDK , it has the same problem.
But when I use memcpy , it is ok.
What is the problem?
My code:
#define PARAM_ENTRY_USED 80
#define TCC_USE 0
S32 DAT_Open(U32 chaNum)
{
volatile U32 *p_QDMA_CHMAP0 = (volatile U32 *)(QDMA_CHMAP0_ADDR);
if(chaNum > 7)
{
return -1;
}
*(volatile U32 *)(QDMA_QRAE0_ADDR) = 0x000000ff;
//Setting QDMA CHMAP: Parameter entry and trigger word
p_QDMA_CHMAP0[chaNum] = ((PARAM_ENTRY_USED+chaNum)<<5) + 12;
//enable the channel in QEER (QDMA Event Enable Register)
*(volatile U32 *)(QDMA_QEESR_ADDR) = 0x000000ff;
return chaNum;
}
void DAT_copy(void *src , void *dst , U16 byteCnt, U16 chaNum)
{
volatile S32 * base;
base = (volatile S32 *)(QDMA_PARAM80_ADDR + chaNum*32);
base[0] = 0x00100008 + ((TCC_USE + chaNum)<<12);
base[1] = (S32)src;
base[2] = 0x00010000 + byteCnt;
base[4] = 0;
base[5] = 0x0000ffff;
base[6] = 0;
base[7] = 1;
base[3] = (S32)dst;
}
void DAT_Copy_2D(void *src , void *dst , U16 lineLen, U16 lineCnt, U16 srcPitch, U16 dstPitch, U16 chaNum)
{
volatile U32 * base;
base = (volatile U32 *)(QDMA_PARAM80_ADDR + chaNum*32);
base[0] = 0x0010000c + ((TCC_USE + chaNum)<<12);
base[1] = (U32)src;
base[2] = ((U32)lineCnt<<16) + lineLen;
base[4] = ((U32)dstPitch<<16) + srcPitch;
base[5] = 0x0000ffff;
base[6] = 0;
base[7] = 1;
base[3] = (U32)dst;
}
void DAT_Wait_6446(U32 id)
{
volatile U32 * ptr_ipr ;
volatile U32 * ptr_iprh ;
volatile U32 * ptr_icr ;
volatile U32 * ptr_icrh ;
ptr_ipr = (volatile U32 *)(IPR_ADDR);
ptr_iprh = (volatile U32 *)(IPRH_ADDR);
ptr_icr = (volatile U32 *)(ICR_ADDR);
ptr_icrh = (volatile U32 *)(ICRH_ADDR);
if((id+TCC_USE)<32)
{
while (!(ptr_ipr[0]&(1<<(id + TCC_USE)))) ; //wait for the dma transfer specified by id completing
ptr_icr[0] |= 1<<(id + TCC_USE); //clear the setted bit in ipr register
}
else
{
while (!(ptr_iprh[0]&(1<<(id+TCC_USE-32)))) ;
ptr_icrh[0] |= 1<<(id+TCC_USE-32);
}
}