From 9364384c8f9be47993cc4a103501b404b83a92c3 Mon Sep 17 00:00:00 2001
From: Lucas Russo <lerwys@gmail.com>
Date: Fri, 20 May 2016 15:30:44 -0300
Subject: [PATCH] sm_io/*/acq/*: fix maximum number of samples in multishot
 mode

---
 src/sm_io/modules/acq/sm_io_acq_exp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sm_io/modules/acq/sm_io_acq_exp.c b/src/sm_io/modules/acq/sm_io_acq_exp.c
index f85feeeb..1319d11a 100644
--- a/src/sm_io/modules/acq/sm_io_acq_exp.c
+++ b/src/sm_io/modules/acq/sm_io_acq_exp.c
@@ -114,8 +114,10 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
         return -ACQ_NUM_CHAN_OOR;
     }
 
-    /* number of samples required is out of the maximum limit */
-    uint32_t max_samples_multishot = ACQ_CORE_MULTISHOT_MEM_SIZE/acq->acq_buf[chan].sample_size;
+    /* number of samples required is out of the maximum limit. Maixmum number of samples 
+     * in multishot mode is simply the maximum number of samples of the DPRAM. The DPRAM
+     * size is calculated to fit the largest sample in the design, so we are safe. */
+    uint32_t max_samples_multishot = ACQ_CORE_MULTISHOT_MEM_SIZE;
     if (((num_shots == ACQ_CORE_MIN_NUM_SHOTS) &&
             (num_samples_pre + num_samples_post > acq->acq_buf[chan].max_samples)) ||
             ((num_shots > ACQ_CORE_MIN_NUM_SHOTS) &&
-- 
GitLab