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
141664a1
Commit
141664a1
authored
Mar 03, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/fmc130m_4ch_ctl.c: add ADC LTC2208 functions
This closes #83 github issue
parent
9bc86782
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
2 deletions
+83
-2
fmc130m_4ch_ctl.c
examples/fmc130m_4ch_ctl.c
+83
-2
No files found.
examples/fmc130m_4ch_ctl.c
View file @
141664a1
...
@@ -29,6 +29,10 @@ void print_help (char *program_name)
...
@@ -29,6 +29,10 @@ void print_help (char *program_name)
"
\t
-pll_status PLL Lock status
\n
"
"
\t
-pll_status PLL Lock status
\n
"
"
\t
-trig_dir <dir> Trigger direction
\n
"
"
\t
-trig_dir <dir> Trigger direction
\n
"
"
\t
-clk_sel <sel = [0(FMC front panel)|1(FMC pin)]> Clock selection
\n
"
"
\t
-clk_sel <sel = [0(FMC front panel)|1(FMC pin)]> Clock selection
\n
"
"
\t
-adc_rand <rand = [0|1]> ADC RAND
\n
"
"
\t
-adc_dith <dith = [0|1]> ADC DITH
\n
"
"
\t
-adc_shdn <shdn = [0|1]> ADC SHDN
\n
"
"
\t
-adc_pga <pga = [0|1]> ADC PGA
\n
"
,
program_name
);
,
program_name
);
}
}
...
@@ -40,6 +44,10 @@ int main (int argc, char *argv [])
...
@@ -40,6 +44,10 @@ int main (int argc, char *argv [])
char
*
bpm_number_str
=
NULL
;
char
*
bpm_number_str
=
NULL
;
char
*
trig_dir_str
=
NULL
;
char
*
trig_dir_str
=
NULL
;
char
*
clk_sel_str
=
NULL
;
char
*
clk_sel_str
=
NULL
;
char
*
adc_rand_str
=
NULL
;
char
*
adc_dith_str
=
NULL
;
char
*
adc_shdn_str
=
NULL
;
char
*
adc_pga_str
=
NULL
;
uint32_t
get_pll_status
=
0
;
uint32_t
get_pll_status
=
0
;
char
**
str_p
=
NULL
;
char
**
str_p
=
NULL
;
...
@@ -83,6 +91,18 @@ int main (int argc, char *argv [])
...
@@ -83,6 +91,18 @@ int main (int argc, char *argv [])
else
if
(
streq
(
argv
[
i
],
"-clk_sel"
))
{
else
if
(
streq
(
argv
[
i
],
"-clk_sel"
))
{
str_p
=
&
clk_sel_str
;
str_p
=
&
clk_sel_str
;
}
}
else
if
(
streq
(
argv
[
i
],
"-adc_rand"
))
{
str_p
=
&
adc_rand_str
;
}
else
if
(
streq
(
argv
[
i
],
"-adc_dith"
))
{
str_p
=
&
adc_dith_str
;
}
else
if
(
streq
(
argv
[
i
],
"-adc_shdn"
))
{
str_p
=
&
adc_shdn_str
;
}
else
if
(
streq
(
argv
[
i
],
"-adc_pga"
))
{
str_p
=
&
adc_pga_str
;
}
/* Fallout for options with parameters */
/* Fallout for options with parameters */
else
{
else
{
*
str_p
=
strdup
(
argv
[
i
]);
*
str_p
=
strdup
(
argv
[
i
]);
...
@@ -161,6 +181,58 @@ int main (int argc, char *argv [])
...
@@ -161,6 +181,58 @@ int main (int argc, char *argv [])
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_fmc_clk_sel was successfully executed
\n
"
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_fmc_clk_sel was successfully executed
\n
"
);
}
}
uint32_t
adc_rand
=
0
;
if
(
adc_rand_str
!=
NULL
)
{
adc_rand
=
strtoul
(
adc_rand_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: adc_rand = %u
\n
"
,
adc_rand
);
err
=
bpm_set_adc_rand
(
bpm_client
,
service
,
adc_rand
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_adc_rand failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_adc_rand was successfully executed
\n
"
);
}
uint32_t
adc_dith
=
0
;
if
(
adc_dith_str
!=
NULL
)
{
adc_dith
=
strtoul
(
adc_dith_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: adc_dith = %u
\n
"
,
adc_dith
);
err
=
bpm_set_adc_dith
(
bpm_client
,
service
,
adc_dith
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_adc_dith failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_adc_dith was successfully executed
\n
"
);
}
uint32_t
adc_shdn
=
0
;
if
(
adc_shdn_str
!=
NULL
)
{
adc_shdn
=
strtoul
(
adc_shdn_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: adc_shdn = %u
\n
"
,
adc_shdn
);
err
=
bpm_set_adc_shdn
(
bpm_client
,
service
,
adc_shdn
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_adc_shdn failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_adc_shdn was successfully executed
\n
"
);
}
uint32_t
adc_pga
=
0
;
if
(
adc_pga_str
!=
NULL
)
{
adc_pga
=
strtoul
(
adc_pga_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: adc_pga = %u
\n
"
,
adc_pga
);
err
=
bpm_set_adc_pga
(
bpm_client
,
service
,
adc_pga
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_adc_pga failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_adc_pga was successfully executed
\n
"
);
}
if
(
get_pll_status
)
{
if
(
get_pll_status
)
{
uint32_t
pll_status
=
0
;
uint32_t
pll_status
=
0
;
bpm_client_err_e
err
=
bpm_get_fmc_pll_status
(
bpm_client
,
service
,
&
pll_status
);
bpm_client_err_e
err
=
bpm_get_fmc_pll_status
(
bpm_client
,
service
,
&
pll_status
);
...
@@ -174,9 +246,18 @@ int main (int argc, char *argv [])
...
@@ -174,9 +246,18 @@ int main (int argc, char *argv [])
err_bpm_exit:
err_bpm_exit:
bpm_client_destroy
(
&
bpm_client
);
bpm_client_destroy
(
&
bpm_client
);
str_p
=
&
clk_sel_str
;
str_p
=
&
adc_pga_str
;
free
(
*
str_p
);
adc_pga_str
=
NULL
;
str_p
=
&
adc_shdn_str
;
free
(
*
str_p
);
adc_shdn_str
=
NULL
;
str_p
=
&
adc_dith_str
;
free
(
*
str_p
);
adc_dith_str
=
NULL
;
str_p
=
&
adc_rand_str
;
free
(
*
str_p
);
free
(
*
str_p
);
clk_sel
_str
=
NULL
;
adc_rand
_str
=
NULL
;
str_p
=
&
trig_dir_str
;
str_p
=
&
trig_dir_str
;
free
(
*
str_p
);
free
(
*
str_p
);
trig_dir_str
=
NULL
;
trig_dir_str
=
NULL
;
...
...
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