Jimmy Schroeder

Multidimensional DMA transfer

Discussion created by Jimmy Schroeder on Sep 19, 2011
Latest reply on Dec 25, 2011 by David Bezaleli

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 ?

Outcomes