Read in /dev/port with Segmentation Fault

scarayol at assystembrime.com scarayol at assystembrime.com
Thu Jun 9 20:05:51 EST 2005


Dear Stéphane,

Yes i remember your mail about /dev/mem access. But, I never succeed to
read or write physical memory with reliability so i wrote a driver and use
ioremap inside  intead of mmap (before i put all the needed memory on IO
memory with the boot command "mem=xM" and then it works. So, i think i have
some problems with "mmap"  :-).
I think my .../char/mem.c is OK for mmap support.
Why is it necessary to use size+ofs_addr for size and page_addr instead of
physaddr, i thought mmap( ) do it itself ?

Thank you for your help.

Kenavo.

Sophie.




                                                                                                                                                    
                    "Fillod Stephane"                                                                                                               
                    <stephane.fillod at th        Pour :  <scarayol at assystembrime.com>                                                                 
                    omson.net>                 cc :    <linuxppc-embedded at ozlabs.org>                                                               
                                               Objet :      RE: Réf. : Re: Read in /dev/port with Segmentation  Fault                               
                    09/06/05 11:35                                                                                                                  
                                                                                                                                                    
                                                                                                                                                    



Sophie CARAYOL wrote:
>Another question, if i use mmap to map physical addresses of I/O
registers,
>could i dereference the pointer on virtual adresse to access data or
should
>i use read/write on the file descriptor ?

Yes, you can dereference the pointer.
Don't you remember my past mail?

>From the Denx's FAQ (TFQ hits the list monthly) for accessing memory bus:

http://www.denx.de/twiki/bin/view/PPCEmbedded/DeviceDrivers#Section_AccessingPeripheralsFromUserSpace

or shorter: http://tinyurl.com/6c7th

See linux/drivers/char/mem.c to check if mmap support is ok on your arch.

Kenavo
--
Stéphane








More information about the Linuxppc-embedded mailing list