On Fri, Feb 5, 2016 at 11:15 AM, Denis Kirjanov <kirjanov@xxxxxxxxx> wrote: > On 2/5/16, Ran Shalit <ranshalit@xxxxxxxxx> wrote: >> Hello, >> >> I read the readme about dma API, but still don't understand how it >> should be used >> It is said that dma_alloc_coherent is responsible for allocating the >> buffer. > >> >> 1. But how to trigger the dma transaction to start ? >> 2. Is there a callback when it is finished ? > > It's used for data transfer between IO device and system memory. You > allocate a kernel buffer for DMA transaction (in this case dma from > device to system memory) and setup your device for dma transfer. An IO > device usually generates an interrupt when DMA transfer completes. > Denis If I understand correctly the full picture how to use dma is as following (schematics): buf = dma_alloc_coherent(); <<-- done once at the lifetime every time we need to trigger dma: //start transaction now writeb(buf, DMA_ADDR) <<- juat an example, actually it is totally depends on dma device writeb(START_DMA, DMA_ADDR+2) <<- juat an example, actually it is totally depends on dma device //usually we also register on irq for callback on finishing the transaction. hope I got it all correct, if you have any comments please add. Thanks, Ran _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies