Skip to content

Commit f1dc58d

Browse files
authored
cpu_interface: use dmb() on ARM to avoid unsupported AXI bursts
1 parent 7242dc5 commit f1dc58d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

misoc/integration/cpu_interface.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,13 @@ def _get_rw_functions_rs(reg_name, reg_base, size, nwords, busword, read_only, c
202202
r += " pub unsafe fn "+reg_name+"_read() -> "+rstype+" {\n"
203203
if nwords > 1:
204204
r += " let r = read_volatile("+rsname+") as "+rstype+";\n"
205+
r += " #[cfg(target_arch = \"arm\")]"
206+
r += " dmb();\n"
205207
for word in range(1, nwords):
206208
r += " let r = r << "+str(busword)+" | " + \
207209
"read_volatile("+rsname+".offset("+str(word*(cpu_dw_bytes//4))+")) as "+rstype+";\n"
210+
r += " #[cfg(target_arch = \"arm\")]"
211+
r += " dmb();\n"
208212
r += " r\n"
209213
else:
210214
r += " read_volatile("+rsname+") as "+rstype+"\n"
@@ -242,7 +246,11 @@ def get_csr_rust(regions, groups, constants, cpu_dw_bytes=4):
242246
r += "\n"
243247
r += " pub mod "+name+" {\n"
244248
r += " #[allow(unused_imports)]\n"
245-
r += " use core::ptr::{read_volatile, write_volatile};\n\n"
249+
r += " use core::ptr::{read_volatile, write_volatile};\n"
250+
r += " #[cfg(target_arch = \"arm\")]"
251+
r += " #[allow(unused_imports)]\n"
252+
r += " use libcortex_a9::asm::dmb;\n"
253+
r += "\n"
246254
for csr in obj:
247255
nwords = (csr.size + busword - 1)//busword
248256
r += _get_rw_functions_rs(csr.name, origin, csr.size, nwords, busword,

0 commit comments

Comments
 (0)