From 09ffd9de1e7192b1888ddfa76b1055b79e0a70f7 Mon Sep 17 00:00:00 2001 From: occheung Date: Fri, 3 Sep 2021 16:05:58 +0800 Subject: [PATCH] dma: fix timestamp fetch --- artiq/firmware/ksupport/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 227816049..73bc3d284 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -329,7 +329,7 @@ unsafe fn dma_record_output_prepare(timestamp: i64, target: i32, #[unwind(aborts)] extern fn dma_record_output(target: i32, word: i32) { unsafe { - let timestamp = *(csr::rtio::NOW_HI_ADDR as *const i64); + let timestamp = ((csr::rtio::now_hi_read() as i64) << 32) | (csr::rtio::now_lo_read() as i64); let data = dma_record_output_prepare(timestamp, target, 1); data.copy_from_slice(&[ (word >> 0) as u8, @@ -345,7 +345,7 @@ extern fn dma_record_output_wide(target: i32, words: CSlice) { assert!(words.len() <= 16); // enforce the hardware limit unsafe { - let timestamp = *(csr::rtio::NOW_HI_ADDR as *const i64); + let timestamp = ((csr::rtio::now_hi_read() as i64) << 32) | (csr::rtio::now_lo_read() as i64); let mut data = dma_record_output_prepare(timestamp, target, words.len()); for word in words.as_ref().iter() { data[..4].copy_from_slice(&[