rf: moved setting clock rate to fix x300 segfault

This commit is contained in:
Ismael Gomez 2016-06-23 09:53:54 +03:00
parent 7edc69052b
commit 40028f45af
1 changed files with 6 additions and 5 deletions

View File

@ -261,6 +261,12 @@ int rf_uhd_open(char *args, void **h)
fprintf(stderr, "Error opening UHD: code %d\n", error);
return -1;
}
/* Find out if the master clock rate is configurable */
double cur_clock, new_clock;
uhd_usrp_get_master_clock_rate(handler->usrp, 0, &cur_clock);
printf("Trying to dynamically change Master clock...\n");
uhd_usrp_set_master_clock_rate(handler->usrp, cur_clock/2, 0);
size_t channel = 0;
uhd_stream_args_t stream_args = {
@ -301,11 +307,6 @@ int rf_uhd_open(char *args, void **h)
uhd_rx_metadata_make(&handler->rx_md_first);
uhd_tx_metadata_make(&handler->tx_md, false, 0, 0, false, false);
/* Find out if the master clock rate is configurable */
double cur_clock, new_clock;
uhd_usrp_get_master_clock_rate(handler->usrp, 0, &cur_clock);
printf("Trying to dynamically change Master clock...\n");
uhd_usrp_set_master_clock_rate(handler->usrp, cur_clock/2, 0);
uhd_usrp_get_master_clock_rate(handler->usrp, 0, &new_clock);
if (new_clock == cur_clock) {
handler->dynamic_rate = false;