mapping externally allocated Scatter Gather DMA buffers

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

 



Hi,

I have been wondering how to interface a Scatter Gather region as a DMA
buffer for an Audio Grabbing device.
The device is a NOC type device, similar to a SOC, the audio grabber is a
part of it, for realizing the audio
capabilities on the device.

The hardware DMA is mostly a Scatter Gather based engine, and it can be
described thus, briefly.

struct dmabuf {
    void *vmalloc;
    dma_addr_t phys;
    void *virt;
    int pages;
    int offset;
    struct scatterlist *sg_list;
    struct list_head list;
};

where:

dmabuf->virt = __get_free_page(GFP_KERNEL);
dmabuf->phys = dma_map_single(dev, PAGE_SIZE, DMA_FROM_DEVICE);
dmabuf->sg_list = kzalloc(sizeof (struct scatterlist) * pages, GFP_KERNEL);
sg_init_table(sg_list, pages);
dmabuf->vmalloc = vmalloc((pages + 1) * PAGE_SIZE);

In a loop with the pages involved, I do populate the pages into the list;


Now I have a stream engine with the hardware, where 8 such dmabufs are
allocated. On an interrupt, the device
can know from status registers, which dmabuf the device driver needs to read
the data from.

I wonder what would be the best possible way to interface the stream engine
to the Alsa DMA capture engine.
I have been eyeballing the alsa sources and whatever documents that are
available, but found very little details
on the alsa core, but nevertheless found that, it might be possible to pass
the vmalloc'd region to
substream->runtime->dma_area. I wonder whether this is possible practically
and would like to hear your
comments on it, whatever feedback, or ideas you have.

Any helpful comments appreciated very much.

Thanks,
Manu
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux