LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Advice on how to map very large buffers & obtain addresses for processor and dma (https://www.linuxquestions.org/questions/linux-newbie-8/advice-on-how-to-map-very-large-buffers-and-obtain-addresses-for-processor-and-dma-4175491960/)

ManteoBob 01-20-2014 08:48 PM

Advice on how to map very large buffers & obtain addresses for processor and dma
 
I am a new to linux and would like to use linux in a data acquisition application. I would like to have a very large buffer area that is filled directly by the d/a dma controller. Once the buffer is full, the acquisition is over and the application will write the data to disk. If done properly, I would think that the processor would be near idle w/ the dma controllers for the d/a & disk doing most of the work.

I think I would like to reserve a pile of (high?) memory and map them via hugetlbs via parameters to the linux load line. This should allow the application to efficiently access this area (?). I have access to the d/a driver and expect I should be able to convert the virtual address from the application to something useful for the dma hardware. It is unclear to me if virt_to_phys() is appropriate.

Comments & suggestions on how implement this is greatly appreciated.

smallpond 01-21-2014 04:28 PM

Can your dma controller handle scatter-gather lists? If so, then just allocate huge pages, push them into an sg list and call dma_map_sg to map the phys addr. If not, then you need to allocate contiguous physical memory. You can create huge pages with sysctl shortly after boot (before memory is fragmented), you don't need to do it on the kernel command line.

https://www.kernel.org/doc/Documenta...-API-HOWTO.txt
http://www.linuxjournal.com/node/7104/print

ManteoBob 01-21-2014 05:01 PM

I now have a direction and lots to read before the next question. Thanks for the quick reply smallpond!


All times are GMT -5. The time now is 07:07 PM.