diff --git a/lib/examples/npdsch_enodeb.c b/lib/examples/npdsch_enodeb.c index 594b7df40..a44cda4b7 100644 --- a/lib/examples/npdsch_enodeb.c +++ b/lib/examples/npdsch_enodeb.c @@ -58,12 +58,13 @@ static srslte_rf_t radio; static char* output_file_name = NULL; -srslte_nbiot_cell_t cell = { +static srslte_nbiot_cell_t cell = { .base = {.nof_ports = 1, .nof_prb = SRSLTE_NBIOT_DEFAULT_NUM_PRB_BASECELL, .cp = SRSLTE_CP_NORM, .id = 0}, .nbiot_prb = SRSLTE_NBIOT_DEFAULT_PRB_OFFSET, .n_id_ncell = 0, .nof_ports = 1, - .mode = SRSLTE_NBIOT_MODE_STANDALONE}; + .mode = SRSLTE_NBIOT_MODE_STANDALONE, + .is_r14 = true}; static uint32_t i_tbs_val = 1, last_i_tbs_val = 1; static int nof_frames = -1; @@ -99,7 +100,7 @@ static int sf_n_re = 0, sf_n_samples = 0; void usage(char* prog) { - printf("Usage: %s [agmiftleosncvrpu]\n", prog); + printf("Usage: %s [agmiftlReosncvrpu]\n", prog); #ifndef DISABLE_RF printf("\t-a RF args [Default %s]\n", rf_args); printf("\t-e RF amplitude [Default %.2f]\n", rf_amp); @@ -116,6 +117,7 @@ void usage(char* prog) printf("\t-r Value of i_rep [Default %d]\n", i_rep_val); printf("\t-n number of frames [Default %d]\n", nof_frames); printf("\t-l n_id_ncell [Default %d]\n", cell.n_id_ncell); + printf("\t-R Is R14 cell [Default %s]\n", cell.is_r14 ? "Yes" : "No"); printf("\t-p NB-IoT PRB id [Default %d]\n", cell.nbiot_prb); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -123,7 +125,7 @@ void usage(char* prog) void parse_args(int argc, char** argv) { int opt; - while ((opt = getopt(argc, argv, "aglfmiosncrtvpu")) != -1) { + while ((opt = getopt(argc, argv, "aglfmiosncrtvpuR")) != -1) { switch (opt) { case 'a': rf_args = argv[optind]; @@ -161,6 +163,9 @@ void parse_args(int argc, char** argv) case 'l': cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10); break; + case 'R': + cell.is_r14 = !cell.is_r14; + break; case 'p': cell.nbiot_prb = (uint32_t)strtol(argv[optind], NULL, 10); break; diff --git a/lib/examples/npdsch_ue.c b/lib/examples/npdsch_ue.c index d3e030e00..06b3d98e2 100644 --- a/lib/examples/npdsch_ue.c +++ b/lib/examples/npdsch_ue.c @@ -91,11 +91,7 @@ typedef struct { uint32_t time_offset; int n_id_ncell; bool is_r14; - int sib2_periodicity; - int sib2_radio_frame_offset; - int sib2_repetition_pattern; - int sib2_tb; - int sib2_window_length; + bool skip_sib2; uint16_t rnti; char* input_file_name; int file_offset_time; @@ -156,6 +152,7 @@ void usage(prog_args_t* args, char* prog) printf("\t-R Is R14 cell [Default %s]\n", args->is_r14 ? "Yes" : "No"); printf("\t-C Disable CFO correction [Default %s]\n", args->disable_cfo ? "Disabled" : "Enabled"); printf("\t-t Add time offset [Default %d]\n", args->time_offset); + printf("\t-s Skip SIB2 decoding[Default %d]\n", args->skip_sib2); #ifdef ENABLE_GUI printf("\t-d disable plots [Default enabled]\n"); printf("\t-D disable all but constellation plots [Default enabled]\n"); @@ -170,7 +167,7 @@ void parse_args(prog_args_t* args, int argc, char** argv) { int opt; args_default(args); - while ((opt = getopt(argc, argv, "aogRBlipHPOCtdDnvrfqwzxc")) != -1) { + while ((opt = getopt(argc, argv, "aogRBlipHPOCtdDsnvrfqwzxc")) != -1) { switch (opt) { case 'i': args->input_file_name = argv[optind]; @@ -212,11 +209,14 @@ void parse_args(prog_args_t* args, int argc, char** argv) args->n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'R': - args->is_r14 = true; + args->is_r14 = !args->is_r14; break; case 'd': args->disable_plots = true; break; + case 's': + args->skip_sib2 = !args->skip_sib2; + break; case 'D': args->disable_plots_except_constellation = true; break; @@ -689,9 +689,10 @@ int main(int argc, char** argv) } } - if (have_sib1 && have_sib2) { - if (prog_args.rnti == SRSLTE_SIRNTI) + if (have_sib1 && (have_sib2 || prog_args.skip_sib2)) { + if (prog_args.rnti == SRSLTE_SIRNTI) { srslte_nbiot_ue_dl_decode_sib1(&ue_dl, system_frame_number); + } state = DECODE_NPDSCH; } break; diff --git a/lib/src/phy/phch/test/npdsch_npdcch_file_test.c b/lib/src/phy/phch/test/npdsch_npdcch_file_test.c index f9f3b1405..f704d4769 100644 --- a/lib/src/phy/phch/test/npdsch_npdcch_file_test.c +++ b/lib/src/phy/phch/test/npdsch_npdcch_file_test.c @@ -34,11 +34,12 @@ char* input_file_name = NULL; -srslte_nbiot_cell_t cell = {.base = {.nof_prb = 1, .nof_ports = 1, .cp = SRSLTE_CP_NORM, .id = 0}, - .nbiot_prb = 0, - .n_id_ncell = 0, - .nof_ports = 1, - .mode = SRSLTE_NBIOT_MODE_STANDALONE}; +static srslte_nbiot_cell_t cell = {.base = {.nof_prb = 1, .nof_ports = 1, .cp = SRSLTE_CP_NORM, .id = 0}, + .nbiot_prb = 0, + .n_id_ncell = 0, + .nof_ports = 1, + .mode = SRSLTE_NBIOT_MODE_STANDALONE, + .is_r14 = true}; int flen; @@ -60,7 +61,7 @@ cf_t* buff_ptrs[SRSLTE_MAX_PORTS] = {NULL, NULL, NULL, NULL}; void usage(char* prog) { - printf("Usage: %s [rovcnwmpstx] -i input_file\n", prog); + printf("Usage: %s [rovcnwmpstRx] -i input_file\n", prog); printf("\t-o DCI format [Default %s]\n", srslte_dci_format_string(dci_format)); printf("\t-c n_id_ncell [Default %d]\n", cell.n_id_ncell); printf("\t-s Start subframe_idx [Default %d]\n", sf_idx); @@ -71,6 +72,7 @@ void usage(char* prog) printf("\t-p cell.nof_ports [Default %d]\n", cell.base.nof_ports); printf("\t-n cell.nof_prb [Default %d]\n", cell.base.nof_prb); printf("\t-m max_frames [Default %d]\n", max_frames); + printf("\t-R Is R14 cell [Default %s]\n", cell.is_r14 ? "Yes" : "No"); printf("\t-x SNR-10 (apply noise to input file) [Default %f]\n", snr); printf("\t-v [set srslte_verbose to debug, default none]\n"); } @@ -86,6 +88,9 @@ void parse_args(int argc, char** argv) case 'c': cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10); break; + case 'R': + cell.is_r14 = !cell.is_r14; + break; case 's': sf_idx = (uint32_t)strtol(argv[optind], NULL, 10); break;