Hi Stefano, > 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.
Please note that with recent kernels (containing git commit-id dd02b67d5e9e7896891fa27eb5db65f55a290998, i.e. v2.6.36-rc2 and up) we can use such external memory which has been setup by firmware correctly with "only standard drivers". One example is the MRAM on the PDM360NG dts file[1] starting in line 118. This uses the CONFIG_MTD_PHYSMAP_OF, CONFIG_MTD_PHYSMAP, CONFIG_MTD_PLATRAM combo. Note that this setup even allows us to divide such an address space in multiple partitions with potentially differing access rights. I find the latter especially smart as it can be used to isolate un-cooperative software widely seen in the industrial field. Cheers Detlev [1] http://git.denx.de/?p=linux-2.6-denx.git;a=blob;f=arch/powerpc/boot/dts/pdm360ng.dts -- You get 3 opportunities to advertise your Rock band, no more. -- Proposed Symbolics guidelines for mail messages (1984) -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: [email protected] _______________________________________________ eldk mailing list [email protected] http://lists.denx.de/mailman/listinfo/eldk
