Commit 6d1f5ba1 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

fd_zio_output: moved sanitization of input arguments to userspace library.

Reason: zio block the channel if the raw_io function returns an error (possibly
a bug in zio user trigger handling).
parent 7a1a6681
......@@ -526,13 +526,13 @@ static int __fd_zio_output(struct fd_dev *fd, int index1_4, uint32_t *attrs)
if (mode == FD_OUT_MODE_DELAY || mode == FD_OUT_MODE_DISABLED) {
if(rep < 0 || rep > 16) /* delay mode allows trains of 1 to 16 pulses. */
return -EINVAL;
return 0;
/* check delay lower limits. FIXME: raise an alarm */
delay.tv_sec = attrs[FD_ATTR_OUT_START_L];
delay.tv_nsec = attrs[FD_ATTR_OUT_START_COARSE] * 8;
if (delay.tv_sec == 0 && delay.tv_nsec < 600)
return -EINVAL;
return 0;
fd_apply_offset(attrs + FD_ATTR_OUT_START_H,
fd->calib.tdc_zero_offset);
......
......@@ -94,6 +94,19 @@ int fdelay_config_pulse(struct fdelay_board *userb,
a[FD_ATTR_OUT_DELTA_COARSE] = pulse->loop.coarse; /* only 0..f */
a[FD_ATTR_OUT_DELTA_FINE] = pulse->loop.frac; /* only 0..f */
int mode = pulse->mode & 0x7f;
/* hotfix: the ZIO has a bug blocking the output when the output raw_io function returns an error.
therefore we temporarily have to check the output programming correctness in the user library. */
if (mode == FD_OUT_MODE_DELAY || mode == FD_OUT_MODE_DISABLED)
{
if(pulse->rep < 0 || pulse->rep > 16) /* delay mode allows trains of 1 to 16 pulses. */
return -EINVAL;
if(a[FD_ATTR_OUT_START_L] == 0 && a[FD_ATTR_OUT_START_COARSE] < (600 / 8)) // 600 ns min delay
return -EINVAL;
}
/* we need to fill the nsample field of the control */
ctrl.attr_trigger.std_val[1] = 1;
ctrl.nsamples = 1;
......
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