From e8f7f8ef9c8063bd60920f42cce2daa22c4fe9e0 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 19 Apr 2017 10:59:12 +0800 Subject: [PATCH] DMA: speed up playback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Time reduced from 1.53µs to 1.37µs. --- artiq/firmware/ksupport/lib.rs | 28 +++++++++++++++------------- artiq/test/coredevice/test_rtio.py | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index ea782f21b..69d6846df 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -398,19 +398,21 @@ extern fn dma_playback(timestamp: i64, ptr: i32) { csr::cri_con::selected_write(0); let status = csr::rtio_dma::error_status_read(); - let timestamp = csr::rtio_dma::error_timestamp_read(); - let channel = csr::rtio_dma::error_channel_read(); - if status & rtio::RTIO_O_STATUS_UNDERFLOW != 0 { - csr::rtio_dma::error_underflow_reset_write(1); - raise!("RTIOUnderflow", - "RTIO underflow at {0} mu, channel {1}", - timestamp as i64, channel as i64, 0) - } - if status & rtio::RTIO_O_STATUS_SEQUENCE_ERROR != 0 { - csr::rtio_dma::error_sequence_error_reset_write(1); - raise!("RTIOSequenceError", - "RTIO sequence error at {0} mu, channel {1}", - timestamp as i64, channel as i64, 0) + if status != 0 { + let timestamp = csr::rtio_dma::error_timestamp_read(); + let channel = csr::rtio_dma::error_channel_read(); + if status & rtio::RTIO_O_STATUS_UNDERFLOW != 0 { + csr::rtio_dma::error_underflow_reset_write(1); + raise!("RTIOUnderflow", + "RTIO underflow at {0} mu, channel {1}", + timestamp as i64, channel as i64, 0) + } + if status & rtio::RTIO_O_STATUS_SEQUENCE_ERROR != 0 { + csr::rtio_dma::error_sequence_error_reset_write(1); + raise!("RTIOSequenceError", + "RTIO sequence error at {0} mu, channel {1}", + timestamp as i64, channel as i64, 0) + } } } } diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index 0aff9b979..d0ee3cec5 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -605,7 +605,7 @@ class DMATest(ExperimentCase): exp.playback_many(count) dt = self.dataset_mgr.get("dma_playback_time") print("dt={}, dt/count={}".format(dt, dt/count)) - self.assertLess(dt/count, 7*us) + self.assertLess(dt/count, 3*us) def test_handle_invalidation(self): exp = self.create(_DMA)