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
e43f6a68
Commit
e43f6a68
authored
Jul 20, 2013
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: wip on test program
parent
8156f0e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
17 deletions
+42
-17
fmctdc-test.c
lib/fmctdc-test.c
+42
-17
No files found.
lib/fmctdc-test.c
View file @
e43f6a68
...
...
@@ -60,25 +60,34 @@ int open_board(char *dev_id_str)
return
0
;
}
int
go_identify
(
int
argc
,
char
**
argv
)
int
check_help
(
int
argc
,
char
**
argv
,
int
min_args
,
char
*
usage
,
char
*
desc
,
char
*
options
)
{
if
(
argc
>=
2
&&
!
strcmp
(
argv
[
1
],
"-h"
))
if
(
argc
>=
2
&&
!
strcmp
(
argv
[
1
],
"-h"
))
{
printf
(
"%s: identifies a given fmc-tdc device in a crate by blinking its status LED.
\n
"
,
argv
[
0
]);
printf
(
"usage: %s [-h] <device>
\n
"
,
argv
[
0
]);
return
0
;
}
if
(
argc
<
2
)
printf
(
"%s: %s
\n
"
,
argv
[
0
],
desc
);
printf
(
"usage: %s %s
\n
"
,
argv
[
0
],
usage
);
printf
(
"%s
\n
"
,
options
);
return
1
;
}
else
if
(
argc
<
min_args
)
{
printf
(
"usage: %s
[-h] <device>
\n
"
,
argv
[
0
]
);
return
0
;
printf
(
"usage: %s
%s
\n
"
,
argv
[
0
],
usage
);
return
1
;
}
return
0
;
}
int
go_identify
(
int
argc
,
char
**
argv
)
{
if
(
check_help
(
argc
,
argv
,
2
,
"[-h] <device>"
,
"identifies a given fmc-tdc device in a crate by blinking its status LEDs."
,
""
))
return
0
;
if
(
open_board
(
argv
[
1
])
<
0
)
return
-
1
;
printf
(
"Blinking the status LED
. Press ENTER
to stop.
\n
"
);
printf
(
"Blinking the status LED
s. Press Enter
to stop.
\n
"
);
fmctdc_identify_card
(
brd
,
1
);
getchar
();
fmctdc_identify_card
(
brd
,
0
);
...
...
@@ -90,12 +99,11 @@ int go_list(int argc, char **argv)
{
int
i
;
if
(
argc
>=
2
&&
!
strcmp
(
argv
[
1
],
"-h"
))
{
printf
(
"%s: lists all installed fmc-tdc boards.
\n
"
,
argv
[
0
]);
printf
(
"usage: %s [-h]
\n
"
,
argv
[
0
]);
return
0
;
}
if
(
check_help
(
argc
,
argv
,
1
,
"[-h]"
,
"lists all installed fmc-tdc boards."
,
""
))
return
0
;
printf
(
"Found %i board(s):
\n
"
,
n_boards
);
...
...
@@ -111,6 +119,23 @@ int go_list(int argc, char **argv)
return
0
;
}
int
go_read
(
int
argc
,
char
**
argv
)
{
int
non_block
=
0
;
if
(
check_help
(
argc
,
argv
,
3
,
"[-h] [-n] <channels> <n_samples>"
,
"reads timestamps from the selected fmc-tdc channels."
,
" -n: non-blocking mode
\n
"
"When n_samples == 0, program will keep reading samples until interrupted."
))
return
0
;
if
(
!
strcmp
(
argv
[
1
],
"-n"
))
non_block
=
1
;
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
rv
=
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