Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-07-2001, 04:37 PM   #1
LQ Newbie
Registered: Feb 2001
Posts: 5

Rep: Reputation: 0

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 ?


Old 03-03-2001, 10:54 PM   #2
LQ Newbie
Registered: Mar 2001
Location: Washington
Posts: 2

Rep: Reputation: 0
Smile 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
Old 03-04-2001, 12:26 AM   #3
LQ Newbie
Registered: Mar 2001
Location: Washington
Posts: 2

Rep: Reputation: 0

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]


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
memory allocation gecoool Programming 2 10-24-2005 10:47 AM
Help - memory allocation in C zaichik Programming 3 09-04-2005 11:16 AM
memory allocation docGonzo2000 Linux - General 1 05-16-2003 10:24 PM
memory allocation docGonzo2000 Linux - General 1 05-16-2003 10:22 PM
memory allocation. raven Programming 5 09-08-2002 02:50 PM > Forums > Non-*NIX Forums > Programming

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration