[ELDK] Userland memory access

Stefano Babic sbabic at denx.de
Tue Oct 5 16:58:25 CEST 2010


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