Commit 76050cdb authored by Lucas Russo's avatar Lucas Russo

sm_io/acq/*: fix maximum number of samples check

We were comparing, for single shot acquisition,
the maximum number of multi shot samples, and
vice-versa
parent bb988294
...@@ -111,12 +111,15 @@ static int _acq_data_acquire (void *owner, void *args, void *ret) ...@@ -111,12 +111,15 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
/* number of samples required is out of the maximum limit */ /* 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; uint32_t max_samples_multishot = ACQ_CORE_MULTISHOT_MEM_SIZE/acq->acq_buf[chan].sample_size;
if (((num_shots > ACQ_CORE_MIN_NUM_SHOTS) && if (((num_shots == ACQ_CORE_MIN_NUM_SHOTS) &&
(num_samples_pre + num_samples_post > acq->acq_buf[chan].max_samples)) || (num_samples_pre + num_samples_post > acq->acq_buf[chan].max_samples)) ||
((num_shots == ACQ_CORE_MIN_NUM_SHOTS) && ((num_shots > ACQ_CORE_MIN_NUM_SHOTS) &&
(num_samples_pre + num_samples_post > max_samples_multishot))) { (num_samples_pre + num_samples_post > max_samples_multishot))) {
DBE_DEBUG (DBG_SM_IO | DBG_LVL_WARN, "[sm_io:acq] data_acquire: " DBE_DEBUG (DBG_SM_IO | DBG_LVL_WARN, "[sm_io:acq] data_acquire: "
"Number of samples required is out of the maximum limit\n"); "Number of samples required (%u) is out of the maximum limit (%u)\n"
"for shots = %u\n",
num_samples_pre + num_samples_post, (num_shots == ACQ_CORE_MIN_NUM_SHOTS) ?
acq->acq_buf[chan].max_samples : max_samples_multishot, num_shots);
return -ACQ_NUM_SAMPLES_OOR; return -ACQ_NUM_SAMPLES_OOR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment