We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57133ee commit 72c42f8Copy full SHA for 72c42f8
samd/sam_d5x_e5x/cache.c
@@ -28,9 +28,18 @@
28
29
// Turn off cache and invalidate all data in it.
30
void samd_peripherals_disable_and_clear_cache(void) {
31
+ // Memory fence for hardware and compiler reasons. If this routine is inlined, the compiler
32
+ // needs to know that everything written out be stored before this is called.
33
+ // -O2 optimization showed this was necessary.
34
+ __sync_synchronize();
35
+
36
CMCC->CTRL.bit.CEN = 0;
37
while (CMCC->SR.bit.CSTS) {}
38
CMCC->MAINT0.bit.INVALL = 1;
39
40
+ // Memory fence for hardware and compiler reasons. Testing showed this second one is also
41
+ // necessary when compiled with -O2.
42
43
}
44
45
// Enable cache
0 commit comments