From 05e161431368e0efe6c2a35a920a54a588c7f99e Mon Sep 17 00:00:00 2001 From: pca006132 Date: Thu, 6 Aug 2020 11:11:32 +0800 Subject: [PATCH] runtime/kernel: fixed duration bug. Fixes #89. --- src/runtime/src/kernel/dma.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/src/kernel/dma.rs b/src/runtime/src/kernel/dma.rs index 4827f34..b5a79bb 100644 --- a/src/runtime/src/kernel/dma.rs +++ b/src/runtime/src/kernel/dma.rs @@ -56,7 +56,7 @@ pub extern fn dma_record_start(name: CSlice) { } } -pub extern fn dma_record_stop(_: i64) { +pub extern fn dma_record_stop(duration: i64) { unsafe { if RECORDER.is_none() { artiq_raise!("DMAError", "DMA is not recording") @@ -68,8 +68,10 @@ pub extern fn dma_record_stop(_: i64) { library.rebind(b"rtio_output_wide", rtio::output_wide as *const ()).unwrap(); + let mut recorder = RECORDER.take().unwrap(); + recorder.duration = duration; KERNEL_CHANNEL_1TO0.lock().as_mut().unwrap().send( - Message::DmaPutRequest(RECORDER.take().unwrap()) + Message::DmaPutRequest(recorder) ); } }