linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* mmap() problem in own driver
@ 2009-07-13  7:00 Sauce.Cheng
  2009-07-13 14:30 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Sauce.Cheng @ 2009-07-13  7:00 UTC (permalink / raw)
  To: linuxppc-dev


Hi everyone
there is a problem of my own driver

I want to get data from kernel space to user space indirectly using mmap()
but i dont know how I can do , anyone can give me some advices ?

firstly, fetch data by DMA to a memory allocated by "kmalloc"
then i want to mmap it to user space and save the data as a file 

Cheers everyone~
Martin
-- 
View this message in context: http://www.nabble.com/mmap%28%29-problem-in-own-driver-tp24457031p24457031.html
Sent from the linuxppc-dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mmap() problem in own driver
  2009-07-13  7:00 mmap() problem in own driver Sauce.Cheng
@ 2009-07-13 14:30 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2009-07-13 14:30 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Sauce.Cheng

On Monday 13 July 2009, Sauce.Cheng wrote:

> I want to get data from kernel space to user space indirectly using mmap()
> but i dont know how I can do , anyone can give me some advices ?
> 
> firstly, fetch data by DMA to a memory allocated by "kmalloc"
> then i want to mmap it to user space and save the data as a file 

You first need to allocate full pages, e.g. using alloc_pages() instead
of kmalloc, which may not be aligned. To get a streaming mapping on
that memory, use dma_map_single(), which returns a DMA address you 
can pass to the device.
For user space access, the easiest is to have a character device,
which uses an mmap() file operation that calls remap_pfn_range()
on the page_to_pfn(pages).

	Arnd <><

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-13 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13  7:00 mmap() problem in own driver Sauce.Cheng
2009-07-13 14:30 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).