|
|
@ -604,22 +604,34 @@ void sync::set_cfo(float cfo)
|
|
|
|
|
|
|
|
|
|
|
|
void sync::set_agc_enable(bool enable)
|
|
|
|
void sync::set_agc_enable(bool enable)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (enable) {
|
|
|
|
// If not enabled, make sure it is not used and return
|
|
|
|
if (running && radio_h) {
|
|
|
|
if (not enable) {
|
|
|
|
srslte_rf_info_t* rf_info = radio_h->get_info();
|
|
|
|
ue_sync.do_agc = false;
|
|
|
|
if (rf_info) {
|
|
|
|
return;
|
|
|
|
srslte_ue_sync_start_agc(
|
|
|
|
}
|
|
|
|
&ue_sync, callback_set_rx_gain, rf_info->min_rx_gain, rf_info->max_rx_gain, radio_h->get_rx_gain());
|
|
|
|
|
|
|
|
search_p.set_agc_enable(true);
|
|
|
|
// Early return if the AGC is enabled
|
|
|
|
} else {
|
|
|
|
if (ue_sync.do_agc) {
|
|
|
|
Error("Error: Radio does not provide RF information\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ERROR("Error setting AGC: PHY not initiated\n");
|
|
|
|
// PHY and radio must have been initialised
|
|
|
|
}
|
|
|
|
if (not running or radio_h == nullptr) {
|
|
|
|
} else {
|
|
|
|
ERROR("Error setting AGC: PHY not initiated\n");
|
|
|
|
ERROR("Error stopping AGC: not implemented\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get radio info and check it is valid
|
|
|
|
|
|
|
|
srslte_rf_info_t* rf_info = radio_h->get_info();
|
|
|
|
|
|
|
|
if (rf_info == nullptr) {
|
|
|
|
|
|
|
|
Error("Error: Radio does not provide RF information\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Enable AGC
|
|
|
|
|
|
|
|
srslte_ue_sync_start_agc(
|
|
|
|
|
|
|
|
&ue_sync, callback_set_rx_gain, rf_info->min_rx_gain, rf_info->max_rx_gain, radio_h->get_rx_gain());
|
|
|
|
|
|
|
|
search_p.set_agc_enable(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float sync::get_tx_cfo()
|
|
|
|
float sync::get_tx_cfo()
|
|
|
|