Driver to allow DMA from user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I want to use DMA from userspace.

I already use dma in kernel, and now I want can create a character
device which will be responsible for this.

The only problem is that I want to use the same memory which was
allocated in kernel with dma_alloc_coherent.

Is it correct to use mmap in order to use the phsyical memory which
was allocated with dma_alloc_coherent ?

If it's that simple it can be surely helpful, and the simple driver
which wraps dma_alloc_coherent can do the job for dmaing from
userspace.

In kernel:

dma_buffer_info->buf_info[i].virtAddr = (uint8_t *)dma_alloc_coherent(

                &ti667x_pci_dev[dev_id]->dev,

                dma_buffer_info->buffer_size,

                (dma_addr_t *)&dma_buffer_info->buf_info[i].pcieAddr,

                GFP_KERNEL);

In userspace:

buf_desc[i].virtAddr = mmap(0,

            size_of_buffer,

            PROT_READ | PROT_WRITE,

            MAP_SHARED,

            pcie_drv_inst[dsp_id].dev_desc,

            buf_desc[i].pcieAddr);

Thanks,
Ran

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux