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
fa4142be
Commit
fa4142be
authored
May 20, 2016
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/trigger.c: add direction polarity option
parent
e730307c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
trigger.c
examples/trigger.c
+27
-6
No files found.
examples/trigger.c
View file @
fa4142be
/*
* Simple example demonstrating the communication between
* a client and the FPGA device
*
*
* */
#include <getopt.h>
...
...
@@ -33,10 +33,11 @@ static struct option long_options[] =
{
"transmsrc"
,
required_argument
,
NULL
,
't'
},
{
"transsel"
,
required_argument
,
NULL
,
'u'
},
{
"dir"
,
required_argument
,
NULL
,
'd'
},
{
"dirpol"
,
required_argument
,
NULL
,
'x'
},
{
NULL
,
0
,
NULL
,
0
}
};
static
const
char
*
shortopt
=
"hb:vo:s:c:r:p:t:u:d:"
;
static
const
char
*
shortopt
=
"hb:vo:s:c:r:p:t:u:d:
x:
"
;
void
print_help
(
char
*
program_name
)
{
...
...
@@ -61,7 +62,8 @@ void print_help (char *program_name)
" -p --rcvsel <Receive selection source for the selected channel = [TBD]>
\n
"
" -t --transmsrc <Transmit source for the selected channel = [0 = trigger backplane, 1 = FPGA internal]>
\n
"
" -u --transmsel <Transmit selection source for the selected channel = [TBD]>
\n
"
" -d --dir <Trigger direction = [0 = FPGA Output, 1 = FPGA Input]>
\n
"
,
" -d --dir <Trigger direction = [0 = FPGA Output, 1 = FPGA Input]>
\n
"
" -x --dirpol <Trigger direction = [0 = FPGA Output, 1 = FPGA Input]>
\n
"
,
program_name
);
}
...
...
@@ -84,6 +86,8 @@ int main (int argc, char *argv [])
int
transmsel_sel
=
0
;
char
*
dir_str
=
NULL
;
int
dir_sel
=
0
;
char
*
dirpol_str
=
NULL
;
int
dirpol_sel
=
0
;
int
opt
;
while
((
opt
=
getopt_long
(
argc
,
argv
,
shortopt
,
long_options
,
NULL
))
!=
-
1
)
{
...
...
@@ -133,7 +137,7 @@ int main (int argc, char *argv [])
case
'u'
:
transmsel_str
=
strdup
(
optarg
);
transmsel_sel
=
1
;
transmsel_sel
=
1
;
break
;
case
'd'
:
...
...
@@ -141,6 +145,11 @@ int main (int argc, char *argv [])
dir_sel
=
1
;
break
;
case
'x'
:
dirpol_str
=
strdup
(
optarg
);
dirpol_sel
=
1
;
break
;
case
'?'
:
fprintf
(
stderr
,
"[client:trigger] Option not recognized or missing argument
\n
"
);
print_help
(
argv
[
0
]);
...
...
@@ -156,11 +165,11 @@ int main (int argc, char *argv [])
/* If we want to change a channel property, we must select a channel first */
if
((
rcvsrc_sel
==
1
||
rcvsel_sel
==
1
||
transmsrc_sel
==
1
||
transmsel_sel
==
1
||
dir_sel
==
1
)
&&
chan_sel
==
0
)
{
dir_sel
==
1
||
dirpol_sel
==
1
)
&&
chan_sel
==
0
)
{
fprintf
(
stderr
,
"[client:trigger]: Channel number not selected (use -c or --channumber option)
\n
"
);
exit
(
1
);
}
/* Set default broker address */
if
(
broker_endp
==
NULL
)
{
fprintf
(
stderr
,
"[client:trigger]: Setting default broker endpoint: %s
\n
"
,
...
...
@@ -267,8 +276,20 @@ int main (int argc, char *argv [])
}
}
uint32_t
dirpol
=
0
;
if
(
dirpol_sel
==
1
)
{
dirpol
=
strtoul
(
dirpol_str
,
NULL
,
10
);
bpm_client_err_e
err
=
bpm_set_trigger_dir_pol
(
bpm_client
,
service_iface
,
chan
,
dirpol
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:trigger]: bpm_set_trigger_dir_pol failed
\n
"
);
goto
err_bpm_set
;
}
}
err_bpm_set:
err_bpm_client_new:
free
(
dirpol_str
);
dirpol_str
=
NULL
;
free
(
dir_str
);
dir_str
=
NULL
;
free
(
transmsel_str
);
...
...
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