examples of using DMA?

bridged with qdn.public.qnxrtp.applications
Post Reply
Guest

examples of using DMA?

Post by Guest » Fri Jun 21, 2002 4:46 pm

I have an application where I need to write data to memory
from a file, and then rapidly read that data back and write it
to a couple of D/A converters to control a couple of
galvanometers. My thought was to use DMA transfers
to accomplish this.

Can anyone provide information or examples showing:
How reserve and map to a chunk of memory for DMA purposes
How to access it
etc?

thanks!

Bruce Gilland

David Gibbs

Re: examples of using DMA?

Post by David Gibbs » Mon Jun 24, 2002 9:27 pm

gilland@cs.colorado.edu wrote:
I have an application where I need to write data to memory
from a file, and then rapidly read that data back and write it
to a couple of D/A converters to control a couple of
galvanometers. My thought was to use DMA transfers
to accomplish this.

Can anyone provide information or examples showing:
How reserve and map to a chunk of memory for DMA purposes
How to access it
etc?
Take a quick look at the docs for mmap() and mem_offset().
mmap() will allow you to allocate DMA safe memory. mem_offset()
will allow you to get the physical address of the DMA safe
memory you allocated, for handing off to the DMA controller.

It sounds like the transfer from file to memory, could be a
read() call, passing the buffer as your DMA safe memory,
then using DMA to pass your memory to your D/A convertors.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Carlos Beltran

Re: examples of using DMA?

Post by Carlos Beltran » Tue Jun 25, 2002 9:04 am

Your hardware should have a DMA controller. Then it is a matter of passing
the physical address of your memory to the controller and he will do the
work. You should check your DMA controller and see how to control it. Well,
it is not that easy but more or less this is the idea.
David already gave you the fucntions to obtain the memory space and the
physical pointers....

Carlos.

<gilland@cs.colorado.edu> wrote in message
news:3d135846.9836824@inn.qnx.com...
I have an application where I need to write data to memory
from a file, and then rapidly read that data back and write it
to a couple of D/A converters to control a couple of
galvanometers. My thought was to use DMA transfers
to accomplish this.

Can anyone provide information or examples showing:
How reserve and map to a chunk of memory for DMA purposes
How to access it
etc?

thanks!

Bruce Gilland

Guest

Re: examples of using DMA?

Post by Guest » Tue Jun 25, 2002 1:18 pm

Thanks David and Carlos,

Will give it a shot ....

On 24 Jun 2002 21:27:44 GMT, David Gibbs <dagibbs@qnx.com> wrote:
gilland@cs.colorado.edu wrote:
I have an application where I need to write data to memory
from a file, and then rapidly read that data back and write it
to a couple of D/A converters to control a couple of
galvanometers. My thought was to use DMA transfers
to accomplish this.

Can anyone provide information or examples showing:
How reserve and map to a chunk of memory for DMA purposes
How to access it
etc?

Take a quick look at the docs for mmap() and mem_offset().
mmap() will allow you to allocate DMA safe memory. mem_offset()
will allow you to get the physical address of the DMA safe
memory you allocated, for handing off to the DMA controller.

It sounds like the transfer from file to memory, could be a
read() call, passing the buffer as your DMA safe memory,
then using DMA to pass your memory to your D/A convertors.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Post Reply

Return to “qdn.public.qnxrtp.applications”