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
a4e110ab
Commit
a4e110ab
authored
Oct 25, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: being able to open using CERN LUN from tstamp tool
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
04f9e5cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
10 deletions
+32
-10
fmc-tdc-tstamp.c
tools/fmc-tdc-tstamp.c
+32
-10
No files found.
tools/fmc-tdc-tstamp.c
View file @
a4e110ab
...
...
@@ -108,10 +108,13 @@ enum tstamp_testing_modes {
*/
static
void
help
(
char
*
name
)
{
fprintf
(
stderr
,
"%s [options] <device> [channels]
\n
"
,
basename
(
name
));
fprintf
(
stderr
,
"%s [options] -D <device_id> -L <cern-lun> [channels]
\n
"
,
basename
(
name
));
fprintf
(
stderr
,
"reads timestamps from fmc-tdc channels. No [channels] means all channels.
\n\n
"
);
fprintf
(
stderr
,
"Options are:
\n
"
);
fprintf
(
stderr
,
" -D : device identifier in hex, e.g. 0x1234
\n
"
);
fprintf
(
stderr
,
" -L : CERN LUN number
\n
"
);
fprintf
(
stderr
,
" -n : non-blocking mode
\n
"
);
fprintf
(
stderr
,
" -s n_samples: dump 'n_samples' timestamps
\n
"
);
fprintf
(
stderr
,
" -w : user White Rabbit format
\n
"
);
...
...
@@ -216,6 +219,7 @@ int main(int argc, char **argv)
{
struct
fmctdc_board
*
brd
;
unsigned
int
dev_id
=
0xFFFFFFFF
;
unsigned
int
lun
=
0xFFFFFFFF
;
struct
fmctdc_time
*
ts
;
int
channels
[
FMCTDC_NUM_CHANNELS
];
int
chan_count
=
0
,
i
,
n
,
ch
,
fd
,
n_ts
,
ret
,
n_boards
;
...
...
@@ -258,7 +262,7 @@ int main(int argc, char **argv)
}
/* Parse Options */
while
((
opt
=
getopt
(
argc
,
argv
,
"D:hwns:frm:l:Lc:VS:t:o:ea:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"D:hwns:frm:l:L
:
c:VS:t:o:ea:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'D'
:
ret
=
sscanf
(
optarg
,
"0x%04x"
,
&
dev_id
);
...
...
@@ -267,6 +271,13 @@ int main(int argc, char **argv)
exit
(
EXIT_SUCCESS
);
}
break
;
case
'L'
:
ret
=
sscanf
(
optarg
,
"%u"
,
&
lun
);
if
(
!
ret
)
{
help
(
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
break
;
case
'h'
:
case
'?'
:
help
(
argv
[
0
]);
...
...
@@ -361,18 +372,29 @@ int main(int argc, char **argv)
}
}
/* Open FMC TDC device */
brd
=
fmctdc_open
(
-
1
,
dev_id
);
/* look for dev_id form the beginning */
if
(
!
brd
)
{
if
(
dev_id
==
0xFFFFFFFF
)
fprintf
(
stderr
,
"Missing device identifier
\n
"
);
else
fprintf
(
stderr
,
"Can't open device 0x%x: %s
\n
"
,
dev_id
,
strerror
(
errno
));
if
(
dev_id
==
0xFFFFFFFF
&&
lun
==
dev_id
)
{
fprintf
(
stderr
,
"Missing device identifier or CENR LUN
\n
"
);
exit
(
EXIT_FAILURE
);
}
/* Open FMC TDC device */
if
(
dev_id
!=
0xFFFFFFFF
)
{
brd
=
fmctdc_open
(
-
1
,
dev_id
);
if
(
!
brd
)
{
fprintf
(
stderr
,
"Can't open device id 0x%x: %s
\n
"
,
dev_id
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
}
else
{
brd
=
fmctdc_open_by_lun
(
lun
);
if
(
!
brd
)
{
fprintf
(
stderr
,
"Can't open device lun %u: %s
\n
"
,
lun
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
}
/* Open Channels from command line */
memset
(
channels
,
0
,
sizeof
(
channels
));
memset
(
p
,
0
,
sizeof
(
p
));
...
...
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