LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   memory allocation, application<-->driver (https://www.linuxquestions.org/questions/programming-9/memory-allocation-application-driver-799/)

charlies 02-07-2001 03:37 PM

Can I use malloc() to allocate memory that will be accessed by a driver ? I want to have my application allocate blocks memory, and then pass the address's to a driver. The driver will dma to/from the memory and notify the application when it is done. The memory blocks will be a little over 64k in length. So, can malloc() allocate suitable memory, and is there a call the driver can make to get the physical address for the dma ?

thanks,

cs

vici 03-03-2001 09:54 PM

xmalloc()
 
xmalloc() (the x could be f for far mem alloc)returns a void pointer so can be cast to whatever.
This pointer is I believe to an array of mem that can be addressed by incrementing pointers by sizeof(type cast) returned mem length be it char, word, dword, long double etc.. If this is what you ask I imagine that accessing mem would be as easy as doing pointer math. (address returned) + sizeof() to next address. Or back again.
I hope this helps

vici 03-03-2001 11:26 PM

A note that the driver is probably outside process space so that the memory may have to be declared globaly.

[Edited by vici on 03-04-2001 at 12:28 AM]


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