fix (workaround) drtioaux packets being corrupted #176

Merged
sb10q merged 3 commits from mwojcik/artiq-zynq:fix_drtio_corruption into master 2022-04-01 14:15:14 +08:00
Showing only changes of commit 6d47f4ac7e - Show all commits

View File

@ -3,6 +3,7 @@ use crc;
use core_io::{ErrorKind as IoErrorKind, Error as IoError};
use io::{proto::ProtoRead, proto::ProtoWrite, Cursor};
use libboard_zynq::{timer::GlobalTimer, time::Milliseconds};
use libcortex_a9::asm::dmb;
use crate::mem::mem::DRTIOAUX_MEM;
use crate::pl::csr::DRTIOAUX;
use crate::drtioaux_proto::Error as ProtocolError;
@ -62,10 +63,10 @@ pub fn copy_work_buffer(src: *mut u32, dst: *mut u32, len: isize) {
// and AXI burst reads/writes are not implemented yet in gateware
// thus the need for a work buffer for transmitting and copying it over
unsafe {
for i in (0..(len/4)).step_by(2) {
//mix offsets to prevent bursts
*dst.offset(i+1) = *src.offset(i+1);
for i in 0..(len/4) {
*dst.offset(i) = *src.offset(i);
//data memory barrier to prevent bursts
Outdated
Review

I think the compiler is allowed to reorder those, unless the memory is marked as volatile.

I think the compiler is allowed to reorder those, unless the memory is marked as volatile.
dmb();
}
}
}