From ef544e64c276998a0965d38ed82f42ffa0b1fe04 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 30 Jan 2019 17:37:42 +0100 Subject: [PATCH] expose RF device as paramter for pdsch_enodeb/_ue --- lib/examples/pdsch_enodeb.c | 11 ++++++++--- lib/examples/pdsch_ue.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/examples/pdsch_enodeb.c b/lib/examples/pdsch_enodeb.c index 2ee5f5b40..e980e4eee 100644 --- a/lib/examples/pdsch_enodeb.c +++ b/lib/examples/pdsch_enodeb.c @@ -83,6 +83,7 @@ uint32_t multiplex_nof_layers = 1; uint8_t mbsfn_sf_mask = 32; int mbsfn_area_id = -1; char *rf_args = ""; +char *rf_dev = ""; float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000; float output_file_snr = +INFINITY; @@ -128,8 +129,9 @@ uint8_t *data_mbms, *data[2], data2[DATA_BUFF_SZ]; uint8_t data_tmp[DATA_BUFF_SZ]; void usage(char *prog) { - printf("Usage: %s [agmfoncvpuxb]\n", prog); + printf("Usage: %s [Iagmfoncvpuxb]\n", prog); #ifndef DISABLE_RF + printf("\t-I RF device [Default %s]\n", rf_dev); printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-l RF amplitude [Default %.2f]\n", rf_amp); printf("\t-g RF TX gain [Default %.2f dB]\n", rf_gain); @@ -155,9 +157,12 @@ void usage(char *prog) { void parse_args(int argc, char **argv) { int opt; - while ((opt = getopt(argc, argv, "aglfmoncpvutxbwMsB")) != -1) { + while ((opt = getopt(argc, argv, "IadglfmoncpvutxbwMsB")) != -1) { switch (opt) { + case 'I': + rf_dev = argv[optind]; + break; case 'a': rf_args = argv[optind]; break; @@ -296,7 +301,7 @@ void base_init() { } else { #ifndef DISABLE_RF printf("Opening RF device...\n"); - if (srslte_rf_open_multi(&rf, rf_args, cell.nof_ports)) { + if (srslte_rf_open_devname(&rf, rf_dev, rf_args, cell.nof_ports)) { fprintf(stderr, "Error opening rf\n"); exit(-1); } diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 2284d0b3d..7ee89c695 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -95,6 +95,7 @@ typedef struct { uint32_t file_cell_id; bool enable_cfo_ref; bool average_subframe; + char *rf_dev; char *rf_args; uint32_t rf_nof_rx_ant; double rf_freq; @@ -123,7 +124,8 @@ void args_default(prog_args_t *args) { args->file_nof_ports = 1; args->file_cell_id = 0; args->file_offset_time = 0; - args->file_offset_freq = 0; + args->file_offset_freq = 0; + args->rf_dev = ""; args->rf_args = ""; args->rf_freq = -1.0; args->rf_nof_rx_ant = 1; @@ -146,8 +148,9 @@ void args_default(prog_args_t *args) { } void usage(prog_args_t *args, char *prog) { - printf("Usage: %s [agpPoOcildFRDnruMNv] -f rx_frequency (in Hz) | -i input_file\n", prog); + printf("Usage: %s [adgpPoOcildFRDnruMNv] -f rx_frequency (in Hz) | -i input_file\n", prog); #ifndef DISABLE_RF + printf("\t-I RF dev [Default %s]\n", args->rf_dev); printf("\t-a RF args [Default %s]\n", args->rf_args); printf("\t-A Number of RX antennas [Default %d]\n", args->rf_nof_rx_ant); #ifdef ENABLE_AGC_DEFAULT @@ -190,7 +193,7 @@ void usage(prog_args_t *args, char *prog) { void parse_args(prog_args_t *args, int argc, char **argv) { int opt; args_default(args); - while ((opt = getopt(argc, argv, "aAoglipPcOCtdDFRnvrfuUsSZyWMNB")) != -1) { + while ((opt = getopt(argc, argv, "adAogliIpPcOCtdDFRnvrfuUsSZyWMNB")) != -1) { switch (opt) { case 'i': args->input_file_name = argv[optind]; @@ -210,6 +213,9 @@ void parse_args(prog_args_t *args, int argc, char **argv) { case 'c': args->file_cell_id = atoi(argv[optind]); break; + case 'I': + args->rf_dev = argv[optind]; + break; case 'a': args->rf_args = argv[optind]; break; @@ -420,7 +426,7 @@ int main(int argc, char **argv) { if (!prog_args.input_file_name) { printf("Opening RF device with %d RX antennas...\n", prog_args.rf_nof_rx_ant); - if (srslte_rf_open_multi(&rf, prog_args.rf_args, prog_args.rf_nof_rx_ant)) { + if (srslte_rf_open_devname(&rf, prog_args.rf_dev, prog_args.rf_args, prog_args.rf_nof_rx_ant)) { fprintf(stderr, "Error opening rf\n"); exit(-1); }