AnsweredAssumed Answered

scatter/gather DMA doesn't work

Question asked by ThierryNolf on Jun 10, 2013
Latest reply on Jun 17, 2013 by Harshit.Gaharwar

Dear all,

 

I am trying to implement a scatter gather DMA mechanism in a sharc device 21469.

I have an internal buffer of 16 channels audio, 4 samples per channel.

Each sample should be copied in external memory in 16 circular buffers of 8192 samples.

 

I build a taplist with offsets 0,0x2000,0x4000,...

My code looks like :

 

void Enable_DMA_Writes(void)
{    /* register the interrut handler */
    interrupt(SIG_P9, DMA_Writes_ISR);       

 

    *pDMAC0 = 0x0;                                        /* good idea to clear it out first */
    *pIIEP0 = (unsigned int)pDMATransmitBuffer;            /* internal address */
    *pIMEP0 = 1;                                        /* internal modifier */
    *pICEP0 = WORDS_PER_CHANNEL;                        /* DMA count */
    *pECEP0 = WORDS_PER_CHANNEL;                        /* DMA count */
    *pEIEP0 = DDR2_START + DMATransmitOffset;
    *pEMEP0 = 1;
                                            /* external modifier */
                                           
    *pELEP0    = 0;                                           
    *pEBEP0    = 0;                                           
   
    *pTCEP0    = 16;
    *pTPEP0    = (unsigned int)pTapListPointer;
    *pDMAC0 = DEN | TRAN | LEN;                        /* TRAN set means external write */
   
    DMATransmitOffset = (DMATransmitOffset + 4) & 0x1FFF;
}

 

I can trace that only the lowest addresses are filled (at address DDR2_START) with reasonable data.  But even there the first four samples are stored correct, the others are droppen somewhere in the buffer.  At most of the storage the samples are in reversed order.

 

Can someone give me some example code or explain me whet I'm doing wrong with this code ?

 

Thanks in advance,

 

Br,

Outcomes