Commit bf443c54 authored by Federico Vaga's avatar Federico Vaga

sw: show input from status tool

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 741d14af
......@@ -3,6 +3,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdbool.h>
#include "fdelay-lib.h"
......@@ -20,11 +21,32 @@ void help(char *name)
exit(1);
}
void print_intput_raw(int flags)
{
fprintf(stdout, "Input, flags 0x%x\n", flags);
}
void print_intput_human(int flags)
{
bool disabled = flags & FD_TDCF_DISABLE_INPUT;
fprintf(stdout, "Input : %s\n",
disabled ? "disabled" : "enabled");
if (!disabled) {
disabled = flags & FD_TDCF_DISABLE_TSTAMP;
fprintf(stdout, " timestamping: %s\n",
disabled ? "disabled" : "enabled");
disabled = !(flags & FD_TDCF_TERM_50);
fprintf(stdout, " 50 Ohm termination: %s\n",
disabled ? "disabled" : "enabled");
}
}
int main(int argc, char **argv)
{
struct fdelay_board *b;
struct fdelay_pulse p;
int ch, err, dev = -1, raw = 0, opt;
int ch, err, dev = -1, raw = 0, opt, flags;
/* Standard part of the file (repeated code) */
if (tools_need_help(argc, argv))
......@@ -72,6 +94,16 @@ int main(int argc, char **argv)
exit(1);
}
flags = fdelay_get_config_tdc(b);
if (flags < 0) {
fputs("Input : failed to get status\n", stdout);
} else {
if (raw)
print_intput_raw(flags);
else
print_intput_human(flags);
}
for (ch = 1; ch <= 4; ch++) {
if (fdelay_get_config_pulse(b, FDELAY_OUTPUT_USER_TO_HW(ch),
&p) < 0) {
......
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