sarfata/pi-blaster — pull request #1 by petiepooo (2013-03-04 03:57:52+00:00)
Title: Open peripheral mappings with O_SYNC flag

General practice seems to be to open the peripheral /dev/mem mappings with O_SYNC so that writes to the raw memory addresses are not cached on ARM chips.

This did not seem to break the previous incarnation, but under heavy IO loads, it's possible that changes to pulse lengths would be delayed until writes to the peripheral devices' regisers are flushed out of the CPU cache into physical memory. With this flag, the writes don't return until they've been written to the peripheral registers, rather than the CPU cache. This may allow relaxing the timing between the steps taken when configuring the peripherals.

Note that this has no bearing on the writes DMA is performing, as the DMA engine does not use the CPU cache, and does its work directly on the physical memory.

See comment in http://www.denx.de/wiki/bin/view/PPCEmbedded/DeviceDrivers section 11.13. Also search for O_SYNC in https://projects.drogon.net/raspberry-pi/wiringpi/ and http://elinux.org/RPi_Low-level_peripherals.