You are correct, reading and writing to /dev/mem, does not grant exclusive access.AFAIK this does not grant exclusive access, so another user process or device driver could access the same registers. However, this is out of my control. The datasheet warning about out-of-order access seems to apply only to sequential instructions in the same thread, which I can control.
But you are mistaken about the datasheet. The peripherals have no concept of software threads, so how are they to differentiate? The datasheet assumes that you have taken whatever steps are required to serialize access to the hardware registers and what they refer to as "peripheral service code". When they say "first write to a peripheral" and "last read of a peripheral" they mean that globally, not just within a single thread.
Statistics: Posted by warthog618 — Tue Jan 23, 2024 4:56 am