Commit 8977a0e8 authored by Lucas Russo's avatar Lucas Russo

sm_io/*/acq/*: protect HW against incompatible trigger types

parent 0ff87f99
......@@ -52,6 +52,7 @@ struct _smio_acq_data_block_t {
#define ACQ_BLOCK_OOR 4 /* Block number out of range */
#define ACQ_NUM_CHAN_OOR 5 /* Channel number out of range */
#define ACQ_COULD_NOT_READ 6 /* Could not read memory block */
#define ACQ_REPLY_END 7 /* End marker */
#define ACQ_TRIG_TYPE 7 /* Incompatible trigger type */
#define ACQ_REPLY_END 8 /* End marker */
#endif
......@@ -128,6 +128,17 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
return -ACQ_NUM_SAMPLES_OOR;
}
/* If skip trigger is set, we must set post_trigger_samples to 0 */
uint32_t trigger_type = 0;
err = _acq_get_trigger_type (self, &trigger_type);
ASSERT_TEST(err == -ACQ_OK, "Could not check for trigger type",
err_acq_get_trig);
if (trigger_type == TYPE_ACQ_CORE_SKIP && num_samples_post > 0) {
DBE_DEBUG (DBG_SM_IO | DBG_LVL_WARN, "[sm_io:acq] data_acquire: "
"Incompatible trigger type. Post trigger samples is greater than 0\n");
return -ACQ_TRIG_TYPE;
}
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:acq] data_acquire:\n"
"\tCurrent acq params for channel #%u: number of pre-trigger samples = %u\n"
"\tnumber of post-trigger samples = %u, number of shots = %u\n",
......@@ -205,6 +216,7 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
return -ACQ_OK;
err_acq_get_trig:
err_acq_not_completed:
err_get_acq_handler:
return err;
......
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