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
29dbdf06
Commit
29dbdf06
authored
Jun 15, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: do not allow open by offset
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
16aa7ca8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
13 deletions
+7
-13
fmctdc-lib.c
lib/fmctdc-lib.c
+2
-9
fmctdc-lib.h
lib/fmctdc-lib.h
+1
-1
fmc-tdc-perftest.c
tools/fmc-tdc-perftest.c
+1
-1
fmc-tdc-tstamp.c
tools/fmc-tdc-tstamp.c
+1
-1
test-common.c
tools/test-common.c
+2
-1
No files found.
lib/fmctdc-lib.c
View file @
29dbdf06
...
...
@@ -82,15 +82,13 @@ void fmctdc_exit(void)
/**
* It opens one specific device. -1 arguments mean "not installed"
* @param[in] offset [deprecated] board enumeration offset [0, N].
* -1 to ignore it and use only dev_id
* @param[in] dev_id FMC device id. -1 to ignore it and use only the offset
* @return an instance token, otherwise NULL and errno is appripriately set.
* ENODEV if the device was not found. EINVAL there is a mismatch with
* the arguments
*/
#define __FMCTDC_OPEN_PATH_MAX 128
struct
fmctdc_board
*
fmctdc_open
(
int
offset
,
int
dev_id
)
struct
fmctdc_board
*
fmctdc_open
(
int
dev_id
)
{
struct
__fmctdc_board
*
b
=
NULL
;
uint32_t
nsamples
=
NSAMPLE
;
...
...
@@ -100,11 +98,6 @@ struct fmctdc_board *fmctdc_open(int offset, int dev_id)
int
ret
;
struct
stat
sb
;
if
(
offset
!=
-
1
)
{
errno
=
EINVAL
;
return
NULL
;
}
if
(
dev_id
<
0
)
{
errno
=
EINVAL
;
return
NULL
;
...
...
@@ -231,7 +224,7 @@ struct fmctdc_board *fmctdc_open_by_lun(int lun)
errno
=
ENODEV
;
return
NULL
;
}
return
fmctdc_open
(
-
1
,
dev_id
);
return
fmctdc_open
(
dev_id
);
}
...
...
lib/fmctdc-lib.h
View file @
29dbdf06
...
...
@@ -218,7 +218,7 @@ extern int fmctdc_ts_mode_get(struct fmctdc_board *userb,
* Set of functions to read time-stamps from the board
* @{
*/
extern
struct
fmctdc_board
*
fmctdc_open
(
int
offset
,
int
dev_id
);
extern
struct
fmctdc_board
*
fmctdc_open
(
int
dev_id
);
extern
struct
fmctdc_board
*
fmctdc_open_by_lun
(
int
lun
);
extern
int
fmctdc_close
(
struct
fmctdc_board
*
);
extern
int
fmctdc_fread
(
struct
fmctdc_board
*
b
,
unsigned
int
channel
,
...
...
tools/fmc-tdc-perftest.c
View file @
29dbdf06
...
...
@@ -267,7 +267,7 @@ int main(int argc, char **argv)
}
/* Open FMC TDC device */
brd
=
fmctdc_open
(
-
1
,
dev_id
);
/* look for dev_id form the beginning */
brd
=
fmctdc_open
(
dev_id
);
/* look for dev_id form the beginning */
if
(
!
brd
)
{
if
(
dev_id
==
0xFFFFFFFF
)
...
...
tools/fmc-tdc-tstamp.c
View file @
29dbdf06
...
...
@@ -377,7 +377,7 @@ int main(int argc, char **argv)
/* Open FMC TDC device */
if
(
dev_id
!=
0xFFFFFFFF
)
{
brd
=
fmctdc_open
(
-
1
,
dev_id
);
brd
=
fmctdc_open
(
dev_id
);
if
(
!
brd
)
{
fprintf
(
stderr
,
"Can't open device id 0x%x: %s
\n
"
,
dev_id
,
strerror
(
errno
));
...
...
tools/test-common.c
View file @
29dbdf06
...
...
@@ -22,7 +22,8 @@ void open_board(char *dev_id_str)
exit
(
-
1
);
}
brd
=
fmctdc_open
(
-
1
,
dev_id
);
brd
=
fmctdc_open
(
dev_id
);
if
(
!
brd
)
{
fprintf
(
stderr
,
"Can't open device %s: %s
\n
"
,
dev_id_str
,
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