Commit ea914484 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski Committed by Alessandro Rubini

tools/fmc-fdelay-input: include the fractional part too

Reason: useful when debugging White Rabbit synchronized cards, which should be in sync with
better than 1ns accuracy. Also grouped decimal digits to improve readability.
parent c13ea19f
...@@ -28,18 +28,27 @@ void dump_input(struct fdelay_time *t, int np, int israw) ...@@ -28,18 +28,27 @@ void dump_input(struct fdelay_time *t, int np, int israw)
int i; int i;
for (i = 0; i < np; i++, t++) { for (i = 0; i < np; i++, t++) {
uint64_t picoseconds =
(uint64_t) t->coarse * 8000ULL +
(uint64_t) t->frac * 8000ULL / 4096ULL;
printf("seq %5i: ", t->seq_id); printf("seq %5i: ", t->seq_id);
if (israw) if (israw)
printf("timestamps %016llx %08x %08x\n", printf("timestamps %016llx %08x %08x\n",
(long long)(t->utc), t->coarse, t->frac); (long long)(t->utc), t->coarse, t->frac);
else else
printf("time %10lli.%09li\n", printf ("time %10llu:%03llu,%03llu,%03llu,%03llu ps\n",
(long long)(t->utc), (long)t->coarse * 8); (long long)(t->utc),
picoseconds / 1000000000ULL,
(picoseconds / 1000000ULL) % 1000ULL,
(picoseconds / 1000ULL) % 1000ULL,
picoseconds % 1000ULL);
} }
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct fdelay_board *b; struct fdelay_board *b;
......
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