Commit a869ec6b authored by Federico Vaga's avatar Federico Vaga

lib: convert all aquired timestamps in a dedicated func

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 013a37f9
...@@ -610,6 +610,16 @@ static void fmctdc_ts_convert(struct fmctdc_time *t, struct ft_hw_timestamp *o) ...@@ -610,6 +610,16 @@ static void fmctdc_ts_convert(struct fmctdc_time *t, struct ft_hw_timestamp *o)
t->seq_id = FT_HW_TS_META_SEQ(o->metadata); t->seq_id = FT_HW_TS_META_SEQ(o->metadata);
} }
static void fmctdc_ts_convert_n(struct fmctdc_time *t,
struct ft_hw_timestamp *o,
unsigned int n)
{
int i;
for (i = 0; i < n; ++i)
fmctdc_ts_convert(&t[i], &o[i]);
}
/** /**
* It reads a given number of time-stamps from the driver. It will wait at * It reads a given number of time-stamps from the driver. It will wait at
* most once and return the number of samples that it received from a given * most once and return the number of samples that it received from a given
...@@ -668,9 +678,8 @@ int fmctdc_read(struct fmctdc_board *userb, unsigned int channel, ...@@ -668,9 +678,8 @@ int fmctdc_read(struct fmctdc_board *userb, unsigned int channel,
if (n_ts % sizeof(*data) == 0) { /* Good samples here */ if (n_ts % sizeof(*data) == 0) { /* Good samples here */
n_ts /= sizeof(*data); n_ts /= sizeof(*data);
n_ts += i; fmctdc_ts_convert_n(&t[i], &data[i], n_ts);
for (; i < n_ts && i < n; i++) i += n_ts;
fmctdc_ts_convert(&t[i], &data[i]);
continue; /* the while loop */ continue; /* the while loop */
} }
......
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