In the EtherCAT protocol stack included with the IDK, this code is often seen:
tiescbsp.c 1232:
ASSERT_DMB
ASSERT_DSB
From ARM's "Barrier Litmus Tests and Cookbook" page 6:
The DSB instruction is a special memory barrier, that synchronizes the execution stream with memory accesses.
The DSB instruction takes the required shareability domain and required access types as arguments.
If the required shareability is Full system then the operation applies to all observers within the system. A DSB
behaves as a DMB with the same arguments, and also has the additional properties defined here.
---
What is the rationale for the extra DMB instruction seen here?
From what I can see, in every case DSB provides the same behavior as a DMB, so the DMB is superfluous. Further, in many cases, the code is observing memory only, so a DMB would appear to be sufficient.
Finally, the use of function-like macros (e.g. ASSERT_DSB) without parenthesis is a bit jarring to my eyes. ASSERT_DSB -- if not for the name -- looks like a literal.