runtime/kernel: fixed duration bug.

Fixes #89.
rtio
pca006132 2020-08-06 11:11:32 +08:00
parent 323191b9fc
commit 05e1614313
1 changed files with 4 additions and 2 deletions

View File

@ -56,7 +56,7 @@ pub extern fn dma_record_start(name: CSlice<u8>) {
} }
} }
pub extern fn dma_record_stop(_: i64) { pub extern fn dma_record_stop(duration: i64) {
unsafe { unsafe {
if RECORDER.is_none() { if RECORDER.is_none() {
artiq_raise!("DMAError", "DMA is not recording") artiq_raise!("DMAError", "DMA is not recording")
@ -68,8 +68,10 @@ pub extern fn dma_record_stop(_: i64) {
library.rebind(b"rtio_output_wide", library.rebind(b"rtio_output_wide",
rtio::output_wide as *const ()).unwrap(); rtio::output_wide as *const ()).unwrap();
let mut recorder = RECORDER.take().unwrap();
recorder.duration = duration;
KERNEL_CHANNEL_1TO0.lock().as_mut().unwrap().send( KERNEL_CHANNEL_1TO0.lock().as_mut().unwrap().send(
Message::DmaPutRequest(RECORDER.take().unwrap()) Message::DmaPutRequest(recorder)
); );
} }
} }