[ELDK] R: Userland memory access

Luigi Rizzi rizzi at algorab.com
Mon Oct 11 18:22:01 CEST 2010


I implemented the entry point in my driver and  from user-land with the
pointer returned from mmap() I can access my SRAM. Unfortunately, every time
I try to write I have an "EMT trap". Actually, sometimes I have  this error
also reading...

Have you got any idea about this misbehave?

Luigi

  


-----Messaggio originale-----
Da: Stefano Babic [mailto:sbabic at denx.de] 
Inviato: martedì 5 ottobre 2010 16.58
A: Luigi Rizzi
Cc: eldk at lists.denx.de
Oggetto: Re: [ELDK] Userland memory access

Luigi Rizzi wrote:
> Hello,
> 
> I connected an external SRAM to my TQM885D module. In the driver I'm
> writing, with the virtual address returned by ioremap(), I can access
> the memory locations with readb/writeb functions and also with direct
> access.
> 
> It's possible to map this kernel virtual space also in a user land
> process?

Of course. You need to implement the mmap entry point in your driver, as
the framebuffer drivers are usual to do. Your application in user space
needs only to call mmap() after opening your driver and use the returned
pointer to access your SRAM.

See more info with "man mmap". You find a lot of examples in kernel how
to write the mmap entry point.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================



More information about the eldk mailing list