Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - 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
Beam Positoning Monitor - Software
Commits
842ef5c6
Commit
842ef5c6
authored
Oct 16, 2014
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/test_data_en.c: add FMC130M_4CH data test enable
parent
4c96dd29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
test_data_en.c
examples/test_data_en.c
+98
-0
No files found.
examples/test_data_en.c
0 → 100644
View file @
842ef5c6
/*
* Simple example demonstrating the communication between
* a client and the FPGA device
*/
#include <mdp.h>
#include <czmq.h>
#include <inttypes.h>
#include <bpm_client.h>
#define DFLT_BIND_FOLDER "/tmp/bpm"
#define DEFAULT_TEST_DATA_EN 0
#define MAX_TEST_DATA_EN 1
void
print_help
(
char
*
program_name
)
{
printf
(
"Usage: %s [options]
\n
"
"
\t
-h This help message
\n
"
"
\t
-v Verbose output
\n
"
"
\t
-e <[0|1]> Enable or disable TEST data
\n
"
"
\t
-b <broker_endpoint> Broker endpoint
\n
"
,
program_name
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
verbose
=
0
;
char
*
broker_endp
=
NULL
;
char
*
test_data_en_str
=
NULL
;
char
**
str_p
=
NULL
;
if
(
argc
<
3
)
{
print_help
(
argv
[
0
]);
exit
(
1
);
}
/* FIXME: This is rather buggy! */
/* Simple handling of command-line options. This should be done
* with getopt, for instance*/
int
i
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
streq
(
argv
[
i
],
"-v"
))
{
verbose
=
1
;
}
else
if
(
streq
(
argv
[
i
],
"-h"
))
{
print_help
(
argv
[
0
]);
exit
(
1
);
}
else
if
(
streq
(
argv
[
i
],
"-e"
))
{
str_p
=
&
test_data_en_str
;
}
else
if
(
streq
(
argv
[
i
],
"-b"
))
{
str_p
=
&
broker_endp
;
}
/* Fallout for options with parameters */
else
{
*
str_p
=
strdup
(
argv
[
i
]);
}
}
/* Set default broker address */
if
(
broker_endp
==
NULL
)
{
broker_endp
=
strdup
(
"ipc://"
DFLT_BIND_FOLDER
);
}
/* Set test data enable default */
uint32_t
test_data_en
;
if
(
test_data_en_str
==
NULL
)
{
fprintf
(
stderr
,
"[client:test_data_en]: Setting test DATA enable to 0
\n
"
);
test_data_en
=
DEFAULT_TEST_DATA_EN
;
}
else
{
test_data_en
=
strtoul
(
test_data_en_str
,
NULL
,
10
);
if
(
test_data_en
>
MAX_TEST_DATA_EN
)
{
fprintf
(
stderr
,
"[client:test_data_en]: Test data enable value too big! Defaulting to: %u
\n
"
,
MAX_TEST_DATA_EN
);
test_data_en
=
MAX_TEST_DATA_EN
;
}
}
fprintf
(
stdout
,
"[client:test_data_en]: test_data_en = %u
\n
"
,
test_data_en
);
bpm_client_t
*
bpm_client
=
bpm_client_new
(
broker_endp
,
verbose
,
NULL
);
/* Test data enable */
bpm_set_adc_test_data_en
(
bpm_client
,
"BPM0:DEVIO:FMC130M_4CH0"
,
test_data_en
);
bpm_client_destroy
(
&
bpm_client
);
str_p
=
&
test_data_en_str
;
free
(
*
str_p
);
test_data_en_str
=
NULL
;
str_p
=
&
broker_endp
;
free
(
*
str_p
);
broker_endp
=
NULL
;
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