|
|
|
@ -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)
|
|
|
|
|