From dc31fb05a305ebfce86d98d72bc2f8cc4f0504ce Mon Sep 17 00:00:00 2001 From: faluco Date: Tue, 26 Oct 2021 11:48:29 +0200 Subject: [PATCH] Fix ODR issue detected by ASAN in arch for the srsran_verbose global variable. --- lib/examples/cell_search.c | 2 +- lib/examples/cell_search_nbiot.c | 2 +- lib/examples/npdsch_enodeb.c | 2 +- lib/examples/npdsch_ue.c | 2 +- lib/examples/pdsch_enodeb.c | 4 +-- lib/examples/pdsch_ue.c | 18 +++++----- lib/examples/pssch_ue.c | 2 +- lib/examples/synch_file.c | 2 +- lib/examples/usrp_capture.c | 2 +- lib/examples/usrp_capture_sync.c | 2 +- lib/examples/usrp_capture_sync_nbiot.c | 2 +- lib/examples/zmq_remote_rx.c | 6 ++-- lib/include/srsran/phy/utils/debug.h | 20 ++++++----- lib/src/phy/ch_estimation/dmrs_pdcch.c | 2 +- .../ch_estimation/test/chest_nbiot_test_dl.c | 2 +- .../phy/ch_estimation/test/chest_test_dl.c | 2 +- .../phy/ch_estimation/test/chest_test_sl.c | 2 +- .../phy/ch_estimation/test/chest_test_srs.c | 2 +- .../phy/ch_estimation/test/chest_test_ul.c | 2 +- lib/src/phy/ch_estimation/test/csi_rs_test.c | 4 +-- .../phy/ch_estimation/test/dmrs_pdcch_test.c | 2 +- .../phy/ch_estimation/test/dmrs_pdsch_test.c | 2 +- .../ch_estimation/test/refsignal_ul_test.c | 2 +- lib/src/phy/fec/block/test/block_test.c | 4 +-- lib/src/phy/fec/test/crc_test.c | 4 +-- lib/src/phy/fec/turbo/test/turbocoder_test.c | 2 +- .../phy/fec/turbo/test/turbodecoder_test.c | 2 +- lib/src/phy/modem/test/soft_demod_test.c | 2 +- lib/src/phy/phch/pbch_nr.c | 12 +++---- lib/src/phy/phch/pdcch_nr.c | 18 +++++----- lib/src/phy/phch/pdsch_nr.c | 10 +++--- lib/src/phy/phch/pucch_nr.c | 2 +- lib/src/phy/phch/pusch_nr.c | 12 +++---- lib/src/phy/phch/sch_nr.c | 10 +++--- lib/src/phy/phch/test/dci_nbiot_test.c | 2 +- lib/src/phy/phch/test/dci_nr_test.c | 2 +- lib/src/phy/phch/test/mib_nr_test.c | 2 +- lib/src/phy/phch/test/npbch_file_test.c | 2 +- lib/src/phy/phch/test/npbch_test.c | 2 +- lib/src/phy/phch/test/npdcch_file_test.c | 2 +- lib/src/phy/phch/test/npdcch_test.c | 2 +- .../phy/phch/test/npdsch_npdcch_file_test.c | 2 +- lib/src/phy/phch/test/npdsch_test.c | 2 +- lib/src/phy/phch/test/pbch_file_test.c | 2 +- lib/src/phy/phch/test/pbch_test.c | 2 +- lib/src/phy/phch/test/pcfich_file_test.c | 2 +- lib/src/phy/phch/test/pcfich_test.c | 2 +- lib/src/phy/phch/test/pdcch_file_test.c | 2 +- lib/src/phy/phch/test/pdcch_nr_test.c | 2 +- lib/src/phy/phch/test/pdcch_test.c | 8 ++--- lib/src/phy/phch/test/pdsch_nr_test.c | 2 +- lib/src/phy/phch/test/pdsch_pdcch_file_test.c | 2 +- lib/src/phy/phch/test/pdsch_test.c | 2 +- lib/src/phy/phch/test/phich_file_test.c | 2 +- lib/src/phy/phch/test/phich_test.c | 2 +- lib/src/phy/phch/test/pmch_file_test.c | 2 +- lib/src/phy/phch/test/pmch_test.c | 2 +- lib/src/phy/phch/test/prach_test_usrp.c | 5 +-- lib/src/phy/phch/test/psbch_file_test.c | 2 +- lib/src/phy/phch/test/psbch_test.c | 2 +- lib/src/phy/phch/test/pscch_test.c | 2 +- lib/src/phy/phch/test/pssch_pscch_file_test.c | 2 +- lib/src/phy/phch/test/pssch_test.c | 2 +- lib/src/phy/phch/test/pucch_nr_test.c | 2 +- lib/src/phy/phch/test/pucch_test.c | 4 +-- lib/src/phy/phch/test/pusch_nr_test.c | 4 +-- lib/src/phy/phch/test/pusch_test.c | 4 +-- lib/src/phy/phch/test/sch_nr_test.c | 2 +- lib/src/phy/phch/uci_nr.c | 34 +++++++++---------- lib/src/phy/resampling/resampler.c | 2 +- lib/src/phy/resampling/test/resampler_test.c | 8 ++--- lib/src/phy/sync/test/npss_file.c | 2 +- lib/src/phy/sync/test/npss_test.c | 2 +- lib/src/phy/sync/test/npss_usrp.c | 2 +- lib/src/phy/sync/test/nsss_test.c | 3 +- lib/src/phy/sync/test/nsss_usrp.c | 2 +- lib/src/phy/sync/test/pss_file.c | 2 +- lib/src/phy/sync/test/pss_usrp.c | 2 +- lib/src/phy/sync/test/psss_file_test.c | 2 +- lib/src/phy/sync/test/ssb_decode_test.c | 2 +- lib/src/phy/sync/test/ssb_file_test.c | 2 +- lib/src/phy/sync/test/ssb_measure_test.c | 2 +- lib/src/phy/sync/test/sync_nbiot_test.c | 2 +- lib/src/phy/sync/test/sync_sl_test.c | 2 +- lib/src/phy/sync/test/sync_test.c | 2 +- lib/src/phy/ue/test/gen_ack_nr_test.c | 2 +- lib/src/phy/ue/test/ue_dl_nbiot_test.c | 2 +- lib/src/phy/ue/test/ue_dl_nr_file_test.c | 2 +- .../phy/ue/test/ue_mib_sync_test_nbiot_usrp.c | 2 +- lib/src/phy/ue/test/ue_sync_nr_test.c | 2 +- lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c | 2 +- lib/src/phy/ue/ue_dl.c | 2 +- lib/src/phy/ue/ue_dl_nr.c | 2 +- lib/src/phy/utils/debug.c | 17 +++++++++- lib/src/radio/test/benchmark_radio.cc | 2 +- lib/test/phy/phy_dl_nr_test.c | 4 +-- lib/test/phy/phy_dl_test.c | 6 ++-- lib/test/phy/pucch_ca_test.c | 2 +- srsue/src/phy/test/scell_search_test.cc | 2 +- test/phy/test_bench.h | 6 ++-- 100 files changed, 195 insertions(+), 182 deletions(-) diff --git a/lib/examples/cell_search.c b/lib/examples/cell_search.c index 89a9459b8..ee3238a11 100644 --- a/lib/examples/cell_search.c +++ b/lib/examples/cell_search.c @@ -97,7 +97,7 @@ void parse_args(int argc, char** argv) rf_gain = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/cell_search_nbiot.c b/lib/examples/cell_search_nbiot.c index 984f6e074..c3d87d11b 100644 --- a/lib/examples/cell_search_nbiot.c +++ b/lib/examples/cell_search_nbiot.c @@ -97,7 +97,7 @@ void parse_args(int argc, char** argv) scan_raster_offset = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/npdsch_enodeb.c b/lib/examples/npdsch_enodeb.c index aeae4dddb..9723314c2 100644 --- a/lib/examples/npdsch_enodeb.c +++ b/lib/examples/npdsch_enodeb.c @@ -161,7 +161,7 @@ void parse_args(int argc, char** argv) cell.nbiot_prb = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/npdsch_ue.c b/lib/examples/npdsch_ue.c index fb1c17a94..a005e512b 100644 --- a/lib/examples/npdsch_ue.c +++ b/lib/examples/npdsch_ue.c @@ -219,7 +219,7 @@ void parse_args(prog_args_t* args, int argc, char** argv) args->disable_plots_except_constellation = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(args, argv[0]); diff --git a/lib/examples/pdsch_enodeb.c b/lib/examples/pdsch_enodeb.c index a00408209..1b1e0a430 100644 --- a/lib/examples/pdsch_enodeb.c +++ b/lib/examples/pdsch_enodeb.c @@ -57,7 +57,7 @@ static int net_port = -1; // -1 generates random dataThat means there is so static uint32_t cfi = 2; static uint32_t mcs_idx = 1, last_mcs_idx = 1; static int nof_frames = -1; -static srsran_tm_t transmission_mode = SRSRAN_TM1; +static srsran_tm_t transmission_mode = SRSRAN_TM1; static uint32_t nof_tb = 1; static uint32_t multiplex_pmi = 0; static uint32_t multiplex_nof_layers = 1; @@ -189,7 +189,7 @@ static void parse_args(int argc, char** argv) mbsfn_area_id = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 's': output_file_snr = strtof(argv[optind], NULL); diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index d4d5662e5..e304ac2fa 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -277,8 +277,8 @@ void parse_args(prog_args_t* args, int argc, char** argv) args->disable_plots_except_constellation = true; break; case 'v': - srsran_verbose++; - args->verbose = srsran_verbose; + increase_srsran_verbose_level(); + args->verbose = get_srsran_verbose_level(); break; case 'Z': args->decimate = (int)strtol(argv[optind], NULL, 10); @@ -690,16 +690,16 @@ int main(int argc, char** argv) to.tv_usec = 0; /* Set default verbose level */ - srsran_verbose = prog_args.verbose; - int n = select(1, &set, NULL, NULL, &to); + set_srsran_verbose_level(prog_args.verbose); + int n = select(1, &set, NULL, NULL, &to); if (n == 1) { /* If a new line is detected set verbose level to Debug */ if (fgets(input, sizeof(input), stdin)) { - srsran_verbose = SRSRAN_VERBOSE_DEBUG; - pkt_errors = 0; - pkt_total = 0; - nof_detected = 0; - nof_trials = 0; + set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG); + pkt_errors = 0; + pkt_total = 0; + nof_detected = 0; + nof_trials = 0; } } diff --git a/lib/examples/pssch_ue.c b/lib/examples/pssch_ue.c index f96ddc182..e3e18c32c 100644 --- a/lib/examples/pssch_ue.c +++ b/lib/examples/pssch_ue.c @@ -179,7 +179,7 @@ void parse_args(prog_args_t* args, int argc, char** argv) args->nof_rx_antennas = (int32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'w': args->disable_plots = true; diff --git a/lib/examples/synch_file.c b/lib/examples/synch_file.c index 04aec21d7..1564e73e9 100644 --- a/lib/examples/synch_file.c +++ b/lib/examples/synch_file.c @@ -74,7 +74,7 @@ void parse_args(int argc, char** argv) force_cfo = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/usrp_capture.c b/lib/examples/usrp_capture.c index 740ca7877..7c385f995 100644 --- a/lib/examples/usrp_capture.c +++ b/lib/examples/usrp_capture.c @@ -75,7 +75,7 @@ void parse_args(int argc, char** argv) nof_rx_antennas = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/usrp_capture_sync.c b/lib/examples/usrp_capture_sync.c index 27c22feb5..591bd24b6 100644 --- a/lib/examples/usrp_capture_sync.c +++ b/lib/examples/usrp_capture_sync.c @@ -96,7 +96,7 @@ void parse_args(int argc, char** argv) nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/usrp_capture_sync_nbiot.c b/lib/examples/usrp_capture_sync_nbiot.c index 2c34fd3f1..58169aeea 100644 --- a/lib/examples/usrp_capture_sync_nbiot.c +++ b/lib/examples/usrp_capture_sync_nbiot.c @@ -68,7 +68,7 @@ void parse_args(int argc, char** argv) nof_subframes = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/examples/zmq_remote_rx.c b/lib/examples/zmq_remote_rx.c index 4d6dcfb98..58d58bfc8 100644 --- a/lib/examples/zmq_remote_rx.c +++ b/lib/examples/zmq_remote_rx.c @@ -114,7 +114,7 @@ int main(int argc, char** argv) ERROR("Error receiving samples"); exit(-1); } - if (srsran_verbose == SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() == SRSRAN_VERBOSE_INFO) { printf("Received %d samples from radio\n", n); } @@ -127,7 +127,7 @@ int main(int argc, char** argv) print_cnt = 0; } } else { - if (srsran_verbose == SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() == SRSRAN_VERBOSE_INFO) { printf("Transmitted %d bytes to ZMQ\n", n); } } @@ -230,7 +230,7 @@ static void parse_args(int argc, char** argv) rf_freq = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'z': zmq_args = argv[optind]; diff --git a/lib/include/srsran/phy/utils/debug.h b/lib/include/srsran/phy/utils/debug.h index 33763d33b..e6355a9fb 100644 --- a/lib/include/srsran/phy/utils/debug.h +++ b/lib/include/srsran/phy/utils/debug.h @@ -38,22 +38,24 @@ SRSRAN_API void get_time_interval(struct timeval* tdata); #define SRSRAN_DEBUG_ENABLED 1 -SRSRAN_API extern int srsran_verbose; +SRSRAN_API int get_srsran_verbose_level(void); +SRSRAN_API void set_srsran_verbose_level(int level); +SRSRAN_API void increase_srsran_verbose_level(void); SRSRAN_API bool is_handler_registered(void); SRSRAN_API void set_handler_enabled(bool enable); -#define SRSRAN_VERBOSE_ISINFO() (srsran_verbose >= SRSRAN_VERBOSE_INFO) -#define SRSRAN_VERBOSE_ISDEBUG() (srsran_verbose >= SRSRAN_VERBOSE_DEBUG) -#define SRSRAN_VERBOSE_ISNONE() (srsran_verbose == SRSRAN_VERBOSE_NONE) +#define SRSRAN_VERBOSE_ISINFO() (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) +#define SRSRAN_VERBOSE_ISDEBUG() (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG) +#define SRSRAN_VERBOSE_ISNONE() (get_srsran_verbose_level() == SRSRAN_VERBOSE_NONE) -#define PRINT_DEBUG srsran_verbose = SRSRAN_VERBOSE_DEBUG -#define PRINT_INFO srsran_verbose = SRSRAN_VERBOSE_INFO -#define PRINT_NONE srsran_verbose = SRSRAN_VERBOSE_NONE +#define PRINT_DEBUG set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG) +#define PRINT_INFO set_srsran_verbose_level(SRSRAN_VERBOSE_INFO) +#define PRINT_NONE set_srsran_verbose_level(SRSRAN_VERBOSE_NONE) #define DEBUG(_fmt, ...) \ do { \ - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { \ + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { \ fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__); \ } else { \ srsran_phy_log_print(LOG_LEVEL_DEBUG_S, _fmt, ##__VA_ARGS__); \ @@ -62,7 +64,7 @@ SRSRAN_API void set_handler_enabled(bool enable); #define INFO(_fmt, ...) \ do { \ - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { \ + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { \ fprintf(stdout, "[INFO]: " _fmt "\n", ##__VA_ARGS__); \ } else { \ srsran_phy_log_print(LOG_LEVEL_INFO_S, _fmt, ##__VA_ARGS__); \ diff --git a/lib/src/phy/ch_estimation/dmrs_pdcch.c b/lib/src/phy/ch_estimation/dmrs_pdcch.c index b08e52a0e..e594b10b0 100644 --- a/lib/src/phy/ch_estimation/dmrs_pdcch.c +++ b/lib/src/phy/ch_estimation/dmrs_pdcch.c @@ -440,7 +440,7 @@ int srsran_dmrs_pdcch_get_measure(const srsran_dmrs_pdcch_estimator_t* q, nof_pilots += NOF_PILOTS_X_RB; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DMRS_PDCCH_DEBUG_RX("Measuring PDCCH l=%d; lse=", l); srsran_vec_fprint_c(stdout, tmp, nof_pilots); } diff --git a/lib/src/phy/ch_estimation/test/chest_nbiot_test_dl.c b/lib/src/phy/ch_estimation/test/chest_nbiot_test_dl.c index 07cc93110..1b1f885d6 100644 --- a/lib/src/phy/ch_estimation/test/chest_nbiot_test_dl.c +++ b/lib/src/phy/ch_estimation/test/chest_nbiot_test_dl.c @@ -79,7 +79,7 @@ void parse_args(int argc, char** argv) snr_db = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/chest_test_dl.c b/lib/src/phy/ch_estimation/test/chest_test_dl.c index 10b0ed269..96385c15d 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_dl.c +++ b/lib/src/phy/ch_estimation/test/chest_test_dl.c @@ -59,7 +59,7 @@ void parse_args(int argc, char** argv) output_matlab = argv[optind]; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/chest_test_sl.c b/lib/src/phy/ch_estimation/test/chest_test_sl.c index 3d68135e0..bab767fce 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_sl.c +++ b/lib/src/phy/ch_estimation/test/chest_test_sl.c @@ -67,7 +67,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/chest_test_srs.c b/lib/src/phy/ch_estimation/test/chest_test_srs.c index 3fa7acb6e..9c489c476 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_srs.c +++ b/lib/src/phy/ch_estimation/test/chest_test_srs.c @@ -176,7 +176,7 @@ void parse_args(int argc, char** argv) cell.id = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/chest_test_ul.c b/lib/src/phy/ch_estimation/test/chest_test_ul.c index c9a5b1568..2d729b2f5 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_ul.c +++ b/lib/src/phy/ch_estimation/test/chest_test_ul.c @@ -62,7 +62,7 @@ void parse_args(int argc, char** argv) output_matlab = argv[optind]; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/csi_rs_test.c b/lib/src/phy/ch_estimation/test/csi_rs_test.c index 9cdfdf096..d8a6dcf35 100644 --- a/lib/src/phy/ch_estimation/test/csi_rs_test.c +++ b/lib/src/phy/ch_estimation/test/csi_rs_test.c @@ -46,7 +46,7 @@ static int nzp_test_case(const srsran_slot_cfg_t* slot_cfg, srsran_convert_power_to_dB(srsran_convert_dB_to_power(rsrp_dB_gold) + awgn->std_dev * awgn->std_dev); const float n0_dB_gold = srsran_convert_amplitude_to_dB(awgn->std_dev); - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[128] = {}; srsran_csi_rs_measure_info(&measure, str, sizeof(str)); INFO("Measure: %s", str); @@ -361,7 +361,7 @@ static void parse_args(int argc, char** argv) first_symbol = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c b/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c index 58bbb4509..10d419a41 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c @@ -49,7 +49,7 @@ static void parse_args(int argc, char** argv) interleaved ^= true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c index 75709fd27..83fc5ca39 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c @@ -141,7 +141,7 @@ static void parse_args(int argc, char** argv) carrier.pci = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ch_estimation/test/refsignal_ul_test.c b/lib/src/phy/ch_estimation/test/refsignal_ul_test.c index 1a8098ee3..7644574e0 100644 --- a/lib/src/phy/ch_estimation/test/refsignal_ul_test.c +++ b/lib/src/phy/ch_estimation/test/refsignal_ul_test.c @@ -57,7 +57,7 @@ void parse_args(int argc, char** argv) cell.id = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/fec/block/test/block_test.c b/lib/src/phy/fec/block/test/block_test.c index a4985d41f..23d3ceb68 100644 --- a/lib/src/phy/fec/block/test/block_test.c +++ b/lib/src/phy/fec/block/test/block_test.c @@ -32,7 +32,7 @@ void usage(char* prog) printf("Usage: %s [Rv]\n", prog); printf("\t-R Number of repetitions [Default %d]\n", nof_repetitions); printf("\t-E Number of encoded bits [Default %d]\n", E); - printf("\t-v increase verbose [Default %d]\n", srsran_verbose); + printf("\t-v increase verbose [Default %d]\n", get_srsran_verbose_level()); } void parse_args(int argc, char** argv) @@ -47,7 +47,7 @@ void parse_args(int argc, char** argv) E = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/fec/test/crc_test.c b/lib/src/phy/fec/test/crc_test.c index 539f00a90..8537e57f2 100644 --- a/lib/src/phy/fec/test/crc_test.c +++ b/lib/src/phy/fec/test/crc_test.c @@ -53,7 +53,7 @@ void parse_args(int argc, char** argv) seed = (uint32_t)strtoul(argv[optind], NULL, 0); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -87,7 +87,7 @@ int main(int argc, char** argv) data[i] = rand() % 2; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { INFO("data="); srsran_vec_fprint_b(stdout, data, num_bits); } diff --git a/lib/src/phy/fec/turbo/test/turbocoder_test.c b/lib/src/phy/fec/turbo/test/turbocoder_test.c index 375697f20..5095063ff 100644 --- a/lib/src/phy/fec/turbo/test/turbocoder_test.c +++ b/lib/src/phy/fec/turbo/test/turbocoder_test.c @@ -35,7 +35,7 @@ void parse_args(int argc, char** argv) long_cb = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/fec/turbo/test/turbodecoder_test.c b/lib/src/phy/fec/turbo/test/turbodecoder_test.c index 2efa681ae..8226d2fa9 100644 --- a/lib/src/phy/fec/turbo/test/turbodecoder_test.c +++ b/lib/src/phy/fec/turbo/test/turbodecoder_test.c @@ -94,7 +94,7 @@ void parse_args(int argc, char** argv) seed = (uint32_t)strtoul(argv[optind], NULL, 0); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/modem/test/soft_demod_test.c b/lib/src/phy/modem/test/soft_demod_test.c index ee3ee49f3..96c7da466 100644 --- a/lib/src/phy/modem/test/soft_demod_test.c +++ b/lib/src/phy/modem/test/soft_demod_test.c @@ -45,7 +45,7 @@ void parse_args(int argc, char** argv) nof_frames = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'm': switch (strtol(argv[optind], NULL, 10)) { diff --git a/lib/src/phy/phch/pbch_nr.c b/lib/src/phy/phch/pbch_nr.c index a457e73ed..557704b67 100644 --- a/lib/src/phy/phch/pbch_nr.c +++ b/lib/src/phy/phch/pbch_nr.c @@ -222,7 +222,7 @@ pbch_nr_pbch_msg_pack(const srsran_pbch_nr_cfg_t* cfg, const srsran_pbch_msg_nr_ a[G[13]] = 0; // Reserved } - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_TX("Packed PBCH bits: "); srsran_vec_fprint_byte(stdout, a, PBCH_NR_A); } @@ -230,7 +230,7 @@ pbch_nr_pbch_msg_pack(const srsran_pbch_nr_cfg_t* cfg, const srsran_pbch_msg_nr_ static void pbch_nr_pbch_msg_unpack(const srsran_pbch_nr_cfg_t* cfg, const uint8_t a[PBCH_NR_A], srsran_pbch_msg_nr_t* msg) { - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_RX("Packed PBCH bits: "); srsran_vec_fprint_byte(stdout, a, PBCH_NR_A); } @@ -330,7 +330,7 @@ static int pbch_nr_polar_encode(srsran_pbch_nr_t* q, const uint8_t c[PBCH_NR_K], return SRSRAN_ERROR; } - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_TX("Allocated: "); srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N); } @@ -347,7 +347,7 @@ static int pbch_nr_polar_decode(srsran_pbch_nr_t* q, const int8_t d[PBCH_NR_N], return SRSRAN_ERROR; } - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_RX("Allocated: "); srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N); } @@ -369,7 +369,7 @@ static int pbch_nr_polar_rm_tx(srsran_pbch_nr_t* q, const uint8_t d[PBCH_NR_N], return SRSRAN_ERROR; } - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_TX("d: "); srsran_vec_fprint_byte(stdout, d, PBCH_NR_N); } @@ -389,7 +389,7 @@ static int pbch_nr_polar_rm_rx(srsran_pbch_nr_t* q, const int8_t llr[PBCH_NR_E], d[i] *= -1; } - if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PBCH_NR_DEBUG_RX("d: "); srsran_vec_fprint_bs(stdout, d, PBCH_NR_N); } diff --git a/lib/src/phy/phch/pdcch_nr.c b/lib/src/phy/phch/pdcch_nr.c index 0cf8f0974..61977b856 100644 --- a/lib/src/phy/phch/pdcch_nr.c +++ b/lib/src/phy/phch/pdcch_nr.c @@ -521,7 +521,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_ srsran_polar_interleaver_run_u8(c, c_prime, q->K, true); // Print c and c_prime (after interleaving) - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { PDCCH_INFO_TX("c="); srsran_vec_fprint_hex(stdout, c, q->K); PDCCH_INFO_TX("c_prime="); @@ -537,7 +537,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_ } // Print d - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { PDCCH_INFO_TX("d="); srsran_vec_fprint_byte(stdout, q->d, q->code.N); } @@ -564,7 +564,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_ q->meas_time_us = (uint32_t)t[0].tv_usec; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { char str[128] = {}; srsran_pdcch_nr_info(q, NULL, str, sizeof(str)); PDCCH_INFO_TX("%s", str); @@ -613,7 +613,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, } // Print channel estimates if enabled - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PDCCH_DEBUG_RX("ce="); srsran_vec_fprint_c(stdout, ce->ce, q->M); } @@ -622,7 +622,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, srsran_predecoding_single(q->symbols, ce->ce, q->symbols, NULL, q->M, 1.0f, ce->noise_var); // Print symbols if enabled - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PDCCH_DEBUG_RX("symbols="); srsran_vec_fprint_c(stdout, q->symbols, q->M); } @@ -653,7 +653,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, } // Print d - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { PDCCH_DEBUG_RX("d="); srsran_vec_fprint_bs(stdout, d, q->K); } @@ -676,7 +676,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, srsran_polar_interleaver_run_u8(c_prime, c, q->K, false); // Print c - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { PDCCH_INFO_RX("c_prime="); srsran_vec_fprint_hex(stdout, c_prime, q->K); PDCCH_INFO_RX("c="); @@ -697,7 +697,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, uint32_t checksum2 = srsran_bit_pack(&ptr, 24); res->crc = checksum1 == checksum2; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { PDCCH_INFO_RX("CRC={%06x, %06x}; msg=", checksum1, checksum2); srsran_vec_fprint_hex(stdout, c, dci_msg->nof_bits); } @@ -711,7 +711,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q, q->meas_time_us = (uint32_t)t[0].tv_usec; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { char str[128] = {}; srsran_pdcch_nr_info(q, res, str, sizeof(str)); PDCCH_INFO_RX("%s", str); diff --git a/lib/src/phy/phch/pdsch_nr.c b/lib/src/phy/phch/pdsch_nr.c index 3d8ebf3f7..26e92fcbf 100644 --- a/lib/src/phy/phch/pdsch_nr.c +++ b/lib/src/phy/phch/pdsch_nr.c @@ -321,7 +321,7 @@ static inline int pdsch_nr_encode_codeword(srsran_pdsch_nr_t* q, return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("b="); srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits); } @@ -333,7 +333,7 @@ static inline int pdsch_nr_encode_codeword(srsran_pdsch_nr_t* q, // 7.3.1.2 Modulation srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], tb->nof_bits); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("d="); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); } @@ -437,7 +437,7 @@ static inline int pdsch_nr_decode_codeword(srsran_pdsch_nr_t* q, return SRSRAN_ERROR_OUT_OF_BOUNDS; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("d="); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); } @@ -460,7 +460,7 @@ static inline int pdsch_nr_decode_codeword(srsran_pdsch_nr_t* q, // Descrambling srsran_sequence_apply_c(llr, llr, tb->nof_bits, pdsch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx)); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("b="); srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits); } @@ -516,7 +516,7 @@ int srsran_pdsch_nr_decode(srsran_pdsch_nr_t* q, return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("ce="); srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re); DEBUG("x="); diff --git a/lib/src/phy/phch/pucch_nr.c b/lib/src/phy/phch/pucch_nr.c index 21132238e..9c0472d38 100644 --- a/lib/src/phy/phch/pucch_nr.c +++ b/lib/src/phy/phch/pucch_nr.c @@ -643,7 +643,7 @@ static int pucch_nr_format2_decode(srsran_pucch_nr_t* q, } } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { INFO("d="); srsran_vec_fprint_c(stdout, q->d, resource->nof_symbols * resource->nof_prb * (SRSRAN_NRE - 4)); INFO("ce="); diff --git a/lib/src/phy/phch/pusch_nr.c b/lib/src/phy/phch/pusch_nr.c index b839dc0ce..e4b1bda7b 100644 --- a/lib/src/phy/phch/pusch_nr.c +++ b/lib/src/phy/phch/pusch_nr.c @@ -556,7 +556,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t* } // Print debug information if configured for ity - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { if (m_ulsch_count != 0) { DEBUG("UL-SCH bit positions:"); srsran_vec_fprint_i(stdout, (int*)pos_ulsch, m_ulsch_count); @@ -662,7 +662,7 @@ static inline int pusch_nr_encode_codeword(srsran_pusch_nr_t* q, } } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("b="); srsran_vec_fprint_b(stdout, b, nof_bits); } @@ -688,7 +688,7 @@ static inline int pusch_nr_encode_codeword(srsran_pusch_nr_t* q, // 7.3.1.2 Modulation srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], nof_bits); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("d="); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); } @@ -794,7 +794,7 @@ static inline int pusch_nr_decode_codeword(srsran_pusch_nr_t* q, return SRSRAN_ERROR_OUT_OF_BOUNDS; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("d="); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); } @@ -842,7 +842,7 @@ static inline int pusch_nr_decode_codeword(srsran_pusch_nr_t* q, // Descrambling srsran_sequence_apply_c(llr, llr, nof_bits, pusch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx)); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("b="); srsran_vec_fprint_bs(stdout, llr, nof_bits); } @@ -968,7 +968,7 @@ int srsran_pusch_nr_decode(srsran_pusch_nr_t* q, return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("ce="); srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re); DEBUG("x="); diff --git a/lib/src/phy/phch/sch_nr.c b/lib/src/phy/phch/sch_nr.c index 05d13a196..d983b33d6 100644 --- a/lib/src/phy/phch/sch_nr.c +++ b/lib/src/phy/phch/sch_nr.c @@ -454,7 +454,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q, // Calculate TB CRC uint32_t checksum_tb = srsran_crc_checksum_byte(crc_tb, data, tb->tbs); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("tb="); srsran_vec_fprint_byte(stdout, data, tb->tbs / 8); } @@ -489,7 +489,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q, srsran_bit_unpack_vector(input_ptr, q->temp_cb, (int)cb_len); } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("cb%d=", r); srsran_vec_fprint_byte(stdout, input_ptr, cb_len / 8); } @@ -510,7 +510,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q, // Encode code block srsran_ldpc_encoder_encode(encoder, q->temp_cb, rm_buffer, cfg.Kr); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("encoded="); srsran_vec_fprint_b(stdout, rm_buffer, encoder->liftN - 2 * encoder->ls); } @@ -668,7 +668,7 @@ static int sch_nr_decode(srsran_sch_nr_t* q, SCH_INFO_RX("CB %d/%d iter=%d CRC=%s", r, cfg.C, n_iter_cb, tb->softbuffer.rx->cb_crc[r] ? "OK" : "KO"); // CB Debug trace - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("CB %d/%d:", r, cfg.C); srsran_vec_fprint_hex(stdout, q->temp_cb, cb_len); } @@ -731,7 +731,7 @@ static int sch_nr_decode(srsran_sch_nr_t* q, SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}", tb->tbs, checksum1, checksum2); } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { DEBUG("Decode: "); srsran_vec_fprint_byte(stdout, res->payload, tb->tbs / 8); } diff --git a/lib/src/phy/phch/test/dci_nbiot_test.c b/lib/src/phy/phch/test/dci_nbiot_test.c index f41f653d0..24f417cdb 100644 --- a/lib/src/phy/phch/test/dci_nbiot_test.c +++ b/lib/src/phy/phch/test/dci_nbiot_test.c @@ -30,7 +30,7 @@ void parse_args(int argc, char** argv) while ((opt = getopt(argc, argv, "cpndv")) != -1) { switch (opt) { case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/dci_nr_test.c b/lib/src/phy/phch/test/dci_nr_test.c index b82b2a71d..48b54f238 100644 --- a/lib/src/phy/phch/test/dci_nr_test.c +++ b/lib/src/phy/phch/test/dci_nr_test.c @@ -365,7 +365,7 @@ static void parse_args(int argc, char** argv) while ((opt = getopt(argc, argv, "vR")) != -1) { switch (opt) { case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'R': nof_repetitions = (uint32_t)strtol(argv[optind], NULL, 10); diff --git a/lib/src/phy/phch/test/mib_nr_test.c b/lib/src/phy/phch/test/mib_nr_test.c index 4ea88fbc7..3a46c5a14 100644 --- a/lib/src/phy/phch/test/mib_nr_test.c +++ b/lib/src/phy/phch/test/mib_nr_test.c @@ -78,7 +78,7 @@ static void parse_args(int argc, char** argv) while ((opt = getopt(argc, argv, "vR")) != -1) { switch (opt) { case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'R': nof_repetitions = (uint32_t)strtol(argv[optind], NULL, 10); diff --git a/lib/src/phy/phch/test/npbch_file_test.c b/lib/src/phy/phch/test/npbch_file_test.c index fc8a1a16d..5eeb7d3d5 100644 --- a/lib/src/phy/phch/test/npbch_file_test.c +++ b/lib/src/phy/phch/test/npbch_file_test.c @@ -83,7 +83,7 @@ void parse_args(int argc, char** argv) sf_idx = (int)(strtol(argv[optind], NULL, 10) % 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'r': nf = (int)strtol(argv[optind], NULL, 10); diff --git a/lib/src/phy/phch/test/npbch_test.c b/lib/src/phy/phch/test/npbch_test.c index afae36af7..3ea02914e 100644 --- a/lib/src/phy/phch/test/npbch_test.c +++ b/lib/src/phy/phch/test/npbch_test.c @@ -49,7 +49,7 @@ void parse_args(int argc, char** argv) cell.base.id = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/npdcch_file_test.c b/lib/src/phy/phch/test/npdcch_file_test.c index 1a19ced39..8e3f4e0f7 100644 --- a/lib/src/phy/phch/test/npdcch_file_test.c +++ b/lib/src/phy/phch/test/npdcch_file_test.c @@ -83,7 +83,7 @@ void parse_args(int argc, char** argv) tti = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/npdcch_test.c b/lib/src/phy/phch/test/npdcch_test.c index f523a1c7b..c0633e72e 100644 --- a/lib/src/phy/phch/test/npdcch_test.c +++ b/lib/src/phy/phch/test/npdcch_test.c @@ -65,7 +65,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); 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 699034d9f..59462faa2 100644 --- a/lib/src/phy/phch/test/npdsch_npdcch_file_test.c +++ b/lib/src/phy/phch/test/npdsch_npdcch_file_test.c @@ -117,7 +117,7 @@ void parse_args(int argc, char** argv) snr = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/npdsch_test.c b/lib/src/phy/phch/test/npdsch_test.c index f96825de1..cd775fb9f 100644 --- a/lib/src/phy/phch/test/npdsch_test.c +++ b/lib/src/phy/phch/test/npdsch_test.c @@ -103,7 +103,7 @@ void parse_args(int argc, char** argv) expected_nof_re = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pbch_file_test.c b/lib/src/phy/phch/test/pbch_file_test.c index 1d52ec98a..59e348639 100644 --- a/lib/src/phy/phch/test/pbch_file_test.c +++ b/lib/src/phy/phch/test/pbch_file_test.c @@ -74,7 +74,7 @@ void parse_args(int argc, char** argv) nof_frames = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'e': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/pbch_test.c b/lib/src/phy/phch/test/pbch_test.c index 444e1c900..bf31e4073 100644 --- a/lib/src/phy/phch/test/pbch_test.c +++ b/lib/src/phy/phch/test/pbch_test.c @@ -54,7 +54,7 @@ void parse_args(int argc, char** argv) cell.id = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pcfich_file_test.c b/lib/src/phy/phch/test/pcfich_file_test.c index a744262bc..d663a8fbe 100644 --- a/lib/src/phy/phch/test/pcfich_file_test.c +++ b/lib/src/phy/phch/test/pcfich_file_test.c @@ -77,7 +77,7 @@ void parse_args(int argc, char** argv) matlab_file_name = argv[optind]; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'e': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/pcfich_test.c b/lib/src/phy/phch/test/pcfich_test.c index 117878597..0d72f15be 100644 --- a/lib/src/phy/phch/test/pcfich_test.c +++ b/lib/src/phy/phch/test/pcfich_test.c @@ -53,7 +53,7 @@ void parse_args(int argc, char** argv) cell.id = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pdcch_file_test.c b/lib/src/phy/phch/test/pdcch_file_test.c index c3adfa35a..6765a47f6 100644 --- a/lib/src/phy/phch/test/pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdcch_file_test.c @@ -93,7 +93,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'e': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/pdcch_nr_test.c b/lib/src/phy/phch/test/pdcch_nr_test.c index 827ee4007..46719631c 100644 --- a/lib/src/phy/phch/test/pdcch_nr_test.c +++ b/lib/src/phy/phch/test/pdcch_nr_test.c @@ -83,7 +83,7 @@ static int parse_args(int argc, char** argv) interleaved ^= true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pdcch_test.c b/lib/src/phy/phch/test/pdcch_test.c index 79c3dce55..37c1f21be 100644 --- a/lib/src/phy/phch/test/pdcch_test.c +++ b/lib/src/phy/phch/test/pdcch_test.c @@ -81,7 +81,7 @@ static void parse_args(int argc, char** argv) snr_dB = (float)strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -298,13 +298,13 @@ static int test_case1() } } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO || !payload_match) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO || !payload_match) { // If payload is not match and there is no logging, set logging to info and run the decoder again - if (srsran_verbose < SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() < SRSRAN_VERBOSE_INFO) { printf("-- Detected payload was not matched, repeating decode with INFO logs (n0: %+.1f dB, corr: %f)\n", n0_dB, corr); - srsran_verbose = SRSRAN_VERBOSE_INFO; + set_srsran_verbose_level(SRSRAN_VERBOSE_INFO); srsran_pdcch_decode_msg(&pdcch_rx, &dl_sf_cfg, &dci_cfg, &dci_rx); } print_dci_msg("Tx: ", &dci_tx); diff --git a/lib/src/phy/phch/test/pdsch_nr_test.c b/lib/src/phy/phch/test/pdsch_nr_test.c index 0c3e77dee..082cb944c 100644 --- a/lib/src/phy/phch/test/pdsch_nr_test.c +++ b/lib/src/phy/phch/test/pdsch_nr_test.c @@ -56,7 +56,7 @@ int parse_args(int argc, char** argv) carrier.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c index a3a00c899..216bdde3f 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -96,7 +96,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'e': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/pdsch_test.c b/lib/src/phy/phch/test/pdsch_test.c index e13f96a48..d2cc70209 100644 --- a/lib/src/phy/phch/test/pdsch_test.c +++ b/lib/src/phy/phch/test/pdsch_test.c @@ -128,7 +128,7 @@ void parse_args(int argc, char** argv) enable_coworker = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'q': enable_256qam ^= true; diff --git a/lib/src/phy/phch/test/phich_file_test.c b/lib/src/phy/phch/test/phich_file_test.c index b82fa7845..7363b8dcd 100644 --- a/lib/src/phy/phch/test/phich_file_test.c +++ b/lib/src/phy/phch/test/phich_file_test.c @@ -100,7 +100,7 @@ void parse_args(int argc, char** argv) cell.nof_ports = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'l': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/phich_test.c b/lib/src/phy/phch/test/phich_test.c index 642542fda..7a5cd5eac 100644 --- a/lib/src/phy/phch/test/phich_test.c +++ b/lib/src/phy/phch/test/phich_test.c @@ -78,7 +78,7 @@ void parse_args(int argc, char** argv) cell.cp = SRSRAN_CP_EXT; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pmch_file_test.c b/lib/src/phy/phch/test/pmch_file_test.c index c1e2246a2..a55850f40 100644 --- a/lib/src/phy/phch/test/pmch_file_test.c +++ b/lib/src/phy/phch/test/pmch_file_test.c @@ -86,7 +86,7 @@ void parse_args(int argc, char** argv) mbsfn_area_id = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'e': cell.cp = SRSRAN_CP_EXT; diff --git a/lib/src/phy/phch/test/pmch_test.c b/lib/src/phy/phch/test/pmch_test.c index 89f87ccc8..dee22f83f 100644 --- a/lib/src/phy/phch/test/pmch_test.c +++ b/lib/src/phy/phch/test/pmch_test.c @@ -103,7 +103,7 @@ void parse_args(int argc, char** argv) nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/prach_test_usrp.c b/lib/src/phy/phch/test/prach_test_usrp.c index 79a2dd183..6dda35c28 100644 --- a/lib/src/phy/phch/test/prach_test_usrp.c +++ b/lib/src/phy/phch/test/prach_test_usrp.c @@ -47,9 +47,6 @@ static float uhd_rx_gain = 40, uhd_tx_gain = 60, uhd_freq = 2.4e9; static char* uhd_args = ""; static char* device_name = ""; -// SRSRAN Verbose -SRSRAN_API extern int srsran_verbose; - void usage(char* prog) { printf("Usage: %s \n", prog); @@ -136,7 +133,7 @@ void parse_args(int argc, char** argv) seq_idx = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'z': zero_corr_zone = (uint32_t)strtol(argv[optind], NULL, 10); diff --git a/lib/src/phy/phch/test/psbch_file_test.c b/lib/src/phy/phch/test/psbch_file_test.c index 3f8ed8f87..208bc8b0b 100644 --- a/lib/src/phy/phch/test/psbch_file_test.c +++ b/lib/src/phy/phch/test/psbch_file_test.c @@ -89,7 +89,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/psbch_test.c b/lib/src/phy/phch/test/psbch_test.c index 7e9ddb55d..133579877 100644 --- a/lib/src/phy/phch/test/psbch_test.c +++ b/lib/src/phy/phch/test/psbch_test.c @@ -67,7 +67,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pscch_test.c b/lib/src/phy/phch/test/pscch_test.c index b82b5fb1c..91e47567a 100644 --- a/lib/src/phy/phch/test/pscch_test.c +++ b/lib/src/phy/phch/test/pscch_test.c @@ -65,7 +65,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pssch_pscch_file_test.c b/lib/src/phy/phch/test/pssch_pscch_file_test.c index 47113978b..72eb6fc70 100644 --- a/lib/src/phy/phch/test/pssch_pscch_file_test.c +++ b/lib/src/phy/phch/test/pssch_pscch_file_test.c @@ -104,7 +104,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pssch_test.c b/lib/src/phy/phch/test/pssch_test.c index c31130c79..95c45455d 100644 --- a/lib/src/phy/phch/test/pssch_test.c +++ b/lib/src/phy/phch/test/pssch_test.c @@ -56,7 +56,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pucch_nr_test.c b/lib/src/phy/phch/test/pucch_nr_test.c index 27214862d..6779549de 100644 --- a/lib/src/phy/phch/test/pucch_nr_test.c +++ b/lib/src/phy/phch/test/pucch_nr_test.c @@ -270,7 +270,7 @@ static void parse_args(int argc, char** argv) snr_db = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/test/pucch_test.c b/lib/src/phy/phch/test/pucch_test.c index 76edd6e09..2c3a268c5 100644 --- a/lib/src/phy/phch/test/pucch_test.c +++ b/lib/src/phy/phch/test/pucch_test.c @@ -66,7 +66,7 @@ void parse_args(int argc, char** argv) snr_db = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -107,7 +107,7 @@ int test_uci_cqi_pucch(void) if (recv != cqi) { printf("Error! cqi = %d (len: %d), %X!=%X \n", cqi, nof_bits, cqi, recv); - if (srsran_verbose) { + if (get_srsran_verbose_level()) { printf("original: "); srsran_vec_fprint_b(stdout, o_bits, nof_bits); printf(" decoded: "); diff --git a/lib/src/phy/phch/test/pusch_nr_test.c b/lib/src/phy/phch/test/pusch_nr_test.c index def99976e..eedae8a0c 100644 --- a/lib/src/phy/phch/test/pusch_nr_test.c +++ b/lib/src/phy/phch/test/pusch_nr_test.c @@ -64,7 +64,7 @@ int parse_args(int argc, char** argv) nof_csi_bits = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -358,7 +358,7 @@ int main(int argc, char** argv) } } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[512]; srsran_pusch_nr_rx_info(&pusch_rx, &pusch_cfg, &pusch_cfg.grant, &data_rx, str, (uint32_t)sizeof(str)); diff --git a/lib/src/phy/phch/test/pusch_test.c b/lib/src/phy/phch/test/pusch_test.c index 7febc9b43..b511ab391 100644 --- a/lib/src/phy/phch/test/pusch_test.c +++ b/lib/src/phy/phch/test/pusch_test.c @@ -161,7 +161,7 @@ void parse_args(int argc, char** argv) optind++; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -349,7 +349,7 @@ int main(int argc, char** argv) ret = SRSRAN_ERROR; } else { INFO("Rx ACK (%d bits) is Ok: ", uci_data_tx.cfg.ack[0].nof_acks); - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { srsran_vec_fprint_byte(stdout, uci_data_tx.value.ack.ack_value, uci_data_tx.cfg.ack[0].nof_acks); } } diff --git a/lib/src/phy/phch/test/sch_nr_test.c b/lib/src/phy/phch/test/sch_nr_test.c index 086c38862..095f230a8 100644 --- a/lib/src/phy/phch/test/sch_nr_test.c +++ b/lib/src/phy/phch/test/sch_nr_test.c @@ -62,7 +62,7 @@ int parse_args(int argc, char** argv) carrier.max_mimo_layers = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/phch/uci_nr.c b/lib/src/phy/phch/uci_nr.c index f1115fc4d..7483a1487 100644 --- a/lib/src/phy/phch/uci_nr.c +++ b/lib/src/phy/phch/uci_nr.c @@ -198,7 +198,7 @@ static int uci_nr_pack_ack_sr(const srsran_uci_cfg_nr_t* cfg, const srsran_uci_v srsran_bit_unpack(value->sr, &bits, cfg->o_sr); A += cfg->o_sr; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Packed UCI bits: "); srsran_vec_fprint_byte(stdout, sequence, A); } @@ -219,7 +219,7 @@ static int uci_nr_unpack_ack_sr(const srsran_uci_cfg_nr_t* cfg, uint8_t* sequenc value->sr = srsran_bit_pack(&bits, cfg->o_sr); A += cfg->o_sr; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Unpacked UCI bits: "); srsran_vec_fprint_byte(stdout, sequence, A); } @@ -248,7 +248,7 @@ static int uci_nr_pack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, const srsran_u } A += n; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Packed UCI bits: "); srsran_vec_fprint_byte(stdout, sequence, A); } @@ -269,7 +269,7 @@ static int uci_nr_unpack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, uint8_t* seq value->sr = srsran_bit_pack(&bits, cfg->o_sr); A += cfg->o_sr; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Unpacked UCI bits: "); srsran_vec_fprint_byte(stdout, sequence, A); } @@ -393,7 +393,7 @@ static int uci_nr_encode_1bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("One bit encoded NR-UCI; o="); srsran_vec_fprint_b(stdout, o, E); } @@ -434,7 +434,7 @@ static int uci_nr_decode_1_bit(srsran_uci_nr_t* q, // Save decoded bit q->bit_sequence[0] = (corr < 0) ? 0 : 1; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("One bit decoding NR-UCI llr="); srsran_vec_fprint_bs(stdout, llr, E); UCI_NR_INFO_RX("One bit decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s", @@ -539,7 +539,7 @@ static int uci_nr_encode_2bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Two bit encoded NR-UCI; E=%d; o=", E); srsran_vec_fprint_b(stdout, o, E); } @@ -585,7 +585,7 @@ static int uci_nr_decode_2_bit(srsran_uci_nr_t* q, q->bit_sequence[0] = c0 ? 1 : 0; q->bit_sequence[1] = c1 ? 1 : 0; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Two bit decoding NR-UCI llr="); srsran_vec_fprint_bs(stdout, llr, E); UCI_NR_INFO_RX("Two bit decoding NR-UCI A=%d; E=%d; Qm=%d; c0=%d; c1=%d; c2=%d %s", @@ -606,7 +606,7 @@ uci_nr_encode_3_11_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, uint3 { srsran_block_encode(q->bit_sequence, A, o, E); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Block encoded UCI bits; o="); srsran_vec_fprint_b(stdout, o, E); } @@ -649,7 +649,7 @@ static int uci_nr_decode_3_11_bit(srsran_uci_nr_t* q, // Take decoded decision with threshold *decoded_ok = (corr > q->block_code_threshold); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Block decoding NR-UCI llr="); srsran_vec_fprint_bs(stdout, llr, E); UCI_NR_INFO_RX("Block decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s", @@ -713,7 +713,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui srsran_crc_attach(crc, q->c, A_prime / C); UCI_NR_INFO_TX("Attaching %d/%d CRC%d=%" PRIx64, r, C, L, srsran_crc_checksum_get(crc)); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Polar cb %d/%d c=", r, C); srsran_vec_fprint_byte(stdout, q->c, K_r); } @@ -721,7 +721,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui // Allocate channel srsran_polar_chanalloc_tx(q->c, q->allocated, q->code.N, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Polar alloc %d/%d ", r, C); srsran_vec_fprint_byte(stdout, q->allocated, q->code.N); } @@ -731,7 +731,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Polar encoded %d/%d ", r, C); srsran_vec_fprint_byte(stdout, q->d, q->code.N); } @@ -739,7 +739,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui // Rate matching srsran_polar_rm_tx(&q->rm_tx, q->d, &o[E_r * r], q->code.n, E_r, K_r, UCI_NR_POLAR_RM_IBIL); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_TX("Polar RM cw %d/%d ", r, C); srsran_vec_fprint_byte(stdout, &o[E_r * r], E_r); } @@ -790,7 +790,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q, for (uint32_t r = 0, s = 0; r < C; r++) { uint32_t k = 0; - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Polar LLR %d/%d ", r, C); srsran_vec_fprint_bs(stdout, &llr[E_r * r], q->code.N); } @@ -805,7 +805,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q, return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Polar alloc %d/%d ", r, C); srsran_vec_fprint_byte(stdout, q->allocated, q->code.N); } @@ -813,7 +813,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q, // Undo channel allocation srsran_polar_chanalloc_rx(q->allocated, q->c, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set); - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { UCI_NR_INFO_RX("Polar cb %d/%d c=", r, C); srsran_vec_fprint_byte(stdout, q->c, K_r); } diff --git a/lib/src/phy/resampling/resampler.c b/lib/src/phy/resampling/resampler.c index 2669b507f..00223d6f3 100644 --- a/lib/src/phy/resampling/resampler.c +++ b/lib/src/phy/resampling/resampler.c @@ -145,7 +145,7 @@ int srsran_resampler_fft_init(srsran_resampler_fft_t* q, srsran_resampler_mode_t q->in_buffer[i] = (float)h; } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { printf("h_%s=", q->mode == SRSRAN_RESAMPLER_MODE_INTERPOLATE ? "interp" : "decimate"); srsran_vec_fprint_c(stdout, q->in_buffer, high_size); } diff --git a/lib/src/phy/resampling/test/resampler_test.c b/lib/src/phy/resampling/test/resampler_test.c index 0d65954c3..17573e109 100644 --- a/lib/src/phy/resampling/test/resampler_test.c +++ b/lib/src/phy/resampling/test/resampler_test.c @@ -53,7 +53,7 @@ static void parse_args(int argc, char** argv) repetitions = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'w': if (strcmp(argv[optind], "sine") == 0) { @@ -129,7 +129,7 @@ int main(int argc, char** argv) break; } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { printf("signal="); srsran_vec_fprint_c(stdout, src, buffer_size); } @@ -143,7 +143,7 @@ int main(int argc, char** argv) get_time_interval(t); uint64_t duration_us = (uint64_t)(t[0].tv_sec * 1000000UL + t[0].tv_usec); - if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { printf("interp="); srsran_vec_fprint_c(stdout, interpolated, buffer_size * factor); printf("decim="); @@ -156,7 +156,7 @@ int main(int argc, char** argv) srsran_vec_sub_ccc(src, &decimated[delay], interpolated, nsamples); float mse = sqrtf(srsran_vec_avg_power_cf(interpolated, nsamples)); - if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { printf("recovered="); srsran_vec_fprint_c(stdout, &decimated[delay], nsamples); } diff --git a/lib/src/phy/sync/test/npss_file.c b/lib/src/phy/sync/test/npss_file.c index be3e955ee..5505e8d84 100644 --- a/lib/src/phy/sync/test/npss_file.c +++ b/lib/src/phy/sync/test/npss_file.c @@ -81,7 +81,7 @@ void parse_args(int argc, char** argv) nof_frames = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/npss_test.c b/lib/src/phy/sync/test/npss_test.c index 8c11be8b8..39f939cf5 100644 --- a/lib/src/phy/sync/test/npss_test.c +++ b/lib/src/phy/sync/test/npss_test.c @@ -45,7 +45,7 @@ void parse_args(int argc, char** argv) input_len = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose = SRSRAN_VERBOSE_DEBUG; + set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/npss_usrp.c b/lib/src/phy/sync/test/npss_usrp.c index 5d8a21770..908e60cfa 100644 --- a/lib/src/phy/sync/test/npss_usrp.c +++ b/lib/src/phy/sync/test/npss_usrp.c @@ -100,7 +100,7 @@ void parse_args(int argc, char** argv) disable_plots = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/nsss_test.c b/lib/src/phy/sync/test/nsss_test.c index ca8ba98dd..491bff831 100644 --- a/lib/src/phy/sync/test/nsss_test.c +++ b/lib/src/phy/sync/test/nsss_test.c @@ -66,7 +66,7 @@ void parse_args(int argc, char** argv) max_num_sf = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose = SRSRAN_VERBOSE_DEBUG; + set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG); break; default: usage(argv[0]); @@ -215,7 +215,6 @@ exit: free(fft_buffer); } - return ret; } diff --git a/lib/src/phy/sync/test/nsss_usrp.c b/lib/src/phy/sync/test/nsss_usrp.c index cae618129..ce7f4a545 100644 --- a/lib/src/phy/sync/test/nsss_usrp.c +++ b/lib/src/phy/sync/test/nsss_usrp.c @@ -84,7 +84,7 @@ void parse_args(int argc, char** argv) nof_frames = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/pss_file.c b/lib/src/phy/sync/test/pss_file.c index 207f63910..9406d9c20 100644 --- a/lib/src/phy/sync/test/pss_file.c +++ b/lib/src/phy/sync/test/pss_file.c @@ -89,7 +89,7 @@ void parse_args(int argc, char** argv) disable_plots = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/pss_usrp.c b/lib/src/phy/sync/test/pss_usrp.c index cef871189..b971b1299 100644 --- a/lib/src/phy/sync/test/pss_usrp.c +++ b/lib/src/phy/sync/test/pss_usrp.c @@ -98,7 +98,7 @@ void parse_args(int argc, char** argv) disable_plots = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/psss_file_test.c b/lib/src/phy/sync/test/psss_file_test.c index 2c29ee9fd..7c33801da 100644 --- a/lib/src/phy/sync/test/psss_file_test.c +++ b/lib/src/phy/sync/test/psss_file_test.c @@ -87,7 +87,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/ssb_decode_test.c b/lib/src/phy/sync/test/ssb_decode_test.c index c40e8838d..c82ff5046 100644 --- a/lib/src/phy/sync/test/ssb_decode_test.c +++ b/lib/src/phy/sync/test/ssb_decode_test.c @@ -81,7 +81,7 @@ static void parse_args(int argc, char** argv) ssb_pattern = srsran_ssb_pattern_fom_str(argv[optind]); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/ssb_file_test.c b/lib/src/phy/sync/test/ssb_file_test.c index 2fd2096e6..377c4aa24 100644 --- a/lib/src/phy/sync/test/ssb_file_test.c +++ b/lib/src/phy/sync/test/ssb_file_test.c @@ -81,7 +81,7 @@ static void parse_args(int argc, char** argv) assert_hrf = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/ssb_measure_test.c b/lib/src/phy/sync/test/ssb_measure_test.c index e5210af3d..b8dbf9244 100644 --- a/lib/src/phy/sync/test/ssb_measure_test.c +++ b/lib/src/phy/sync/test/ssb_measure_test.c @@ -86,7 +86,7 @@ static void parse_args(int argc, char** argv) ssb_pattern = srsran_ssb_pattern_fom_str(argv[optind]); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/sync_nbiot_test.c b/lib/src/phy/sync/test/sync_nbiot_test.c index 41cda5c7f..923bf67aa 100644 --- a/lib/src/phy/sync/test/sync_nbiot_test.c +++ b/lib/src/phy/sync/test/sync_nbiot_test.c @@ -63,7 +63,7 @@ void parse_args(int argc, char** argv) offset = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose = SRSRAN_VERBOSE_DEBUG; + set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/sync_sl_test.c b/lib/src/phy/sync/test/sync_sl_test.c index 131b12c46..15ceca07e 100644 --- a/lib/src/phy/sync/test/sync_sl_test.c +++ b/lib/src/phy/sync/test/sync_sl_test.c @@ -101,7 +101,7 @@ void parse_args(int argc, char** argv) } break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/sync/test/sync_test.c b/lib/src/phy/sync/test/sync_test.c index 377d0ae12..278702f7c 100644 --- a/lib/src/phy/sync/test/sync_test.c +++ b/lib/src/phy/sync/test/sync_test.c @@ -56,7 +56,7 @@ void parse_args(int argc, char** argv) cp = SRSRAN_CP_EXT; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/test/gen_ack_nr_test.c b/lib/src/phy/ue/test/gen_ack_nr_test.c index 7a95e98c9..7038a9f50 100644 --- a/lib/src/phy/ue/test/gen_ack_nr_test.c +++ b/lib/src/phy/ue/test/gen_ack_nr_test.c @@ -136,7 +136,7 @@ static void parse_args(int argc, char** argv) while ((opt = getopt(argc, argv, "v")) != -1) { switch (opt) { case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/test/ue_dl_nbiot_test.c b/lib/src/phy/ue/test/ue_dl_nbiot_test.c index 6c89eda29..208193d1d 100644 --- a/lib/src/phy/ue/test/ue_dl_nbiot_test.c +++ b/lib/src/phy/ue/test/ue_dl_nbiot_test.c @@ -40,7 +40,7 @@ void parse_args(int argc, char** argv) cell.n_id_ncell = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/test/ue_dl_nr_file_test.c b/lib/src/phy/ue/test/ue_dl_nr_file_test.c index f18768cff..d2f122e51 100644 --- a/lib/src/phy/ue/test/ue_dl_nr_file_test.c +++ b/lib/src/phy/ue/test/ue_dl_nr_file_test.c @@ -57,7 +57,7 @@ static int parse_args(int argc, char** argv) carrier.pci = (uint32_t)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'n': slot_cfg.idx = (uint32_t)strtol(argv[optind], NULL, 10); diff --git a/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c b/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c index cc58ccfd1..9cedcb5b6 100644 --- a/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c +++ b/lib/src/phy/ue/test/ue_mib_sync_test_nbiot_usrp.c @@ -77,7 +77,7 @@ void parse_args(int argc, char** argv) nof_frames = (int)strtol(argv[optind], NULL, 10); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/test/ue_sync_nr_test.c b/lib/src/phy/ue/test/ue_sync_nr_test.c index eff7480ce..4022cb1d1 100644 --- a/lib/src/phy/ue/test/ue_sync_nr_test.c +++ b/lib/src/phy/ue/test/ue_sync_nr_test.c @@ -52,7 +52,7 @@ static void parse_args(int argc, char** argv) while ((opt = getopt(argc, argv, "v")) != -1) { switch (opt) { case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c b/lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c index 8c721b3e7..10e9dd43f 100644 --- a/lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c +++ b/lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c @@ -96,7 +96,7 @@ void parse_args(int argc, char** argv) disable_plots = true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index ce5766992..f025bb61e 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -1439,7 +1439,7 @@ int srsran_ue_dl_find_and_decode(srsran_ue_dl_t* q, if (ret == 1) { // Logging - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[512]; srsran_dci_dl_info(&dci_dl[0], str, 512); INFO("PDCCH: %s, snr=%.1f dB", str, q->chest_res.snr_db); diff --git a/lib/src/phy/ue/ue_dl_nr.c b/lib/src/phy/ue/ue_dl_nr.c index 19551ddd1..5a167f75e 100644 --- a/lib/src/phy/ue/ue_dl_nr.c +++ b/lib/src/phy/ue/ue_dl_nr.c @@ -567,7 +567,7 @@ int srsran_ue_dl_nr_decode_pdsch(srsran_ue_dl_nr_t* q, return SRSRAN_ERROR; } - if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { + if (SRSRAN_DEBUG_ENABLED && get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { char str[512]; srsran_ue_dl_nr_pdsch_info(q, cfg, res, str, sizeof(str)); INFO("PDSCH: %s", str); diff --git a/lib/src/phy/utils/debug.c b/lib/src/phy/utils/debug.c index 6aa886ba5..b27e5300a 100644 --- a/lib/src/phy/utils/debug.c +++ b/lib/src/phy/utils/debug.c @@ -13,9 +13,24 @@ #include "srsran/phy/utils/debug.h" #include -int srsran_verbose = 0; +static int srsran_verbose = 0; static bool handler_registered = false; +int get_srsran_verbose_level(void) +{ + return srsran_verbose; +} + +void set_srsran_verbose_level(int level) +{ + srsran_verbose = level; +} + +void increase_srsran_verbose_level(void) +{ + srsran_verbose++; +} + bool is_handler_registered(void) { return handler_registered; diff --git a/lib/src/radio/test/benchmark_radio.cc b/lib/src/radio/test/benchmark_radio.cc index ab88adcfd..5a354a5a8 100644 --- a/lib/src/radio/test/benchmark_radio.cc +++ b/lib/src/radio/test/benchmark_radio.cc @@ -146,7 +146,7 @@ void parse_args(int argc, char** argv) fft_plot_enable ^= true; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'h': default: diff --git a/lib/test/phy/phy_dl_nr_test.c b/lib/test/phy/phy_dl_nr_test.c index f478117d0..2080f0057 100644 --- a/lib/test/phy/phy_dl_nr_test.c +++ b/lib/test/phy/phy_dl_nr_test.c @@ -130,7 +130,7 @@ static int parse_args(int argc, char** argv) cfo_hz = strtof(argv[optind], NULL); break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; default: usage(argv[0]); @@ -478,7 +478,7 @@ int main(int argc, char** argv) } } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[512]; srsran_pdsch_res_nr_t pdsch_res_vec[SRSRAN_MAX_CODEWORDS] = {}; pdsch_res_vec[0] = pdsch_res; diff --git a/lib/test/phy/phy_dl_test.c b/lib/test/phy/phy_dl_test.c index 78c9ed5c5..66c713380 100644 --- a/lib/test/phy/phy_dl_test.c +++ b/lib/test/phy/phy_dl_test.c @@ -128,7 +128,7 @@ void parse_args(int argc, char** argv) optind++; break; case 'v': - srsran_verbose++; + increase_srsran_verbose_level(); break; case 'q': enable_256qam = (enable_256qam) ? false : true; @@ -220,7 +220,7 @@ int work_ue(srsran_ue_dl_t* ue_dl, ue_dl_cfg->cfg.pdsch.csi_enable = false; ue_dl_cfg->cfg.pdsch.meas_evm_en = false; - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[512]; srsran_dci_dl_info(&dci_dl[0], str, 512); INFO("UE PDCCH: rnti=0x%x, %s", rnti, str); @@ -244,7 +244,7 @@ int work_ue(srsran_ue_dl_t* ue_dl, return SRSRAN_ERROR; } - if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { + if (get_srsran_verbose_level() >= SRSRAN_VERBOSE_INFO) { char str[512]; srsran_pdsch_rx_info(&ue_dl_cfg->cfg.pdsch, pdsch_res, str, 512); INFO("eNb PDSCH: rnti=0x%x, %s", rnti, str); diff --git a/lib/test/phy/pucch_ca_test.c b/lib/test/phy/pucch_ca_test.c index a9b94c0d6..cf38a7783 100644 --- a/lib/test/phy/pucch_ca_test.c +++ b/lib/test/phy/pucch_ca_test.c @@ -131,7 +131,7 @@ static int test_pucch_ca(srsran_ack_nack_feedback_mode_t ack_nack_feedback_mode, int main(int argc, char** argv) { // Set PHY lib verbose to INFO - srsran_verbose = SRSRAN_VERBOSE_INFO; + set_srsran_verbose_level(SRSRAN_VERBOSE_INFO); uint32_t nof_tb_1[SRSRAN_MAX_CARRIERS] = {1, 1, 1, 1, 1}; uint32_t nof_tb_2[SRSRAN_MAX_CARRIERS] = {2, 1, 1, 1, 1}; diff --git a/srsue/src/phy/test/scell_search_test.cc b/srsue/src/phy/test/scell_search_test.cc index d82e5d3fc..a269401b7 100644 --- a/srsue/src/phy/test/scell_search_test.cc +++ b/srsue/src/phy/test/scell_search_test.cc @@ -482,7 +482,7 @@ int main(int argc, char** argv) phy_args.rx_gain_offset = rx_gain + 62.0f; // Set phy-lib logging level - srsran_verbose = phy_lib_log_level; + set_srsran_verbose_level(phy_lib_log_level); // Allocate PDSCH data and tx-soft-buffers only if pdsch is enabled and radio is not available for (int i = 0; i < SRSRAN_MAX_TB && serving_cell_pdsch_enable && radio == nullptr; i++) { diff --git a/test/phy/test_bench.h b/test/phy/test_bench.h index 86c0718ba..3c1a9b593 100644 --- a/test/phy/test_bench.h +++ b/test/phy/test_bench.h @@ -113,11 +113,11 @@ public: // Make sure PHY log is not set by UE or gNb PHY set_handler_enabled(false); if (args.phy_lib_log_level == "info") { - srsran_verbose = SRSRAN_VERBOSE_INFO; + set_srsran_verbose_level(SRSRAN_VERBOSE_INFO); } else if (args.phy_lib_log_level == "debug") { - srsran_verbose = SRSRAN_VERBOSE_DEBUG; + set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG); } else { - srsran_verbose = SRSRAN_VERBOSE_NONE; + set_srsran_verbose_level(SRSRAN_VERBOSE_NONE); } // Configure channel