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
5579d060
Commit
5579d060
authored
Mar 20, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/fmc-fdelay-term: with no args only report status
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
4d77a253
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
fine-delay.in
doc/fine-delay.in
+7
-3
fmc-fdelay-term.c
tools/fmc-fdelay-term.c
+13
-16
No files found.
doc/fine-delay.in
View file @
5579d060
...
...
@@ -957,14 +957,18 @@ 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).
host system, the command receives one optional argument, either
@t
{
1
}
or @t
{
on
}
(activate termination) or @t
{
0
}
or @t
{
off
}
(deactivate termination).
@smallexample
spusa# ./tools/fmc-fdelay-term
1
spusa# ./tools/fmc-fdelay-term
on
./tools/fmc-fdelay-term: termination is on
@end smallexample
If no arguments are passed the termination status is reported back but
not changed.
@c ==========================================================================
@node fmc-fdelay-board-time
@section fmc-fdelay-board-time
...
...
tools/fmc-fdelay-term.c
View file @
5579d060
...
...
@@ -10,7 +10,7 @@
static
void
help
(
char
*
name
)
{
fprintf
(
stderr
,
"%s: Use
\"
%s [-i <index>] [-d <dev>]
1|0
\n
"
,
fprintf
(
stderr
,
"%s: Use
\"
%s [-i <index>] [-d <dev>]
[on|off]
\n
"
,
name
,
name
);
exit
(
1
);
}
...
...
@@ -48,20 +48,17 @@ int main(int argc, char **argv)
exit
(
1
);
}
/* Parse the mandatory extra argument */
if
(
optind
!=
argc
-
1
)
help
(
argv
[
0
]);
/* Parse the extra argument, if any */
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
);
if
(
optind
==
argc
-
1
)
{
char
*
s
=
argv
[
optind
]
;
if
(
!
strcmp
(
s
,
"0"
)
||
!
strcmp
(
s
,
"off
"
))
newval
=
0
;
else
if
(
!
strcmp
(
s
,
"1"
)
||
!
strcmp
(
s
,
"on"
))
newval
=
1
;
else
help
(
argv
[
0
]
);
}
/* Finally work */
b
=
fdelay_open
(
index
,
dev
);
if
(
!
b
)
{
...
...
@@ -74,14 +71,14 @@ int main(int argc, char **argv)
switch
(
newval
)
{
case
1
:
hwval
|=
FD_TDCF_TERM_50
;
fdelay_set_config_tdc
(
b
,
hwval
);
break
;
case
0
:
hwval
&=
~
FD_TDCF_TERM_50
;
fdelay_set_config_tdc
(
b
,
hwval
);
break
;
}
fdelay_set_config_tdc
(
b
,
hwval
);
hwval
=
fdelay_get_config_tdc
(
b
);
printf
(
"%s: termination is %d %s
\n
"
,
argv
[
0
],
hwval
,
printf
(
"%s: termination is %s
\n
"
,
argv
[
0
],
hwval
,
hwval
&
FD_TDCF_TERM_50
?
"on"
:
"off"
);
fdelay_close
(
b
);
...
...
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