-   Programming (
-   -   memory allocation, application<-->driver (

charlies 02-07-2001 04: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 ?



vici 03-03-2001 10:54 PM

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-04-2001 12:26 AM

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 10:39 AM.