Commit f9756f73 authored by Juan David González Cobas's avatar Juan David González Cobas Committed by Alessandro Rubini

lib: subtract offsets in configuration readback

To get the output configuration, a simple readback of the
sysfs start/end/delta parameters is not enough, because
start and end are affected by delay-offset and the tdc
offset. This patch addresses the problem in an incomplete
manner
parent 391d7d16
......@@ -210,7 +210,11 @@ static void fdelay_subtract_ps(struct fdelay_time *t2,
int fdelay_get_config_pulse_ps(struct fdelay_board *userb,
int channel, struct fdelay_pulse_ps *ps)
{
__define_board(b, userb);
struct fdelay_pulse pulse;
char s[32];
uint32_t delay_offset;
uint32_t offset;
if (fdelay_get_config_pulse(userb, channel, &pulse) < 0)
return -1;
......@@ -221,6 +225,13 @@ int fdelay_get_config_pulse_ps(struct fdelay_board *userb,
fdelay_subtract_ps(&pulse.end, &pulse.start, (int64_t *)&ps->length);
fdelay_time_to_pico(&pulse.loop, &ps->period);
sprintf(s,"fd-ch%i/%s", channel + 1, "delay-offset");
if (fdelay_sysfs_get(b, s, &delay_offset) < 0)
return -1;
if (fdelay_sysfs_get(b, "fd-input/offset", &offset) < 0)
return -1;
ps->length -= delay_offset + offset;
return 0;
}
int fdelay_has_triggered(struct fdelay_board *userb, int channel)
......
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