mirror of https://github.com/PentHertz/srsLTE.git
Add device name argument
This commit is contained in:
parent
18e973f236
commit
0b5ebbea0e
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/**
|
||||||
* Copyright 2013-2020 Software Radio Systems Limited
|
* Copyright 2013-2022 Software Radio Systems Limited
|
||||||
*
|
*
|
||||||
* This file is part of srsLTE and adapted for the Modmobmap tool by FlUxIuS @ PentHertz.
|
* This file is part of srsRAN.
|
||||||
*
|
*
|
||||||
* srsLTE is free software: you can redistribute it and/or modify
|
* srsRAN is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of
|
* published by the Free Software Foundation, either version 3 of
|
||||||
* the License, or (at your option) any later version.
|
* the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* srsLTE is distributed in the hope that it will be useful,
|
* srsRAN is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
|
@ -66,11 +66,13 @@ struct cells results[1024];
|
||||||
|
|
||||||
float rf_gain = 70.0;
|
float rf_gain = 70.0;
|
||||||
char* rf_args = "";
|
char* rf_args = "";
|
||||||
|
char* rf_dev = "";
|
||||||
|
|
||||||
void usage(char* prog)
|
void usage(char* prog)
|
||||||
{
|
{
|
||||||
printf("Usage: %s [agsendtvb] -b band\n", prog);
|
printf("Usage: %s [agsendtvb] -b band\n", prog);
|
||||||
printf("\t-a RF args [Default %s]\n", rf_args);
|
printf("\t-a RF args [Default %s]\n", rf_args);
|
||||||
|
printf("\t-d RF devicename [Default %s]\n", rf_dev);
|
||||||
printf("\t-g RF gain [Default %.2f dB]\n", rf_gain);
|
printf("\t-g RF gain [Default %.2f dB]\n", rf_gain);
|
||||||
printf("\t-s earfcn_start [Default All]\n");
|
printf("\t-s earfcn_start [Default All]\n");
|
||||||
printf("\t-e earfcn_end [Default All]\n");
|
printf("\t-e earfcn_end [Default All]\n");
|
||||||
|
@ -89,6 +91,9 @@ void parse_args(int argc, char** argv)
|
||||||
case 'b':
|
case 'b':
|
||||||
band = (int)strtol(argv[optind], NULL, 10);
|
band = (int)strtol(argv[optind], NULL, 10);
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
rf_dev = argv[optind];
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
earfcn_start = (int)strtol(argv[optind], NULL, 10);
|
earfcn_start = (int)strtol(argv[optind], NULL, 10);
|
||||||
break;
|
break;
|
||||||
|
@ -117,7 +122,7 @@ void parse_args(int argc, char** argv)
|
||||||
|
|
||||||
int srsran_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srsran_timestamp_t* t)
|
int srsran_rf_recv_wrapper(void* h, void* data, uint32_t nsamples, srsran_timestamp_t* t)
|
||||||
{
|
{
|
||||||
DEBUG(" ---- Receive %d samples ---- \n", nsamples);
|
DEBUG(" ---- Receive %d samples ---- ", nsamples);
|
||||||
return srsran_rf_recv_with_time((srsran_rf_t*)h, data, nsamples, 1, NULL, NULL);
|
return srsran_rf_recv_with_time((srsran_rf_t*)h, data, nsamples, 1, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +165,9 @@ int main(int argc, char** argv)
|
||||||
parse_args(argc, argv);
|
parse_args(argc, argv);
|
||||||
|
|
||||||
printf("Opening RF device...\n");
|
printf("Opening RF device...\n");
|
||||||
if (srsran_rf_open(&rf, rf_args)) {
|
|
||||||
ERROR("Error opening rf\n");
|
if (srsran_rf_open_devname(&rf, rf_dev, rf_args, 1)) {
|
||||||
|
ERROR("Error opening rf");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (!cell_detect_config.init_agc) {
|
if (!cell_detect_config.init_agc) {
|
||||||
|
@ -169,7 +175,7 @@ int main(int argc, char** argv)
|
||||||
} else {
|
} else {
|
||||||
printf("Starting AGC thread...\n");
|
printf("Starting AGC thread...\n");
|
||||||
if (srsran_rf_start_gain_thread(&rf, false)) {
|
if (srsran_rf_start_gain_thread(&rf, false)) {
|
||||||
ERROR("Error opening rf\n");
|
ERROR("Error opening rf");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
srsran_rf_set_rx_gain(&rf, 50);
|
srsran_rf_set_rx_gain(&rf, 50);
|
||||||
|
@ -180,7 +186,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
nof_freqs = srsran_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
|
nof_freqs = srsran_band_get_fd_band(band, channels, earfcn_start, earfcn_end, MAX_EARFCN);
|
||||||
if (nof_freqs < 0) {
|
if (nof_freqs < 0) {
|
||||||
ERROR("Error getting EARFCN list\n");
|
ERROR("Error getting EARFCN list");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +197,7 @@ int main(int argc, char** argv)
|
||||||
signal(SIGINT, sig_int_handler);
|
signal(SIGINT, sig_int_handler);
|
||||||
|
|
||||||
if (srsran_ue_cellsearch_init(&cs, cell_detect_config.max_frames_pss, srsran_rf_recv_wrapper, (void*)&rf)) {
|
if (srsran_ue_cellsearch_init(&cs, cell_detect_config.max_frames_pss, srsran_rf_recv_wrapper, (void*)&rf)) {
|
||||||
ERROR("Error initiating UE cell detect\n");
|
ERROR("Error initiating UE cell detect");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +217,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
/* set rf_freq */
|
/* set rf_freq */
|
||||||
srsran_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ);
|
srsran_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ);
|
||||||
INFO("Set rf_freq to %.3f MHz\n", (double)channels[freq].fd * MHZ / 1000000);
|
INFO("Set rf_freq to %.3f MHz", (double)channels[freq].fd * MHZ / 1000000);
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd);
|
"[%3d/%d]: EARFCN %d Freq. %.2f MHz looking for PSS.\n", freq, nof_freqs, channels[freq].id, channels[freq].fd);
|
||||||
|
@ -223,14 +229,14 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
bzero(found_cells, 3 * sizeof(srsran_ue_cellsearch_result_t));
|
bzero(found_cells, 3 * sizeof(srsran_ue_cellsearch_result_t));
|
||||||
|
|
||||||
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSRAN_CS_SAMP_FREQ / 1000000);
|
INFO("Setting sampling frequency %.2f MHz for PSS search", SRSRAN_CS_SAMP_FREQ / 1000000);
|
||||||
srsran_rf_set_rx_srate(&rf, SRSRAN_CS_SAMP_FREQ);
|
srsran_rf_set_rx_srate(&rf, SRSRAN_CS_SAMP_FREQ);
|
||||||
INFO("Starting receiver...\n");
|
INFO("Starting receiver...");
|
||||||
srsran_rf_start_rx_stream(&rf, false);
|
srsran_rf_start_rx_stream(&rf, false);
|
||||||
|
|
||||||
n = srsran_ue_cellsearch_scan(&cs, found_cells, NULL);
|
n = srsran_ue_cellsearch_scan(&cs, found_cells, NULL);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
ERROR("Error searching cell\n");
|
ERROR("Error searching cell");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else if (n > 0) {
|
} else if (n > 0) {
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
@ -240,7 +246,7 @@ int main(int argc, char** argv)
|
||||||
cell.cp = found_cells[i].cp;
|
cell.cp = found_cells[i].cp;
|
||||||
int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL);
|
int ret = rf_mib_decoder(&rf, 1, &cell_detect_config, &cell, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ERROR("Error decoding MIB\n");
|
ERROR("Error decoding MIB");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (ret == SRSRAN_UE_MIB_FOUND) {
|
if (ret == SRSRAN_UE_MIB_FOUND) {
|
||||||
|
|
Loading…
Reference in New Issue