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.

streaming dma setup question.



I’m trying to understand the steps involved with streaming dma on my am335x. I have done this before on a pci based system so I have some experience.

What I don't understand is what to set the  struct device * dev argument to be in the following system call..

dma_addr_t dma_map_single (struct device * dev, void * cpu_addr, size_t size, enum dma_data_direction dir);  

also required in dma_set_coherent_mask(), dma_alloc_coherent(), dma_sync_single_for_cpu() etc..

On the pci system I just called pci_find_device() with the required attributes and the equivalent pci_dev structure was filled in. Does anyone know how it works

on this system.

 

Thanks,

Adrian H

 

  • Hi Adrian,

    There is a "DMA-API.txt" file that comes with the kernel.  It is in the "Documentation" directory at the root of the Linux kernel which provides some additional description of the DMA API.  there is also a DMA-API-HOWTO.txt

    Another source for an overview can be found here: http://free-electrons.com/doc/dma.pdf

  • Hello Jeff,

    Thankyou for your help. I understand all the steps in DMA-API.txt and have implemented them succesfully in the past on a PCI based system.

    My specific question was regarding the 'device structure' which on pci, usb etc.. is populated at the bus level with all the info needed by a subsequent device driver.

    What I have finally done is to set set the *dev pointer to null for all cases where it's needed instead of a valid pointer to a specific driver framework and it works fine.

    This is not explained anywhere in any of the documentation that I have  come across to date.

    Thanks,

    Adrian