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
bacf5df8
Commit
bacf5df8
authored
Mar 21, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: implement human, float and raw output; used in fdelay-input
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
12cfcd21
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
27 deletions
+53
-27
fine-delay.in
doc/fine-delay.in
+23
-6
fmc-fdelay-input.c
tools/fmc-fdelay-input.c
+7
-19
tools-util.c
tools/tools-util.c
+23
-2
No files found.
doc/fine-delay.in
View file @
bacf5df8
...
...
@@ -1033,18 +1033,35 @@ It receives the following options:
Nonblocking mode: just print what is pending in the buffer.
@item -
r
@item -
f
Raw output: printf the hex timestamps.
Floating point: print as a floatingpoint seconds.pico value.
The default is a human-readable string, where the decimal part
is split.
@item -
f
@item -
r
Floading point (human-readable).
This is the default, but the option overrides a
previous ``-r'' if any was there.
Raw output: print the three hardware timestamps, in decimal.
@end table
This an example output, reading a pps signal through a 16ns cable:
@smallexample
spusa.root# ./tools/fmc-fdelay-input -c 3
seq 10921: time 11984:000,000,015,328 ps
seq 10922: time 11985:000,000,015,410 ps
seq 10923: time 11986:000,000,015,248 ps
spusa.root# ./tools/fmc-fdelay-input -c 3 -r
seq 10924: raw utc 11987, coarse 1, frac 3773
seq 10925: raw utc 11988, coarse 1, frac 3814
seq 10926: raw utc 11989, coarse 1, frac 3794
spusa.root# ./tools/fmc-fdelay-input -c 3 -f
seq 10927: time 11990.000000015328
seq 10928: time 11991.000000015410
seq 10929: time 11992.000000015410
@end smallexample
In a future release we'll support reading concurrently from several
boards.
...
...
tools/fmc-fdelay-input.c
View file @
bacf5df8
...
...
@@ -23,26 +23,13 @@ void help(char *name)
exit
(
1
);
}
void
dump_input
(
struct
fdelay_time
*
t
,
int
np
,
int
israw
)
void
dump_input
(
struct
fdelay_time
*
t
,
int
np
,
int
umode
)
{
int
i
;
for
(
i
=
0
;
i
<
np
;
i
++
,
t
++
)
{
uint64_t
picoseconds
=
(
uint64_t
)
t
->
coarse
*
8000ULL
+
(
uint64_t
)
t
->
frac
*
8000ULL
/
4096ULL
;
printf
(
"seq %5i: "
,
t
->
seq_id
);
if
(
israw
)
printf
(
"timestamps %016llx %08x %08x
\n
"
,
(
long
long
)(
t
->
utc
),
t
->
coarse
,
t
->
frac
);
else
printf
(
"time %10llu:%03llu,%03llu,%03llu,%03llu ps
\n
"
,
(
long
long
)(
t
->
utc
),
picoseconds
/
1000000000ULL
,
(
picoseconds
/
1000000ULL
)
%
1000ULL
,
(
picoseconds
/
1000ULL
)
%
1000ULL
,
picoseconds
%
1000ULL
);
tools_report_time
(
""
,
t
,
umode
);
}
}
...
...
@@ -54,7 +41,8 @@ int main(int argc, char **argv)
struct
fdelay_board
*
b
;
int
nboards
;
int
opt
,
index
=
-
1
,
dev
=
-
1
;
int
nonblock
=
0
,
raw
=
0
,
count
=
0
;
int
nonblock
=
0
,
count
=
0
;
int
umode
=
TOOLS_UMODE_USER
;
/* Standard part of the file (repeated code) */
...
...
@@ -113,11 +101,11 @@ int main(int argc, char **argv)
break
;
case
'r'
:
raw
=
1
;
umode
=
TOOLS_UMODE_RAW
;
break
;
case
'f'
:
raw
=
0
;
umode
=
TOOLS_UMODE_FLOAT
;
break
;
}
}
...
...
@@ -153,7 +141,7 @@ int main(int argc, char **argv)
if
(
!
ret
)
continue
;
dump_input
(
pdata
,
ret
,
raw
);
dump_input
(
pdata
,
ret
,
umode
);
if
(
nonblock
)
/* non blocking: nothing more to do */
break
;
...
...
tools/tools-util.c
View file @
bacf5df8
...
...
@@ -50,8 +50,29 @@ int tools_need_help(int argc, char **argv)
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
);
unsigned
long
long
picoseconds
=
t
->
coarse
*
8000ULL
+
t
->
frac
*
8000ULL
/
4096ULL
;
printf
(
" %s "
,
name
);
switch
(
umode
)
{
case
TOOLS_UMODE_USER
:
printf
(
"time %10llu:%03llu,%03llu,%03llu,%03llu ps
\n
"
,
(
long
long
)(
t
->
utc
),
(
picoseconds
/
(
1000LL
*
1000
*
1000
)),
(
picoseconds
/
(
1000LL
*
1000
)
%
1000
),
(
picoseconds
/
(
1000LL
)
%
1000
),
(
picoseconds
%
1000LL
));
break
;
case
TOOLS_UMODE_FLOAT
:
printf
(
"time %10llu.%012llu
\n
"
,
(
long
long
)(
t
->
utc
),
picoseconds
);
break
;
case
TOOLS_UMODE_RAW
:
printf
(
" raw utc %10lli, coarse %9li, frac %9li
\n
"
,
(
long
long
)
t
->
utc
,
(
long
)
t
->
coarse
,
(
long
)
t
->
frac
);
break
;
}
}
void
tools_report_action
(
int
channel
,
struct
fdelay_pulse
*
p
,
int
umode
)
...
...
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