Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - 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 TDC 1ns 5cha - Software
Commits
c951193d
Commit
c951193d
authored
Apr 08, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add flush and just-read options
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
ba2ccc42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
fmc-tdc-tstamp.c
tools/fmc-tdc-tstamp.c
+29
-14
No files found.
tools/fmc-tdc-tstamp.c
View file @
c951193d
...
...
@@ -90,11 +90,26 @@ static void help(char *name)
fprintf
(
stderr
,
" -w : user White Rabbit format
\n
"
);
fprintf
(
stderr
,
" -d <ch_ref>,<ch_tar>: difference between a reference channel and
\n
"
);
fprintf
(
stderr
,
" a target channel (<ch_tar> - <ch_ref>)
\n
"
);
fprintf
(
stderr
,
" -f: flush buffer
\n
"
);
fprintf
(
stderr
,
" -r: read buffer, no acquisition start
\n
"
);
fprintf
(
stderr
,
" -h: print this message
\n\n
"
);
fprintf
(
stderr
,
" channels enumerations go from %d to %d
\n\n
"
,
FMCTDC_CH_1
,
FMCTDC_CH_LAST
);
}
static
void
tstamp_flush
(
struct
fmctdc_board
*
brd
,
int
ch
,
int
flush
)
{
int
ret
;
if
(
!
flush
)
return
;
ret
=
fmctdc_flush
(
brd
,
ch
);
if
(
ret
)
fprintf
(
stderr
,
"fmc-tdc-tstamp: failed to flush channel %d: %s
\n
"
,
ch
,
fmctdc_strerror
(
errno
));
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -106,7 +121,7 @@ int main(int argc, char **argv)
int
chan_count
=
0
,
i
,
n
,
ch
,
nfds
,
fd
,
byte_read
,
ret
,
n_boards
;
int
nblock
=
0
;
int
n_samples
=
-
1
;
int
fmt_wr
=
0
;
int
fmt_wr
=
0
,
flush
=
0
,
read
=
0
;
char
opt
;
fd_set
rfds
;
...
...
@@ -124,13 +139,19 @@ int main(int argc, char **argv)
ref
[
i
]
=
-
1
;
/* Parse Options */
while
((
opt
=
getopt
(
argc
,
argv
,
"hwns:d:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"hwns:d:
fr
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
case
'?'
:
help
(
argv
[
0
]);
exit
(
EXIT_SUCCESS
);
break
;
case
'f'
:
flush
=
1
;
break
;
case
'r'
:
read
=
1
;
break
;
case
's'
:
sscanf
(
optarg
,
"%i"
,
&
n_samples
);
break
;
...
...
@@ -191,22 +212,14 @@ int main(int argc, char **argv)
exit
(
EXIT_FAILURE
);
}
channels
[
ch
]
=
fmctdc_fileno_channel
(
brd
,
ch
);
ret
=
fmctdc_flush
(
brd
,
ch
);
if
(
ret
)
fprintf
(
stderr
,
"%s: failed to flush channel %d: %s
\n
"
,
argv
[
0
],
ch
,
fmctdc_strerror
(
errno
));
tstamp_flush
(
brd
,
ch
,
flush
);
chan_count
++
;
optind
++
;
}
/* If there are not channels, then dump them all */
if
(
!
chan_count
)
{
for
(
i
=
0
;
i
<
FMCTDC_NUM_CHANNELS
;
i
++
)
{
ret
=
fmctdc_flush
(
brd
,
i
);
if
(
ret
)
fprintf
(
stderr
,
"%s: failed to flush channel %d: %s
\n
"
,
argv
[
0
],
i
,
fmctdc_strerror
(
errno
));
tstamp_flush
(
brd
,
ch
,
flush
);
channels
[
i
]
=
fmctdc_fileno_channel
(
brd
,
i
);
ret
=
fmctdc_reference_set
(
brd
,
i
,
ref
[
i
]);
...
...
@@ -225,7 +238,8 @@ int main(int argc, char **argv)
/* Enable acquisition */
fmctdc_set_acquisition
(
brd
,
1
);
if
(
!
read
)
fmctdc_set_acquisition
(
brd
,
1
);
/* Read Time-Stamps */
n
=
0
;
while
(
n
<
n_samples
||
n_samples
<=
0
)
{
...
...
@@ -281,7 +295,8 @@ int main(int argc, char **argv)
fmctdc_reference_clear
(
brd
,
-
1
);
}
/* Disable acquisition */
fmctdc_set_acquisition
(
brd
,
0
);
if
(
!
read
)
fmctdc_set_acquisition
(
brd
,
0
);
fmctdc_close
(
brd
);
exit
(
EXIT_SUCCESS
);
...
...
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