Messages in this thread | | | From | "Stephen C. Tweedie" <> | Date | Fri, 17 Mar 2000 14:15:17 +0000 (GMT) | Subject | Re: 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/
| |