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
5deba899
Commit
5deba899
authored
Sep 07, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: use valid bit in order to apply a configuration
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
010b3830
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
fmc-tdc-tstamp.c
tools/fmc-tdc-tstamp.c
+20
-3
No files found.
tools/fmc-tdc-tstamp.c
View file @
5deba899
...
...
@@ -238,7 +238,9 @@ static int tstamp_testing_mode(struct fmctdc_time *ts,
return
err
;
}
#define FMCTDC_CFG_VALID (1 << 0)
struct
fmctdc_config_chan
{
unsigned
long
flags
;
enum
fmctdc_ts_mode
mode
;
};
...
...
@@ -283,6 +285,7 @@ int main(int argc, char **argv)
}
for
(
i
=
0
;
i
<
FMCTDC_NUM_CHANNELS
;
++
i
)
{
ch_cfg
[
i
].
flags
=
0
;
ch_cfg
[
i
].
mode
=
FMCTDC_TS_MODE_POST
;
}
...
...
@@ -345,7 +348,15 @@ int main(int argc, char **argv)
argv
[
0
],
FMCTDC_NUM_CHANNELS
);
break
;
}
sscanf
(
optarg
,
"%i"
,
&
ch_valid
[
chan_count
++
]);
ret
=
sscanf
(
optarg
,
"%i"
,
&
tmp
);
if
(
ret
!=
1
||
tmp
>=
FMCTDC_NUM_CHANNELS
)
{
fprintf
(
stderr
,
"%s: invalid channel number %u
\n
"
,
argv
[
0
],
tmp
);
help
(
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
ch_valid
[
chan_count
++
]
=
tmp
;
ch_cfg
[
tmp
].
flags
|=
FMCTDC_CFG_VALID
;
break
;
case
'S'
:
sscanf
(
optarg
,
"%i"
,
&
n_show
);
...
...
@@ -400,14 +411,20 @@ int main(int argc, char **argv)
/* Open Channels from command line */
memset
(
channels
,
0
,
sizeof
(
channels
));
memset
(
p
,
0
,
sizeof
(
p
));
if
(
!
chan_count
)
if
(
!
chan_count
)
{
chan_count
=
FMCTDC_NUM_CHANNELS
;
for
(
i
=
0
;
i
<
FMCTDC_NUM_CHANNELS
;
i
++
)
ch_cfg
[
i
].
flags
|=
FMCTDC_CFG_VALID
;
}
for
(
i
=
0
;
i
<
FMCTDC_NUM_CHANNELS
;
i
++
)
{
if
((
ch_cfg
[
i
].
flags
&
FMCTDC_CFG_VALID
)
==
0
)
continue
;
ret
=
fmctdc_ts_mode_set
(
brd
,
i
,
ch_cfg
[
i
].
mode
);
if
(
ret
)
{
fprintf
(
stderr
,
"%s: chan %d: cannot set time-stamp mode: %s.
Use default
\n
"
,
"%s: chan %d: cannot set time-stamp mode: %s.
\n
"
,
argv
[
0
],
i
,
fmctdc_strerror
(
errno
));
}
}
...
...
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