Multidimensional DMA transfer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Multidimensional DMA transfer

1,409 次查看
Jim95
Contributor III

Hello,

 

I try to transfer data between a 2 dimensional buffer (read) and a 1 dimensional buffer (write) using the SmartDSP functions.

All the data looks like correct in the BD's but the transfer remains wrong the second buffer remains empty.

 

My function to initialize the DMA chain

 

os_status init_2dim_dma_tranfer(uint8_t *source, uint8_t *dest){ os_status status; uint8_t *phys_addr; msc815x_dma_buffer_config_t msc815x_dma_buffer_config; msc815x_dma_attributes_config_t msc815x_dma_attributes_config; msc815x_dma_buffer_md_config_t msc815x_dma_buffer_md_config;     osDmaChainReset(dma_chain_handler);     msc815x_dma_buffer_md_config.high_dim[0].base_count = 0x00;    msc815x_dma_buffer_md_config.high_dim[0].count = 0x80;    msc815x_dma_buffer_md_config.high_dim[0].offset = 0x1C0;    msc815x_dma_buffer_md_config.high_dim[1].base_count = 0x00;    msc815x_dma_buffer_md_config.high_dim[1].offset = 0x00;    msc815x_dma_buffer_md_config.high_dim[1].count = 0x00;    msc815x_dma_buffer_md_config.high_dim[2].base_count = 0x00;    msc815x_dma_buffer_md_config.high_dim[2].offset = 0x00;    msc815x_dma_buffer_md_config.high_dim[2].count = 0x00;  msc815x_dma_buffer_md_config.buffer_dim = DMA_BUFF_DIM_2; msc815x_dma_buffer_md_config.cont_dim = DMA_BUFF_CONT_DIM_2; msc815x_dma_buffer_md_config.freeze_dim = DMA_BUFF_FRZ_DIM_2; msc815x_dma_buffer_md_config.interrupt_dim = DMA_BUFF_INT_DIM_2; msc815x_dma_buffer_md_config.mask_requests_dim = DMA_BUFF_MR_DIM_2; msc815x_dma_buffer_md_config.last = 0;      status = osMmuDataVirtToPhys(source, (void**)&phys_addr);    OS_ASSERT_COND(status == OS_SUCCESS);     msc815x_dma_buffer_config.address = (uint32_t) phys_addr; msc815x_dma_buffer_config.dma_port = DMA_PORT_A; msc815x_dma_buffer_config.interrupt = FALSE; msc815x_dma_buffer_config.size = 0x40; msc815x_dma_buffer_config.arch = NULL; msc815x_dma_buffer_config.md = msc815x_dma_buffer_md_config;  status = msc815xDmaChainBufferAdd(dma_chain_handler, &msc815x_dma_buffer_config, DMA_READ);    OS_ASSERT_COND(status == OS_SUCCESS);    msc815x_dma_buffer_md_config.high_dim[0].base_count = 0x00;    msc815x_dma_buffer_md_config.high_dim[0].offset = 0x00;    msc815x_dma_buffer_md_config.high_dim[1].base_count = 0x00;    msc815x_dma_buffer_md_config.high_dim[1].offset = 0x00;    msc815x_dma_buffer_md_config.high_dim[1].count = 0x00;    msc815x_dma_buffer_md_config.high_dim[2].base_count = 0x00; msc815x_dma_buffer_md_config.high_dim[2].offset = 0x00; msc815x_dma_buffer_md_config.high_dim[2].count = 0x00;    msc815x_dma_buffer_md_config.buffer_dim = DMA_BUFF_DIM_1; msc815x_dma_buffer_md_config.cont_dim = DMA_BUFF_CONT_DIM_1; msc815x_dma_buffer_md_config.freeze_dim = DMA_BUFF_FRZ_DIM_1; msc815x_dma_buffer_md_config.interrupt_dim = DMA_BUFF_INT_DIM_1; msc815x_dma_buffer_md_config.mask_requests_dim = DMA_BUFF_MR_DIM_1;        status = osMmuDataVirtToPhys(dest, (void**)&phys_addr);    OS_ASSERT_COND(status == OS_SUCCESS);     msc815x_dma_buffer_config.address = (uint32_t) phys_addr;    msc815x_dma_buffer_config.size = 0x2000;    msc815x_dma_buffer_config.interrupt = TRUE;    msc815x_dma_buffer_config.md = msc815x_dma_buffer_md_config;     status = msc815xDmaChainBufferAdd(dma_chain_handler, &msc815x_dma_buffer_config, DMA_WRITE);    OS_ASSERT_COND(status == OS_SUCCESS);        /* Bind the chain */    status = osDmaChannelBind(dma_channel_handler, dma_chain_handler);    OS_ASSERT_COND(status == OS_SUCCESS);    #ifdef ENABLE_CLASS_PROFILING   {       msc815x_class_profiling_param_t msc815x_class_profiling_param;       msc815x_class_profiling_param = CLASS_PROFILE_INIT;       msc815x_class_profiling_param.profile_port = DMA_PORT_TO_PROFILE;       msc815x_class_profiling_param.profiling_type = INITATOR_BW;       status = msc815xConfigureClassProfiling(&msc815x_class_profiling_param);       OS_ASSERT_COND(status == OS_SUCCESS);   }#endif      return status;}

I use the parameters find inr the MSC8156 RM for the 2 dimensional buffer.

 

Is there an exemple show how using the DMA with multidimesional buffers ?

0 项奖励
5 回复数

842 次查看
AndrewinApps
Contributor IV

Hello Jim95,

 

Yes, we do have an example showing multidimensional DMA in SDOS (see attached zip file which includes a few PPT slides regarding this).

This example project is for 8157, but the DMA is the same as in MSC8156, so the example still applies.

 

Please let me know when you've downloaded the attachment so I can remove it from the post.

 

(Attachment removed.) 

0 项奖励

842 次查看
didib
Contributor I

Can you upload the DAMA example again?

 

Thanks!

0 项奖励

842 次查看
Jim95
Contributor III

Thank you Andrew I have downloaded it

0 项奖励

842 次查看
MBharath
Contributor I

Hi,


   I have a similar problem with dma transfer. I want to transfer a 2 dimentional array to a 2 dimentional array. Both the arrays are 2 Dimentional. Please let me know how a 2 dimentional transfer can be done using DMA.
  
   Please let me know whether skipping of some data in each row of source array of a 2 dimentional buffer can be tranfered to destination which may be 1 or 2 dimentional.
  
   Please let me know where i can find an example for 2 dimentional dma transfer.
  
Thanks and Regards,
Bharath M

0 项奖励

842 次查看
Jim95
Contributor III

The code example I give in my fisrt message is correct but I had a problem with the cache.

Maybe you just have to flush the cache to complete the transfer

0 项奖励