DSPRelated.com
Forums

problems with C6211 QDMA

Started by Unknown February 13, 2002
dear all,

i try'd to move data with the QDMA in any direction (CSx -> CSy)
the problem is in greneral, that the first call to the function
(see later) didn't move the data corectly. the 2. and higher call do it.
the bits in CIPR register are set correct for the end.

what can be for that?

regards, willi elherr *** here our C-source

/* check transfer
* rtc_ms1 is a irq_driven time_counter in mili secs
*/
static int _ckend()
{
int r = 0;

.. debug info's
for(rtc_ms1 = 1000; rtc_ms1 && !(pC6xEdmaCb->cipr & EdmaCm); );
if(!rtc_ms1) r = 1;
pC6xEdmaCb->cipr |= EdmaCm;
return(r);
}

/* copy loop 8/16/32 bit 1d-1d (chanel 8)
* Opt register
* pr esz s sum d dum Ti tc L F
* .-.-. .__. . .-. . .-. . .-.-.-. .... .... .... . . . .
*
* 0 0 1 * * 0 1 1 0 1 1 1 1 0 0 0 0.................0 0 1
23780001
*/
static int _cp1d1d(void *dst,void *src,uint n,uint es)
{
uint ec,em;

em = 0x23780001;
if(es == 1) em += (2 << Edma_OptS_Esz);
else if(es == 2) em += (1 << Edma_OptS_Esz);
pC6xQdmaCb->fex = es;
pC6xQdmaCb->opt = em;

while(n)
{ if(n > 0xf000) ec = 0xf000;
else ec = n;
.. debug info's
pC6xQdmaCb->sa = (uint)src;
pC6xQdmaCb->da = (uint)dst;
pC6xQdmaCb->fec = ec;
pC6xQdmaCbS->opt = em; /* start transfer */

if(n -= ec)
{ dst = (void *)((uchar *)dst + ec * es);
src = (void *)((uchar *)src + ec * es);
}
if(_ckend()) return(1);
}
return(0);
}

/* copy with qdma 1d-1d
* 2DS/2DD = 0, SUM/DUM = 11, FS = 1
*/
int qmemcpy_1d1d(void *dst,void *src,uint n)
{
int r,m = (uint)src | (uint)dst | n;

.. debug info's
pC6xEdmaCb->cier &= ~EdmaCm;
pC6xEdmaCb->cipr |= EdmaCm;
if(m & 1) r = _cp1d1d(dst,src,n, 1); /* 8 bit transfer */
else if(m & 2) r = _cp1d1d(dst,src,n/2,2); /* 16 bit transfer */
else r = _cp1d1d(dst,src,n/4,4); /* 32 bit transfer */
return(r);
}