DMA

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello,

I am trying to figure out how to make a program from user land that can
use the DMA controller.  I would like it to read values, returned from
the SPI port, and store the values in the SDRAM.  Can this be done?

I have figured out that I need to use a physical address when
programming the DMA controller, not a virtual address such as is used in
application programs.  Is there a way to find the physical address from
the virtual address?

Thanks in advance to anyone who can help.

BJ

Re: DMA

Quoted text here. Click to load it

You're question is rather vauge, but I think what you need to
do is write a device driver that does the DMA to/from a buffer.
That device driver can then allow the user-program to mmap()
the DMA buffers into user-space.

--
Grant Edwards                   grante             Yow!  AIEEEEE! I am having
                                  at               an UNDULATING EXPERIENCE!
We've slightly trimmed the long signature. Click to see the full one.
Re: DMA

Quoted text here. Click to load it
Thank you for the reply.

That sounds like what I had anticipated I would have to do but I don't
know how to go about it.

Does anyone have a sample program that I could follow?

BJ

Re: DMA
Quoted text here. Click to load it

Here's a demo I did many years ago that sort of does that:

ftp://ftp.visi.com/users/grante/stuff/demomm.tar.gz

It supports mmapping a PCI card's memory region into user
space, as well as a "scratch" buffer that can be used for DMA.
It's 5 years old, and hasn't been touched since kernel 2.2.  I
suspect that the kernal API has changed so much it's worthless.

--
Grant Edwards                   grante             Yow!  -- In 1962, you could
                                  at               buy a pair of SHARKSKIN
We've slightly trimmed the long signature. Click to see the full one.
Re: DMA
Bus master DMA (e.g. by a PCI card) or using a DMA utility in the
Motherboard or processor.

If (2) you need to find out a free controller and reserve same for your
driver.

Generally it's not a good idea at all to try to do any DMA related work
in userland. You should do a device driver and call that from you
program, providing userland addresses for the buffer and then ave the
driver do the work.

-Michael

Site Timeline