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 burst in Linux user space

I am posting this solution to a problem I was having with the DMA usage from within Linux user space. 

The DMA transfer were not working until I obtained the actual physical address to hand to the DMA registers, rather than the memory mapped virtual space provided by a standard Linux allocation to user space.  I wound up doing some thing like this:

  CMEM_AllocParams cmem_params;
  cmem_params.type = CMEM_POOL;
  cmem_params.flags = CMEM_NONCACHED;

//Initialize the Contiguous memory pool

  ret = CMEM_init();

//Get some memory

  unsigned *src_addr = (unsigned *)CMEM_alloc(BUF_SIZE, &cmem_params);
  unsigned *dest_addr = (unsigned *)CMEM_alloc(BUF_SIZE, &cmem_params);
   SCPY_AddrParams src = {OMAP_DMA_AMODE_POST_INC,(unsigned)src_addr,0,0};
  SCPY_AddrParams dest = {OMAP_DMA_AMODE_POST_INC,(unsigned)dest_addr,0,0};

  for(i=0;i < ((int)BUF_SIZE / 4);i++) {
    src_addr[i]   = 0xC0FFEE00;            //Put some data in
    dest_addr[i]  = 0;                                // Clear the destination so I'll know if the transfer worked
  }
 
  uint8_t* srcMem;
  uint8_t* destMem;

  srcMem = (uint8_t*)src_addr;
  destMem = (uint8_t*)dest_addr;

//GET THE PHYSICAL ADDRESS
  uint32_t  physicalSource = (uint32_t)CMEM_getPhys((void *)(src_addr));
  uint32_t  physicalDest = (uint32_t)CMEM_getPhys((void *)(dest_addr));
 

//Now do the DMA burst - (fyi, asicDma.BurstWrite(...) is my implementation where I configure and trigger the DMA much like what is shown in the

//TRM
  asicDma.BurstWrite(physicalSource, physicalDest,16, 16, 8);