Using /dev/mem
From Buici
For situations where system software needs to access hardware resources and there isn't time or a practical justification for writing a driver, the /dev/mem<//tt> give user-mode applications access to the physical address space of the machine.
There is an example application on the net called <tt>devmem2.c that gives some guidance in using /dev/mem, but it doesn't elaborate on some important details.
- When choosing a seek address for the memory mapped region, the address must be page aligned. On ARM this means that the address must be a multiple of 4KiB, 0x1000.
- Writes to the memory region will not be performed immediately unless the O_SYNC flag is set when opening the file handle.
If you are having trouble finding devmem2.c, that and another small sample program are available by ftp, ftp://ftp.buici.com/pub/arm/devmem.
---Elf 17:39, 6 April 2006 (PDT)

