Commit ed85f99f authored by Federico Vaga's avatar Federico Vaga

kernel: inform on missing edges

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 46d07c47
...@@ -127,7 +127,7 @@ struct ft_channel_state { ...@@ -127,7 +127,7 @@ struct ft_channel_state {
int expected_edge; int expected_edge;
int cur_seq_id; int cur_seq_id;
int delay_reference; int delay_reference;
uint32_t prev_hseq;
int32_t user_offset; int32_t user_offset;
struct ft_wr_timestamp prev_ts; /**< used to validate time-stamps struct ft_wr_timestamp prev_ts; /**< used to validate time-stamps
......
...@@ -115,6 +115,7 @@ static inline int process_timestamp(struct zio_cset *cset, ...@@ -115,6 +115,7 @@ static inline int process_timestamp(struct zio_cset *cset,
struct ft_wr_timestamp ts; struct ft_wr_timestamp ts;
struct ft_wr_timestamp diff; struct ft_wr_timestamp diff;
int channel, edge, frac, ret = 0; int channel, edge, frac, ret = 0;
uint32_t hseq, prev_hseq;
st = &ft->channels[cset->index]; st = &ft->channels[cset->index];
...@@ -129,6 +130,9 @@ static inline int process_timestamp(struct zio_cset *cset, ...@@ -129,6 +130,9 @@ static inline int process_timestamp(struct zio_cset *cset,
return 0; return 0;
} }
edge = hwts->metadata & (1 << 4) ? 1 : 0; edge = hwts->metadata & (1 << 4) ? 1 : 0;
prev_hseq = st->prev_hseq;
hseq = hwts->metadata >> 5;
st->prev_hseq = hseq;
/* first, convert the timestamp from the HDL units (81 ps bins) /* first, convert the timestamp from the HDL units (81 ps bins)
to the WR format (where fractional part is 8 ns rescaled to to the WR format (where fractional part is 8 ns rescaled to
...@@ -160,6 +164,13 @@ static inline int process_timestamp(struct zio_cset *cset, ...@@ -160,6 +164,13 @@ static inline int process_timestamp(struct zio_cset *cset,
return 0; return 0;
} }
if (unlikely(prev_hseq + 1 != hseq)) {
/* we missed some edges */
dev_warn(&cset->head.dev,
"missed edges. Last seen %u, current %u\n",
prev_hseq, hseq);
}
/* From this point we are working with the expected EDGE */ /* From this point we are working with the expected EDGE */
...@@ -197,7 +208,7 @@ static inline int process_timestamp(struct zio_cset *cset, ...@@ -197,7 +208,7 @@ static inline int process_timestamp(struct zio_cset *cset,
st->cur_seq_id++; st->cur_seq_id++;
} }
ts.hseq_id = hwts->metadata >> 5; ts.hseq_id = hseq;
/* Return a valid timestamp */ /* Return a valid timestamp */
*wrts = ts; *wrts = ts;
......
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