lkml.org 
[lkml]   [2000]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: DMA to user space
Hi,

On Wed, 15 Mar 2000 17:12:16 -0500, John Wilson <wilson@dbit.dbit.com>
said:

> I hope I'm asking this in the right place, flame away if not! :-)
> I'm writing a driver for a strange DMA device and I would like to be able
> to do DMA directly into the user's buffer. Is this possible?

Yes. In 2.3, look at the the raw IO code in drivers/char/raw.c. It
uses the "kiobuf" mechanism to locate the "struct page *"s associated
with an arbitrary user buffer: map_user_kiobuf() does all the hard
work. The driver can then use those pages in any way it wants.

> So, is it as simple as requiring the user to mlock() the buffer and then
> using virt_to_bus to get the page addresses? Or is it more complicated, or
> just totally hopeless?

It's a bit more complex than that, but map_user_kiobuf() takes care of
it. There's a version for 2.2 if you want it.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [from the cache]
©2003-2011 Jasper Spaans