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

lib: add readback config_pulse function

parent 06c7a070
......@@ -139,6 +139,64 @@ int fdelay_config_pulse_ps(struct fdelay_board *userb,
return fdelay_config_pulse(userb, channel, &p);
}
int fdelay_get_config_pulse(struct fdelay_board *userb,
int channel, struct fdelay_pulse *pulse)
{
__define_board(b, userb);
char s[32];
uint32_t utc_h, utc_l, rep, mode;
sprintf(s,"fd-ch%i/%s", channel + 1, "mode");
if (fdelay_sysfs_get(b, s, &mode) < 0)
return -1; /* errno already set */
pulse->mode = mode;
sprintf(s,"fd-ch%i/%s", channel + 1, "rep");
if (fdelay_sysfs_get(b, s, &rep) < 0)
return -1;
pulse->rep = rep;
sprintf(s,"fd-ch%i/%s", channel + 1, "start-h");
if (fdelay_sysfs_get(b, s, &utc_h) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "start-l");
if (fdelay_sysfs_get(b, s, &utc_l) < 0)
return -1;
pulse->start.utc = (((uint64_t)utc_h) << 32) | utc_l;
sprintf(s,"fd-ch%i/%s", channel + 1, "start-coarse");
if (fdelay_sysfs_get(b, s, &pulse->start.coarse) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "start-frac");
if (fdelay_sysfs_get(b, s, &pulse->start.frac) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "end-h");
if (fdelay_sysfs_get(b, s, &utc_h) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "end-l");
if (fdelay_sysfs_get(b, s, &utc_l) < 0)
return -1;
pulse->end.utc = (((uint64_t)utc_h) << 32) | utc_l;
sprintf(s,"fd-ch%i/%s", channel + 1, "end-coarse");
if (fdelay_sysfs_get(b, s, &pulse->end.coarse) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "end-frac");
if (fdelay_sysfs_get(b, s, &pulse->end.frac) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "delta-l");
if (fdelay_sysfs_get(b, s, &utc_l) < 0)
return -1;
pulse->loop.utc = utc_l;
sprintf(s,"fd-ch%i/%s", channel + 1, "delta-coarse");
if (fdelay_sysfs_get(b, s, &pulse->loop.coarse) < 0)
return -1;
sprintf(s,"fd-ch%i/%s", channel + 1, "delta-frac");
if (fdelay_sysfs_get(b, s, &pulse->loop.frac) < 0)
return -1;
return 0;
}
int fdelay_has_triggered(struct fdelay_board *userb, int channel)
{
__define_board(b, userb);
......
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