I am writing a driver for a PCI card supporting DMA transfers.
I allocate a buffer (contiguous in physical memory) for the DMA with the following instruction :
vaddr = mmap(0,16*1024,PROT_READ|PROT_WRITE|PROT_NOCACHE,MAP_PHYS|MAP_ANON,NOFD,0);
Then I get the physical address paddr and pass it to the DMA controller :
It Works fine, but my problem is that the driver’s client
already allocate the buffer with a simple variable declaration :
Is there any way to know if MyBuff is contiguous in physical memory ?
If MyBuff is not contiguous in Physical memory, is it possible
to know the physical address and length of each block ?
(My idea is to implement the DMA scatter/gather mode)
Thank You All for your help.