Commit 12cfcd21 authored by Alessandro Rubini's avatar Alessandro Rubini

tools: prepare reporting time in three modes (no change now)

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 703e1325
......@@ -353,7 +353,7 @@ int main(int argc, char **argv)
/* Done. Report verbosely and activate the information we parsed */
channel = FDELAY_OUTPUT_USER_TO_HW(channel);
if (verbose)
tools_report_action(channel, &p);
tools_report_action(channel, &p, TOOLS_UMODE_RAW);
if (fdelay_config_pulse(b, channel, &p) < 0) {
fprintf(stderr, "%s: fdelay_config_pulse(): %s\n",
argv[0], strerror(errno));
......
......@@ -68,7 +68,8 @@ int main(int argc, char **argv)
argv[0], ch, strerror(errno));
}
/* pass hw number again, as the function is low-level */
tools_report_action(FDELAY_OUTPUT_USER_TO_HW(ch), &p);
tools_report_action(FDELAY_OUTPUT_USER_TO_HW(ch),
&p, TOOLS_UMODE_RAW);
}
fdelay_close(b);
fdelay_exit();
......
......@@ -5,7 +5,12 @@
extern void tools_getopt_d_i(int argc, char **argv,
int *dev, int *index);
extern int tools_need_help(int argc, char **argv);
extern void report_time(char *name, struct fdelay_time *t);
extern void tools_report_action(int channel, struct fdelay_pulse *p);
#define TOOLS_UMODE_USER 0
#define TOOLS_UMODE_RAW 1
#define TOOLS_UMODE_FLOAT 2
extern void tools_report_time(char *name, struct fdelay_time *t, int umode);
extern void tools_report_action(int channel, struct fdelay_pulse *p, int umode);
extern void help(char *name); /* This is mandatory in all tools */
......@@ -48,13 +48,13 @@ int tools_need_help(int argc, char **argv)
return 0;
}
void report_time(char *name, struct fdelay_time *t)
void tools_report_time(char *name, struct fdelay_time *t, int umode)
{
printf(" %s utc %10lli, coarse %9li, frac %9li\n",
name, (long long)t->utc, (long)t->coarse, (long)t->frac);
}
void tools_report_action(int channel, struct fdelay_pulse *p)
void tools_report_action(int channel, struct fdelay_pulse *p, int umode)
{
char *mode;
char s[80];
......@@ -71,7 +71,7 @@ void tools_report_action(int channel, struct fdelay_pulse *p)
printf("Channel %i, mode %s, repeat %i %s\n",
FDELAY_OUTPUT_HW_TO_USER(channel), mode,
p->rep, p->rep == -1 ? "(infinite)" : "");
report_time("start", &p->start);
report_time("end ", &p->end);
report_time("loop ", &p->loop);
tools_report_time("start", &p->start, umode);
tools_report_time("end ", &p->end, umode);
tools_report_time("loop ", &p->loop, umode);
}
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