question about writing to memory directly from user space in Linux

Fillod Stephane stephane.fillod at thomson.net
Wed Mar 23 21:36:03 EST 2005


Vijay Padiyar wrote:
>I am running Linux 2.6.10 on an MPC8260 target. We have an I2C
controller
>that is part of our application code. In VxWorks, we could address the
>MPC8260 I2C memory registers directly from application space and so
this was
>not a problem.

The I2C abstraction layer of Linux is very good, and user-land support
quite comfortable. Why bother port/develop a new driver? Besides, 
interrupt handling in user-space can be troublesome..

>Can you suggest some kind of a "synchronization" function which I can
call
>from *user space* which will ensure that all values written to mmaped
memory
>locations from user space are actually flushed to their physical
locations?
>I think this might be a potential problem with my code.

Please have a look at Denx's FAQ for accessing memory bus:

 
http://www.denx.de/twiki/bin/view/PPCEmbedded/DeviceDrivers#Section_Acce
ssingPeripheralsFromUserSpace
or shorter: http://tinyurl.com/6c7th

Depending on the O_SYNC flag passed to open, the mmap'ed memory will be
accessed through non guarded cache or not. See linux/drivers/char/mem.c.
The ppc instruction "eieio" deals with I/O ordering.


Regards,
-- 
Stephane




More information about the Linuxppc-embedded mailing list