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
9b5ff175
Commit
9b5ff175
authored
Nov 30, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add printing version of the repo
with -V switch Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
97e63f29
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
5 deletions
+41
-5
Makefile
tools/Makefile
+2
-0
fmc-tdc-list.c
tools/fmc-tdc-list.c
+3
-1
fmc-tdc-temperature.c
tools/fmc-tdc-temperature.c
+3
-1
fmc-tdc-term.c
tools/fmc-tdc-term.c
+3
-1
fmc-tdc-time.c
tools/fmc-tdc-time.c
+3
-1
fmc-tdc-tstamp.c
tools/fmc-tdc-tstamp.c
+16
-1
test-common.c
tools/test-common.c
+11
-0
No files found.
tools/Makefile
View file @
9b5ff175
...
...
@@ -17,6 +17,8 @@ TESTS = fmc-tdc-list \
fmc-tdc-tstamp
CFLAGS
=
-I
.
-I
$(LIBTDC)
-I
../kernel
-Wall
$(EXTRACFLAGS)
GIT_VERSION
:=
$(
shell
git describe
--dirty
--long
--tags
)
CFLAGS
+=
-DGIT_VERSION
=
"
\"
$(GIT_VERSION)
\"
"
COMMON_SRCS
=
test-common.c
LDFLAGS
=
-L
$(LIBTDC)
...
...
tools/fmc-tdc-list.c
View file @
9b5ff175
...
...
@@ -14,6 +14,8 @@
#include "test-common.h"
char
git_version
[]
=
"git version: "
GIT_VERSION
;
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
...
...
@@ -21,7 +23,7 @@ int main(int argc, char **argv)
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
1
,
"[-h]"
,
"lists all installed fmc-tdc boards."
,
""
);
"[-h]
[-V]
"
,
"lists all installed fmc-tdc boards."
,
""
);
printf
(
"Found %i board(s):
\n
"
,
n_boards
);
...
...
tools/fmc-tdc-temperature.c
View file @
9b5ff175
...
...
@@ -13,12 +13,14 @@
#include "test-common.h"
char
git_version
[]
=
"git version: "
GIT_VERSION
;
int
main
(
int
argc
,
char
**
argv
)
{
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
2
,
"[-h] <device>"
,
"[-h]
[-V]
<device>"
,
"Displays current temperature of the mezzanine.
\n
"
,
""
);
open_board
(
argv
[
1
]);
...
...
tools/fmc-tdc-term.c
View file @
9b5ff175
...
...
@@ -13,12 +13,14 @@
#include "test-common.h"
char
git_version
[]
=
"git version: "
GIT_VERSION
;
int
main
(
int
argc
,
char
**
argv
)
{
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
2
,
"[-h] <device> <channel> [on/off]"
,
"[-h]
[-V]
<device> <channel> [on/off]"
,
"Enables or disables the 50 Ohm termination of a given input channel.
\n
"
"No on/off command returns the current state of termination resistor."
,
""
);;
...
...
tools/fmc-tdc-time.c
View file @
9b5ff175
...
...
@@ -13,6 +13,8 @@
#include "test-common.h"
char
git_version
[]
=
"git version: "
GIT_VERSION
;
void
perror_hint
(
const
char
*
func
)
{
perror
(
func
);
...
...
@@ -27,7 +29,7 @@ int main(int argc, char **argv)
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
3
,
"[-h
] <device> <command> [timeval]"
,
"[-h] [-V
] <device> <command> [timeval]"
,
"Gets/sets the mezzanine TAI time and controls White Rabbit timing."
,
"Commands are:
\n
"
" get - shows current time and White Rabbit status.
\n
"
...
...
tools/fmc-tdc-tstamp.c
View file @
9b5ff175
...
...
@@ -28,6 +28,8 @@
#include "fmctdc-lib.h"
char
git_version
[]
=
"git_version: "
GIT_VERSION
;
/* Previous time stamp for each channel */
struct
fmctdc_time
ts_prev
[
FMCTDC_NUM_CHANNELS
];
static
unsigned
int
stop
=
0
,
fmt_wr
=
0
;
...
...
@@ -83,6 +85,15 @@ void dump(unsigned int ch, struct fmctdc_time *ts, int diff_mode)
fprintf
(
stdout
,
" [%f Hz]
\n
"
,
hz
);
}
/* We could use print_version from test-common.c, but to avoid creating
* dependencies use local copy */
static
void
print_version
(
char
*
pname
)
{
printf
(
"%s %s
\n
"
,
pname
,
git_version
);
printf
(
"%s
\n
"
,
libfmctdc_version_s
);
printf
(
"%s
\n
"
,
libfmctdc_zio_version_s
);
}
/* Print help message */
static
void
help
(
char
*
name
)
{
...
...
@@ -101,6 +112,7 @@ static void help(char *name)
fprintf
(
stderr
,
" -l: maximum buffer lenght
\n
"
);
fprintf
(
stderr
,
" -L:
\t
keep reading from the last hardware timestamp instead than from the proper buffer
\n
"
);
fprintf
(
stderr
,
" -h: print this message
\n\n
"
);
fprintf
(
stderr
,
" -V: print version info
\n\n
"
);
fprintf
(
stderr
,
" channels enumerations go from %d to %d
\n\n
"
,
FMCTDC_CH_1
,
FMCTDC_CH_LAST
);
}
...
...
@@ -151,13 +163,16 @@ int main(int argc, char **argv)
ref
[
i
]
=
-
1
;
/* Parse Options */
while
((
opt
=
getopt
(
argc
,
argv
,
"hwns:d:frm:l:Lc:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"hwns:d:frm:l:Lc:
V
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
case
'?'
:
help
(
argv
[
0
]);
exit
(
EXIT_SUCCESS
);
break
;
case
'V'
:
print_version
(
argv
[
0
]);
exit
(
EXIT_SUCCESS
);
case
'f'
:
flush
=
1
;
break
;
...
...
tools/test-common.c
View file @
9b5ff175
...
...
@@ -13,6 +13,7 @@
#include "test-common.h"
extern
char
git_version
[];
int
n_boards
;
struct
fmctdc_board
*
brd
=
NULL
;
...
...
@@ -39,6 +40,13 @@ void open_board(char *dev_id_str)
}
}
static
void
print_version
(
char
*
pname
)
{
printf
(
"%s %s
\n
"
,
pname
,
git_version
);
printf
(
"%s
\n
"
,
libfmctdc_version_s
);
printf
(
"%s
\n
"
,
libfmctdc_zio_version_s
);
}
void
check_help
(
int
argc
,
char
**
argv
,
int
min_args
,
char
*
usage
,
char
*
desc
,
char
*
options
)
{
...
...
@@ -47,6 +55,9 @@ void check_help(int argc, char **argv, int min_args, char *usage, char *desc,
printf
(
"usage: %s %s
\n
"
,
argv
[
0
],
usage
);
printf
(
"%s
\n
"
,
options
);
exit
(
0
);
}
else
if
((
argc
>=
2
)
&&
(
!
strcmp
(
argv
[
1
],
"-V"
)))
{
print_version
(
argv
[
0
]);
exit
(
0
);
}
else
if
(
argc
<
min_args
)
{
printf
(
"usage: %s %s
\n
"
,
argv
[
0
],
usage
);
exit
(
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