This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DMA transfer to a ping or pong buffer - how do i put the address in the DMASSAU and DMASSAL

hi i need to kno wi can shift data from a dma channel to a buffer. do i write the address of the buffer inthe  DMASSAU and DMASSAL or is it ok if i jus mention the name of the buffer. i f we can mention the name of the buffer can u tell me how that can be done

  • Hi,

    Basically, You need to assign the address of the buffer.  

    We have some DMA examples in the C55x CSL. Please refer to the examples. http://focus.ti.com/docs/toolsw/folders/print/sprc133.html

    Best Regards,

    Peter Chung

     

  • Another approach to ping-pong buffering is to use a separate DMA channel for each phase, as demonstrated in the code below. The 55xx DSP's have plenty of DMA channels, and "wasting" one avoids having to change address registers at run time which can be done, but requires careful handshaking.

    Maybe I don't understand your question, but It's perfectly ok to use symbolic names when initializing the DMA address registers.

     /* set up DMA channels 2 and 3 for double buffering ADC data into top of processing chain */
     /* these are low priority DMA channels, while the ADC DMA is a high priority channel */ 
     hDmaPing = DMA_open(DMA_CHA3,DMA_OPEN_RESET);
     DMA_getConfig(hDmaPing,&myDmaConfig);
     /**** be sure the statement below calls out correct Source memory type for AdcInBuff! ****/
     myDmaConfig.dmacsdp = DMA_FMK(DMACSDP,DST,DMA_DMACSDP_DST_DARAM)\
     | DMA_FMK(DMACSDP,SRC,DMA_DMACSDP_SRC_SARAM)\
     | DMA_FMK(DMACSDP,DATATYPE,DMA_DMACSDP_DATATYPE_16BIT);
     myDmaConfig.dmaccr = DMA_FMK(DMACCR,DSTAMODE,DMA_DMACCR_DSTAMODE_POSTINC)\
     | DMA_FMK(DMACCR,SRCAMODE,DMA_DMACCR_SRCAMODE_POSTINC)\
     | DMA_FMK(DMACCR,REPEAT,0)  | DMA_FMK(DMACCR,AUTOINIT,1)\
     | DMA_FMK(DMACCR,PRIO,DMA_DMACCR_PRIO_LOW)\
     | DMA_FMK(DMACCR,EN,0);
     myDmaConfig.dmacicr = DMA_FMK(DMACICR,FRAMEIE,1);  /* interrupt when DMA completes */
     /* program source and destination start addresses in BYTES (not words!) */
     src_byte_addr = ((Uint32)&AdcInBuff)<<1;
     myDmaConfig.dmacssal = (DMA_AdrPtr)( src_byte_addr & 0xFFFF ); /* initial source address */
     myDmaConfig.dmacssau = (src_byte_addr >> 16);
     dst_byte_addr = ((Uint32)&Scale0InBuff)<<1;
     myDmaConfig.dmacdsal = (DMA_AdrPtr)( dst_byte_addr & 0xFFFF ); /* initial dest address */
     myDmaConfig.dmacdsau = (dst_byte_addr) >> 16;
     /* set transfer counts */
     myDmaConfig.dmacfn = 1;        /* transfer one frame */
     myDmaConfig.dmacen = dma_count;     /* transfer half of AdcInBuff */
     /* write configuration to DMA registers */ 
     DMA_config(hDmaPing,&myDmaConfig);
     

    /**** This DMA transfer will be started on the HALF interrupt from AdcInBuff DMA0  */
     /**** When it completes (FRAME interrupt), downstream processing will be called */

     /* make a few modification for the other DMA channel */
     hDmaPong = DMA_open(DMA_CHA2,DMA_OPEN_RESET);
     /* bottom half source and destination start addresses in BYTES (not words!) */
     src_byte_addr = ((Uint32)(&AdcInBuff + dma_count/2))<<1;
     myDmaConfig.dmacssal = (DMA_AdrPtr)( src_byte_addr & 0xFFFF ); /* initial source address */
     myDmaConfig.dmacssau = (src_byte_addr >> 16);
     dst_byte_addr = ((Uint32)(&Scale0InBuff + dma_count/2)<<1);
     myDmaConfig.dmacdsal = (DMA_AdrPtr)( dst_byte_addr & 0xFFFF );/* initial dest address */
     myDmaConfig.dmacdsau = (dst_byte_addr) >> 16;
     /* set transfer count */
     myDmaConfig.dmacen = dma_count;     /* transfer half of AdcInBuff */
     /* write configuration to DMA registers */ 
     DMA_config(hDmaPong,&myDmaConfig);  

    /**** This DMA transfer will be started on the FRAME interrupt from AdcInBuff DMA0  */
     /**** When it completes (FRAME interrupt), downstream processing will be called */

    David L. Rick

    Hach Company