AnsweredAssumed Answered

Use of DMA

Question asked by arnogir on Jan 5, 2015
Latest reply on Feb 24, 2015 by arnogir

Hello

 

I'm working on a K70 with MQX 4.1.

 

I use the LCDC controller of the K70.

 

I want modify my controller driver to use the DMA to copy a new image to the image buffer used by the LCDC (given by LCDC_LSSAR)

 

Then currently I have the following code: (This code copy a picture from  pGet to pPut (LSSAR = Pput)


for(Row = Top; Row < (Top + Height); Row++)
 {
 #if defined(PEG_MULT_SOFT_SURFACES)
 pGet = (PEGCOLOR *)mpCompositeBuffer;
 #else
 #if (PEG_ORIENTATION == PEG_ORIENTATION_ROTATE_CW)
 pGet = (PEGCOLOR *)(pSurface->pScanPointers[mHRes-1]);
 #else
 pGet = (PEGCOLOR *)(pSurface->pScanPointers[0] - mVRes);
 #endif
 #endif 
 
 pPut = (PEGCOLOR *)mpVidMemBase;
 pGet += (mVRes * Row + Left);
 pPut += (mVRes * Row + Left);
 
 
 for(Column = 0; Column < Width ; Column++)
 { 
 pPut[Column] = pGet[Column];  
 }
 }
 

 

The picture is 480x800 pixel of two bytes (65K color) with mVRes = 800. Top, Left, Width, Height allow to indicate wich part of the picture refresh.

 

Then I want use the DMA because this copy take about 30ms!

 

I have the following code:

lcd_dma_tcd.SRC_ADDR  = (uint32_t)pGet;
 lcd_dma_tcd.SRC_WIDTH  = 2;
 lcd_dma_tcd.SRC_OFFSET  = 0;  
 lcd_dma_tcd.SRC_MODULO  = 0;
 lcd_dma_tcd.DST_ADDR  = (uint32_t)pPut;
 lcd_dma_tcd.DST_WIDTH  = 2;
 lcd_dma_tcd.DST_OFFSET  = 0;  
 lcd_dma_tcd.DST_MODULO  = 0;
 lcd_dma_tcd.LOOP_BYTES  = Width * 2;
 lcd_dma_tcd.LOOP_COUNT  = Height;
 lcd_dma_tcd.LOOP_SRC_OFFSET = (mVRes - Width) *2;
 lcd_dma_tcd.LOOP_DST_OFFSET = (mVRes - Width) *2;
 
 dma_channel_claim(&lcd_dma_channel_handle, 0);
 dma_channel_setup(lcd_dma_channel_handle, 1,0);
 dma_callback_reg(lcd_dma_channel_handle,(DMA_EOT_CALLBACK)(my_CallBack),&Copy);
 dma_request_source(lcd_dma_channel_handle, 54); 
 dma_transfer_submit(lcd_dma_channel_handle, &lcd_dma_tcd, &lcd_dma_tcd_seq);
 dma_request_enable(lcd_dma_channel_handle);
 


But transfer not start. I don't now where is my mistake?

I try with a simpliest code to copy a simple buffer but nothing work.

 

thank for your help.

Outcomes