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
18309d45
Commit
18309d45
authored
Sep 07, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: deprecate fmctdc_read_temperature
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
e8dd0b96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
8 deletions
+39
-8
fmctdc-lib.c
lib/fmctdc-lib.c
+27
-5
fmctdc-lib.h
lib/fmctdc-lib.h
+4
-1
fmc-tdc-temperature.c
tools/fmc-tdc-temperature.c
+8
-2
No files found.
lib/fmctdc-lib.c
View file @
18309d45
...
...
@@ -317,15 +317,21 @@ int fmctdc_close(struct fmctdc_board *userb)
/**
* It reads the current temperature of a TDC device
* @param[in] userb TDC board instance token
* @return temperature
* @param[out] temperature the temperature in degree
* @return 0 on success, -1 on error and errno is appropriately set
*/
float
fmctdc_read_temperature
(
struct
fmctdc_board
*
userb
)
int
fmctdc_temperature_get
(
struct
fmctdc_board
*
userb
,
float
*
temperature
)
{
uint32_t
t
;
__define_board
(
b
,
userb
);
uint32_t
t
;
int
ret
;
fmctdc_sysfs_get
(
b
,
"temperature"
,
&
t
);
return
(
float
)
t
/
16
.
0
;
ret
=
fmctdc_sysfs_get
(
b
,
"temperature"
,
&
t
);
if
(
ret
<
0
)
return
ret
;
*
temperature
=
(
float
)
t
/
16
.
0
;
return
0
;
}
...
...
@@ -1188,3 +1194,19 @@ int fmctdc_ts_mode_get(struct fmctdc_board *userb,
return
0
;
}
/* DEPRECATED */
/**
* It reads the current temperature of a TDC device
* @param[in] userb TDC board instance token
* @return the temperature in degree
*/
float
fmctdc_read_temperature
(
struct
fmctdc_board
*
userb
)
{
float
t
;
fmctdc_temperature_get
(
userb
,
&
t
);
return
t
;
}
lib/fmctdc-lib.h
View file @
18309d45
...
...
@@ -96,6 +96,8 @@ extern int fmctdc_init(void);
extern
void
fmctdc_exit
(
void
);
/* Utilities */
extern
char
*
fmctdc_strerror
(
int
err
);
extern
int
fmctdc_temperature_get
(
struct
fmctdc_board
*
userb
,
float
*
temperature
);
/* Open And Close Devices */
extern
struct
fmctdc_board
*
fmctdc_open
(
int
offset
,
int
dev_id
);
extern
struct
fmctdc_board
*
fmctdc_open_by_lun
(
int
lun
);
...
...
@@ -171,7 +173,8 @@ extern int fmctdc_get_time(struct fmctdc_board *b, struct fmctdc_time *t);
extern
int
fmctdc_set_host_time
(
struct
fmctdc_board
*
b
);
extern
int
fmctdc_wr_mode
(
struct
fmctdc_board
*
b
,
int
on
);
extern
int
fmctdc_check_wr_mode
(
struct
fmctdc_board
*
b
);
extern
float
fmctdc_read_temperature
(
struct
fmctdc_board
*
b
);
extern
float
fmctdc_read_temperature
(
struct
fmctdc_board
*
b
)
__attribute__
((
deprecated
));
/* other */
extern
const
char
*
const
libfmctdc_version_s
;
...
...
tools/fmc-tdc-temperature.c
View file @
18309d45
...
...
@@ -13,15 +13,21 @@ char git_version[] = "git version: " GIT_VERSION;
int
main
(
int
argc
,
char
**
argv
)
{
init
(
argc
,
argv
);
float
t
;
int
err
;
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
2
,
"[-h] [-V] <device>"
,
"Displays current temperature of the mezzanine.
\n
"
,
""
);
open_board
(
argv
[
1
]);
printf
(
"%.1f deg C
\n
"
,
fmctdc_read_temperature
(
brd
));
err
=
fmctdc_temperature_get
(
brd
,
&
t
);
if
(
err
)
fprintf
(
stderr
,
"Failed to read temperature: %s
\n
"
,
fmctdc_strerror
(
errno
));
printf
(
"%.1f deg C
\n
"
,
t
);
return
0
;
}
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