Commit 16701b4a authored by Lucas Russo's avatar Lucas Russo

examples/fmc130m_4ch_ctl.c: add clk_sel option

parent b6b5a445
......@@ -28,6 +28,7 @@ void print_help (char *program_name)
"\t-b <broker_endpoint> Broker endpoint\n"
"\t-pll_status PLL Lock status\n"
"\t-trig_dir <dir> Trigger direction\n"
"\t-clk_sel <sel = [0(FMC front panel)|1(FMC pin)]> Clock selection\n"
, program_name);
}
......@@ -38,6 +39,7 @@ int main (int argc, char *argv [])
char *board_number_str = NULL;
char *bpm_number_str = NULL;
char *trig_dir_str = NULL;
char *clk_sel_str = NULL;
uint32_t get_pll_status = 0;
char **str_p = NULL;
......@@ -78,6 +80,9 @@ int main (int argc, char *argv [])
else if (streq (argv[i], "-trig_dir")) {
str_p = &trig_dir_str;
}
else if (streq (argv[i], "-clk_sel")) {
str_p = &clk_sel_str;
}
/* Fallout for options with parameters */
else {
*str_p = strdup (argv[i]);
......@@ -143,6 +148,19 @@ int main (int argc, char *argv [])
fprintf (stdout, "[client:fmc130m_4ch]: bpm_set_trig_dir was successfully executed\n");
}
uint32_t clk_sel = 0;
if (clk_sel_str != NULL) {
clk_sel = strtoul (clk_sel_str, NULL, 10);
fprintf (stdout, "[client:fmc130m_4ch]: clk_sel = %u\n", clk_sel);
err = bpm_set_fmc_clk_sel (bpm_client, service, clk_sel);
if (err != BPM_CLIENT_SUCCESS){
fprintf (stderr, "[client:fmc130m_4ch]: bpm_set_fmc_clk_sel failed\n");
goto err_bpm_exit;
}
fprintf (stdout, "[client:fmc130m_4ch]: bpm_set_fmc_clk_sel was successfully executed\n");
}
if (get_pll_status) {
uint32_t pll_status = 0;
bpm_client_err_e err = bpm_get_fmc_pll_status (bpm_client, service, &pll_status);
......@@ -156,6 +174,9 @@ int main (int argc, char *argv [])
err_bpm_exit:
bpm_client_destroy (&bpm_client);
str_p = &clk_sel_str;
free (*str_p);
clk_sel_str = NULL;
str_p = &trig_dir_str;
free (*str_p);
trig_dir_str = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment