Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - Software
Commits
84750ca9
Commit
84750ca9
authored
Mar 19, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add fmc-fdelay-term
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
6c67531f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
30 deletions
+56
-30
fine-delay.in
doc/fine-delay.in
+16
-0
.gitignore
lib/.gitignore
+0
-1
Makefile
lib/Makefile
+0
-1
.gitignore
tools/.gitignore
+1
-0
Makefile
tools/Makefile
+1
-0
fmc-fdelay-term.c
tools/fmc-fdelay-term.c
+38
-28
No files found.
doc/fine-delay.in
View file @
84750ca9
...
...
@@ -944,6 +944,22 @@ boards in the current system:
dev
_
id 0200, /dev/zio/zio-fd-0200, /sys/bus/zio/devices/zio-fd-0200
@end smallexample
@c ==========================================================================
@node fmc-fdelay-term
@section fmc-fdelay-term
The command can be used to activate or deactivate the 50 ohm
termination resistor. In addition to the @t
{
-i
}
or @t
{
-d
}
arguments, mandatory if more than one board is found on the
host system, the command receives one mandatory argument, either
@t
{
1
}
(activate termination) or @t
{
0
}
(deactivate termination).
@smallexample
spusa# ./tools/fmc-fdelay-term 1
./tools/fmc-fdelay-term: termination is on
@end smallexample
@c ##########################################################################
@node Troubleshooting
@appendix Troubleshooting
...
...
lib/.gitignore
View file @
84750ca9
*.a
.depend
fdelay-board-time
fdelay-term
fdelay-read
fdelay-fread
fdelay-pulse
...
...
lib/Makefile
View file @
84750ca9
...
...
@@ -11,7 +11,6 @@ LDFLAGS = -L. -lfdelay
DEMOSRC
:=
DEMOSRC
+=
fdelay-board-time.c
DEMOSRC
+=
fdelay-term.c
DEMOSRC
+=
fdelay-read.c
DEMOSRC
+=
fdelay-fread.c
DEMOSRC
+=
fdelay-pulse.c
...
...
tools/.gitignore
View file @
84750ca9
fmc-fdelay-list
fmc-fdelay-term
tools/Makefile
View file @
84750ca9
...
...
@@ -7,6 +7,7 @@ HOST_EXTRACFLAGS += -I$(M) -I../lib -I../zio/include -Wno-trigraphs -Wall -ggdb
HOSTCC
?=
gcc
hostprogs-y
:=
fmc-fdelay-list
hostprogs-y
+=
fmc-fdelay-term
# we are not in the kernel, so we need to piggy-back on "make modules"
all modules
:
$(hostprogs-y)
...
...
lib/
fdelay-term.c
→
tools/fmc-
fdelay-term.c
View file @
84750ca9
...
...
@@ -2,57 +2,67 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <errno.h>
#include "fdelay-lib.h"
#include "tools-common.h"
int
main
(
int
argc
,
char
**
argv
)
{
struct
fdelay_board
*
b
;
int
i
,
hwval
,
newval
;
int
dev
=
0
;
int
nboards
,
hwval
,
newval
;
int
index
=
-
1
,
dev
=
-
1
;
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"%s: Use %s <dev> 1|0
\n
"
,
argv
[
0
],
argv
[
0
]);
exit
(
1
);
}
newval
=
-
1
;
if
(
argc
>
2
)
{
dev
=
strtol
(
argv
[
1
],
NULL
,
0
);
if
(
!
strcmp
(
argv
[
2
],
"0"
))
newval
=
0
;
else
if
(
!
strcmp
(
argv
[
2
],
"1"
))
newval
=
1
;
else
{
fprintf
(
stderr
,
"%s: arg
\"
%s
\"
is not 0 nor 1
\n
"
,
argv
[
0
],
argv
[
2
]);
exit
(
1
);
}
}
i
=
fdelay_init
();
if
(
i
<
0
)
{
/* Standard part of the file (repeated code) */
nboards
=
fdelay_init
();
if
(
nboards
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_init(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
if
(
i
==
0
)
{
if
(
nboards
==
0
)
{
fprintf
(
stderr
,
"%s: no boards found
\n
"
,
argv
[
0
]);
exit
(
1
);
}
if
(
i
!=
1
)
{
fprintf
(
stderr
,
"%s: found %i boards
\n
"
,
argv
[
0
],
i
);
if
(
nboards
==
1
)
index
=
0
;
/* so it works with no arguments */
tools_getopt_d_i
(
argc
,
argv
,
&
dev
,
&
index
);
if
(
index
<
0
&&
dev
<
0
)
{
fprintf
(
stderr
,
"%s: several boards, please pass -i or -d
\n
"
,
argv
[
0
]);
exit
(
1
);
}
/* Parse the mandatory extra argument */
if
(
optind
!=
argc
-
1
)
{
fprintf
(
stderr
,
"%s: Use
\"
%s [-i <index>] [-d <dev>] 1|0
\n
"
,
argv
[
0
],
argv
[
0
]);
exit
(
1
);
}
newval
=
-
1
;
if
(
!
strcmp
(
argv
[
optind
],
"0"
))
newval
=
0
;
else
if
(
!
strcmp
(
argv
[
optind
],
"1"
))
newval
=
1
;
else
{
fprintf
(
stderr
,
"%s: arg
\"
%s
\"
is not 0 nor 1
\n
"
,
argv
[
0
],
argv
[
optind
]);
exit
(
1
);
}
b
=
fdelay_open
(
dev
,
-
1
);
/* Finally work */
b
=
fdelay_open
(
index
,
dev
);
if
(
!
b
)
{
fprintf
(
stderr
,
"%s: fdelay_open(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
fprintf
(
stderr
,
"%s: using board %d
\n
"
,
argv
[
0
],
dev
);
hwval
=
fdelay_get_config_tdc
(
b
);
switch
(
newval
)
{
case
1
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment