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
46d05c91
Commit
46d05c91
authored
Mar 20, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add fmc-fdelay-board-time
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
6b40ded5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
198 additions
and
4 deletions
+198
-4
fine-delay.in
doc/fine-delay.in
+46
-1
.gitignore
lib/.gitignore
+0
-1
Makefile
lib/Makefile
+0
-1
.gitignore
oldtools/.gitignore
+2
-1
Makefile
oldtools/Makefile
+1
-0
fdelay-board-time.c
oldtools/fdelay-board-time.c
+0
-0
.gitignore
tools/.gitignore
+1
-0
Makefile
tools/Makefile
+1
-0
fmc-fdelay-board-time.c
tools/fmc-fdelay-board-time.c
+147
-0
No files found.
doc/fine-delay.in
View file @
46d05c91
...
@@ -952,7 +952,9 @@ boards in the current system:
...
@@ -952,7 +952,9 @@ boards in the current system:
@section fmc-fdelay-term
@section fmc-fdelay-term
The command can be used to activate or deactivate the 50 ohm
The command can be used to activate or deactivate the 50 ohm
termination resistor. In addition to the @t
{
-i
}
or @t
{
-d
}
termination resistor.
In addition to the @t
{
-i
}
or @t
{
-d
}
arguments, mandatory if more than one board is found on the
arguments, mandatory if more than one board is found on the
host system, the command receives one mandatory argument, either
host system, the command receives one mandatory argument, either
@t
{
1
}
(activate termination) or @t
{
0
}
(deactivate termination).
@t
{
1
}
(activate termination) or @t
{
0
}
(deactivate termination).
...
@@ -962,6 +964,49 @@ host system, the command receives one mandatory argument, either
...
@@ -962,6 +964,49 @@ host system, the command receives one mandatory argument, either
./tools/fmc-fdelay-term: termination is on
./tools/fmc-fdelay-term: termination is on
@end smallexample
@end smallexample
@c ==========================================================================
@node fmc-fdelay-board-time
@section fmc-fdelay-board-time
The command is used to act on the time notion of the @sc
{
fine-delay
}
card.
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, that is
either a command or a floating point number. The number is the
time, in seconds, to be set in the card; the command is one of
the following ones:
@table @code
@item get
Read board time and print to @i
{
stdout
}
.
@item host
Set board time from host time
@item wr
Lock the boards to White Rabbit time. It may block if no White
Rabbit is there. No timeout is currently available.
@item local
Detach the board from White Rabbit, and run local time instead.
@end table
Examples:
@smallexample
spusa# ./lib/fdelay-board-time 25.5; ./lib/fdelay-board-time get
25.504007360
spusa# ./lib/fdelay-board-time get
34.111048968
spusa# ./lib/fdelay-board-time host
spusa# ./lib/fdelay-board-time get
1335974946.493415600
@end smallexample
@c ##########################################################################
@c ##########################################################################
@node Troubleshooting
@node Troubleshooting
...
...
lib/.gitignore
View file @
46d05c91
*.a
*.a
.depend
.depend
fdelay-board-time
fdelay-read
fdelay-read
fdelay-fread
fdelay-fread
fdelay-pulse
fdelay-pulse
...
...
lib/Makefile
View file @
46d05c91
...
@@ -10,7 +10,6 @@ CFLAGS = -Wall -ggdb -O2 -I../kernel -I../zio/include
...
@@ -10,7 +10,6 @@ CFLAGS = -Wall -ggdb -O2 -I../kernel -I../zio/include
LDFLAGS
=
-L
.
-lfdelay
LDFLAGS
=
-L
.
-lfdelay
DEMOSRC
:=
DEMOSRC
:=
DEMOSRC
+=
fdelay-board-time.c
DEMOSRC
+=
fdelay-read.c
DEMOSRC
+=
fdelay-read.c
DEMOSRC
+=
fdelay-fread.c
DEMOSRC
+=
fdelay-fread.c
DEMOSRC
+=
fdelay-pulse.c
DEMOSRC
+=
fdelay-pulse.c
...
...
oldtools/.gitignore
View file @
46d05c91
...
@@ -5,4 +5,5 @@ fd-raw-settime
...
@@ -5,4 +5,5 @@ fd-raw-settime
fd-raw-output
fd-raw-output
fd-raw-perf
fd-raw-perf
fdelay-list
fdelay-list
fdelay-term
fdelay-term
\ No newline at end of file
fdelay-board-time
oldtools/Makefile
View file @
46d05c91
...
@@ -16,6 +16,7 @@ hostprogs-y += fd-raw-perf
...
@@ -16,6 +16,7 @@ hostprogs-y += fd-raw-perf
# programs that used to live in lib/
# programs that used to live in lib/
hostprogs-y
+=
fdelay-list
hostprogs-y
+=
fdelay-list
hostprogs-y
+=
fdelay-term
hostprogs-y
+=
fdelay-term
hostprogs-y
+=
fdelay-board-time
# we are not in the kernel, so we need to piggy-back on "make modules"
# we are not in the kernel, so we need to piggy-back on "make modules"
...
...
lib
/fdelay-board-time.c
→
oldtools
/fdelay-board-time.c
View file @
46d05c91
File moved
tools/.gitignore
View file @
46d05c91
fmc-fdelay-list
fmc-fdelay-list
fmc-fdelay-term
fmc-fdelay-term
fmc-fdelay-board-time
tools/Makefile
View file @
46d05c91
...
@@ -8,6 +8,7 @@ HOSTCC ?= gcc
...
@@ -8,6 +8,7 @@ HOSTCC ?= gcc
hostprogs-y
:=
fmc-fdelay-list
hostprogs-y
:=
fmc-fdelay-list
hostprogs-y
+=
fmc-fdelay-term
hostprogs-y
+=
fmc-fdelay-term
hostprogs-y
+=
fmc-fdelay-board-time
# we are not in the kernel, so we need to piggy-back on "make modules"
# we are not in the kernel, so we need to piggy-back on "make modules"
all modules
:
$(hostprogs-y)
all modules
:
$(hostprogs-y)
...
...
tools/fmc-fdelay-board-time.c
0 → 100644
View file @
46d05c91
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "fdelay-lib.h"
#include "tools-common.h"
int
main
(
int
argc
,
char
**
argv
)
{
struct
fdelay_board
*
b
;
struct
fdelay_time
t
;
int
nboards
,
i
,
get
=
0
,
host
=
0
,
wr_on
=
0
,
wr_off
=
0
;
int
index
=
-
1
,
dev
=
-
1
;
char
*
s
;
/* 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
(
nboards
==
0
)
{
fprintf
(
stderr
,
"%s: no boards found
\n
"
,
argv
[
0
]);
exit
(
1
);
}
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>] <cmd>
\"\n
"
,
argv
[
0
],
argv
[
0
]);
fprintf
(
stderr
,
" cmd is one of
\"
get
\"
,
\"
host
\"
, "
"
\"
local
\"
,
\"
wr
\"
or a floating point time in secs
\n
"
);
exit
(
1
);
}
s
=
argv
[
optind
];
/* Crappy parser */
if
(
!
strcmp
(
s
,
"get"
))
get
=
1
;
else
if
(
!
strcmp
(
s
,
"host"
))
host
=
1
;
else
if
(
!
strcmp
(
s
,
"wr"
))
wr_on
=
1
;
else
if
(
!
strcmp
(
s
,
"local"
))
wr_off
=
1
;
else
{
double
nano
;
long
long
sec
;
memset
(
&
t
,
0
,
sizeof
(
t
));
i
=
sscanf
(
s
,
"%lli%lf
\n
"
,
&
sec
,
&
nano
);
if
(
i
<
1
)
{
fprintf
(
stderr
,
"%s: Not a number
\"
%s
\"\n
"
,
argv
[
0
],
s
);
exit
(
1
);
}
t
.
utc
=
sec
;
t
.
coarse
=
nano
*
1000
*
1000
*
1000
/
8
;
}
b
=
fdelay_open
(
index
,
dev
);
if
(
!
b
)
{
fprintf
(
stderr
,
"%s: fdelay_open(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
if
(
get
)
{
if
(
fdelay_get_time
(
b
,
&
t
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_get_time(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
printf
(
"%lli.%09li
\n
"
,
(
long
long
)
t
.
utc
,
(
long
)
t
.
coarse
*
8
);
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
host
)
{
if
(
fdelay_set_host_time
(
b
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_set_host_time(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
wr_on
)
{
setbuf
(
stdout
,
NULL
);
printf
(
"Locking the card to WR: "
);
if
(
fdelay_wr_mode
(
b
,
1
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_wr_mode(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
while
(
fdelay_check_wr_mode
(
b
)
!=
0
)
{
printf
(
"."
);
sleep
(
1
);
}
printf
(
" locked!
\n
"
);
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
wr_off
)
{
if
(
fdelay_wr_mode
(
b
,
0
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_wr_mode(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
if
(
fdelay_set_time
(
b
,
&
t
)
<
0
)
{
fprintf
(
stderr
,
"%s: fdelay_set_host_time(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
}
fdelay_close
(
b
);
fdelay_exit
();
return
0
;
}
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