rename global rf object in examples to radio

LGTM complains about global variables with short names (foo)
master
Andre Puschmann 5 years ago
parent 8e0b106c22
commit dd04f45ca0

@ -50,7 +50,7 @@ const uint8_t dummy_sib1_payload[] = {0x43, 0x4d, 0xd0, 0x92, 0x22, 0x06, 0x04,
#ifndef DISABLE_RF
#include "srslte/phy/rf/rf.h"
srslte_rf_t rf;
static srslte_rf_t radio;
#else
#pragma message "Compiling npdsch_ue with no RF support"
#endif
@ -212,7 +212,7 @@ void base_init()
} else {
#ifndef DISABLE_RF
printf("Opening RF device...\n");
if (srslte_rf_open(&rf, rf_args)) {
if (srslte_rf_open(&radio, rf_args)) {
fprintf(stderr, "Error opening rf\n");
exit(-1);
}
@ -301,7 +301,7 @@ void base_free()
}
} else {
#ifndef DISABLE_RF
srslte_rf_close(&rf);
srslte_rf_close(&radio);
#endif
}
}
@ -495,7 +495,7 @@ int main(int argc, char** argv)
int srate = srslte_sampling_freq_hz(cell.base.nof_prb);
if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_tx_srate(&rf, (double)srate);
float srate_rf = srslte_rf_set_tx_srate(&radio, (double)srate);
if (srate_rf != srate) {
fprintf(stderr, "Could not set sampling rate\n");
exit(-1);
@ -504,8 +504,8 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid number of PRB %d\n", cell.base.nof_prb);
exit(-1);
}
printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&rf, rf_gain));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&rf, 0, rf_freq) / 1000000);
printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&radio, rf_gain));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&radio, 0, rf_freq) / 1000000);
}
#endif
@ -702,7 +702,7 @@ int main(int argc, char** argv)
} else {
#ifndef DISABLE_RF
// FIXME: output scaling needed?
srslte_rf_send2(&rf, output_buffer, sf_n_samples, true, start_of_burst, false);
srslte_rf_send2(&radio, output_buffer, sf_n_samples, true, start_of_burst, false);
start_of_burst = false;
#endif
}

@ -38,7 +38,7 @@
#ifndef DISABLE_RF
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/rf/rf.h"
srslte_rf_t rf;
srslte_rf_t radio;
#else
#pragma message "Compiling pdsch_ue with no RF support"
#endif
@ -282,7 +282,7 @@ static void base_init()
} else {
#ifndef DISABLE_RF
printf("Opening RF device...\n");
if (srslte_rf_open_devname(&rf, rf_dev, rf_args, cell.nof_ports)) {
if (srslte_rf_open_devname(&radio, rf_dev, rf_args, cell.nof_ports)) {
fprintf(stderr, "Error opening rf\n");
exit(-1);
}
@ -431,7 +431,7 @@ static void base_free()
}
} else {
#ifndef DISABLE_RF
srslte_rf_close(&rf);
srslte_rf_close(&radio);
#endif
}
@ -770,7 +770,7 @@ int main(int argc, char** argv)
int srate = srslte_sampling_freq_hz(cell.nof_prb);
if (srate != -1) {
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_tx_srate(&rf, (double)srate);
float srate_rf = srslte_rf_set_tx_srate(&radio, (double)srate);
if (srate_rf != srate) {
ERROR("Could not set sampling rate\n");
exit(-1);
@ -779,8 +779,8 @@ int main(int argc, char** argv)
ERROR("Invalid number of PRB %d\n", cell.nof_prb);
exit(-1);
}
printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&rf, rf_gain));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&rf, cell.nof_ports, rf_freq) / 1000000);
printf("Set TX gain: %.1f dB\n", srslte_rf_set_tx_gain(&radio, rf_gain));
printf("Set TX freq: %.2f MHz\n", srslte_rf_set_tx_freq(&radio, cell.nof_ports, rf_freq) / 1000000);
}
#endif
@ -994,7 +994,7 @@ int main(int argc, char** argv)
srslte_vec_sc_prod_cfc(
output_buffer[i], rf_amp * norm_factor, output_buffer[i], SRSLTE_SF_LEN_PRB(cell.nof_prb));
}
srslte_rf_send_multi(&rf, (void**)output_buffer, sf_n_samples, true, start_of_burst, false);
srslte_rf_send_multi(&radio, (void**)output_buffer, sf_n_samples, true, start_of_burst, false);
start_of_burst = false;
#endif
}

@ -157,7 +157,7 @@ int main(int argc, char** argv)
/* Example function to initialize the Radio frontend. In this case, we use srsLTE RF API to open a device,
* which automatically picks UHD, bladeRF, limeSDR, etc.
*/
static srslte_rf_t rf = {};
static srslte_rf_t radio = {};
static char* rf_args = "fastpath";
static float rf_gain = 40.0, rf_freq = -1.0, rf_rate = 11.52e6;
static uint32_t rf_recv_frame_size_ms = 1;
@ -165,14 +165,14 @@ static int init_radio(uint32_t* buffer_len)
{
// Uses srsLTE RF API to open a device, could use other code here
printf("Opening RF device...\n");
if (srslte_rf_open_multi(&rf, rf_args, nof_rx_antennas)) {
if (srslte_rf_open_multi(&radio, rf_args, nof_rx_antennas)) {
ERROR("Error opening rf\n");
return -1;
}
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, nof_rx_antennas, rf_freq) / 1000000);
printf("Set RX gain: %.2f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
float srate = srslte_rf_set_rx_srate(&rf, rf_rate);
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&radio, nof_rx_antennas, rf_freq) / 1000000);
printf("Set RX gain: %.2f dB\n", srslte_rf_set_rx_gain(&radio, rf_gain));
float srate = srslte_rf_set_rx_srate(&radio, rf_rate);
if (srate != rf_rate) {
ERROR("Error setting samplign frequency %.2f MHz\n", rf_rate * 1e-6);
return -1;
@ -183,7 +183,7 @@ static int init_radio(uint32_t* buffer_len)
}
printf("Set RX rate: %.2f MHz\n", srate * 1e-6);
srslte_rf_start_rx_stream(&rf, false);
srslte_rf_start_rx_stream(&radio, false);
return 0;
}
@ -191,12 +191,12 @@ static int init_radio(uint32_t* buffer_len)
*/
static int rx_radio(void** buffer, uint32_t buf_len)
{
return srslte_rf_recv_with_time_multi(&rf, buffer, buf_len, true, NULL, NULL);
return srslte_rf_recv_with_time_multi(&radio, buffer, buf_len, true, NULL, NULL);
}
static void close_radio()
{
srslte_rf_close(&rf);
srslte_rf_close(&radio);
}
static void int_handler(int dummy)

Loading…
Cancel
Save