From 9d15a44c73c3911583c1300c5573b7a6c682459b Mon Sep 17 00:00:00 2001 From: faluco <63966637+faluco@users.noreply.github.com> Date: Wed, 10 Feb 2021 13:46:25 +0100 Subject: [PATCH] Port lib/phy to srslog (#2298) * - Ported the channel class to srslog. - Removed all newlines of log messages in lib/phy. * Remove more newlines that use the C debug macros. --- lib/include/srslte/phy/channel/channel.h | 5 +- lib/include/srslte/phy/fec/polar/polar_code.h | 4 +- .../srslte/phy/fec/turbo/turbodecoder_iter.h | 2 +- lib/include/srslte/phy/modem/evm.h | 2 +- lib/include/srslte/phy/utils/debug.h | 4 +- lib/src/phy/agc/agc.c | 13 +-- lib/src/phy/ch_estimation/chest_dl.c | 37 +++--- lib/src/phy/ch_estimation/chest_dl_nbiot.c | 6 +- lib/src/phy/ch_estimation/chest_sl.c | 16 +-- lib/src/phy/ch_estimation/chest_ul.c | 18 ++- lib/src/phy/ch_estimation/dmrs_pdcch.c | 24 ++-- lib/src/phy/ch_estimation/dmrs_pucch.c | 28 ++--- .../phy/ch_estimation/refsignal_dl_nbiot.c | 12 +- lib/src/phy/ch_estimation/refsignal_ul.c | 17 +-- .../ch_estimation/test/chest_nbiot_test_dl.c | 6 +- .../phy/ch_estimation/test/chest_test_dl.c | 7 +- .../phy/ch_estimation/test/chest_test_srs.c | 5 +- .../phy/ch_estimation/test/chest_test_ul.c | 8 +- lib/src/phy/ch_estimation/test/csi_rs_test.c | 6 +- .../phy/ch_estimation/test/dmrs_pdcch_test.c | 2 +- .../phy/ch_estimation/test/dmrs_pdsch_test.c | 8 +- .../ch_estimation/test/refsignal_ul_test.c | 3 +- lib/src/phy/channel/ch_awgn.c | 2 +- lib/src/phy/channel/channel.cc | 32 ++--- lib/src/phy/channel/test/awgn_channel_test.c | 6 +- lib/src/phy/common/phy_common.c | 21 ++-- lib/src/phy/common/phy_common_sl.c | 4 +- lib/src/phy/common/sequence.c | 2 +- lib/src/phy/common/zc_sequence.c | 12 +- lib/src/phy/dft/dft_fftw.c | 2 +- lib/src/phy/dft/dft_precoding.c | 7 +- lib/src/phy/dft/ofdm.c | 13 +-- lib/src/phy/dft/test/ofdm_test.c | 4 +- lib/src/phy/enb/enb_dl.c | 57 +++++---- lib/src/phy/enb/enb_dl_nr.c | 22 ++-- lib/src/phy/enb/enb_ul.c | 37 +++--- lib/src/phy/fec/block/block.c | 6 +- lib/src/phy/fec/block/test/block_test.c | 2 +- lib/src/phy/fec/cbsegm.c | 5 +- .../phy/fec/convolutional/test/viterbi_test.c | 3 +- lib/src/phy/fec/convolutional/viterbi.c | 18 +-- lib/src/phy/fec/crc.c | 5 +- lib/src/phy/fec/ldpc/base_graph.c | 2 +- lib/src/phy/fec/ldpc/ldpc_decoder.c | 54 ++++----- lib/src/phy/fec/ldpc/ldpc_encoder.c | 27 +++-- lib/src/phy/fec/ldpc/ldpc_rm.c | 8 +- lib/src/phy/fec/polar/polar_code.c | 15 +-- lib/src/phy/fec/polar/polar_decoder.c | 10 +- lib/src/phy/fec/test/crc_test.c | 4 +- lib/src/phy/fec/turbo/rm_conv.c | 9 +- lib/src/phy/fec/turbo/rm_turbo.c | 22 +--- lib/src/phy/fec/turbo/tc_interl_lte.c | 4 +- lib/src/phy/fec/turbo/tc_interl_umts.c | 2 +- .../phy/fec/turbo/test/turbodecoder_test.c | 5 +- lib/src/phy/fec/turbo/turbocoder.c | 13 +-- lib/src/phy/fec/turbo/turbodecoder.c | 11 +- lib/src/phy/mimo/layermap.c | 33 +++--- lib/src/phy/mimo/precoding.c | 97 +++++++-------- lib/src/phy/mimo/test/layermap_test.c | 6 +- lib/src/phy/mimo/test/pmi_select_test.c | 12 +- lib/src/phy/mimo/test/precoder_test.c | 8 +- lib/src/phy/modem/demod_soft.c | 9 +- lib/src/phy/modem/mod.c | 7 +- lib/src/phy/modem/test/modem_test.c | 6 +- lib/src/phy/modem/test/soft_demod_test.c | 4 +- lib/src/phy/phch/dci.c | 42 +++---- lib/src/phy/phch/npbch.c | 18 +-- lib/src/phy/phch/npdcch.c | 34 +++--- lib/src/phy/phch/npdsch.c | 32 ++--- lib/src/phy/phch/pbch.c | 10 +- lib/src/phy/phch/pcfich.c | 8 +- lib/src/phy/phch/pdcch.c | 48 +++----- lib/src/phy/phch/pdcch_nr.c | 23 ++-- lib/src/phy/phch/pdsch.c | 64 +++++----- lib/src/phy/phch/pdsch_nr.c | 38 +++--- lib/src/phy/phch/phich.c | 33 +++--- lib/src/phy/phch/pmch.c | 28 ++--- lib/src/phy/phch/prach.c | 45 +++---- lib/src/phy/phch/psbch.c | 42 +++---- lib/src/phy/phch/pscch.c | 28 ++--- lib/src/phy/phch/pssch.c | 67 +++++------ lib/src/phy/phch/pucch.c | 56 ++++----- lib/src/phy/phch/pucch_cfg_nr.c | 48 ++++---- lib/src/phy/phch/pucch_nr.c | 68 +++++------ lib/src/phy/phch/pucch_proc.c | 16 +-- lib/src/phy/phch/pusch.c | 42 +++---- lib/src/phy/phch/pusch_nr.c | 40 +++---- lib/src/phy/phch/ra_dl.c | 46 ++++---- lib/src/phy/phch/ra_dl_nr.c | 20 ++-- lib/src/phy/phch/ra_helper.h | 2 +- lib/src/phy/phch/ra_nbiot.c | 4 +- lib/src/phy/phch/ra_nr.c | 6 +- lib/src/phy/phch/ra_ul.c | 26 ++--- lib/src/phy/phch/regs.c | 54 +++++---- lib/src/phy/phch/sch.c | 77 ++++++------ lib/src/phy/phch/sch_nr.c | 60 +++++----- lib/src/phy/phch/sci.c | 4 +- lib/src/phy/phch/test/npbch_file_test.c | 12 +- lib/src/phy/phch/test/npdcch_file_test.c | 4 +- lib/src/phy/phch/test/npdcch_test.c | 2 +- .../phy/phch/test/npdsch_npdcch_file_test.c | 8 +- lib/src/phy/phch/test/npdsch_test.c | 30 ++--- lib/src/phy/phch/test/pbch_file_test.c | 27 +++-- lib/src/phy/phch/test/pbch_test.c | 4 +- lib/src/phy/phch/test/pcfich_file_test.c | 25 ++-- lib/src/phy/phch/test/pcfich_test.c | 8 +- lib/src/phy/phch/test/pdcch_file_test.c | 37 +++--- lib/src/phy/phch/test/pdcch_nr_test.c | 16 ++- lib/src/phy/phch/test/pdcch_test.c | 21 ++-- lib/src/phy/phch/test/pdsch_nr_test.c | 37 +++--- lib/src/phy/phch/test/pdsch_pdcch_file_test.c | 15 ++- lib/src/phy/phch/test/pdsch_test.c | 62 +++++----- lib/src/phy/phch/test/phich_file_test.c | 31 +++-- lib/src/phy/phch/test/phich_test.c | 13 +-- lib/src/phy/phch/test/pmch_file_test.c | 21 ++-- lib/src/phy/phch/test/pmch_test.c | 51 ++++---- lib/src/phy/phch/test/prach_test.c | 2 +- lib/src/phy/phch/test/prach_test_multi.c | 47 ++++---- lib/src/phy/phch/test/prach_test_usrp.c | 21 ++-- lib/src/phy/phch/test/psbch_file_test.c | 10 +- lib/src/phy/phch/test/psbch_test.c | 2 +- lib/src/phy/phch/test/pscch_test.c | 6 +- lib/src/phy/phch/test/pssch_pscch_file_test.c | 29 ++--- lib/src/phy/phch/test/pssch_test.c | 18 +-- lib/src/phy/phch/test/pucch_nr_test.c | 20 ++-- lib/src/phy/phch/test/pucch_test.c | 38 +++--- lib/src/phy/phch/test/pusch_nr_test.c | 36 +++--- lib/src/phy/phch/test/pusch_test.c | 27 +++-- lib/src/phy/phch/test/sch_nr_test.c | 25 ++-- lib/src/phy/phch/uci.c | 27 ++--- lib/src/phy/phch/uci_nr.c | 65 +++++------ lib/src/phy/resampling/interp.c | 5 +- lib/src/phy/resampling/resampler.c | 4 +- lib/src/phy/rf/rf_blade_imp.c | 65 +++++------ lib/src/phy/rf/rf_imp.c | 5 +- lib/src/phy/rf/rf_soapy_imp.c | 16 +-- lib/src/phy/rf/rf_uhd_imp.cc | 20 ++-- lib/src/phy/rf/rf_utils.c | 28 ++--- lib/src/phy/scrambling/test/scrambling_test.c | 4 +- lib/src/phy/sync/cfo.c | 6 +- lib/src/phy/sync/cp.c | 2 +- lib/src/phy/sync/npss.c | 2 +- lib/src/phy/sync/nsss.c | 20 ++-- lib/src/phy/sync/pss.c | 46 +++----- lib/src/phy/sync/psss.c | 7 +- lib/src/phy/sync/refsignal_dl_sync.c | 6 +- lib/src/phy/sync/sss.c | 5 +- lib/src/phy/sync/sync.c | 73 ++++++------ lib/src/phy/sync/sync_nbiot.c | 8 +- lib/src/phy/sync/test/cfo_test.c | 2 +- lib/src/phy/sync/test/pss_file.c | 25 ++-- lib/src/phy/sync/test/pss_usrp.c | 24 ++-- lib/src/phy/sync/test/sync_sl_test.c | 6 +- lib/src/phy/sync/test/sync_test.c | 8 +- .../phy/ue/test/ue_mib_sync_test_nbiot_usrp.c | 2 +- lib/src/phy/ue/test/ue_sync_test_nbiot_usrp.c | 2 +- lib/src/phy/ue/ue_cell_search.c | 14 +-- lib/src/phy/ue/ue_cell_search_nbiot.c | 8 +- lib/src/phy/ue/ue_dl.c | 109 ++++++++--------- lib/src/phy/ue/ue_dl_nbiot.c | 89 +++++++------- lib/src/phy/ue/ue_dl_nr.c | 36 +++--- lib/src/phy/ue/ue_mib.c | 34 +++--- lib/src/phy/ue/ue_mib_nbiot.c | 16 +-- lib/src/phy/ue/ue_sync.c | 110 ++++++++---------- lib/src/phy/ue/ue_sync_nbiot.c | 18 +-- lib/src/phy/ue/ue_ul.c | 47 ++++---- lib/src/phy/ue/ue_ul_nr.c | 2 +- lib/src/phy/utils/convolution.c | 15 ++- lib/src/phy/utils/ringbuffer.c | 4 +- lib/src/phy/utils/vector.c | 2 +- lib/src/radio/test/benchmark_radio.cc | 6 +- lib/test/common/timer_test.cc | 2 +- lib/test/phy/phy_dl_nr_test.c | 50 ++++---- lib/test/phy/phy_dl_test.c | 64 +++++----- lib/test/phy/pucch_ca_test.c | 3 +- srsenb/src/phy/phy_common.cc | 3 +- srsenb/src/phy/txrx.cc | 4 +- srsenb/src/stack/upper/pdcp_nr.cc | 6 +- srsenb/src/stack/upper/rlc_nr.cc | 6 +- srsue/src/phy/phy_common.cc | 10 +- srsue/src/phy/sync.cc | 3 +- srsue/test/phy/scell_search_test.cc | 17 ++- 182 files changed, 1783 insertions(+), 2073 deletions(-) diff --git a/lib/include/srslte/phy/channel/channel.h b/lib/include/srslte/phy/channel/channel.h index 2ba2c0d8a..01a2a0406 100644 --- a/lib/include/srslte/phy/channel/channel.h +++ b/lib/include/srslte/phy/channel/channel.h @@ -60,14 +60,14 @@ public: uint32_t rlf_t_off_ms = 2000; } args_t; - channel(const args_t& channel_args, uint32_t _nof_channels); + channel(const args_t& channel_args, uint32_t _nof_channels, srslog::basic_logger& logger); ~channel(); - void set_logger(log_filter* _log_h); void set_srate(uint32_t srate); void set_signal_power_dBfs(float power_dBfs); void run(cf_t* in[SRSLTE_MAX_CHANNELS], cf_t* out[SRSLTE_MAX_CHANNELS], uint32_t len, const srslte_timestamp_t& t); private: + srslog::basic_logger& logger; float hst_init_phase = 0.0f; srslte_channel_fading_t* fading[SRSLTE_MAX_CHANNELS] = {}; srslte_channel_delay_t* delay[SRSLTE_MAX_CHANNELS] = {}; @@ -76,7 +76,6 @@ private: srslte_channel_rlf_t* rlf = nullptr; cf_t* buffer_in = nullptr; cf_t* buffer_out = nullptr; - log_filter* log_h = nullptr; uint32_t nof_channels = 0; uint32_t current_srate = 0; args_t args = {}; diff --git a/lib/include/srslte/phy/fec/polar/polar_code.h b/lib/include/srslte/phy/fec/polar/polar_code.h index fe70685c1..cab6c14eb 100644 --- a/lib/include/srslte/phy/fec/polar/polar_code.h +++ b/lib/include/srslte/phy/fec/polar/polar_code.h @@ -351,7 +351,7 @@ static inline const uint16_t* get_mother_code(uint8_t n) return mother_code_10; break; default: - ERROR("Wrong code_size_log\n"); + ERROR("Wrong code_size_log"); return NULL; } } @@ -381,7 +381,7 @@ static inline const uint16_t* get_blk_interleaver(uint8_t n) return blk_interleaver_10; break; default: - ERROR("Wrong code_size_log (%d)\n", n); + ERROR("Wrong code_size_log (%d)", n); return NULL; } } diff --git a/lib/include/srslte/phy/fec/turbo/turbodecoder_iter.h b/lib/include/srslte/phy/fec/turbo/turbodecoder_iter.h index 7c4151a72..87e2bc517 100644 --- a/lib/include/srslte/phy/fec/turbo/turbodecoder_iter.h +++ b/lib/include/srslte/phy/fec/turbo/turbodecoder_iter.h @@ -130,7 +130,7 @@ void MAKE_CALL(run_tdec_iteration)(srslte_tdec_t* h, llr_t* input) h->n_iter++; } else { - ERROR("Error CB index not set (call srslte_tdec_new_cb() first\n"); + ERROR("Error CB index not set (call srslte_tdec_new_cb() first"); } } diff --git a/lib/include/srslte/phy/modem/evm.h b/lib/include/srslte/phy/modem/evm.h index 69f81dd62..fa1a64b99 100644 --- a/lib/include/srslte/phy/modem/evm.h +++ b/lib/include/srslte/phy/modem/evm.h @@ -174,7 +174,7 @@ static inline void srslte_evm_buffer_resize(srslte_evm_buffer_t* q, uint32_t new \ /* Return NAN if EVM buffers, modem table, LLR, symbols or bits missing*/ \ if (!q || !modem_table || !modem_table->nbits_x_symbol || !llr || !symbols || !nof_bits) { \ - ERROR("Invalid inputs %p %p %p %p %d\n", q, modem_table, llr, symbols, nof_bits); \ + ERROR("Invalid inputs %p %p %p %p %d", q, modem_table, llr, symbols, nof_bits); \ return evm_rms; \ } \ \ diff --git a/lib/include/srslte/phy/utils/debug.h b/lib/include/srslte/phy/utils/debug.h index a6178513d..970bcc31b 100644 --- a/lib/include/srslte/phy/utils/debug.h +++ b/lib/include/srslte/phy/utils/debug.h @@ -48,7 +48,7 @@ SRSLTE_API extern int handler_registered; #define DEBUG(_fmt, ...) \ do { \ if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_DEBUG && !handler_registered) { \ - fprintf(stdout, "[DEBUG]: " _fmt, ##__VA_ARGS__); \ + fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__); \ } else { \ srslte_phy_log_print(LOG_LEVEL_DEBUG_S, _fmt, ##__VA_ARGS__); \ } \ @@ -57,7 +57,7 @@ SRSLTE_API extern int handler_registered; #define INFO(_fmt, ...) \ do { \ if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { \ - fprintf(stdout, "[INFO]: " _fmt, ##__VA_ARGS__); \ + fprintf(stdout, "[INFO]: " _fmt "\n", ##__VA_ARGS__); \ } else { \ srslte_phy_log_print(LOG_LEVEL_INFO_S, _fmt, ##__VA_ARGS__); \ } \ diff --git a/lib/src/phy/agc/agc.c b/lib/src/phy/agc/agc.c index dadd0afc1..1fd4cee3b 100644 --- a/lib/src/phy/agc/agc.c +++ b/lib/src/phy/agc/agc.c @@ -97,13 +97,13 @@ static inline void agc_enter_state_hold(srslte_agc_t* q) float gain_db = q->gain_db + q->gain_offset_db; if (gain_db < q->min_gain_db) { gain_db = q->min_gain_db; - INFO("Warning: Rx signal strength is too high. Forcing minimum Rx gain %.2fdB\n", gain_db); + INFO("Warning: Rx signal strength is too high. Forcing minimum Rx gain %.2fdB", gain_db); } else if (gain_db > q->max_gain_db) { gain_db = q->max_gain_db; - INFO("Warning: Rx signal strength is too weak. Forcing maximum Rx gain %.2fdB\n", gain_db); + INFO("Warning: Rx signal strength is too weak. Forcing maximum Rx gain %.2fdB", gain_db); } else if (isinf(gain_db) || isnan(gain_db)) { gain_db = q->default_gain_db; - INFO("Warning: AGC went to an unknown state. Setting Rx gain to %.2fdB\n", gain_db); + INFO("Warning: AGC went to an unknown state. Setting Rx gain to %.2fdB", gain_db); } // Set gain @@ -132,7 +132,6 @@ static inline void agc_run_state_init(srslte_agc_t* q) static inline void agc_run_state_measure(srslte_agc_t* q, cf_t* signal, uint32_t len) { - // Perform measurement of the frame float y = 0; float* t; @@ -145,7 +144,7 @@ static inline void agc_run_state_measure(srslte_agc_t* q, cf_t* signal, uint32_t y = t[srslte_vec_max_fi(t, 2 * len)]; // take only positive max to avoid abs() (should be similar) break; default: - ERROR("Unsupported AGC mode\n"); + ERROR("Unsupported AGC mode"); return; } @@ -162,7 +161,7 @@ static inline void agc_run_state_measure(srslte_agc_t* q, cf_t* signal, uint32_t y = q->y_tmp[srslte_vec_max_fi(q->y_tmp, q->nof_frames)]; break; default: - ERROR("Unsupported AGC mode\n"); + ERROR("Unsupported AGC mode"); return; } } @@ -177,7 +176,7 @@ static inline void agc_run_state_measure(srslte_agc_t* q, cf_t* signal, uint32_t if (q->frame_cnt == 0) { q->y_out = SRSLTE_VEC_EMA(y, q->y_out, q->bandwidth); q->gain_offset_db = srslte_convert_amplitude_to_dB(q->target) - srslte_convert_amplitude_to_dB(q->y_out); - INFO("AGC gain offset: %.2f y_out=%.3f, y=%.3f target=%.1f\n", q->gain_offset_db, q->y_out, y, q->target); + INFO("AGC gain offset: %.2f y_out=%.3f, y=%.3f target=%.1f", q->gain_offset_db, q->y_out, y, q->target); } } diff --git a/lib/src/phy/ch_estimation/chest_dl.c b/lib/src/phy/ch_estimation/chest_dl.c index 82f8e3be6..bafd3196b 100644 --- a/lib/src/phy/ch_estimation/chest_dl.c +++ b/lib/src/phy/ch_estimation/chest_dl.c @@ -29,7 +29,6 @@ #ifdef DEFAULT_FILTER_LEN static void set_default_filter(srslte_chest_dl_t* q, int filter_len) { - float fil[SRSLTE_CHEST_DL_MAX_SMOOTH_FIL_LEN]; for (int i = 0; i < filter_len / 2; i++) { @@ -66,13 +65,13 @@ int srslte_chest_dl_init(srslte_chest_dl_t* q, uint32_t max_prb, uint32_t nof_rx ret = srslte_refsignal_cs_init(&q->csr_refs, max_prb); if (ret != SRSLTE_SUCCESS) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); goto clean_exit; } q->mbsfn_refs = calloc(SRSLTE_MAX_MBSFN_AREA_IDS, sizeof(srslte_refsignal_t*)); if (!q->mbsfn_refs) { - ERROR("Calloc error initializing mbsfn_refs (%d)\n", ret); + ERROR("Calloc error initializing mbsfn_refs (%d)", ret); goto clean_exit; } @@ -114,22 +113,22 @@ int srslte_chest_dl_init(srslte_chest_dl_t* q, uint32_t max_prb, uint32_t nof_rx } if (srslte_interp_linear_vector_init(&q->srslte_interp_linvec, SRSLTE_NRE * max_prb)) { - ERROR("Error initializing vector interpolator\n"); + ERROR("Error initializing vector interpolator"); goto clean_exit; } if (srslte_interp_linear_init(&q->srslte_interp_lin, 2 * max_prb, SRSLTE_NRE / 2)) { - ERROR("Error initializing interpolator\n"); + ERROR("Error initializing interpolator"); goto clean_exit; } if (srslte_interp_linear_init(&q->srslte_interp_lin_3, 4 * max_prb, SRSLTE_NRE / 4)) { - ERROR("Error initializing interpolator\n"); + ERROR("Error initializing interpolator"); goto clean_exit; } if (srslte_interp_linear_init(&q->srslte_interp_lin_mbsfn, 6 * max_prb, SRSLTE_NRE / 6)) { - ERROR("Error initializing interpolator\n"); + ERROR("Error initializing interpolator"); goto clean_exit; } @@ -137,7 +136,7 @@ int srslte_chest_dl_init(srslte_chest_dl_t* q, uint32_t max_prb, uint32_t nof_rx if (q->wiener_dl) { srslte_wiener_dl_init(q->wiener_dl, max_prb, 2, nof_rx_antennas); } else { - ERROR("Error allocating wiener filter\n"); + ERROR("Error allocating wiener filter"); goto clean_exit; } @@ -277,25 +276,25 @@ int srslte_chest_dl_set_cell(srslte_chest_dl_t* q, srslte_cell_t cell) q->cell = cell; ret = srslte_refsignal_cs_set_cell(&q->csr_refs, cell); if (ret != SRSLTE_SUCCESS) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); return SRSLTE_ERROR; } if (srslte_pss_generate(q->pss_signal, cell.id % 3)) { - ERROR("Error initializing PSS signal for noise estimation\n"); + ERROR("Error initializing PSS signal for noise estimation"); return SRSLTE_ERROR; } if (srslte_interp_linear_vector_resize(&q->srslte_interp_linvec, SRSLTE_NRE * q->cell.nof_prb)) { - ERROR("Error initializing vector interpolator\n"); + ERROR("Error initializing vector interpolator"); return SRSLTE_ERROR; } if (srslte_interp_linear_resize(&q->srslte_interp_lin, 2 * q->cell.nof_prb, SRSLTE_NRE / 2)) { - ERROR("Error initializing interpolator\n"); + ERROR("Error initializing interpolator"); return SRSLTE_ERROR; } if (srslte_interp_linear_resize(&q->srslte_interp_lin_3, 4 * q->cell.nof_prb, SRSLTE_NRE / 4)) { - ERROR("Error initializing interpolator\n"); + ERROR("Error initializing interpolator"); return SRSLTE_ERROR; } if (srslte_interp_linear_resize(&q->srslte_interp_lin_mbsfn, 6 * q->cell.nof_prb, SRSLTE_NRE / 6)) { @@ -622,7 +621,6 @@ static void chest_interpolate_noise_est(srslte_chest_dl_t* q, uint32_t port_id, uint32_t rxant_id) { - float filter[SRSLTE_CHEST_MAX_SMOOTH_FIL_LEN]; uint32_t filter_len = 0; uint32_t sf_idx = sf->tti % 10; @@ -635,7 +633,7 @@ static void chest_interpolate_noise_est(srslte_chest_dl_t* q, /* Estimate noise */ if (cfg->noise_alg == SRSLTE_NOISE_ALG_REFS) { if (ch_mode == SRSLTE_SF_MBSFN) { - ERROR("Warning: REFS noise estimation algorithm not supported in MBSFN subframes\n"); + ERROR("Warning: REFS noise estimation algorithm not supported in MBSFN subframes"); } q->noise_estimate[rxant_id][port_id] = estimate_noise_pilots(q, sf, port_id); @@ -674,11 +672,10 @@ static void chest_interpolate_noise_est(srslte_chest_dl_t* q, } if (ce != NULL) { - switch (cfg->filter_type) { case SRSLTE_CHEST_FILTER_GAUSS: if (ch_mode == SRSLTE_SF_MBSFN) { - ERROR("Warning: Gauss filter not supported in MBSFN subframes\n"); + ERROR("Warning: Gauss filter not supported in MBSFN subframes"); } if (cfg->filter_coef[0] <= 0) { filter_len = srslte_chest_set_smooth_filter_gauss(filter, 4, q->noise_estimate[rxant_id][port_id] * 200.0f); @@ -694,7 +691,7 @@ static void chest_interpolate_noise_est(srslte_chest_dl_t* q, } if (cfg->estimator_alg != SRSLTE_ESTIMATOR_ALG_INTERPOLATE && ch_mode == SRSLTE_SF_MBSFN) { - ERROR("Warning: Subframe interpolation must be enabled in MBSFN subframes\n"); + ERROR("Warning: Subframe interpolation must be enabled in MBSFN subframes"); } /* Smooth estimates (if applicable) and interpolate */ @@ -731,7 +728,6 @@ chest_dl_estimate_correct_sync_error(srslte_chest_dl_t* q, srslte_dl_sf_cfg_t* s // For each cell port... for (uint32_t cell_port_id = 0; cell_port_id < q->cell.nof_ports; cell_port_id++) { - uint32_t npilots = srslte_refsignal_cs_nof_re(&q->csr_refs, sf, cell_port_id); uint32_t nsymb = srslte_refsignal_cs_nof_symbols(&q->csr_refs, sf, cell_port_id); @@ -823,7 +819,7 @@ static int estimate_port_mbsfn(srslte_chest_dl_t* q, uint16_t mbsfn_area_id = cfg->mbsfn_area_id; if (!q->mbsfn_refs[mbsfn_area_id]) { - ERROR("Error in chest_dl: MBSFN area id=%d not initialized\n", cfg->mbsfn_area_id); + ERROR("Error in chest_dl: MBSFN area id=%d not initialized", cfg->mbsfn_area_id); } /* Use the known CSR signal to compute Least-squares estimates */ @@ -984,7 +980,6 @@ int srslte_chest_dl_estimate_cfg(srslte_chest_dl_t* q, cf_t* input[SRSLTE_MAX_PORTS], srslte_chest_dl_res_t* res) { - for (uint32_t rxant_id = 0; rxant_id < q->nof_rx_antennas; rxant_id++) { // Estimate and correct synchronization error if enabled if (cfg->sync_error_enable) { diff --git a/lib/src/phy/ch_estimation/chest_dl_nbiot.c b/lib/src/phy/ch_estimation/chest_dl_nbiot.c index c8fbec821..eb2378cce 100644 --- a/lib/src/phy/ch_estimation/chest_dl_nbiot.c +++ b/lib/src/phy/ch_estimation/chest_dl_nbiot.c @@ -169,13 +169,13 @@ static void interpolate_pilots(srslte_chest_dl_nbiot_t* q, cf_t* pilot_estimates cf_t ce_avg[2][num_ces]; // interpolate the symbols with references in the freq domain - DEBUG("Interpolating %d pilots in %d symbols at port %d.\n", nsymbols * 2, nsymbols, port_id); + DEBUG("Interpolating %d pilots in %d symbols at port %d.", nsymbols * 2, nsymbols, port_id); for (int l = 0; l < nsymbols; l++) { uint32_t fidx_offset = srslte_refsignal_dl_nbiot_fidx(q->cell, l, port_id, 0); // points to the RE of the beginning of the l'th symbol containing a ref uint32_t ce_idx = srslte_refsignal_nrs_nsymbol(l) * q->cell.base.nof_prb * SRSLTE_NRE; ce_idx += q->cell.nbiot_prb * SRSLTE_NRE; - DEBUG(" - freq.-dmn interp. in sym %d at RE %d\n", srslte_refsignal_nrs_nsymbol(l), ce_idx + fidx_offset); + DEBUG(" - freq.-dmn interp. in sym %d at RE %d", srslte_refsignal_nrs_nsymbol(l), ce_idx + fidx_offset); srslte_interp_linear_offset( &q->srslte_interp_lin, &pilot_estimates[2 * l], &ce[ce_idx], fidx_offset, SRSLTE_NRE / 2 - fidx_offset); } @@ -256,7 +256,7 @@ int srslte_chest_dl_nbiot_estimate_port(srslte_chest_dl_nbiot_t* q, uint32_t sf_idx, uint32_t port_id) { - DEBUG("x.%d: Estimating DL channel on port %d.\n", sf_idx, port_id); + DEBUG("x.%d: Estimating DL channel on port %d.", sf_idx, port_id); int nref = srslte_refsignal_nbiot_cs_nof_re(&q->cell, port_id); // Get references from the input signal diff --git a/lib/src/phy/ch_estimation/chest_sl.c b/lib/src/phy/ch_estimation/chest_sl.c index 8e0adaa28..8ccf356e5 100644 --- a/lib/src/phy/ch_estimation/chest_sl.c +++ b/lib/src/phy/ch_estimation/chest_sl.c @@ -195,7 +195,7 @@ static void interpolate_pilots_sl_psbch(srslte_chest_sl_t* q) // make sure l_idx is at least 2 to avoid accessing array at negative index below if (l_idx < 2) { - ERROR("Couldn't interpolate PSBCH pilots. Invalid number of reference symbols.\n"); + ERROR("Couldn't interpolate PSBCH pilots. Invalid number of reference symbols."); return; } @@ -240,7 +240,6 @@ static void interpolate_pilots_sl_psbch(srslte_chest_sl_t* q) static void chest_sl_psbch_ls_estimate(srslte_chest_sl_t* q, cf_t* sf_buffer) { - uint32_t dmrs_index = 0; uint32_t k = q->cell.nof_prb * SRSLTE_NRE / 2 - 36; uint32_t sf_nsymbols = srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); @@ -387,7 +386,7 @@ static void interpolate_pilots_sl_pscch(srslte_chest_sl_t* q) // make sure l_idx is at least 2 to avoid accessing array at negative index below if (l_idx < 2) { - ERROR("Couldn't interpolate PSCCH pilots. Invalid number of reference symbols.\n"); + ERROR("Couldn't interpolate PSCCH pilots. Invalid number of reference symbols."); return; } @@ -545,7 +544,6 @@ static int chest_sl_pssch_put_dmrs(srslte_chest_sl_t* q, cf_t* sf_buffer) // Mapping to physical resources for (int i = 0; i < srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); i++) { if (srslte_pssch_is_symbol(SRSLTE_SIDELINK_DMRS_SYMBOL, q->cell.tm, i, q->cell.cp)) { - if (q->cell.tm == SRSLTE_SIDELINK_TM1 || q->cell.tm == SRSLTE_SIDELINK_TM2) { if (q->chest_sl_cfg.nof_prb <= q->sl_comm_resource_pool.prb_num) { memcpy(&sf_buffer[k + i * q->cell.nof_prb * SRSLTE_NRE], @@ -588,7 +586,6 @@ static int chest_sl_pssch_get_dmrs(srslte_chest_sl_t* q, cf_t* sf_buffer, cf_t** // Mapping to physical resources for (int i = 0; i < srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); i++) { if (srslte_pssch_is_symbol(SRSLTE_SIDELINK_DMRS_SYMBOL, q->cell.tm, i, q->cell.cp)) { - if (q->cell.tm == SRSLTE_SIDELINK_TM1 || q->cell.tm == SRSLTE_SIDELINK_TM2) { if (q->chest_sl_cfg.nof_prb <= q->sl_comm_resource_pool.prb_num) { memcpy(dmrs_received[dmrs_idx], @@ -643,7 +640,7 @@ static void interpolate_pilots_sl_pssch(srslte_chest_sl_t* q) // make sure l_idx is at least 2 to avoid accessing array at negative index below if (l_idx < 2) { - ERROR("Couldn't interpolate PSSCH pilots. Invalid number of reference symbols.\n"); + ERROR("Couldn't interpolate PSSCH pilots. Invalid number of reference symbols."); return; } @@ -652,9 +649,7 @@ static void interpolate_pilots_sl_pssch(srslte_chest_sl_t* q) } if (q->cell.tm == SRSLTE_SIDELINK_TM1 || q->cell.tm == SRSLTE_SIDELINK_TM2) { - if (q->chest_sl_cfg.nof_prb <= q->sl_comm_resource_pool.prb_num) { - k = q->chest_sl_cfg.prb_start_idx * SRSLTE_NRE; srslte_interp_linear_vector3(&q->lin_vec_sl, @@ -690,7 +685,6 @@ static void interpolate_pilots_sl_pssch(srslte_chest_sl_t* q) q->chest_sl_cfg.nof_prb * SRSLTE_NRE); } else { - // First band k = q->chest_sl_cfg.prb_start_idx * SRSLTE_NRE; @@ -768,7 +762,6 @@ static void interpolate_pilots_sl_pssch(srslte_chest_sl_t* q) } } else if (q->cell.tm == SRSLTE_SIDELINK_TM3 || q->cell.tm == SRSLTE_SIDELINK_TM4) { - k = q->chest_sl_cfg.prb_start_idx * SRSLTE_NRE; srslte_interp_linear_vector3(&q->lin_vec_sl, @@ -813,7 +806,6 @@ static void chest_sl_pssch_ls_estimate(srslte_chest_sl_t* q, cf_t* sf_buffer) srslte_vec_cf_zero(q->ce, q->sf_n_re); for (int i = 0; i < srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); i++) { if (srslte_pssch_is_symbol(SRSLTE_SIDELINK_DMRS_SYMBOL, q->cell.tm, i, q->cell.cp)) { - if (q->cell.tm == SRSLTE_SIDELINK_TM1 || q->cell.tm == SRSLTE_SIDELINK_TM2) { if (q->chest_sl_cfg.nof_prb <= q->sl_comm_resource_pool.prb_num) { srslte_vec_prod_conj_ccc(&sf_buffer[k + i * q->cell.nof_prb * SRSLTE_NRE], @@ -886,7 +878,7 @@ float srslte_chest_sl_estimate_noise(srslte_chest_sl_t* q) { uint32_t sf_nsymbols = srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); if (sf_nsymbols == 0) { - ERROR("Error estimating channel noise. Invalid number of OFDM symbols.\n"); + ERROR("Error estimating channel noise. Invalid number of OFDM symbols."); return SRSLTE_ERROR; } diff --git a/lib/src/phy/ch_estimation/chest_ul.c b/lib/src/phy/ch_estimation/chest_ul.c index b23796140..bdd8aa654 100644 --- a/lib/src/phy/ch_estimation/chest_ul.c +++ b/lib/src/phy/ch_estimation/chest_ul.c @@ -76,7 +76,7 @@ int srslte_chest_ul_init(srslte_chest_ul_t* q, uint32_t max_prb) } if (srslte_interp_linear_vector_init(&q->srslte_interp_linvec, MAX_REFS_SYM)) { - ERROR("Error initializing vector interpolator\n"); + ERROR("Error initializing vector interpolator"); goto clean_exit; } @@ -86,7 +86,7 @@ int srslte_chest_ul_init(srslte_chest_ul_t* q, uint32_t max_prb) q->dmrs_signal_configured = false; if (srslte_refsignal_dmrs_pusch_pregen_init(&q->dmrs_pregen, max_prb)) { - ERROR("Error allocating memory for pregenerated signals\n"); + ERROR("Error allocating memory for pregenerated signals"); goto clean_exit; } } @@ -160,12 +160,12 @@ int srslte_chest_ul_set_cell(srslte_chest_ul_t* q, srslte_cell_t cell) q->cell = cell; ret = srslte_refsignal_ul_set_cell(&q->dmrs_signal, cell); if (ret != SRSLTE_SUCCESS) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); return SRSLTE_ERROR; } if (srslte_interp_linear_vector_resize(&q->srslte_interp_linvec, NOF_REFS_SYM)) { - ERROR("Error initializing vector interpolator\n"); + ERROR("Error initializing vector interpolator"); return SRSLTE_ERROR; } } @@ -190,7 +190,6 @@ void srslte_chest_ul_pregen(srslte_chest_ul_t* q, /* Uses the difference between the averaged and non-averaged pilot estimates */ static float estimate_noise_pilots(srslte_chest_ul_t* q, cf_t* ce, uint32_t nslots, uint32_t nrefs, uint32_t n_prb[2]) { - float power = 0; for (int i = 0; i < nslots; i++) { power += srslte_chest_estimate_noise_pilots( @@ -310,7 +309,7 @@ static void chest_ul_estimate(srslte_chest_ul_t* q, // Check if intra-subframe frequency hopping is enabled if (n_prb[0] != n_prb[1]) { - ERROR("ERROR: intra-subframe frequency hopping not supported in the estimator!!\n"); + ERROR("ERROR: intra-subframe frequency hopping not supported in the estimator!!"); } if (res->ce != NULL) { @@ -357,14 +356,14 @@ int srslte_chest_ul_estimate_pusch(srslte_chest_ul_t* q, srslte_chest_ul_res_t* res) { if (!q->dmrs_signal_configured) { - ERROR("Error must call srslte_chest_ul_set_cfg() before using the UL estimator\n"); + ERROR("Error must call srslte_chest_ul_set_cfg() before using the UL estimator"); return SRSLTE_ERROR; } uint32_t nof_prb = cfg->grant.L_prb; if (!srslte_dft_precoding_valid_prb(nof_prb)) { - ERROR("Error invalid nof_prb=%d\n", nof_prb); + ERROR("Error invalid nof_prb=%d", nof_prb); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -389,7 +388,6 @@ int srslte_chest_ul_estimate_pusch(srslte_chest_ul_t* q, static float estimate_noise_pilots_pucch(srslte_chest_ul_t* q, cf_t* ce, uint32_t n_rs, uint32_t n_prb[SRSLTE_NOF_SLOTS_PER_SF]) { - float power = 0; for (int ns = 0; ns < SRSLTE_NOF_SLOTS_PER_SF; ns++) { for (int i = 0; i < n_rs; i++) { @@ -422,7 +420,7 @@ int srslte_chest_ul_estimate_pucch(srslte_chest_ul_t* q, { int n_rs = srslte_refsignal_dmrs_N_rs(cfg->format, q->cell.cp); if (!n_rs) { - ERROR("Error computing N_rs\n"); + ERROR("Error computing N_rs"); return SRSLTE_ERROR; } int nrefs_sf = SRSLTE_NRE * n_rs * SRSLTE_NOF_SLOTS_PER_SF; diff --git a/lib/src/phy/ch_estimation/dmrs_pdcch.c b/lib/src/phy/ch_estimation/dmrs_pdcch.c index eda3997d6..f30e6b091 100644 --- a/lib/src/phy/ch_estimation/dmrs_pdcch.c +++ b/lib/src/phy/ch_estimation/dmrs_pdcch.c @@ -125,12 +125,12 @@ int srslte_dmrs_pdcch_put(const srslte_carrier_nr_t* carrier, } if (coreset->mapping_type == srslte_coreset_mapping_type_interleaved) { - ERROR("Error interleaved CORESET mapping is not currently implemented\n"); + ERROR("Error interleaved CORESET mapping is not currently implemented"); return SRSLTE_ERROR; } if (coreset->duration < SRSLTE_CORESET_DURATION_MIN || coreset->duration > SRSLTE_CORESET_DURATION_MAX) { - ERROR("Error CORESET duration %d is out-of-bounds (%d,%d)\n", + ERROR("Error CORESET duration %d is out-of-bounds (%d,%d)", coreset->duration, SRSLTE_CORESET_DURATION_MIN, SRSLTE_CORESET_DURATION_MAX); @@ -150,7 +150,7 @@ int srslte_dmrs_pdcch_put(const srslte_carrier_nr_t* carrier, // Get Cin uint32_t cinit = dmrs_pdcch_get_cinit(slot_idx, l, n_id); - DMRS_PDCCH_INFO_TX("n=%d; l=%d; cinit=%08x\n", slot_idx, l, cinit); + DMRS_PDCCH_INFO_TX("n=%d; l=%d; cinit=%08x", slot_idx, l, cinit); // Put data dmrs_pdcch_put_symbol_noninterleaved( @@ -169,7 +169,7 @@ int srslte_dmrs_pdcch_estimator_init(srslte_dmrs_pdcch_estimator_t* q, } if (coreset->duration < SRSLTE_CORESET_DURATION_MIN || coreset->duration > SRSLTE_CORESET_DURATION_MAX) { - ERROR("Error CORESET duration %d is out-of-bounds (%d,%d)\n", + ERROR("Error CORESET duration %d is out-of-bounds (%d,%d)", coreset->duration, SRSLTE_CORESET_DURATION_MIN, SRSLTE_CORESET_DURATION_MAX); @@ -201,7 +201,7 @@ int srslte_dmrs_pdcch_estimator_init(srslte_dmrs_pdcch_estimator_t* q, #else if (srslte_interp_linear_init(&q->interpolator, coreset_bw * 3, 4)) { #endif - ERROR("Initiating interpolator\n"); + ERROR("Initiating interpolator"); return SRSLTE_ERROR; } @@ -347,7 +347,7 @@ int srslte_dmrs_pdcch_estimate(srslte_dmrs_pdcch_estimator_t* q, // Calculate PRN sequence initial state uint32_t cinit = dmrs_pdcch_get_cinit(slot_idx, l, n_id); - DMRS_PDCCH_INFO_RX("n=%d; l=%d; cinit=%08x\n", slot_idx, l, cinit); + DMRS_PDCCH_INFO_RX("n=%d; l=%d; cinit=%08x", slot_idx, l, cinit); // Extract pilots least square estimates srslte_dmrs_pdcch_extract(q, cinit, &sf_symbols[l * q->carrier.nof_prb * SRSLTE_NRE], q->lse[l]); @@ -390,13 +390,13 @@ int srslte_dmrs_pdcch_get_measure(const srslte_dmrs_pdcch_estimator_t* q, uint32_t L = 1U << dci_location->L; if (q->coreset.mapping_type == srslte_coreset_mapping_type_interleaved) { - ERROR("Error interleaved mapping not implemented\n"); + ERROR("Error interleaved mapping not implemented"); return SRSLTE_ERROR; } // Check that CORESET duration is not less than minimum if (q->coreset.duration < SRSLTE_CORESET_DURATION_MIN) { - ERROR("Invalid CORESET duration\n"); + ERROR("Invalid CORESET duration"); return SRSLTE_ERROR; } @@ -455,7 +455,7 @@ int srslte_dmrs_pdcch_get_measure(const srslte_dmrs_pdcch_estimator_t* q, measure->norm_corr = 0.0f; } - DMRS_PDCCH_INFO_RX("Measure L=%d; ncce=%d; RSRP=%+.1f dBfs; EPRE=%+.1f dBfs; Corr=%.3f\n", + DMRS_PDCCH_INFO_RX("Measure L=%d; ncce=%d; RSRP=%+.1f dBfs; EPRE=%+.1f dBfs; Corr=%.3f", dci_location->L, dci_location->ncce, measure->rsrp_dBfs, @@ -475,13 +475,13 @@ int srslte_dmrs_pdcch_get_ce(const srslte_dmrs_pdcch_estimator_t* q, uint32_t L = 1U << dci_location->L; if (q->coreset.mapping_type == srslte_coreset_mapping_type_interleaved) { - ERROR("Error interleaved mapping not implemented\n"); + ERROR("Error interleaved mapping not implemented"); return SRSLTE_ERROR; } // Check that CORESET duration is not less than minimum if (q->coreset.duration < SRSLTE_CORESET_DURATION_MIN) { - ERROR("Invalid CORESET duration\n"); + ERROR("Invalid CORESET duration"); return SRSLTE_ERROR; } @@ -502,7 +502,7 @@ int srslte_dmrs_pdcch_get_ce(const srslte_dmrs_pdcch_estimator_t* q, // Double check extracted RE match ideal count ce->nof_re = (SRSLTE_NRE - 3) * 6 * L; if (count != ce->nof_re) { - ERROR("Incorrect number of extracted resources (%d != %d)\n", count, ce->nof_re); + ERROR("Incorrect number of extracted resources (%d != %d)", count, ce->nof_re); } // At the moment Noise is not calculated diff --git a/lib/src/phy/ch_estimation/dmrs_pucch.c b/lib/src/phy/ch_estimation/dmrs_pucch.c index 7488bb831..92aab871a 100644 --- a/lib/src/phy/ch_estimation/dmrs_pucch.c +++ b/lib/src/phy/ch_estimation/dmrs_pucch.c @@ -81,7 +81,7 @@ static uint32_t dmrs_pucch_format1_n_pucch(const srslte_pucch_nr_resource_t* res } } - ERROR("Invalid case nof_symbols=%d and m_prime=%d\n", resource->nof_symbols, m_prime); + ERROR("Invalid case nof_symbols=%d and m_prime=%d", resource->nof_symbols, m_prime); return 0; } @@ -97,7 +97,7 @@ int srslte_dmrs_pucch_format1_put(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_ERROR; } @@ -105,13 +105,13 @@ int srslte_dmrs_pucch_format1_put(const srslte_pucch_nr_t* q, uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } uint32_t n_pucch = dmrs_pucch_format1_n_pucch(resource, 0); if (n_pucch == 0) { - ERROR("Error getting number of symbols\n"); + ERROR("Error getting number of symbols"); return SRSLTE_ERROR; } @@ -127,13 +127,13 @@ int srslte_dmrs_pucch_format1_put(const srslte_pucch_nr_t* q, uint32_t alpha_idx = 0; if (srslte_pucch_nr_alpha_idx(carrier, cfg, slot, l, l_prime, resource->initial_cyclic_shift, 0, &alpha_idx) < SRSLTE_SUCCESS) { - ERROR("Calculating alpha\n"); + ERROR("Calculating alpha"); } // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } @@ -165,7 +165,7 @@ int srslte_dmrs_pucch_format1_estimate(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_ERROR; } @@ -173,13 +173,13 @@ int srslte_dmrs_pucch_format1_estimate(const srslte_pucch_nr_t* q, uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } uint32_t n_pucch = dmrs_pucch_format1_n_pucch(resource, 0); if (n_pucch == 0) { - ERROR("Error getting number of symbols\n"); + ERROR("Error getting number of symbols"); return SRSLTE_ERROR; } @@ -197,13 +197,13 @@ int srslte_dmrs_pucch_format1_estimate(const srslte_pucch_nr_t* q, uint32_t alpha_idx = 0; if (srslte_pucch_nr_alpha_idx(carrier, cfg, slot, l, l_prime, resource->initial_cyclic_shift, 0, &alpha_idx) < SRSLTE_SUCCESS) { - ERROR("Calculating alpha\n"); + ERROR("Calculating alpha"); } // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } @@ -307,7 +307,7 @@ int srslte_dmrs_pucch_format2_put(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_ERROR; } @@ -350,7 +350,7 @@ int srslte_dmrs_pucch_format2_estimate(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_ERROR; } @@ -521,7 +521,7 @@ int srslte_dmrs_pucch_format_3_4_get_symbol_idx(const srslte_pucch_nr_resource_t } break; default: - ERROR("Invalid case (%d)\n", resource->nof_symbols); + ERROR("Invalid case (%d)", resource->nof_symbols); return SRSLTE_ERROR; } diff --git a/lib/src/phy/ch_estimation/refsignal_dl_nbiot.c b/lib/src/phy/ch_estimation/refsignal_dl_nbiot.c index 266ca7638..e9711275f 100644 --- a/lib/src/phy/ch_estimation/refsignal_dl_nbiot.c +++ b/lib/src/phy/ch_estimation/refsignal_dl_nbiot.c @@ -113,7 +113,7 @@ free_and_exit: int srslte_refsignal_dl_nbiot_set_cell(srslte_refsignal_dl_nbiot_t* q, srslte_nbiot_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; - INFO("Generating NRS for n_id_ncell=%d\n", cell.n_id_ncell); + INFO("Generating NRS for n_id_ncell=%d", cell.n_id_ncell); if (q != NULL && srslte_nbiot_cell_isvalid(&cell)) { ret = SRSLTE_ERROR; @@ -144,7 +144,7 @@ int srslte_refsignal_dl_nbiot_set_cell(srslte_refsignal_dl_nbiot_t* q, srslte_nb /* save signal */ int idx = SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(i, (ns % 2) * nsymbols + l, SRSLTE_NBIOT_DEFAULT_NUM_PRB_BASECELL); - DEBUG("Ref port=%d, lp=%d, ns=%d, ns/2=%d, idx=%d, i=%d, nsymbols=%d, l=%d\n", + DEBUG("Ref port=%d, lp=%d, ns=%d, ns/2=%d, idx=%d, i=%d, nsymbols=%d, l=%d", p, lp, ns, @@ -207,7 +207,7 @@ int srslte_refsignal_nrs_put_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t uint32_t fidx = srslte_refsignal_dl_nbiot_fidx(cell, l, port_id, m) + cell.nbiot_prb * SRSLTE_NRE; sf_symbols[SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx)] = pilots[SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(m, l, 1)]; #if EXTRA_DEBUG - DEBUG("port: %d, re_idx: %d, pilot_idx: %d, %+2.2f%+2.2fi\n", + DEBUG("port: %d, re_idx: %d, pilot_idx: %d, %+2.2f%+2.2fi", port_id, SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx), SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(i, l, 1), @@ -219,7 +219,7 @@ int srslte_refsignal_nrs_put_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t #if EXTRA_DEBUG if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE chest_nbiot_tx_after_mapping.bin: NRS after mapping\n", 0); + DEBUG("SAVED FILE chest_nbiot_tx_after_mapping.bin: NRS after mapping", 0); srslte_vec_save_file( "chest_nbiot_tx_after_mapping.bin", pilots, SRSLTE_REFSIGNAL_NUM_SF(1, port_id) * sizeof(cf_t)); } @@ -241,7 +241,7 @@ int srslte_refsignal_nrs_get_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t uint32_t fidx = srslte_refsignal_dl_nbiot_fidx(cell, l, port_id, m) + cell.nbiot_prb * SRSLTE_NRE; pilots[SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(m, l, 1)] = sf_symbols[SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx)]; #if EXTRA_DEBUG - DEBUG("port: %d, pilot_idx: %d, re_idx: %d, %+2.2f%+2.2fi\n", + DEBUG("port: %d, pilot_idx: %d, re_idx: %d, %+2.2f%+2.2fi", port_id, SRSLTE_NBIOT_REFSIGNAL_PILOT_IDX(m, l, 1), SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx), @@ -253,7 +253,7 @@ int srslte_refsignal_nrs_get_sf(srslte_nbiot_cell_t cell, uint32_t port_id, cf_t #if EXTRA_DEBUG if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE chest_nbiot_rx_after_demapping.bin: NRS after demapping\n", 0); + DEBUG("SAVED FILE chest_nbiot_rx_after_demapping.bin: NRS after demapping", 0); srslte_vec_save_file( "chest_nbiot_rx_after_demapping.bin", pilots, SRSLTE_REFSIGNAL_NUM_SF(1, port_id) * sizeof(cf_t)); } diff --git a/lib/src/phy/ch_estimation/refsignal_ul.c b/lib/src/phy/ch_estimation/refsignal_ul.c index cdb1699f6..2d428d363 100644 --- a/lib/src/phy/ch_estimation/refsignal_ul.c +++ b/lib/src/phy/ch_estimation/refsignal_ul.c @@ -129,11 +129,9 @@ static int generate_srslte_sequence_hopping_v(srslte_refsignal_ul_t* q) */ int srslte_refsignal_ul_set_cell(srslte_refsignal_ul_t* q, srslte_cell_t cell) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && srslte_cell_isvalid(&cell)) { - if (cell.id != q->cell.id || q->cell.nof_prb == 0) { q->cell = cell; @@ -188,7 +186,7 @@ void srslte_refsignal_dmrs_pusch_put(srslte_refsignal_ul_t* q, cf_t* sf_symbols) { for (uint32_t ns_idx = 0; ns_idx < 2; ns_idx++) { - INFO("Putting DMRS to n_prb: %d, L: %d, ns_idx: %d\n", + INFO("Putting DMRS to n_prb: %d, L: %d, ns_idx: %d", pusch_cfg->grant.n_prb_tilde[ns_idx], pusch_cfg->grant.L_prb, ns_idx); @@ -205,7 +203,7 @@ void srslte_refsignal_dmrs_pusch_get(srslte_refsignal_ul_t* q, cf_t* r_pusch) { for (uint32_t ns_idx = 0; ns_idx < 2; ns_idx++) { - INFO("Getting DMRS from n_prb: %d, L: %d, ns_idx: %d\n", + INFO("Getting DMRS from n_prb: %d, L: %d, ns_idx: %d", pusch_cfg->grant.n_prb_tilde[ns_idx], pusch_cfg->grant.L_prb, ns_idx); @@ -334,7 +332,6 @@ int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t* q, uint32_t cyclic_shift_for_dmrs, cf_t* r_pusch) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (pusch_cfg_isvalid(q, cfg, nof_prb)) { ret = SRSLTE_ERROR; @@ -373,7 +370,7 @@ uint32_t srslte_refsignal_dmrs_N_rs(srslte_pucch_format_t format, srslte_cp_t cp case SRSLTE_PUCCH_FORMAT_2B: return 2; default: - ERROR("DMRS Nof RS: Unsupported format %d\n", format); + ERROR("DMRS Nof RS: Unsupported format %d", format); return 0; } return 0; @@ -415,7 +412,7 @@ uint32_t srslte_refsignal_dmrs_pucch_symbol(uint32_t m, srslte_pucch_format_t fo } break; default: - ERROR("DMRS Symbol indexes: Unsupported format %d\n", format); + ERROR("DMRS Symbol indexes: Unsupported format %d", format); return 0; } return 0; @@ -485,7 +482,7 @@ int srslte_refsignal_dmrs_pucch_gen(srslte_refsignal_ul_t* q, w = w_arg_pucch_format2_cpnorm; break; default: - ERROR("DMRS Generator: Unsupported format %d\n", cfg->format); + ERROR("DMRS Generator: Unsupported format %d", cfg->format); return SRSLTE_ERROR; } @@ -512,12 +509,10 @@ int srslte_refsignal_dmrs_pucch_cp(srslte_refsignal_ul_t* q, { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q && source && dest) { - uint32_t nsymbols = SRSLTE_CP_ISNORM(q->cell.cp) ? SRSLTE_CP_NORM_NSYMB : SRSLTE_CP_EXT_NSYMB; uint32_t N_rs = srslte_refsignal_dmrs_N_rs(cfg->format, q->cell.cp); for (uint32_t ns = 0; ns < 2; ns++) { - // Determine n_prb uint32_t n_prb = srslte_pucch_n_prb(&q->cell, cfg, ns); @@ -799,7 +794,6 @@ static uint32_t srs_Fb(srslte_refsignal_srs_cfg_t* cfg, uint32_t b, uint32_t nof /* Returns k0: frequency-domain starting position for ue-specific SRS */ static uint32_t srs_k0_ue(srslte_refsignal_srs_cfg_t* cfg, uint32_t nof_prb, uint32_t tti) { - if (cfg->bw_cfg < 8 && cfg->B < 4 && cfg->k_tc < 2) { uint32_t k0p = srslte_refsignal_srs_rb_start_cs(cfg->bw_cfg, nof_prb) * SRSLTE_NRE + cfg->k_tc; uint32_t k0 = k0p; @@ -875,7 +869,6 @@ int srslte_refsignal_srs_gen(srslte_refsignal_ul_t* q, uint32_t M_sc = srslte_refsignal_srs_M_sc(q, cfg); for (uint32_t ns = 2 * sf_idx; ns < 2 * (sf_idx + 1); ns++) { - float alpha = 2 * M_PI * cfg->n_srs / 8; compute_r(q, pusch_cfg, M_sc / SRSLTE_NRE, ns, 0, alpha, &r_srs[(ns % 2) * M_sc]); } 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 f3cc733d0..ea3b5f493 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 @@ -128,7 +128,7 @@ int main(int argc, char** argv) } if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE chest_start.bin: channel estimates start\n"); + DEBUG("SAVED FILE chest_start.bin: channel estimates start"); srslte_vec_save_file("chest_start.bin", ce, num_re * sizeof(cf_t)); } @@ -189,10 +189,10 @@ int main(int argc, char** argv) float rsrp = srslte_chest_dl_nbiot_get_rsrp(&est); float noise = srslte_chest_dl_nbiot_get_noise_estimate(&est); float snr = srslte_chest_dl_nbiot_get_snr(&est); - DEBUG("rsrq=%4.2f, rsrp=%4.2f, noise=%4.2f, snr=%4.2f\n", rsrq, rsrp, noise, snr); + DEBUG("rsrq=%4.2f, rsrp=%4.2f, noise=%4.2f, snr=%4.2f", rsrq, rsrp, noise, snr); if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE chest_final.bin: channel after estimation\n"); + DEBUG("SAVED FILE chest_final.bin: channel after estimation"); srslte_vec_save_file("chest_final.bin", ce, num_re * sizeof(cf_t)); } 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 0fb6b2e45..c7f2ff203 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_dl.c +++ b/lib/src/phy/ch_estimation/test/chest_test_dl.c @@ -119,13 +119,13 @@ int main(int argc, char** argv) max_cid = cell.id; } if (srslte_chest_dl_init(&est, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); goto do_exit; } while (cid <= max_cid) { cell.id = cid; if (srslte_chest_dl_set_cell(&est, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); goto do_exit; } @@ -135,7 +135,6 @@ int main(int argc, char** argv) sf_cfg.tti = sf_idx; for (uint32_t n_port = 0; n_port < cell.nof_ports; n_port++) { - srslte_vec_cf_zero(input, num_re); for (i = 0; i < num_re; i++) { input[i] = 0.5 - rand() / RAND_MAX + I * (0.5 - rand() / RAND_MAX); @@ -218,7 +217,7 @@ int main(int argc, char** argv) } } cid += 10; - INFO("cid=%d\n", cid); + INFO("cid=%d", cid); } srslte_chest_dl_free(&est); ret = 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 4d5808016..a14d74bc9 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_srs.c +++ b/lib/src/phy/ch_estimation/test/chest_test_srs.c @@ -117,7 +117,7 @@ int srs_test_context_run(srs_test_context_t* q) { srslte_ul_sf_cfg_t ul_sf_cfg = {}; - INFO(" TEST: bw_cfg=%d; sf_cfg=%d; B=%d; b_hops=%d; n_srs=%d; I_srs=%d;\n", + INFO(" TEST: bw_cfg=%d; sf_cfg=%d; B=%d; b_hops=%d; n_srs=%d; I_srs=%d;", srs_cfg.bw_cfg, srs_cfg.subframe_config, srs_cfg.B, @@ -147,7 +147,7 @@ int srs_test_context_run(srs_test_context_t* q) &q->chest_ul, &ul_sf_cfg, &srs_cfg, &dmrs_pusch_cfg, q->sf_symbols, &q->chest_ul_res) == SRSLTE_SUCCESS); - INFO("RESULTS: tti=%d; snr_db=%+.1f; noise_estimate_dbm=%+.1f; ta_us=%+.1f;\n", + INFO("RESULTS: tti=%d; snr_db=%+.1f; noise_estimate_dbm=%+.1f; ta_us=%+.1f;", ul_sf_cfg.tti, q->chest_ul_res.snr_db, q->chest_ul_res.noise_estimate_dbm, @@ -187,7 +187,6 @@ void parse_args(int argc, char** argv) int main(int argc, char** argv) { - srs_test_context_t context = {}; int ret = SRSLTE_SUCCESS; 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 2a48577ac..343aae3a1 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_ul.c +++ b/lib/src/phy/ch_estimation/test/chest_test_ul.c @@ -118,13 +118,13 @@ int main(int argc, char** argv) } printf("max_cid=%d, cid=%d, cell.id=%d\n", max_cid, cid, cell.id); if (srslte_chest_ul_init(&est, cell.nof_prb)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); goto do_exit; } while (cid <= max_cid) { cell.id = cid; if (srslte_chest_ul_set_cell(&est, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); goto do_exit; } @@ -133,7 +133,6 @@ int main(int argc, char** argv) for (int delta_ss = 29; delta_ss < SRSLTE_NOF_DELTA_SS; delta_ss++) { for (int cshift = 7; cshift < SRSLTE_NOF_CSHIFT; cshift++) { for (int t = 2; t < 3; t++) { - /* Setup and pregen DMRS reference signals */ srslte_refsignal_dmrs_pusch_cfg_t pusch_cfg; @@ -161,7 +160,6 @@ int main(int argc, char** argv) for (int sf_idx = 0; sf_idx < 10; sf_idx += 3) { for (int cshift_dmrs = 0; cshift_dmrs < SRSLTE_NOF_CSHIFT; cshift_dmrs += 5) { - if (SRSLTE_VERBOSE_ISINFO()) { printf("nof_prb: %d, ", nof_prb); printf("cyclic_shift: %d, ", pusch_cfg.cyclic_shift); @@ -210,7 +208,7 @@ int main(int argc, char** argv) mse += cabsf(ce[i] - h[i]); } mse /= num_re; - INFO("MSE: %f\n", mse); + INFO("MSE: %f", mse); if (mse > 4) { goto do_exit; } 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 daa665abb..e526c01a4 100644 --- a/lib/src/phy/ch_estimation/test/csi_rs_test.c +++ b/lib/src/phy/ch_estimation/test/csi_rs_test.c @@ -55,7 +55,7 @@ static int test(const srslte_slot_cfg_t* slot_cfg, if (srslte_verbose >= SRSLTE_VERBOSE_INFO) { char str[128] = {}; srslte_csi_rs_measure_info(&measure, str, sizeof(str)); - INFO("Measure: %s\n", str); + INFO("Measure: %s", str); } TESTASSERT(fabsf(measure.rsrp_dB - rsrp_dB_gold) < 1.0f); @@ -126,12 +126,12 @@ int main(int argc, char** argv) cf_t* grid = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(carrier.nof_prb)); if (grid == NULL) { - ERROR("Alloc\n"); + ERROR("Alloc"); goto clean_exit; } if (srslte_channel_awgn_init(&awgn, 1234) < SRSLTE_SUCCESS) { - ERROR("AWGN Init\n"); + ERROR("AWGN Init"); goto clean_exit; } 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 db80b9876..55d0bc4f8 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c @@ -156,7 +156,7 @@ int main(int argc, char** argv) srslte_dmrs_pdcch_estimator_init(&estimator, &carrier, &coreset); if (run_test(&estimator, &coreset, &search_space, aggregation_level, sf_symbols, &pdcch_ce)) { - ERROR("Test %d failed\n", test_counter); + ERROR("Test %d failed", test_counter); } else { test_passed++; } 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 2cfc4ec35..206ff4d4a 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c @@ -254,18 +254,18 @@ int main(int argc, char** argv) // Initialise object DMRS for PDSCH if (srslte_dmrs_sch_init(&dmrs_pdsch, true) != SRSLTE_SUCCESS) { - ERROR("Init\n"); + ERROR("Init"); goto clean_exit; } // Set carrier configuration if (srslte_dmrs_sch_set_carrier(&dmrs_pdsch, &carrier) != SRSLTE_SUCCESS) { - ERROR("Setting carrier\n"); + ERROR("Setting carrier"); goto clean_exit; } if (srslte_chest_dl_res_init(&chest_dl_res, carrier.nof_prb) != SRSLTE_SUCCESS) { - ERROR("Initiating channel estimation result\n"); + ERROR("Initiating channel estimation result"); goto clean_exit; } @@ -317,7 +317,7 @@ int main(int argc, char** argv) char str[64] = {}; srslte_dmrs_sch_cfg_to_str(&pdsch_cfg.dmrs, str, 64); - ERROR("Test %d failed. %s.\n", test_counter, str); + ERROR("Test %d failed. %s.", test_counter, str); } test_counter++; 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 cb1e33714..0d48f4467 100644 --- a/lib/src/phy/ch_estimation/test/refsignal_ul_test.c +++ b/lib/src/phy/ch_estimation/test/refsignal_ul_test.c @@ -76,7 +76,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (srslte_refsignal_ul_set_cell(&refs, cell)) { - ERROR("Error initializing UL reference signal\n"); + ERROR("Error initializing UL reference signal"); goto do_exit; } @@ -93,7 +93,6 @@ int main(int argc, char** argv) for (int h = 0; h < 3; h++) { for (int sf_idx = 0; sf_idx < 10; sf_idx++) { for (int cshift_dmrs = 0; cshift_dmrs < SRSLTE_NOF_CSHIFT; cshift_dmrs++) { - uint32_t nof_prb = n; pusch_cfg.cyclic_shift = cshift; pusch_cfg.delta_ss = delta_ss; diff --git a/lib/src/phy/channel/ch_awgn.c b/lib/src/phy/channel/ch_awgn.c index aed1b3fae..d2b18a6af 100644 --- a/lib/src/phy/channel/ch_awgn.c +++ b/lib/src/phy/channel/ch_awgn.c @@ -69,7 +69,7 @@ int srslte_channel_awgn_init(srslte_channel_awgn_t* q, uint32_t seed) q->table_cos = srslte_vec_f_malloc(AWGN_TABLE_ALLOC_SIZE); q->table_log = srslte_vec_f_malloc(AWGN_TABLE_ALLOC_SIZE); if (!q->table_cos || !q->table_log) { - ERROR("Malloc\n"); + ERROR("Malloc"); } // Fill tables diff --git a/lib/src/phy/channel/channel.cc b/lib/src/phy/channel/channel.cc index 73a647d87..877c2a3ed 100644 --- a/lib/src/phy/channel/channel.cc +++ b/lib/src/phy/channel/channel.cc @@ -16,7 +16,8 @@ using namespace srslte; -channel::channel(const channel::args_t& channel_args, uint32_t _nof_channels) +channel::channel(const channel::args_t& channel_args, uint32_t _nof_channels, srslog::basic_logger& logger) : + logger(logger) { int ret = SRSLTE_SUCCESS; uint32_t srate_max = (uint32_t)srslte_symbol_sz(SRSLTE_MAX_PRB) * 15000; @@ -137,11 +138,6 @@ static inline cf_t local_cexpf(float phase) } } -void channel::set_logger(log_filter* _log_h) -{ - log_h = _log_h; -} - void channel::run(cf_t* in[SRSLTE_MAX_CHANNELS], cf_t* out[SRSLTE_MAX_CHANNELS], uint32_t len, @@ -214,22 +210,16 @@ void channel::run(cf_t* in[SRSLTE_MAX_CHANNELS], } } - if (log_h) { - // Logging - std::stringstream str; - - str << "t=" << t.full_secs + t.frac_secs << "s; "; - - if (delay[0]) { - str << "delay=" << delay[0]->delay_us << "us; "; - } - - if (hst) { - str << "hst=" << hst->fs_hz << "Hz; "; - } - - log_h->debug("%s\n", str.str().c_str()); + // Logging + std::stringstream str; + str << "t=" << t.full_secs + t.frac_secs << "s; "; + if (delay[0]) { + str << "delay=" << delay[0]->delay_us << "us; "; + } + if (hst) { + str << "hst=" << hst->fs_hz << "Hz; "; } + logger.debug("%s", str.str().c_str()); } void channel::set_srate(uint32_t srate) diff --git a/lib/src/phy/channel/test/awgn_channel_test.c b/lib/src/phy/channel/test/awgn_channel_test.c index 33c54a514..86bccda6a 100644 --- a/lib/src/phy/channel/test/awgn_channel_test.c +++ b/lib/src/phy/channel/test/awgn_channel_test.c @@ -83,7 +83,7 @@ int main(int argc, char** argv) output_buffer = srslte_vec_cf_malloc(nof_samples); if (!input_buffer || !output_buffer) { - ERROR("Error: Allocating memory\n"); + ERROR("Error: Allocating memory"); ret = SRSLTE_ERROR; } @@ -93,7 +93,7 @@ int main(int argc, char** argv) #ifdef ENABLE_GUI sdrgui_init(); sdrgui_init_title("SRS AWGN Channel"); - plot_real_t plot_fft = NULL; + plot_real_t plot_fft = NULL; plot_scatter_t plot_scatter = NULL; plot_real_init(&plot_fft); @@ -107,7 +107,7 @@ int main(int argc, char** argv) cf_t* fft_out = srslte_vec_cf_malloc(nof_samples); srslte_dft_plan_t fft = {}; if (srslte_dft_plan_c(&fft, nof_samples, SRSLTE_DFT_FORWARD)) { - ERROR("Error: init DFT\n"); + ERROR("Error: init DFT"); ret = SRSLTE_ERROR; } #endif /* ENABLE_GUI */ diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index 095a2085a..97e3ca2ff 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -282,7 +282,6 @@ char* srslte_cp_string(srslte_cp_t cp) /* Returns the new time advance N_ta_new as specified in Section 4.2.3 of 36.213 */ uint32_t srslte_N_ta_new(uint32_t N_ta_old, uint32_t ta) { - ta &= 63; int n_ta_new = N_ta_old + ((float)ta - 31) * 16; if (n_ta_new < 0) { @@ -643,7 +642,7 @@ bool srslte_band_is_tdd(uint32_t band) i++; } if (i == SRSLTE_NOF_LTE_BANDS) { - ERROR("Invalid Band %d\n", band); + ERROR("Invalid Band %d", band); return false; } return lte_bands[i].ul_earfcn_offset == 0; @@ -653,7 +652,7 @@ uint8_t srslte_band_get_band(uint32_t dl_earfcn) { uint32_t i = SRSLTE_NOF_LTE_BANDS - 1; if (dl_earfcn > lte_bands[i].dl_earfcn_offset) { - ERROR("Invalid DL_EARFCN=%d\n", dl_earfcn); + ERROR("Invalid DL_EARFCN=%d", dl_earfcn); } i--; while (i > 0 && lte_bands[i].dl_earfcn_offset > dl_earfcn) { @@ -666,7 +665,7 @@ double srslte_band_fd(uint32_t dl_earfcn) { uint32_t i = SRSLTE_NOF_LTE_BANDS - 1; if (dl_earfcn > lte_bands[i].dl_earfcn_offset) { - ERROR("Invalid DL_EARFCN=%d\n", dl_earfcn); + ERROR("Invalid DL_EARFCN=%d", dl_earfcn); } i--; while (i > 0 && lte_bands[i].dl_earfcn_offset > dl_earfcn) { @@ -679,7 +678,7 @@ double srslte_band_fu(uint32_t ul_earfcn) { uint32_t i = SRSLTE_NOF_LTE_BANDS - 1; if (ul_earfcn > lte_bands[i].ul_earfcn_offset) { - ERROR("Invalid UL_EARFCN=%d\n", ul_earfcn); + ERROR("Invalid UL_EARFCN=%d", ul_earfcn); } i--; while (i > 0 && (lte_bands[i].ul_earfcn_offset > ul_earfcn || lte_bands[i].ul_earfcn_offset == 0)) { @@ -692,7 +691,7 @@ uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn) { uint32_t i = SRSLTE_NOF_LTE_BANDS - 1; if (dl_earfcn > lte_bands[i].dl_earfcn_offset) { - ERROR("Invalid DL_EARFCN=%d\n", dl_earfcn); + ERROR("Invalid DL_EARFCN=%d", dl_earfcn); } i--; while (i > 0 && lte_bands[i].dl_earfcn_offset > dl_earfcn) { @@ -719,14 +718,14 @@ int srslte_band_get_fd_band(uint32_t band, i++; } if (i >= SRSLTE_NOF_LTE_BANDS - 1) { - ERROR("Error: Invalid band %d\n", band); + ERROR("Error: Invalid band %d", band); return SRSLTE_ERROR; } if (end_earfcn == -1) { end_earfcn = lte_bands[i + 1].dl_earfcn_offset - 1; } else { if (end_earfcn > lte_bands[i + 1].dl_earfcn_offset - 1) { - ERROR("Error: Invalid end earfcn %d. Max is %d\n", end_earfcn, lte_bands[i + 1].dl_earfcn_offset - 1); + ERROR("Error: Invalid end earfcn %d. Max is %d", end_earfcn, lte_bands[i + 1].dl_earfcn_offset - 1); return SRSLTE_ERROR; } } @@ -734,7 +733,7 @@ int srslte_band_get_fd_band(uint32_t band, start_earfcn = lte_bands[i].dl_earfcn_offset; } else { if (start_earfcn < lte_bands[i].dl_earfcn_offset) { - ERROR("Error: Invalid start earfcn %d. Min is %d\n", start_earfcn, lte_bands[i].dl_earfcn_offset); + ERROR("Error: Invalid start earfcn %d. Min is %d", start_earfcn, lte_bands[i].dl_earfcn_offset); return SRSLTE_ERROR; } } @@ -794,11 +793,11 @@ uint32_t srslte_print_check(char* s, size_t max_len, uint32_t cur_len, const cha cur_len += ret; } else { // Formatting error detected - ERROR("Formatting error when printing string\n"); + ERROR("Formatting error when printing string"); exit(-1); } } else { - ERROR("Buffer full when printing string\n"); + ERROR("Buffer full when printing string"); exit(-1); } return cur_len; diff --git a/lib/src/phy/common/phy_common_sl.c b/lib/src/phy/common/phy_common_sl.c index da5a2b28d..e45252fee 100644 --- a/lib/src/phy/common/phy_common_sl.c +++ b/lib/src/phy/common/phy_common_sl.c @@ -99,10 +99,10 @@ uint32_t srslte_sl_get_num_symbols(srslte_sl_tm_t tm, srslte_cp_t cp) if (cp == SRSLTE_CP_NORM) { return SRSLTE_CP_NORM_SF_NSYMB; } else { - ERROR("Invalid CP\n"); + ERROR("Invalid CP"); } } else { - ERROR("Invalid TM\n"); + ERROR("Invalid TM"); } return 0; // Calling function may use return value for loop termination } diff --git a/lib/src/phy/common/sequence.c b/lib/src/phy/common/sequence.c index 13fc32ca3..9210e827b 100644 --- a/lib/src/phy/common/sequence.c +++ b/lib/src/phy/common/sequence.c @@ -287,7 +287,7 @@ void srslte_sequence_state_advance(srslte_sequence_state_t* s, uint32_t length) int srslte_sequence_set_LTE_pr(srslte_sequence_t* q, uint32_t len, uint32_t seed) { if (len > q->max_len) { - ERROR("Error generating pseudo-random sequence: len %d is greater than allocated len %d\n", len, q->max_len); + ERROR("Error generating pseudo-random sequence: len %d is greater than allocated len %d", len, q->max_len); return SRSLTE_ERROR; } diff --git a/lib/src/phy/common/zc_sequence.c b/lib/src/phy/common/zc_sequence.c index 18652c089..250f02cf2 100644 --- a/lib/src/phy/common/zc_sequence.c +++ b/lib/src/phy/common/zc_sequence.c @@ -231,7 +231,7 @@ static int zc_sequence_lte_r_uv_arg(uint32_t M_zc, uint32_t u, uint32_t v, cf_t* } else if (M_zc >= 36) { zc_sequence_r_uv_arg_mprb(M_zc, u, v, tmp_arg); } else { - ERROR("Invalid M_zc (%d)\n", M_zc); + ERROR("Invalid M_zc (%d)", M_zc); return SRSLTE_ERROR; } @@ -251,7 +251,7 @@ static int zc_sequence_nr_r_uv_arg(uint32_t M_zc, uint32_t u, uint32_t v, cf_t* } else if (M_zc >= 36) { zc_sequence_r_uv_arg_mprb(M_zc, u, v, tmp_arg); } else { - ERROR("Invalid M_zc (%d)\n", M_zc); + ERROR("Invalid M_zc (%d)", M_zc); return SRSLTE_ERROR; } @@ -274,7 +274,7 @@ int srslte_zc_sequence_generate_lte(uint32_t u, uint32_t v, float alpha, uint32_ // Check U and V if (u >= SRSLTE_ZC_SEQUENCE_NOF_GROUPS || v >= SRSLTE_ZC_SEQUENCE_NOF_BASE) { - ERROR("Invalid u (%d) or v (%d)\n", u, v); + ERROR("Invalid u (%d) or v (%d)", u, v); return SRSLTE_ERROR_OUT_OF_BOUNDS; } @@ -301,7 +301,7 @@ int srslte_zc_sequence_generate_nr(uint32_t u, uint32_t v, float alpha, uint32_t // Check U and V if (u >= SRSLTE_ZC_SEQUENCE_NOF_GROUPS || v >= SRSLTE_ZC_SEQUENCE_NOF_BASE) { - ERROR("Invalid u (%d) or v (%d)\n", u, v); + ERROR("Invalid u (%d) or v (%d)", u, v); return SRSLTE_ERROR_OUT_OF_BOUNDS; } @@ -341,7 +341,7 @@ int srslte_zc_sequence_lut_init_nr(srslte_zc_sequence_lut_t* q, // Allocate sequence q->sequence[u][v] = srslte_vec_cf_malloc(nof_alphas * q->M_zc); if (q->sequence[u][v] == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } @@ -349,7 +349,7 @@ int srslte_zc_sequence_lut_init_nr(srslte_zc_sequence_lut_t* q, for (uint32_t alpha_idx = 0; alpha_idx < nof_alphas; alpha_idx++) { if (srslte_zc_sequence_generate_nr(u, v, alphas[alpha_idx], m, delta, &q->sequence[u][v][alpha_idx * q->M_zc]) < SRSLTE_SUCCESS) { - ERROR("Generating sequence\n"); + ERROR("Generating sequence"); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/dft/dft_fftw.c b/lib/src/phy/dft/dft_fftw.c index 4fcb894f0..14659d306 100644 --- a/lib/src/phy/dft/dft_fftw.c +++ b/lib/src/phy/dft/dft_fftw.c @@ -344,7 +344,7 @@ void srslte_dft_run_guru_c(srslte_dft_plan_t* plan) if (plan->is_guru == true) { fftwf_execute(plan->p); } else { - ERROR("srslte_dft_run_guru_c: the selected plan is not guru!\n"); + ERROR("srslte_dft_run_guru_c: the selected plan is not guru!"); } } diff --git a/lib/src/phy/dft/dft_precoding.c b/lib/src/phy/dft/dft_precoding.c index c063fe430..619bb2929 100644 --- a/lib/src/phy/dft/dft_precoding.c +++ b/lib/src/phy/dft/dft_precoding.c @@ -36,9 +36,9 @@ int srslte_dft_precoding_init(srslte_dft_precoding_t* q, uint32_t max_prb, bool ret = SRSLTE_ERROR; for (uint32_t i = 1; i <= max_prb; i++) { if (srslte_dft_precoding_valid_prb(i)) { - DEBUG("Initiating DFT precoding plan for %d PRBs\n", i); + DEBUG("Initiating DFT precoding plan for %d PRBs", i); if (srslte_dft_plan_c(&q->dft_plan[i], i * SRSLTE_NRE, is_tx ? SRSLTE_DFT_FORWARD : SRSLTE_DFT_BACKWARD)) { - ERROR("Error: Creating DFT plan %d\n", i); + ERROR("Error: Creating DFT plan %d", i); goto clean_exit; } srslte_dft_plan_set_norm(&q->dft_plan[i], true); @@ -104,9 +104,8 @@ uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb) int srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols) { - if (!srslte_dft_precoding_valid_prb(nof_prb) && nof_prb <= q->max_prb) { - ERROR("Error invalid number of PRB (%d)\n", nof_prb); + ERROR("Error invalid number of PRB (%d)", nof_prb); return SRSLTE_ERROR; } diff --git a/lib/src/phy/dft/ofdm.c b/lib/src/phy/dft/ofdm.c index 88b97d3c7..e729d8b9d 100644 --- a/lib/src/phy/dft/ofdm.c +++ b/lib/src/phy/dft/ofdm.c @@ -28,12 +28,11 @@ static int ofdm_init_mbsfn_(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg, srslte_dft_dir_t dir) { - // If the symbol size is not given, calculate in function of the number of resource blocks if (cfg->symbol_sz == 0) { int symbol_sz_err = srslte_symbol_sz(cfg->nof_prb); if (symbol_sz_err <= SRSLTE_SUCCESS) { - ERROR("Invalid number of PRB %d\n", cfg->nof_prb); + ERROR("Invalid number of PRB %d", cfg->nof_prb); return SRSLTE_ERROR; } cfg->symbol_sz = (uint32_t)symbol_sz_err; @@ -65,13 +64,13 @@ static int ofdm_init_mbsfn_(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg, srslte_dft if (q->fft_plan.size) { // Replan if it was initialised previously if (srslte_dft_replan(&q->fft_plan, q->cfg.symbol_sz)) { - ERROR("Reeplaning DFT plan\n"); + ERROR("Reeplaning DFT plan"); return SRSLTE_ERROR; } } else { // Create plan from zero otherwise if (srslte_dft_plan_c(&q->fft_plan, symbol_sz, dir)) { - ERROR("Creating DFT plan\n"); + ERROR("Creating DFT plan"); return SRSLTE_ERROR; } } @@ -156,7 +155,7 @@ static int ofdm_init_mbsfn_(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg, srslte_dft SRSLTE_CP_NSYMB(cp), symbol_sz + cp2, symbol_sz)) { - ERROR("Creating Guru DFT plan (%d)\n", slot); + ERROR("Creating Guru DFT plan (%d)", slot); return SRSLTE_ERROR; } } else { @@ -170,7 +169,7 @@ static int ofdm_init_mbsfn_(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg, srslte_dft SRSLTE_CP_NSYMB(cp), symbol_sz, symbol_sz + cp2)) { - ERROR("Creating Guru inverse-DFT plan (%d)\n", slot); + ERROR("Creating Guru inverse-DFT plan (%d)", slot); return SRSLTE_ERROR; } } @@ -179,7 +178,7 @@ static int ofdm_init_mbsfn_(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg, srslte_dft srslte_dft_plan_set_mirror(&q->fft_plan, true); - DEBUG("Init %s symbol_sz=%d, nof_symbols=%d, cp=%s, nof_re=%d, nof_guards=%d\n", + DEBUG("Init %s symbol_sz=%d, nof_symbols=%d, cp=%s, nof_re=%d, nof_guards=%d", dir == SRSLTE_DFT_FORWARD ? "FFT" : "iFFT", q->cfg.symbol_sz, q->nof_symbols, diff --git a/lib/src/phy/dft/test/ofdm_test.c b/lib/src/phy/dft/test/ofdm_test.c index 0fb150059..f80ef75e0 100644 --- a/lib/src/phy/dft/test/ofdm_test.c +++ b/lib/src/phy/dft/test/ofdm_test.c @@ -122,7 +122,7 @@ int main(int argc, char** argv) ofdm_cfg.freq_shift_f = freq_shift_f; ofdm_cfg.normalize = true; if (srslte_ofdm_tx_init_cfg(&ifft, &ofdm_cfg)) { - ERROR("Error initializing iFFT\n"); + ERROR("Error initializing iFFT"); exit(-1); } @@ -131,7 +131,7 @@ int main(int argc, char** argv) ofdm_cfg.rx_window_offset = rx_window_offset; ofdm_cfg.freq_shift_f = -freq_shift_f; if (srslte_ofdm_rx_init_cfg(&fft, &ofdm_cfg)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); exit(-1); } diff --git a/lib/src/phy/enb/enb_dl.c b/lib/src/phy/enb/enb_dl.c index 90e521126..3643678db 100644 --- a/lib/src/phy/enb/enb_dl.c +++ b/lib/src/phy/enb/enb_dl.c @@ -51,7 +51,7 @@ int srslte_enb_dl_init(srslte_enb_dl_t* q, cf_t* out_buffer[SRSLTE_MAX_PORTS], u ofdm_cfg.out_buffer = out_buffer[i]; ofdm_cfg.sf_type = SRSLTE_SF_NORM; if (srslte_ofdm_tx_init_cfg(&q->ifft[i], &ofdm_cfg)) { - ERROR("Error initiating FFT (%d)\n", i); + ERROR("Error initiating FFT (%d)", i); goto clean_exit; } } @@ -60,52 +60,52 @@ int srslte_enb_dl_init(srslte_enb_dl_t* q, cf_t* out_buffer[SRSLTE_MAX_PORTS], u ofdm_cfg.out_buffer = out_buffer[0]; ofdm_cfg.sf_type = SRSLTE_SF_MBSFN; if (srslte_ofdm_tx_init_cfg(&q->ifft_mbsfn, &ofdm_cfg)) { - ERROR("Error initiating FFT \n"); + ERROR("Error initiating FFT"); goto clean_exit; } if (srslte_pbch_init(&q->pbch)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); goto clean_exit; } if (srslte_pcfich_init(&q->pcfich, 0)) { - ERROR("Error creating PCFICH object\n"); + ERROR("Error creating PCFICH object"); goto clean_exit; } if (srslte_phich_init(&q->phich, 0)) { - ERROR("Error creating PHICH object\n"); + ERROR("Error creating PHICH object"); goto clean_exit; } int mbsfn_area_id = 1; if (srslte_pmch_init(&q->pmch, max_prb, 1)) { - ERROR("Error creating PMCH object\n"); + ERROR("Error creating PMCH object"); } srslte_pmch_set_area_id(&q->pmch, mbsfn_area_id); if (srslte_pdcch_init_enb(&q->pdcch, max_prb)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); goto clean_exit; } if (srslte_pdsch_init_enb(&q->pdsch, max_prb)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto clean_exit; } if (srslte_refsignal_cs_init(&q->csr_signal, max_prb)) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); goto clean_exit; } if (srslte_refsignal_mbsfn_init(&q->mbsfnr_signal, max_prb)) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); goto clean_exit; } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters\n"); + ERROR("Invalid parameters"); } clean_exit: @@ -151,58 +151,58 @@ int srslte_enb_dl_set_cell(srslte_enb_dl_t* q, srslte_cell_t cell) } q->cell = cell; if (srslte_regs_init(&q->regs, q->cell)) { - ERROR("Error resizing REGs\n"); + ERROR("Error resizing REGs"); return SRSLTE_ERROR; } for (int i = 0; i < q->cell.nof_ports; i++) { if (srslte_ofdm_tx_set_prb(&q->ifft[i], q->cell.cp, q->cell.nof_prb)) { - ERROR("Error re-planning iFFT (%d)\n", i); + ERROR("Error re-planning iFFT (%d)", i); return SRSLTE_ERROR; } } if (srslte_ofdm_tx_set_prb(&q->ifft_mbsfn, SRSLTE_CP_EXT, q->cell.nof_prb)) { - ERROR("Error re-planning ifft_mbsfn\n"); + ERROR("Error re-planning ifft_mbsfn"); return SRSLTE_ERROR; } srslte_ofdm_set_non_mbsfn_region(&q->ifft_mbsfn, 2); if (srslte_pbch_set_cell(&q->pbch, q->cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); return SRSLTE_ERROR; } if (srslte_pcfich_set_cell(&q->pcfich, &q->regs, q->cell)) { - ERROR("Error creating PCFICH object\n"); + ERROR("Error creating PCFICH object"); return SRSLTE_ERROR; } if (srslte_phich_set_cell(&q->phich, &q->regs, q->cell)) { - ERROR("Error creating PHICH object\n"); + ERROR("Error creating PHICH object"); return SRSLTE_ERROR; } if (srslte_pdcch_set_cell(&q->pdcch, &q->regs, q->cell)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); return SRSLTE_ERROR; } if (srslte_pdsch_set_cell(&q->pdsch, q->cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); return SRSLTE_ERROR; } if (srslte_pmch_set_cell(&q->pmch, q->cell)) { - ERROR("Error creating PMCH object\n"); + ERROR("Error creating PMCH object"); return SRSLTE_ERROR; } if (srslte_refsignal_cs_set_cell(&q->csr_signal, q->cell)) { - ERROR("Error initializing CSR signal (%d)\n", ret); + ERROR("Error initializing CSR signal (%d)", ret); return SRSLTE_ERROR; } int mbsfn_area_id = 1; if (srslte_refsignal_mbsfn_set_cell(&q->mbsfnr_signal, q->cell, mbsfn_area_id)) { - ERROR("Error initializing MBSFNR signal (%d)\n", ret); + ERROR("Error initializing MBSFNR signal (%d)", ret); return SRSLTE_ERROR; } /* Generate PSS/SSS signals */ @@ -218,7 +218,7 @@ int srslte_enb_dl_set_cell(srslte_enb_dl_t* q, srslte_cell_t cell) ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid cell properties: Id=%d, Ports=%d, PRBs=%d\n", cell.id, cell.nof_ports, cell.nof_prb); + ERROR("Invalid cell properties: Id=%d, Ports=%d, PRBs=%d", cell.id, cell.nof_ports, cell.nof_prb); } return ret; } @@ -376,10 +376,10 @@ int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, sr ZERO_OBJECT(dci_msg); if (srslte_dci_msg_pack_pdsch(&q->cell, &q->dl_sf, dci_cfg, dci_dl, &dci_msg)) { - ERROR("Error packing DL DCI\n"); + ERROR("Error packing DL DCI"); } if (srslte_pdcch_encode(&q->pdcch, &q->dl_sf, &dci_msg, q->sf_symbols)) { - ERROR("Error encoding DL DCI message\n"); + ERROR("Error encoding DL DCI message"); return SRSLTE_ERROR; } @@ -392,10 +392,10 @@ int srslte_enb_dl_put_pdcch_ul(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, sr ZERO_OBJECT(dci_msg); if (srslte_dci_msg_pack_pusch(&q->cell, &q->dl_sf, dci_cfg, dci_ul, &dci_msg)) { - ERROR("Error packing UL DCI\n"); + ERROR("Error packing UL DCI"); } if (srslte_pdcch_encode(&q->pdcch, &q->dl_sf, &dci_msg, q->sf_symbols)) { - ERROR("Error encoding UL DCI message\n"); + ERROR("Error encoding UL DCI message"); return SRSLTE_ERROR; } @@ -596,7 +596,6 @@ get_ack_fdd(const srslte_uci_cfg_t* uci_cfg, const srslte_uci_value_t* uci_value bool csi_report = uci_cfg->cqi.data_enable || uci_cfg->cqi.ri_len; switch (pdsch_ack->ack_nack_feedback_mode) { - case SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL: // Get ACK from PCell only, skipping DRX enb_dl_get_ack_fdd_pcell_skip_drx(uci_value, pdsch_ack, nof_tb); @@ -646,7 +645,7 @@ void srslte_enb_dl_get_ack(const srslte_cell_t* cell, if (cell->frame_type == SRSLTE_FDD) { get_ack_fdd(uci_cfg, uci_value, pdsch_ack); } else { - ERROR("Not implemented for TDD\n"); + ERROR("Not implemented for TDD"); } } diff --git a/lib/src/phy/enb/enb_dl_nr.c b/lib/src/phy/enb/enb_dl_nr.c index 02b743c2d..9f38f00ba 100644 --- a/lib/src/phy/enb/enb_dl_nr.c +++ b/lib/src/phy/enb/enb_dl_nr.c @@ -25,7 +25,7 @@ static int enb_dl_alloc_prb(srslte_enb_dl_nr_t* q, uint32_t new_nof_prb) q->sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(q->max_prb)); if (q->sf_symbols[i] == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } } @@ -41,7 +41,7 @@ int srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS], } if (args->nof_tx_antennas == 0) { - ERROR("Error invalid number of antennas (%d)\n", args->nof_tx_antennas); + ERROR("Error invalid number of antennas (%d)", args->nof_tx_antennas); return SRSLTE_ERROR; } @@ -52,7 +52,7 @@ int srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS], } if (enb_dl_alloc_prb(q, args->nof_max_prb) < SRSLTE_SUCCESS) { - ERROR("Error allocating\n"); + ERROR("Error allocating"); return SRSLTE_ERROR; } @@ -68,12 +68,12 @@ int srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS], } if (srslte_dmrs_sch_init(&q->dmrs, false) < SRSLTE_SUCCESS) { - ERROR("Error DMRS\n"); + ERROR("Error DMRS"); return SRSLTE_ERROR; } if (srslte_pdcch_nr_init_tx(&q->pdcch, &args->pdcch) < SRSLTE_SUCCESS) { - ERROR("Error PDCCH\n"); + ERROR("Error PDCCH"); return SRSLTE_ERROR; } @@ -109,12 +109,12 @@ int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_ } if (srslte_dmrs_sch_set_carrier(&q->dmrs, carrier) < SRSLTE_SUCCESS) { - ERROR("Error DMRS\n"); + ERROR("Error DMRS"); return SRSLTE_ERROR; } if (enb_dl_alloc_prb(q, carrier->nof_prb) < SRSLTE_SUCCESS) { - ERROR("Error allocating\n"); + ERROR("Error allocating"); return SRSLTE_ERROR; } @@ -195,24 +195,24 @@ int srslte_enb_dl_nr_pdcch_put(srslte_enb_dl_nr_t* q, // Put DMRS if (srslte_dmrs_pdcch_put(&q->carrier, &q->coreset, slot_cfg, &dci_dl->location, q->sf_symbols[0]) < SRSLTE_SUCCESS) { - ERROR("Error putting PDCCH DMRS\n"); + ERROR("Error putting PDCCH DMRS"); return SRSLTE_ERROR; } // Pack DCI srslte_dci_msg_nr_t dci_msg = {}; if (srslte_dci_nr_pack(&q->carrier, &q->coreset, dci_dl, &dci_msg) < SRSLTE_SUCCESS) { - ERROR("Error packing DL DCI\n"); + ERROR("Error packing DL DCI"); return SRSLTE_ERROR; } // PDCCH Encode if (srslte_pdcch_nr_encode(&q->pdcch, &dci_msg, q->sf_symbols[0]) < SRSLTE_SUCCESS) { - ERROR("Error encoding PDCCH\n"); + ERROR("Error encoding PDCCH"); return SRSLTE_ERROR; } - INFO("DCI DL NR: L=%d; ncce=%d;\n", dci_dl->location.L, dci_dl->location.ncce); + INFO("DCI DL NR: L=%d; ncce=%d;", dci_dl->location.L, dci_dl->location.ncce); return SRSLTE_SUCCESS; } diff --git a/lib/src/phy/enb/enb_ul.c b/lib/src/phy/enb/enb_ul.c index eed9fa2f7..b1aea7cb6 100644 --- a/lib/src/phy/enb/enb_ul.c +++ b/lib/src/phy/enb/enb_ul.c @@ -47,29 +47,29 @@ int srslte_enb_ul_init(srslte_enb_ul_t* q, cf_t* in_buffer, uint32_t max_prb) ofdm_cfg.normalize = false; ofdm_cfg.rx_window_offset = 0.5f; if (srslte_ofdm_rx_init_cfg(&q->fft, &ofdm_cfg)) { - ERROR("Error initiating FFT\n"); + ERROR("Error initiating FFT"); goto clean_exit; } if (srslte_pucch_init_enb(&q->pucch)) { - ERROR("Error creating PUCCH object\n"); + ERROR("Error creating PUCCH object"); goto clean_exit; } if (srslte_pusch_init_enb(&q->pusch, max_prb)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto clean_exit; } if (srslte_chest_ul_init(&q->chest, max_prb)) { - ERROR("Error initiating channel estimator\n"); + ERROR("Error initiating channel estimator"); goto clean_exit; } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters\n"); + ERROR("Invalid parameters"); } clean_exit: @@ -82,7 +82,6 @@ clean_exit: void srslte_enb_ul_free(srslte_enb_ul_t* q) { if (q) { - srslte_ofdm_rx_free(&q->fft); srslte_pucch_free(&q->pucch); srslte_pusch_free(&q->pusch); @@ -110,22 +109,22 @@ int srslte_enb_ul_set_cell(srslte_enb_ul_t* q, q->cell = cell; if (srslte_ofdm_rx_set_prb(&q->fft, q->cell.cp, q->cell.nof_prb)) { - ERROR("Error initiating FFT\n"); + ERROR("Error initiating FFT"); return SRSLTE_ERROR; } if (srslte_pucch_set_cell(&q->pucch, q->cell)) { - ERROR("Error creating PUCCH object\n"); + ERROR("Error creating PUCCH object"); return SRSLTE_ERROR; } if (srslte_pusch_set_cell(&q->pusch, q->cell)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); return SRSLTE_ERROR; } if (srslte_chest_ul_set_cell(&q->chest, cell)) { - ERROR("Error initiating channel estimator\n"); + ERROR("Error initiating channel estimator"); return SRSLTE_ERROR; } @@ -135,7 +134,7 @@ int srslte_enb_ul_set_cell(srslte_enb_ul_t* q, ret = SRSLTE_SUCCESS; } } else { - ERROR("Invalid cell properties: Id=%d, Ports=%d, PRBs=%d\n", cell.id, cell.nof_ports, cell.nof_prb); + ERROR("Invalid cell properties: Id=%d, Ports=%d, PRBs=%d", cell.id, cell.nof_ports, cell.nof_prb); } return ret; } @@ -143,11 +142,11 @@ int srslte_enb_ul_set_cell(srslte_enb_ul_t* q, int srslte_enb_ul_add_rnti(srslte_enb_ul_t* q, uint16_t rnti) { if (srslte_pucch_set_rnti(&q->pucch, rnti)) { - ERROR("Error setting PUCCH rnti\n"); + ERROR("Error setting PUCCH rnti"); return -1; } if (srslte_pusch_set_rnti(&q->pusch, rnti)) { - ERROR("Error setting PUSCH rnti\n"); + ERROR("Error setting PUSCH rnti"); return -1; } return 0; @@ -178,14 +177,14 @@ static int get_pucch(srslte_enb_ul_t* q, srslte_ul_sf_cfg_t* ul_sf, srslte_pucch // Select format cfg->format = srslte_pucch_proc_select_format(&q->cell, cfg, &cfg->uci_cfg, NULL); if (cfg->format == SRSLTE_PUCCH_FORMAT_ERROR) { - ERROR("Returned Error while selecting PUCCH format\n"); + ERROR("Returned Error while selecting PUCCH format"); return SRSLTE_ERROR; } // Get possible resources int nof_resources = srslte_pucch_proc_get_resources(&q->cell, cfg, &cfg->uci_cfg, NULL, n_pucch_i); if (nof_resources < 1 || nof_resources > SRSLTE_PUCCH_CS_MAX_ACK) { - ERROR("No PUCCH resource could be calculated (%d)\n", nof_resources); + ERROR("No PUCCH resource could be calculated (%d)", nof_resources); return SRSLTE_ERROR; } @@ -201,16 +200,15 @@ static int get_pucch(srslte_enb_ul_t* q, srslte_ul_sf_cfg_t* ul_sf, srslte_pucch // Prepare configuration if (srslte_chest_ul_estimate_pucch(&q->chest, ul_sf, cfg, q->sf_symbols, &q->chest_res)) { - ERROR("Error estimating PUCCH DMRS\n"); + ERROR("Error estimating PUCCH DMRS"); return SRSLTE_ERROR; } pucch_res.snr_db = q->chest_res.snr_db; ret = srslte_pucch_decode(&q->pucch, ul_sf, cfg, &q->chest_res, q->sf_symbols, &pucch_res); if (ret < SRSLTE_SUCCESS) { - ERROR("Error decoding PUCCH\n"); + ERROR("Error decoding PUCCH"); } else { - // Get PUCCH Format 1b with channel selection if: // - At least one ACK bit needs to be received; and // - PUCCH Format 1b was used; and @@ -245,9 +243,8 @@ int srslte_enb_ul_get_pucch(srslte_enb_ul_t* q, srslte_pucch_cfg_t* cfg, srslte_pucch_res_t* res) { - if (!srslte_pucch_cfg_isvalid(cfg, q->cell.nof_prb)) { - ERROR("Invalid PUCCH configuration\n"); + ERROR("Invalid PUCCH configuration"); return SRSLTE_ERROR_INVALID_INPUTS; } diff --git a/lib/src/phy/fec/block/block.c b/lib/src/phy/fec/block/block.c index c953b578f..2ed378484 100644 --- a/lib/src/phy/fec/block/block.c +++ b/lib/src/phy/fec/block/block.c @@ -69,7 +69,7 @@ __attribute__((constructor)) static void srslte_block_init() void srslte_block_encode(const uint8_t* input, uint32_t input_len, uint8_t* output, uint32_t output_len) { if (!input || !output) { - ERROR("Invalid inputs\n"); + ERROR("Invalid inputs"); return; } @@ -148,7 +148,7 @@ int32_t srslte_block_decode_i8(const int8_t* llr, uint32_t nof_llr, uint8_t* dat // Return invalid inputs if data is not provided if (!llr || !data) { - ERROR("Invalid inputs\n"); + ERROR("Invalid inputs"); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -166,7 +166,7 @@ int32_t srslte_block_decode_i16(const int16_t* llr, uint32_t nof_llr, uint8_t* d // Return invalid inputs if data is not provided if (!llr || !data) { - ERROR("Invalid inputs\n"); + ERROR("Invalid inputs"); return SRSLTE_ERROR_INVALID_INPUTS; } diff --git a/lib/src/phy/fec/block/test/block_test.c b/lib/src/phy/fec/block/test/block_test.c index fdccfedaf..36a730fbf 100644 --- a/lib/src/phy/fec/block/test/block_test.c +++ b/lib/src/phy/fec/block/test/block_test.c @@ -109,7 +109,7 @@ int test(uint32_t block_size) double total_bits = (double)(block_size * nof_repetitions); INFO("Block size %d PASSED! Encoder: %.1f us / %.1f Mbps; 16 bit Decoder: %.1f us / %.2f Mbps; 8 bit decoder: %.1f / " - "%.2f Mbps\n", + "%.2f Mbps", block_size, t_encode_us / (double)nof_repetitions, total_bits / (double)t_encode_us, diff --git a/lib/src/phy/fec/cbsegm.c b/lib/src/phy/fec/cbsegm.c index 7c3cce3c5..39029aacd 100644 --- a/lib/src/phy/fec/cbsegm.c +++ b/lib/src/phy/fec/cbsegm.c @@ -91,7 +91,7 @@ int srslte_cbsegm(srslte_cbsegm_t* s, uint32_t tbs) s->L_tb = 24; // 24 bit CRC always s->L_cb = 24; // 24 bit CRC always s->F = s->C1 * s->K1 + s->C2 * s->K2 - Bp; - INFO("CB Segmentation: TBS: %d, C=%d, C+=%d K+=%d, C-=%d, K-=%d, F=%d, Bp=%d\n", + INFO("CB Segmentation: TBS: %d, C=%d, C+=%d K+=%d, C-=%d, K-=%d, F=%d, Bp=%d", tbs, s->C, s->C1, @@ -162,7 +162,6 @@ static int cbsegm_ldpc_select_ls(uint32_t Kp, uint32_t K_b, uint32_t* Z_c, uint8 // If the lifting index is valid, save outputs and return if (i != VOID_LIFTSIZE) { - if (i_ls) { *i_ls = i; } @@ -262,7 +261,7 @@ static int srslte_cbsegm_ldpc(srslte_cbsegm_t* s, srslte_basegraph_t bg, uint32_ s->K2 = 0; s->K2_idx = 0; - INFO("LDPC CB Segmentation: TBS: %d, C=%d, K=%d, F=%d, Bp=%d\n", tbs, s->C, s->K1, s->F, Bp); + INFO("LDPC CB Segmentation: TBS: %d, C=%d, K=%d, F=%d, Bp=%d", tbs, s->C, s->K1, s->F, Bp); return SRSLTE_SUCCESS; } diff --git a/lib/src/phy/fec/convolutional/test/viterbi_test.c b/lib/src/phy/fec/convolutional/test/viterbi_test.c index 8792a282d..55cef2a53 100644 --- a/lib/src/phy/fec/convolutional/test/viterbi_test.c +++ b/lib/src/phy/fec/convolutional/test/viterbi_test.c @@ -201,7 +201,6 @@ int main(int argc, char** argv) errors_f = 0; errors_sse = 0; while (frame_cnt < nof_frames) { - /* generate data_tx */ srslte_random_t random_gen = srslte_random_init(0); for (int j = 0; j < frame_length; j++) { @@ -283,7 +282,7 @@ int main(int argc, char** argv) if (snr_points == 1) { int expected_e = get_expected_errors(nof_frames, seed, frame_length, tail_biting, ebno_db); if (expected_e == -1) { - ERROR("Test parameters not defined in test_results.h\n"); + ERROR("Test parameters not defined in test_results.h"); exit(-1); } else { printf( diff --git a/lib/src/phy/fec/convolutional/viterbi.c b/lib/src/phy/fec/convolutional/viterbi.c index fe4cf37c6..323d09863 100644 --- a/lib/src/phy/fec/convolutional/viterbi.c +++ b/lib/src/phy/fec/convolutional/viterbi.c @@ -216,7 +216,7 @@ int decode37_neon(void* o, uint8_t* symbols, uint8_t* data, uint32_t frame_lengt uint32_t best_state; if (frame_length > q->framebits) { - ERROR("Initialized decoder for max frame length %d bits\n", q->framebits); + ERROR("Initialized decoder for max frame length %d bits", q->framebits); return -1; } @@ -294,7 +294,7 @@ int init37(srslte_viterbi_t* q, int poly[3], uint32_t framebits, bool tail_bitin } if ((q->ptr = create_viterbi37_port(poly, TB_ITER * framebits)) == NULL) { - ERROR("create_viterbi37 failed\n"); + ERROR("create_viterbi37 failed"); free37(q); return -1; } else { @@ -338,7 +338,7 @@ int init37_sse(srslte_viterbi_t* q, int poly[3], uint32_t framebits, bool tail_b } if ((q->ptr = create_viterbi37_sse(poly, TB_ITER * framebits)) == NULL) { - ERROR("create_viterbi37 failed\n"); + ERROR("create_viterbi37 failed"); free37(q); return -1; } else { @@ -376,7 +376,7 @@ int init37_neon(srslte_viterbi_t* q, int poly[3], uint32_t framebits, bool tail_ } if ((q->ptr = create_viterbi37_neon(poly, TB_ITER * framebits)) == NULL) { - ERROR("create_viterbi37 failed\n"); + ERROR("create_viterbi37 failed"); free37(q); return -1; } else { @@ -414,7 +414,7 @@ int init37_avx2(srslte_viterbi_t* q, int poly[3], uint32_t framebits, bool tail_ } if ((q->ptr = create_viterbi37_avx2(poly, TB_ITER * framebits)) == NULL) { - ERROR("create_viterbi37 failed\n"); + ERROR("create_viterbi37 failed"); free37(q); return -1; } else { @@ -452,7 +452,7 @@ int init37_avx2_16bit(srslte_viterbi_t* q, int poly[3], uint32_t framebits, bool } // printf("pt0\n"); if ((q->ptr = create_viterbi37_avx2_16bit(poly, TB_ITER * framebits)) == NULL) { - ERROR("create_viterbi37 failed\n"); + ERROR("create_viterbi37 failed"); free37(q); return -1; } else { @@ -500,7 +500,7 @@ int srslte_viterbi_init(srslte_viterbi_t* q, #endif #endif default: - ERROR("Decoder not implemented\n"); + ERROR("Decoder not implemented"); return -1; } } @@ -540,7 +540,7 @@ int srslte_viterbi_decode_f(srslte_viterbi_t* q, float* symbols, uint8_t* data, { uint32_t len; if (frame_length > q->framebits) { - ERROR("Initialized decoder for max frame length %d bits\n", q->framebits); + ERROR("Initialized decoder for max frame length %d bits", q->framebits); return -1; } if (q->tail_biting) { @@ -572,7 +572,7 @@ int srslte_viterbi_decode_s(srslte_viterbi_t* q, int16_t* symbols, uint8_t* data { uint32_t len; if (frame_length > q->framebits) { - ERROR("Initialized decoder for max frame length %d bits\n", q->framebits); + ERROR("Initialized decoder for max frame length %d bits", q->framebits); return -1; } if (q->tail_biting) { diff --git a/lib/src/phy/fec/crc.c b/lib/src/phy/fec/crc.c index 9d108b4f0..0a9b68930 100644 --- a/lib/src/phy/fec/crc.c +++ b/lib/src/phy/fec/crc.c @@ -36,7 +36,6 @@ static void gen_crc_table(srslte_crc_t* h) uint64_t reversecrcbit(uint32_t crc, int nbits, srslte_crc_t* h) { - uint64_t m, rmask = 0x1; for (m = 0; m < nbits; m++) { @@ -50,7 +49,6 @@ uint64_t reversecrcbit(uint32_t crc, int nbits, srslte_crc_t* h) int srslte_crc_set_init(srslte_crc_t* crc_par, uint64_t crc_init_value) { - crc_par->crcinit = crc_init_value; if (crc_par->crcinit != (crc_par->crcinit & crc_par->crcmask)) { printf("ERROR(invalid crcinit in crc_set_init().\n"); @@ -61,7 +59,6 @@ int srslte_crc_set_init(srslte_crc_t* crc_par, uint64_t crc_init_value) int srslte_crc_init(srslte_crc_t* h, uint32_t crc_poly, int crc_order) { - // Set crc working default parameters h->polynom = crc_poly; h->order = crc_order; @@ -72,7 +69,7 @@ int srslte_crc_init(srslte_crc_t* h, uint32_t crc_poly, int crc_order) h->crchighbit = (uint64_t)1 << (h->order - 1); if (srslte_crc_set_init(h, h->crcinit)) { - ERROR("Error setting CRC init word\n"); + ERROR("Error setting CRC init word"); return -1; } diff --git a/lib/src/phy/fec/ldpc/base_graph.c b/lib/src/phy/fec/ldpc/base_graph.c index 7b055547b..b7bde7e52 100644 --- a/lib/src/phy/fec/ldpc/base_graph.c +++ b/lib/src/phy/fec/ldpc/base_graph.c @@ -4469,7 +4469,7 @@ int create_compact_pcm(uint16_t* pcm, int8_t (*positions)[MAX_CNCT], srslte_base ls_index = get_ls_index(ls); if (ls_index == VOID_LIFTSIZE) { - ERROR("Invalid lifting size %d\n", ls); + ERROR("Invalid lifting size %d", ls); return -1; } const uint16_t* tmp = get_cnct_matrix(bg, ls_index); diff --git a/lib/src/phy/fec/ldpc/ldpc_decoder.c b/lib/src/phy/fec/ldpc/ldpc_decoder.c index 61456ee1e..7f30a1246 100644 --- a/lib/src/phy/fec/ldpc/ldpc_decoder.c +++ b/lib/src/phy/fec/ldpc/ldpc_decoder.c @@ -55,13 +55,13 @@ static int decode_f(void* o, const float* llrs, uint8_t* message, uint32_t cdwd_ // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } @@ -98,7 +98,7 @@ static int init_f(srslte_ldpc_decoder_t* q) q->free = free_dec_f; if ((q->ptr = create_ldpc_dec_f(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_f(q); return -1; } @@ -133,13 +133,13 @@ static int decode_s(void* o, const int16_t* llrs, uint8_t* message, uint32_t cdw // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } @@ -176,7 +176,7 @@ static int init_s(srslte_ldpc_decoder_t* q) q->free = free_dec_s; if ((q->ptr = create_ldpc_dec_s(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_s(q); return -1; } @@ -211,13 +211,13 @@ static int decode_c(void* o, const int8_t* llrs, uint8_t* message, uint32_t cdwd // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } @@ -254,7 +254,7 @@ static int init_c(srslte_ldpc_decoder_t* q) q->free = free_dec_c; if ((q->ptr = create_ldpc_dec_c(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c(q); return -1; } @@ -289,13 +289,13 @@ static int decode_c_flood(void* o, const int8_t* llrs, uint8_t* message, uint32_ // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } init_ldpc_dec_c_flood(q->ptr, llrs, q->ls); @@ -332,7 +332,7 @@ static int init_c_flood(srslte_ldpc_decoder_t* q) q->free = free_dec_c_flood; if ((q->ptr = create_ldpc_dec_c_flood(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c_flood(q); return -1; } @@ -368,13 +368,13 @@ static int decode_c_avx2(void* o, const int8_t* llrs, uint8_t* message, uint32_t // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } init_ldpc_dec_c_avx2(q->ptr, llrs, q->ls); @@ -410,7 +410,7 @@ static int init_c_avx2(srslte_ldpc_decoder_t* q) q->free = free_dec_c_avx2; if ((q->ptr = create_ldpc_dec_c_avx2(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c_avx2(q); return -1; } @@ -446,13 +446,13 @@ static int decode_c_avx2long(void* o, const int8_t* llrs, uint8_t* message, uint // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } init_ldpc_dec_c_avx2long(q->ptr, llrs, q->ls); @@ -488,7 +488,7 @@ static int init_c_avx2long(srslte_ldpc_decoder_t* q) q->free = free_dec_c_avx2long; if ((q->ptr = create_ldpc_dec_c_avx2long(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c_avx2long(q); return -1; } @@ -524,13 +524,13 @@ static int decode_c_avx2_flood(void* o, const int8_t* llrs, uint8_t* message, ui // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } init_ldpc_dec_c_avx2_flood(q->ptr, llrs, q->ls); @@ -567,7 +567,7 @@ static int init_c_avx2_flood(srslte_ldpc_decoder_t* q) q->free = free_dec_c_avx2_flood; if ((q->ptr = create_ldpc_dec_c_avx2_flood(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c_avx2_flood(q); return -1; } @@ -604,13 +604,13 @@ static int decode_c_avx2long_flood(void* o, const int8_t* llrs, uint8_t* message // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } init_ldpc_dec_c_avx2long_flood(q->ptr, llrs, q->ls); @@ -649,7 +649,7 @@ static int init_c_avx2long_flood(srslte_ldpc_decoder_t* q) q->free = free_dec_c_avx2long_flood; if ((q->ptr = create_ldpc_dec_c_avx2long_flood(q->bgN, q->bgM, q->ls, q->scaling_fctr)) == NULL) { - ERROR("Create_ldpc_dec failed\n"); + ERROR("Create_ldpc_dec failed"); free_dec_c_avx2long(q); return -1; } @@ -669,7 +669,7 @@ int srslte_ldpc_decoder_init(srslte_ldpc_decoder_t* q, int ls_index = get_ls_index(ls); if (ls_index == VOID_LIFTSIZE) { - ERROR("Invalid lifting size %d\n", ls); + ERROR("Invalid lifting size %d", ls); return -1; } @@ -683,7 +683,7 @@ int srslte_ldpc_decoder_init(srslte_ldpc_decoder_t* q, q->bgM = BG2M; break; default: - ERROR("Base Graph BG%d does not exist\n", bg + 1); + ERROR("Base Graph BG%d does not exist", bg + 1); return -1; } q->bg = bg; @@ -746,7 +746,7 @@ int srslte_ldpc_decoder_init(srslte_ldpc_decoder_t* q, } #endif // LV_HAVE_AVX2 default: - ERROR("Unknown decoder.\n"); + ERROR("Unknown decoder."); return -1; } } diff --git a/lib/src/phy/fec/ldpc/ldpc_encoder.c b/lib/src/phy/fec/ldpc/ldpc_encoder.c index 4f5ef7afe..f4e254f82 100644 --- a/lib/src/phy/fec/ldpc/ldpc_encoder.c +++ b/lib/src/phy/fec/ldpc/ldpc_encoder.c @@ -57,13 +57,13 @@ static int encode_c(void* o, const uint8_t* input, uint8_t* output, uint32_t inp // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } @@ -92,7 +92,7 @@ static int init_c(srslte_ldpc_encoder_t* q) int ls_index = get_ls_index(q->ls); if (ls_index == VOID_LIFTSIZE) { - ERROR("Invalid lifting size %d\n", q->ls); + ERROR("Invalid lifting size %d", q->ls); return -1; } @@ -105,7 +105,7 @@ static int init_c(srslte_ldpc_encoder_t* q) } else if (q->bg == BG2 && (ls_index == 3 || ls_index == 7)) { q->encode_high_rate = encode_high_rate_case4; } else { - ERROR("Invalid lifting size %d and/or Base Graph %d\n", q->ls, q->bg + 1); + ERROR("Invalid lifting size %d and/or Base Graph %d", q->ls, q->bg + 1); return -1; } @@ -153,13 +153,13 @@ static int encode_avx2(void* o, const uint8_t* input, uint8_t* output, uint32_t // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } @@ -186,7 +186,7 @@ static int init_avx2(srslte_ldpc_encoder_t* q) int ls_index = get_ls_index(q->ls); if (ls_index == VOID_LIFTSIZE) { - ERROR("Invalid lifting size %d\n", q->ls); + ERROR("Invalid lifting size %d", q->ls); return -1; } @@ -199,7 +199,7 @@ static int init_avx2(srslte_ldpc_encoder_t* q) } else if (q->bg == BG2 && (ls_index == 3 || ls_index == 7)) { q->encode_high_rate_avx2 = encode_high_rate_case4_avx2; } else { - ERROR("Invalid lifting size %d and/or Base Graph %d\n", q->ls, q->bg + 1); + ERROR("Invalid lifting size %d and/or Base Graph %d", q->ls, q->bg + 1); return -1; } @@ -246,13 +246,13 @@ encode_avx2long(void* o, const uint8_t* input, uint8_t* output, uint32_t input_l // We need at least q->bgK + 4 variable nodes to cover the high-rate region. However, // 2 variable nodes are systematically punctured by the encoder. if (cdwd_rm_length < (q->bgK + 2) * q->ls) { - // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region.\n"); + // ERROR("The rate-matched codeword should have a length at least equal to the high-rate region."); cdwd_rm_length = (q->bgK + 2) * q->ls; // return -1; } if (cdwd_rm_length % q->ls) { cdwd_rm_length = (cdwd_rm_length / q->ls + 1) * q->ls; - // ERROR("The rate-matched codeword length should be a multiple of the lifting size.\n"); + // ERROR("The rate-matched codeword length should be a multiple of the lifting size."); // return -1; } load_avx2long(q->ptr, input, q->bgK, q->bgN, q->ls); @@ -278,7 +278,7 @@ static int init_avx2long(srslte_ldpc_encoder_t* q) int ls_index = get_ls_index(q->ls); if (ls_index == VOID_LIFTSIZE) { - ERROR("Invalid lifting size %d\n", q->ls); + ERROR("Invalid lifting size %d", q->ls); return -1; } @@ -291,7 +291,7 @@ static int init_avx2long(srslte_ldpc_encoder_t* q) } else if (q->bg == BG2 && (ls_index == 3 || ls_index == 7)) { q->encode_high_rate_avx2 = encode_high_rate_case4_avx2long; } else { - ERROR("Invalid lifting size %d and/or Base Graph %d\n", q->ls, q->bg + 1); + ERROR("Invalid lifting size %d and/or Base Graph %d", q->ls, q->bg + 1); return -1; } @@ -315,7 +315,6 @@ int srslte_ldpc_encoder_init(srslte_ldpc_encoder_t* q, srslte_basegraph_t bg, uint16_t ls) { - switch (bg) { case BG1: q->bgN = BG1Nfull; @@ -326,7 +325,7 @@ int srslte_ldpc_encoder_init(srslte_ldpc_encoder_t* q, q->bgM = BG2M; break; default: - ERROR("Base Graph BG%d does not exist\n", bg + 1); + ERROR("Base Graph BG%d does not exist", bg + 1); return -1; } q->bg = bg; diff --git a/lib/src/phy/fec/ldpc/ldpc_rm.c b/lib/src/phy/fec/ldpc/ldpc_rm.c index 1c0efd118..ac862c020 100644 --- a/lib/src/phy/fec/ldpc/ldpc_rm.c +++ b/lib/src/phy/fec/ldpc/ldpc_rm.c @@ -121,13 +121,13 @@ static int init_rm(srslte_ldpc_rm_t* p, // check E smaller than MAXE if ((E > MAXE) != 0) { // - ERROR("Wrong RM codeword length (E) = %d. It must be smaller than %d for base graph %d\n", E, MAXE, bg + 1); + ERROR("Wrong RM codeword length (E) = %d. It must be smaller than %d for base graph %d", E, MAXE, bg + 1); return -1; } // check out_len is multiple of mod_order if ((E % mod_order) != 0) { // N can only be a multiple of either BASEN[0] or BASEN[1], but not both - ERROR("Wrong RM codeword length (E) = %d. It must be a multiple of modulation order = %d\n", E, mod_order); + ERROR("Wrong RM codeword length (E) = %d. It must be a multiple of modulation order = %d", E, mod_order); return -1; } @@ -420,7 +420,6 @@ int srslte_ldpc_rm_tx_init(srslte_ldpc_rm_t* p) int srslte_ldpc_rm_rx_init_f(srslte_ldpc_rm_t* p) { - if (p == NULL) { return -1; } @@ -606,7 +605,6 @@ int srslte_ldpc_rm_rx_f(srslte_ldpc_rm_t* q, const srslte_mod_t mod_type, const uint32_t Nref) { - if (init_rm(q, E, F, bg, ls, rv, mod_type, Nref) != 0) { perror("rate matcher init"); exit(-1); @@ -638,7 +636,6 @@ int srslte_ldpc_rm_rx_s(srslte_ldpc_rm_t* q, const srslte_mod_t mod_type, const uint32_t Nref) { - if (init_rm(q, E, F, bg, ls, rv, mod_type, Nref) != 0) { perror("rate matcher init"); exit(-1); @@ -671,7 +668,6 @@ int srslte_ldpc_rm_rx_c(srslte_ldpc_rm_t* q, const srslte_mod_t mod_type, const uint32_t Nref) { - if (init_rm(q, E, F, bg, ls, rv, mod_type, Nref) != 0) { perror("rate matcher init"); exit(-1); diff --git a/lib/src/phy/fec/polar/polar_code.c b/lib/src/phy/fec/polar/polar_code.c index b4d39fb33..c4ece0928 100644 --- a/lib/src/phy/fec/polar/polar_code.c +++ b/lib/src/phy/fec/polar/polar_code.c @@ -74,7 +74,6 @@ int cmpfunc(const void* a, const void* b) return -1; } if (ai > bi) { - return 1; } @@ -87,17 +86,16 @@ int cmpfunc(const void* a, const void* b) */ int get_code_params(srslte_polar_code_t* c, const uint16_t K, const uint16_t E, const uint8_t nMax) { - // include here also npc and nwmPC computatoins if (E > EMAX) { - ERROR("Rate-matched codeword size (E) not supported. Chose E<=8192\n"); + ERROR("Rate-matched codeword size (E) not supported. Chose E<=8192"); return -1; } switch (nMax) { case 9: // downlink // iil = true if (K < 36 || K > 164) { - ERROR("Codeblock length (K=%d) not supported for downlink transmission, choose 165 > K > 35\n", K); + ERROR("Codeblock length (K=%d) not supported for downlink transmission, choose 165 > K > 35", K); return -1; } break; @@ -105,13 +103,13 @@ int get_code_params(srslte_polar_code_t* c, const uint16_t K, const uint16_t E, // iil = false if (K < 18 || (K > 25 && K < 31) || K > 1023) { ERROR("Codeblock length (K=%d) not supported for uplink transmission, choose K > 17 and K < 1024, " - "excluding 31 > K > 25\n", + "excluding 31 > K > 25", K); return -1; } break; default: - ERROR("nMax not supported choose 9 for downlink and 10 for uplink transmissions\n"); + ERROR("nMax not supported choose 9 for downlink and 10 for uplink transmissions"); return -1; } // number of parity check bits (nPC) and parity check bits of minimum bandwidth nWmPC @@ -125,7 +123,7 @@ int get_code_params(srslte_polar_code_t* c, const uint16_t K, const uint16_t E, } if (K + nPC >= E) { - ERROR(" Rate-matched codeword length (E) not supported, choose E > %d\n", K + nPC); + ERROR(" Rate-matched codeword length (E) not supported, choose E > %d", K + nPC); return -1; } @@ -173,7 +171,7 @@ int get_code_params(srslte_polar_code_t* c, const uint16_t K, const uint16_t E, uint16_t N = (1U << n); if (K >= N) { - ERROR("Codeblock length (K) not supported, choose K < N\n"); + ERROR("Codeblock length (K) not supported, choose K < N"); return -1; } @@ -213,7 +211,6 @@ int srslte_polar_code_init(srslte_polar_code_t* c) int srslte_polar_code_get(srslte_polar_code_t* c, uint16_t K, uint16_t E, uint8_t nMax) { - if (c == NULL) { return -1; } diff --git a/lib/src/phy/fec/polar/polar_decoder.c b/lib/src/phy/fec/polar/polar_decoder.c index 7ea989e82..90e81dba3 100644 --- a/lib/src/phy/fec/polar/polar_decoder.c +++ b/lib/src/phy/fec/polar/polar_decoder.c @@ -142,7 +142,7 @@ static int init_ssc_f(srslte_polar_decoder_t* q) q->free = free_ssc_f; if ((q->ptr = create_polar_decoder_ssc_f(q->nMax)) == NULL) { - ERROR("create_polar_decoder_ssc_f failed\n"); + ERROR("create_polar_decoder_ssc_f failed"); free_ssc_f(q); return -1; } @@ -156,7 +156,7 @@ static int init_ssc_s(srslte_polar_decoder_t* q) q->free = free_ssc_s; if ((q->ptr = create_polar_decoder_ssc_s(q->nMax)) == NULL) { - ERROR("create_polar_decoder_ssc_s failed\n"); + ERROR("create_polar_decoder_ssc_s failed"); free_ssc_s(q); return -1; } @@ -170,7 +170,7 @@ static int init_ssc_c(srslte_polar_decoder_t* q) q->free = free_ssc_c; if ((q->ptr = create_polar_decoder_ssc_c(q->nMax)) == NULL) { - ERROR("create_polar_decoder_ssc_c failed\n"); + ERROR("create_polar_decoder_ssc_c failed"); free_ssc_c(q); return -1; } @@ -186,7 +186,7 @@ static int init_ssc_c_avx2(srslte_polar_decoder_t* q) q->free = free_ssc_c_avx2; if ((q->ptr = create_polar_decoder_ssc_c_avx2(q->nMax)) == NULL) { - ERROR("create_polar_decoder_ssc_c failed\n"); + ERROR("create_polar_decoder_ssc_c failed"); free_ssc_c_avx2(q); return -1; } @@ -209,7 +209,7 @@ int srslte_polar_decoder_init(srslte_polar_decoder_t* q, srslte_polar_decoder_ty return init_ssc_c_avx2(q); #endif default: - ERROR("Decoder not implemented\n"); + ERROR("Decoder not implemented"); return -1; } return 0; diff --git a/lib/src/phy/fec/test/crc_test.c b/lib/src/phy/fec/test/crc_test.c index 17ef2e51f..0c88d8ce6 100644 --- a/lib/src/phy/fec/test/crc_test.c +++ b/lib/src/phy/fec/test/crc_test.c @@ -100,13 +100,13 @@ int main(int argc, char** argv) // generate CRC word crc_word = srslte_crc_checksum(&crc_p, data, num_bits); - INFO("checksum=%x\n", crc_word); + INFO("checksum=%x", crc_word); free(data); // check if generated word is as expected if (get_expected_word(num_bits, crc_length, crc_poly, seed, &expected_word)) { - ERROR("Test parameters not defined in test_results.h\n"); + ERROR("Test parameters not defined in test_results.h"); exit(-1); } exit(expected_word != crc_word); diff --git a/lib/src/phy/fec/turbo/rm_conv.c b/lib/src/phy/fec/turbo/rm_conv.c index 4fa731510..b4b11d743 100644 --- a/lib/src/phy/fec/turbo/rm_conv.c +++ b/lib/src/phy/fec/turbo/rm_conv.c @@ -33,7 +33,6 @@ uint8_t RM_PERM_CC_INV[NCOLS] = {16, 0, 24, 8, 20, 4, 28, 12, 18, 2, 26, 10, 22, */ int srslte_rm_conv_tx(uint8_t* input, uint32_t in_len, uint8_t* output, uint32_t out_len) { - uint8_t tmp[3 * NCOLS * NROWS_MAX]; int nrows, ndummy, K_p; @@ -41,7 +40,7 @@ int srslte_rm_conv_tx(uint8_t* input, uint32_t in_len, uint8_t* output, uint32_t nrows = (uint32_t)(in_len / 3 - 1) / NCOLS + 1; if (nrows > NROWS_MAX) { - ERROR("Input too large. Max input length is %d\n", 3 * NCOLS * NROWS_MAX); + ERROR("Input too large. Max input length is %d", 3 * NCOLS * NROWS_MAX); return -1; } K_p = nrows * NCOLS; @@ -84,7 +83,6 @@ int srslte_rm_conv_tx(uint8_t* input, uint32_t in_len, uint8_t* output, uint32_t */ int srslte_rm_conv_rx(float* input, uint32_t in_len, float* output, uint32_t out_len) { - int nrows, ndummy, K_p; int i, j, k; int d_i, d_j; @@ -93,7 +91,7 @@ int srslte_rm_conv_rx(float* input, uint32_t in_len, float* output, uint32_t out nrows = (uint32_t)(out_len / 3 - 1) / NCOLS + 1; if (nrows > NROWS_MAX) { - ERROR("Output too large. Max output length is %d\n", 3 * NCOLS * NROWS_MAX); + ERROR("Output too large. Max output length is %d", 3 * NCOLS * NROWS_MAX); return -1; } K_p = nrows * NCOLS; @@ -151,7 +149,6 @@ int srslte_rm_conv_rx(float* input, uint32_t in_len, float* output, uint32_t out */ int srslte_rm_conv_rx_s(int16_t* input, uint32_t in_len, int16_t* output, uint32_t out_len) { - int nrows, ndummy, K_p; int i, j, k; int d_i, d_j; @@ -160,7 +157,7 @@ int srslte_rm_conv_rx_s(int16_t* input, uint32_t in_len, int16_t* output, uint32 nrows = (uint32_t)(out_len / 3 - 1) / NCOLS + 1; if (nrows > NROWS_MAX) { - ERROR("Output too large. Max output length is %d\n", 3 * NCOLS * NROWS_MAX); + ERROR("Output too large. Max output length is %d", 3 * NCOLS * NROWS_MAX); return -1; } K_p = nrows * NCOLS; diff --git a/lib/src/phy/fec/turbo/rm_turbo.c b/lib/src/phy/fec/turbo/rm_turbo.c index d6ab3c87f..e94ddb5ef 100644 --- a/lib/src/phy/fec/turbo/rm_turbo.c +++ b/lib/src/phy/fec/turbo/rm_turbo.c @@ -84,7 +84,7 @@ int deinter_table_idx_from_sb_len(uint32_t nof_subblocks) } } if (nof_subblocks != 0) { - ERROR("Error number of sub-blocks %d not supported in RM\n", nof_subblocks); + ERROR("Error number of sub-blocks %d not supported in RM", nof_subblocks); } return -1; } @@ -95,7 +95,6 @@ static uint16_t temp_table1[3 * 6176], temp_table2[3 * 6176]; static void srslte_rm_turbo_gentable_systematic(uint16_t* table_bits, int k0_vec_[4][2], uint32_t nrows, int ndummy) { - bool last_is_null = true; int k_b = 0, buff_idx = 0; for (int j = 0; j < NCOLS; j++) { @@ -122,7 +121,6 @@ static void srslte_rm_turbo_gentable_systematic(uint16_t* table_bits, int k0_vec static void srslte_rm_turbo_gentable_parity(uint16_t* table_parity, int k0_vec_[4][2], int offset, uint16_t nrows, int ndummy) { - bool last_is_null = true; int k_b = 0, buff_idx0 = 0; int K_p = nrows * NCOLS; @@ -167,7 +165,6 @@ srslte_rm_turbo_gentable_parity(uint16_t* table_parity, int k0_vec_[4][2], int o static void srslte_rm_turbo_gentable_receive(uint16_t* table, uint32_t cb_len, uint32_t rv_idx) { - int nrows = (uint32_t)(cb_len / 3 - 1) / NCOLS + 1; int ndummy = nrows * NCOLS - cb_len / 3; if (ndummy < 0) { @@ -258,7 +255,6 @@ static void interleave_table_sb(uint16_t* in, uint16_t* out, uint32_t cb_idx, ui for (int i = 0; i < out_len; i++) { // Do not change tail bit order if (in[i] < 3 * long_cb) { - // align to 32 bytes (warning: must be same alignment as in rm_turbo.c) out[i] = (in[i] % 3) * (long_cb + 32) + inter(in[i] / 3, nof_sb); } else { @@ -346,14 +342,11 @@ int srslte_rm_turbo_tx_lut(uint8_t* w_buff, uint32_t w_offset, uint32_t rv_idx) { - if (rv_idx < 4 && cb_idx < SRSLTE_NOF_TC_CB_SIZES) { - int in_len = 3 * srslte_cbsegm_cbsize(cb_idx) + 12; /* Sub-block interleaver (5.1.4.1.1) and bit collection */ if (rv_idx == 0) { - // Systematic bits // srslte_bit_interleave(systematic, w_buff, interleaver_systematic_bits[cb_idx], in_len/3); srslte_bit_interleaver_run(&bit_interleavers_systematic_bits[cb_idx], systematic, w_buff, 0); @@ -405,9 +398,7 @@ int srslte_rm_turbo_rx_lut_(int16_t* input, uint32_t rv_idx, bool enable_input_tdec) { - if (rv_idx < 4 && cb_idx < SRSLTE_NOF_TC_CB_SIZES) { - #if SRSLTE_TDEC_EXPECT_INPUT_SB == 1 int cb_len = srslte_cbsegm_cbsize(cb_idx); int idx = deinter_table_idx_from_sb_len(srslte_tdec_autoimp_get_subblocks(cb_len)); @@ -417,7 +408,7 @@ int srslte_rm_turbo_rx_lut_(int16_t* input, } else if (idx < NOF_DEINTER_TABLE_SB_IDX) { deinter = deinterleaver_sb[idx][cb_idx][rv_idx]; } else { - ERROR("Sub-block size index %d not supported in srslte_rm_turbo_rx_lut()\n", idx); + ERROR("Sub-block size index %d not supported in srslte_rm_turbo_rx_lut()", idx); return -1; } #else @@ -447,7 +438,6 @@ int srslte_rm_turbo_rx_lut_(int16_t* input, int srslte_rm_turbo_rx_lut_8bit(int8_t* input, int8_t* output, uint32_t in_len, uint32_t cb_idx, uint32_t rv_idx) { if (rv_idx < 4 && cb_idx < SRSLTE_NOF_TC_CB_SIZES) { - #if SRSLTE_TDEC_EXPECT_INPUT_SB == 1 int cb_len = srslte_cbsegm_cbsize(cb_idx); int idx = deinter_table_idx_from_sb_len(srslte_tdec_autoimp_get_subblocks_8bit(cb_len)); @@ -457,7 +447,7 @@ int srslte_rm_turbo_rx_lut_8bit(int8_t* input, int8_t* output, uint32_t in_len, } else if (idx < NOF_DEINTER_TABLE_SB_IDX) { deinter = deinterleaver_sb[idx][cb_idx][rv_idx]; } else { - ERROR("Sub-block size index %d not supported in srslte_rm_turbo_rx_lut()\n", idx); + ERROR("Sub-block size index %d not supported in srslte_rm_turbo_rx_lut()", idx); return -1; } #else @@ -987,7 +977,6 @@ int srslte_rm_turbo_tx(uint8_t* w_buff, uint32_t out_len, uint32_t rv_idx) { - int ndummy, kidx; int nrows, K_p; @@ -1078,7 +1067,6 @@ int srslte_rm_turbo_rx(float* w_buff, uint32_t rv_idx, uint32_t nof_filler_bits) { - int nrows, ndummy, K_p, k0, N_cb, jp, kidx; int i, j, k; int d_i, d_j; @@ -1087,7 +1075,7 @@ int srslte_rm_turbo_rx(float* w_buff, nrows = (uint16_t)(out_len / 3 - 1) / NCOLS + 1; K_p = nrows * NCOLS; if (3 * K_p > w_buff_len) { - ERROR("Output too large. Max output length including dummy bits is %d (3x%dx32, in_len %d)\n", + ERROR("Output too large. Max output length including dummy bits is %d (3x%dx32, in_len %d)", w_buff_len, nrows, out_len); @@ -1095,7 +1083,7 @@ int srslte_rm_turbo_rx(float* w_buff, } if (out_len < 3) { - ERROR("Error minimum input length for rate matching is 3\n"); + ERROR("Error minimum input length for rate matching is 3"); return -1; } diff --git a/lib/src/phy/fec/turbo/tc_interl_lte.c b/lib/src/phy/fec/turbo/tc_interl_lte.c index 8fee00187..ebf80ee51 100644 --- a/lib/src/phy/fec/turbo/tc_interl_lte.c +++ b/lib/src/phy/fec/turbo/tc_interl_lte.c @@ -63,13 +63,13 @@ int srslte_tc_interl_LTE_gen_interl(srslte_tc_interl_t* h, uint32_t long_cb, uin uint64_t i, j; if (long_cb > h->max_long_cb) { - ERROR("Interleaver initiated for max_long_cb=%d\n", h->max_long_cb); + ERROR("Interleaver initiated for max_long_cb=%d", h->max_long_cb); return -1; } cb_table_idx = srslte_cbsegm_cbindex(long_cb); if (cb_table_idx == -1) { - ERROR("Can't find long_cb=%d in valid TC CB table\n", long_cb); + ERROR("Can't find long_cb=%d in valid TC CB table", long_cb); return -1; } diff --git a/lib/src/phy/fec/turbo/tc_interl_umts.c b/lib/src/phy/fec/turbo/tc_interl_umts.c index f569501e7..8eca86e26 100644 --- a/lib/src/phy/fec/turbo/tc_interl_umts.c +++ b/lib/src/phy/fec/turbo/tc_interl_umts.c @@ -88,7 +88,7 @@ int srslte_tc_interl_UMTS_gen(srslte_tc_interl_t* h, uint32_t long_cb) M_long = long_cb; if (long_cb > h->max_long_cb) { - ERROR("Interleaver initiated for max_long_cb=%d\n", h->max_long_cb); + ERROR("Interleaver initiated for max_long_cb=%d", h->max_long_cb); return -1; } diff --git a/lib/src/phy/fec/turbo/test/turbodecoder_test.c b/lib/src/phy/fec/turbo/test/turbodecoder_test.c index 399337b08..9538a1655 100644 --- a/lib/src/phy/fec/turbo/test/turbodecoder_test.c +++ b/lib/src/phy/fec/turbo/test/turbodecoder_test.c @@ -180,7 +180,7 @@ int main(int argc, char** argv) } if (srslte_tcod_init(&tcod, frame_length)) { - ERROR("Error initiating Turbo coder\n"); + ERROR("Error initiating Turbo coder"); exit(-1); } @@ -190,7 +190,7 @@ int main(int argc, char** argv) // tdec_type = SRSLTE_TDEC_SSE_WINDOW; #endif if (srslte_tdec_init_manual(&tdec, frame_length, tdec_type)) { - ERROR("Error initiating Turbo decoder\n"); + ERROR("Error initiating Turbo decoder"); exit(-1); } @@ -211,7 +211,6 @@ int main(int argc, char** argv) snr_points = 1; } for (i = 0; i < snr_points; i++) { - mean_usec = 0; errors = 0; frame_cnt = 0; diff --git a/lib/src/phy/fec/turbo/turbocoder.c b/lib/src/phy/fec/turbo/turbocoder.c index a1918a728..869e4c818 100644 --- a/lib/src/phy/fec/turbo/turbocoder.c +++ b/lib/src/phy/fec/turbo/turbocoder.c @@ -39,7 +39,6 @@ static bool table_initiated = false; int srslte_tcod_init(srslte_tcod_t* h, uint32_t max_long_cb) { - h->max_long_cb = max_long_cb; h->temp = srslte_vec_malloc(max_long_cb / 8); @@ -68,7 +67,6 @@ void srslte_tcod_free(srslte_tcod_t* h) /* Expects bits (1 byte = 1 bit) and produces bits. The systematic and parity bits are interlaced in the output */ int srslte_tcod_encode(srslte_tcod_t* h, uint8_t* input, uint8_t* output, uint32_t long_cb) { - uint8_t reg1_0, reg1_1, reg1_2, reg2_0, reg2_1, reg2_2; uint32_t i, k = 0, j; uint8_t bit; @@ -76,13 +74,13 @@ int srslte_tcod_encode(srslte_tcod_t* h, uint8_t* input, uint8_t* output, uint32 uint16_t* per; if (long_cb > h->max_long_cb) { - ERROR("Turbo coder initiated for max_long_cb=%d\n", h->max_long_cb); + ERROR("Turbo coder initiated for max_long_cb=%d", h->max_long_cb); return -1; } int longcb_idx = srslte_cbsegm_cbindex(long_cb); if (longcb_idx < 0) { - ERROR("Invalid CB size %d\n", long_cb); + ERROR("Invalid CB size %d", long_cb); return -1; } @@ -190,7 +188,7 @@ int srslte_tcod_encode_lut(srslte_tcod_t* h, uint32_t long_cb = (uint32_t)srslte_cbsegm_cbsize(cblen_idx); if (long_cb % 8) { - ERROR("Turbo coder LUT implementation long_cb must be multiple of 8\n"); + ERROR("Turbo coder LUT implementation long_cb must be multiple of 8"); return -1; } @@ -367,14 +365,14 @@ void srslte_tcod_gentable() srslte_tc_interl_t interl; if (srslte_tc_interl_init(&interl, 6144)) { - ERROR("Error initiating interleave\n"); + ERROR("Error initiating interleave"); return; } for (uint32_t len = 0; len < 188; len++) { uint32_t long_cb = srslte_cbsegm_cbsize(len); if (srslte_tc_interl_LTE_gen(&interl, long_cb)) { - ERROR("Error initiating TC interleaver for long_cb=%d\n", long_cb); + ERROR("Error initiating TC interleaver for long_cb=%d", long_cb); return; } // Save fw/bw permutation tables @@ -389,7 +387,6 @@ void srslte_tcod_gentable() // Compute state transitions for (uint32_t state = 0; state < 8; state++) { for (uint32_t data = 0; data < 256; data++) { - uint8_t reg_0, reg_1, reg_2; reg_0 = (state & 4) >> 2; reg_1 = (state & 2) >> 1; diff --git a/lib/src/phy/fec/turbo/turbodecoder.c b/lib/src/phy/fec/turbo/turbodecoder.c index 5d9ecce1d..2d5424aee 100644 --- a/lib/src/phy/fec/turbo/turbodecoder.c +++ b/lib/src/phy/fec/turbo/turbodecoder.c @@ -187,7 +187,7 @@ int srslte_tdec_init_manual(srslte_tdec_t* h, uint32_t max_long_cb, srslte_tdec_ break; #endif /* LV_HAVE_AVX2 */ default: - ERROR("Error decoder %d not supported\n", dec_type); + ERROR("Error decoder %d not supported", dec_type); goto clean_and_exit; } @@ -394,7 +394,7 @@ static int tdec_sb_idx(uint32_t long_cb) case 0: return AUTO_16_SSE; } - ERROR("Error in tdec_sb_idx() invalid nof_sb=%d\n", nof_sb); + ERROR("Error in tdec_sb_idx() invalid nof_sb=%d", nof_sb); return 0; } @@ -427,7 +427,7 @@ static int tdec_sb_idx_8(uint32_t long_cb) case 0: return 10 + AUTO_16_SSE; } - ERROR("Error in tdec_sb_idx_8() invalid nof_sb=%d\n", nof_sb); + ERROR("Error in tdec_sb_idx_8() invalid nof_sb=%d", nof_sb); return 0; } @@ -486,7 +486,6 @@ static void tdec_iteration_16(srslte_tdec_t* h, int16_t* input) h->current_inter_idx = interleaver_idx(h->nof_blocks16[h->current_dec]); if (h->current_llr_type == SRSLTE_TDEC_8) { - h->current_inter_idx = interleaver_idx(h->nof_blocks8[h->current_dec]); if (!h->n_iter) { @@ -502,7 +501,7 @@ static void tdec_iteration_16(srslte_tdec_t* h, int16_t* input) int srslte_tdec_new_cb(srslte_tdec_t* h, uint32_t long_cb) { if (long_cb > h->max_long_cb) { - ERROR("TDEC was initialized for max_long_cb=%d\n", h->max_long_cb); + ERROR("TDEC was initialized for max_long_cb=%d", h->max_long_cb); return -1; } @@ -510,7 +509,7 @@ int srslte_tdec_new_cb(srslte_tdec_t* h, uint32_t long_cb) h->current_long_cb = long_cb; h->current_cbidx = srslte_cbsegm_cbindex(long_cb); if (h->current_cbidx < 0) { - ERROR("Invalid CB length %d\n", long_cb); + ERROR("Invalid CB length %d", long_cb); return -1; } return 0; diff --git a/lib/src/phy/mimo/layermap.c b/lib/src/phy/mimo/layermap.c index 99e8a0769..a975c2646 100644 --- a/lib/src/phy/mimo/layermap.c +++ b/lib/src/phy/mimo/layermap.c @@ -55,13 +55,12 @@ int srslte_layermap_multiplex(cf_t* d[SRSLTE_MAX_CODEWORDS], n[0] = nof_layers / nof_cw; n[1] = nof_layers - n[0]; if (nof_symbols[0] / n[0] == nof_symbols[1] / n[1]) { - srslte_layermap_diversity(d[0], x, n[0], nof_symbols[0]); srslte_layermap_diversity(d[1], &x[n[0]], n[1], nof_symbols[1]); return nof_symbols[0] / n[0]; } else { - ERROR("Number of symbols in codewords 0 and 1 is not consistent (%d, %d)\n", nof_symbols[0], nof_symbols[1]); + ERROR("Number of symbols in codewords 0 and 1 is not consistent (%d, %d)", nof_symbols[0], nof_symbols[1]); return -1; } } @@ -79,17 +78,16 @@ int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS], int nof_symbols[SRSLTE_MAX_CODEWORDS], srslte_tx_scheme_t type) { - if (nof_cw > SRSLTE_MAX_CODEWORDS) { - ERROR("Maximum number of codewords is %d (nof_cw=%d)\n", SRSLTE_MAX_CODEWORDS, nof_cw); + ERROR("Maximum number of codewords is %d (nof_cw=%d)", SRSLTE_MAX_CODEWORDS, nof_cw); return -1; } if (nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("Maximum number of layers is %d (nof_layers=%d)\n", SRSLTE_MAX_LAYERS, nof_layers); + ERROR("Maximum number of layers is %d (nof_layers=%d)", SRSLTE_MAX_LAYERS, nof_layers); return -1; } if (nof_layers < nof_cw) { - ERROR("Number of codewords must be lower or equal than number of layers\n"); + ERROR("Number of codewords must be lower or equal than number of layers"); return -1; } @@ -98,7 +96,7 @@ int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS], if (nof_cw == 1 && nof_layers == 1) { return srslte_layermap_single(d[0], x[0], nof_symbols[0]); } else { - ERROR("Number of codewords and layers must be 1 for transmission on single antenna ports\n"); + ERROR("Number of codewords and layers must be 1 for transmission on single antenna ports"); return -1; } break; @@ -107,11 +105,11 @@ int srslte_layermap_type(cf_t* d[SRSLTE_MAX_CODEWORDS], if (nof_layers == 2 || nof_layers == 4) { return srslte_layermap_diversity(d[0], x, nof_layers, nof_symbols[0]); } else { - ERROR("Number of layers must be 2 or 4 for transmit diversity\n"); + ERROR("Number of layers must be 2 or 4 for transmit diversity"); return -1; } } else { - ERROR("Number of codewords must be 1 for transmit diversity\n"); + ERROR("Number of codewords must be 1 for transmit diversity"); return -1; } break; @@ -174,17 +172,16 @@ int srslte_layerdemap_type(cf_t* x[SRSLTE_MAX_LAYERS], int nof_symbols[SRSLTE_MAX_CODEWORDS], srslte_tx_scheme_t type) { - if (nof_cw > SRSLTE_MAX_CODEWORDS) { - ERROR("Maximum number of codewords is %d (nof_cw=%d)\n", SRSLTE_MAX_CODEWORDS, nof_cw); + ERROR("Maximum number of codewords is %d (nof_cw=%d)", SRSLTE_MAX_CODEWORDS, nof_cw); return -1; } if (nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("Maximum number of layers is %d (nof_layers=%d)\n", SRSLTE_MAX_LAYERS, nof_layers); + ERROR("Maximum number of layers is %d (nof_layers=%d)", SRSLTE_MAX_LAYERS, nof_layers); return -1; } if (nof_layers < nof_cw) { - ERROR("Number of codewords must be lower or equal than number of layers\n"); + ERROR("Number of codewords must be lower or equal than number of layers"); return -1; } @@ -194,7 +191,7 @@ int srslte_layerdemap_type(cf_t* x[SRSLTE_MAX_LAYERS], nof_symbols[0] = srslte_layerdemap_single(x[0], d[0], nof_layer_symbols); nof_symbols[1] = 0; } else { - ERROR("Number of codewords and layers must be 1 for transmission on single antenna ports\n"); + ERROR("Number of codewords and layers must be 1 for transmission on single antenna ports"); return -1; } break; @@ -204,11 +201,11 @@ int srslte_layerdemap_type(cf_t* x[SRSLTE_MAX_LAYERS], nof_symbols[0] = srslte_layerdemap_diversity(x, d[0], nof_layers, nof_layer_symbols); nof_symbols[1] = 0; } else { - ERROR("Number of layers must be 2 or 4 for transmit diversity\n"); + ERROR("Number of layers must be 2 or 4 for transmit diversity"); return -1; } } else { - ERROR("Number of codewords must be 1 for transmit diversity\n"); + ERROR("Number of codewords must be 1 for transmit diversity"); return -1; } break; @@ -249,7 +246,7 @@ int srslte_layermap_nr(cf_t** d, int nof_cw, cf_t** x, int nof_layers, uint32_t return SRSLTE_SUCCESS; } - ERROR("Error. Incompatible number of layers (%d) and codewords (%d)\n", nof_layers, nof_cw); + ERROR("Error. Incompatible number of layers (%d) and codewords (%d)", nof_layers, nof_cw); return SRSLTE_ERROR; } @@ -282,6 +279,6 @@ int srslte_layerdemap_nr(cf_t** d, int nof_cw, cf_t** x, int nof_layers, uint32_ return SRSLTE_SUCCESS; } - ERROR("Error. Incompatible number of layers (%d) and codewords (%d)\n", nof_layers, nof_cw); + ERROR("Error. Incompatible number of layers (%d) and codewords (%d)", nof_layers, nof_cw); return SRSLTE_ERROR; } diff --git a/lib/src/phy/mimo/precoding.c b/lib/src/phy/mimo/precoding.c index 9961cd256..d0202c976 100644 --- a/lib/src/phy/mimo/precoding.c +++ b/lib/src/phy/mimo/precoding.c @@ -72,7 +72,6 @@ int srslte_predecoding_single_sse(cf_t* y[SRSLTE_MAX_PORTS], float scaling, float noise_estimate) { - float* xPtr = (float*)x; const float* hPtr1 = (const float*)h[0]; const float* yPtr1 = (const float*)y[0]; @@ -179,7 +178,6 @@ int srslte_predecoding_single_avx(cf_t* y[SRSLTE_MAX_PORTS], float scaling, float noise_estimate) { - float* xPtr = (float*)x; const float* hPtr1 = (const float*)h[0]; const float* yPtr1 = (const float*)y[0]; @@ -355,7 +353,6 @@ int srslte_predecoding_single(cf_t* y_, float scaling, float noise_estimate) { - cf_t* y[SRSLTE_MAX_PORTS]; cf_t* h[SRSLTE_MAX_PORTS]; y[0] = y_; @@ -491,7 +488,7 @@ int srslte_predecoding_diversity_gen_(cf_t* y[SRSLTE_MAX_PORTS], } return i; } else { - ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); + ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)", nof_ports); return -1; } } @@ -536,7 +533,6 @@ int srslte_predecoding_diversity2_sse(cf_t* y[SRSLTE_MAX_PORTS], __m128 x0, x1; for (int i = 0; i < nof_symbols / 4; i++) { - h0Val_00 = _mm_load_ps(h0Ptr0); h0Ptr0 += 4; h0Val_10 = _mm_load_ps(h0Ptr0); @@ -767,7 +763,7 @@ int srslte_predecoding_diversity_csi(cf_t* y[SRSLTE_MAX_PORTS], } return i; } else { - ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); + ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)", nof_ports); return -1; } } @@ -804,11 +800,9 @@ int srslte_precoding_mimo_2x2_gen(cf_t W[2][2], float scaling, float noise_estimate) { - cf_t G[2][2], Gx[2][2]; for (int i = 0; i < nof_symbols; i++) { - // G=H*W G[0][0] = h[0][0][i] * W[0][0] + h[0][1][i] * W[1][0]; G[0][1] = h[0][0][i] * W[1][0] + h[0][1][i] * W[1][1]; @@ -823,7 +817,7 @@ int srslte_precoding_mimo_2x2_gen(cf_t W[2][2], Gx[1][1] = conjf(G[1][1]); } else { // MMSE equalizer: Gx = (G'G+I) - ERROR("MMSE MIMO decoder not implemented\n"); + ERROR("MMSE MIMO decoder not implemented"); return -1; } @@ -894,7 +888,6 @@ static int srslte_predecoding_ccd_2x2_zf_csi(cf_t* y[SRSLTE_MAX_PORTS], cf_t h00, h01, h10, h11, det; for (; i < nof_symbols; i++) { - // Even precoder h00 = +h[0][0][i] + h[1][0][i]; h10 = +h[0][1][i] + h[1][1][i]; @@ -982,7 +975,6 @@ static int srslte_predecoding_ccd_2x2_zf(cf_t* y[SRSLTE_MAX_PORTS], cf_t h00, h01, h10, h11, det; for (; i < nof_symbols; i++) { - // Even precoder h00 = +h[0][0][i] + h[1][0][i]; h10 = +h[0][1][i] + h[1][1][i]; @@ -1028,13 +1020,13 @@ static int srslte_predecoding_ccd_zf(cf_t* y[SRSLTE_MAX_PORTS], return srslte_predecoding_ccd_2x2_zf(y, h, x, nof_symbols, scaling); } } else { - ERROR("Error predecoding CCD: Invalid number of layers %d\n", nof_layers); + ERROR("Error predecoding CCD: Invalid number of layers %d", nof_layers); return -1; } } else if (nof_ports == 4) { - ERROR("Error predecoding CCD: Only 2 ports supported\n"); + ERROR("Error predecoding CCD: Only 2 ports supported"); } else { - ERROR("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); + ERROR("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -1099,7 +1091,6 @@ static int srslte_predecoding_ccd_2x2_mmse_csi(cf_t* y[SRSLTE_MAX_PORTS], cf_t h00, h01, h10, h11; for (; i < nof_symbols; i++) { - // Even precoder h00 = +h[0][0][i] + h[1][0][i]; h10 = +h[0][1][i] + h[1][1][i]; @@ -1174,7 +1165,6 @@ static int srslte_predecoding_ccd_2x2_mmse(cf_t* y[SRSLTE_MAX_PORTS], cf_t h00, h01, h10, h11; for (; i < nof_symbols; i++) { - // Even precoder h00 = +h[0][0][i] + h[1][0][i]; h10 = +h[0][1][i] + h[1][1][i]; @@ -1213,13 +1203,13 @@ int srslte_predecoding_ccd_mmse(cf_t* y[SRSLTE_MAX_PORTS], return srslte_predecoding_ccd_2x2_mmse(y, h, x, nof_symbols, scaling, noise_estimate); } } else { - ERROR("Error predecoding CCD: Invalid number of layers %d\n", nof_layers); + ERROR("Error predecoding CCD: Invalid number of layers %d", nof_layers); return -1; } } else if (nof_ports == 4) { - ERROR("Error predecoding CCD: Only 2 ports supported\n"); + ERROR("Error predecoding CCD: Only 2 ports supported"); } else { - ERROR("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); + ERROR("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -1276,7 +1266,7 @@ static int srslte_predecoding_multiplex_2x2_zf_csi(cf_t* y[SRSLTE_MAX_PORTS], h11 = srslte_simd_cf_sub(h01i, srslte_simd_cf_mulj(h11i)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1318,7 +1308,7 @@ static int srslte_predecoding_multiplex_2x2_zf_csi(cf_t* y[SRSLTE_MAX_PORTS], h11 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1386,7 +1376,7 @@ static int srslte_predecoding_multiplex_2x2_zf(cf_t* y[SRSLTE_MAX_PORTS], h11 = srslte_simd_cf_sub(h01i, srslte_simd_cf_mulj(h11i)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1425,7 +1415,7 @@ static int srslte_predecoding_multiplex_2x2_zf(cf_t* y[SRSLTE_MAX_PORTS], h11 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1488,7 +1478,7 @@ static int srslte_predecoding_multiplex_2x2_mmse_csi(cf_t* y[SRSLTE_MAX_PORTS], h11 = srslte_simd_cf_sub(h01i, srslte_simd_cf_mulj(h11i)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1530,7 +1520,7 @@ static int srslte_predecoding_multiplex_2x2_mmse_csi(cf_t* y[SRSLTE_MAX_PORTS], h11 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1592,7 +1582,7 @@ static int srslte_predecoding_multiplex_2x2_mmse(cf_t* y[SRSLTE_MAX_PORTS], h11 = srslte_simd_cf_sub(h01i, srslte_simd_cf_mulj(h11i)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1631,7 +1621,7 @@ static int srslte_predecoding_multiplex_2x2_mmse(cf_t* y[SRSLTE_MAX_PORTS], h11 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1678,7 +1668,7 @@ static int srslte_predecoding_multiplex_2x1_mrc(cf_t* y[SRSLTE_MAX_PORTS], hx = srslte_simd_cf_sub(h0xi, srslte_simd_cf_mulj(h1xi)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1713,7 +1703,7 @@ static int srslte_predecoding_multiplex_2x1_mrc(cf_t* y[SRSLTE_MAX_PORTS], h1 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1763,7 +1753,7 @@ static int srslte_predecoding_multiplex_2x1_mrc_csi(cf_t* y[SRSLTE_MAX_PORTS], hx = srslte_simd_cf_sub(h0xi, srslte_simd_cf_mulj(h1xi)); break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1799,7 +1789,7 @@ static int srslte_predecoding_multiplex_2x1_mrc_csi(cf_t* y[SRSLTE_MAX_PORTS], h1 = h[0][1][i] - _Complex_I * h[1][1][i]; break; default: - ERROR("Wrong codebook_idx=%d\n", codebook_idx); + ERROR("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -1853,7 +1843,7 @@ static int srslte_predecoding_multiplex(cf_t* y[SRSLTE_MAX_PORTS], } else if (nof_ports == 4) { ERROR("Error predecoding multiplex: not implemented for %d Tx ports", nof_ports); } else { - ERROR("Error predecoding multiplex: Invalid combination of ports %d and rx antennas %d\n", nof_ports, nof_rxant); + ERROR("Error predecoding multiplex: Invalid combination of ports %d and rx antennas %d", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -1877,13 +1867,12 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS], float scaling, float noise_estimate) { - if (nof_ports > SRSLTE_MAX_PORTS) { - ERROR("Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS, nof_ports); + ERROR("Maximum number of ports is %d (nof_ports=%d)", SRSLTE_MAX_PORTS, nof_ports); return SRSLTE_ERROR; } if (nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("Maximum number of layers is %d (nof_layers=%d)\n", SRSLTE_MAX_LAYERS, nof_layers); + ERROR("Maximum number of layers is %d (nof_layers=%d)", SRSLTE_MAX_LAYERS, nof_layers); return SRSLTE_ERROR; } @@ -1898,7 +1887,7 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS], y, h, x, csi, nof_rxant, nof_ports, nof_layers, nof_symbols, scaling, noise_estimate); } } else { - ERROR("Invalid number of layers %d\n", nof_layers); + ERROR("Invalid number of layers %d", nof_layers); return SRSLTE_ERROR; } return SRSLTE_ERROR; @@ -1906,7 +1895,7 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS], if (nof_ports == 1 && nof_layers == 1) { return srslte_predecoding_single_multi(y, h[0], x[0], csi, nof_rxant, nof_symbols, scaling, noise_estimate); } else { - ERROR("Number of ports and layers must be 1 for transmission on single antenna ports (%d, %d)\n", + ERROR("Number of ports and layers must be 1 for transmission on single antenna ports (%d, %d)", nof_ports, nof_layers); return SRSLTE_ERROR; @@ -1915,14 +1904,14 @@ int srslte_predecoding_type(cf_t* y[SRSLTE_MAX_PORTS], if (nof_ports == nof_layers) { return srslte_predecoding_diversity_multi(y, h, x, csi, nof_rxant, nof_ports, nof_symbols, scaling); } else { - ERROR("Error number of layers must equal number of ports in transmit diversity\n"); + ERROR("Error number of layers must equal number of ports in transmit diversity"); return SRSLTE_ERROR; } case SRSLTE_TXSCHEME_SPATIALMUX: return srslte_predecoding_multiplex( y, h, x, csi, nof_rxant, nof_ports, nof_layers, codebook_idx, nof_symbols, scaling, noise_estimate); default: - ERROR("Invalid Txscheme=%d\n", type); + ERROR("Invalid Txscheme=%d", type); return SRSLTE_ERROR; } } @@ -1988,7 +1977,7 @@ int srslte_precoding_diversity(cf_t* x[SRSLTE_MAX_LAYERS], } return 4 * i; } else { - ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); + ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)", nof_ports); return -1; } } @@ -2065,7 +2054,7 @@ int srslte_precoding_cdd(cf_t* x[SRSLTE_MAX_LAYERS], { if (nof_ports == 2) { if (nof_layers != 2) { - ERROR("Invalid number of layers %d for 2 ports\n", nof_layers); + ERROR("Invalid number of layers %d for 2 ports", nof_layers); return -1; } #ifdef LV_HAVE_AVX @@ -2078,10 +2067,10 @@ int srslte_precoding_cdd(cf_t* x[SRSLTE_MAX_LAYERS], #endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_AVX */ } else if (nof_ports == 4) { - ERROR("Not implemented\n"); + ERROR("Not implemented"); return -1; } else { - ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); + ERROR("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)", nof_ports); return -1; } } @@ -2116,7 +2105,7 @@ int srslte_precoding_multiplex(cf_t* x[SRSLTE_MAX_LAYERS], srslte_vec_sc_prod_ccc(x[0], -_Complex_I * scaling, y[1], nof_symbols); break; default: - ERROR("Invalid multiplex combination: codebook_idx=%d, nof_layers=%d, nof_ports=%d\n", + ERROR("Invalid multiplex combination: codebook_idx=%d, nof_layers=%d, nof_ports=%d", codebook_idx, nof_layers, nof_ports); @@ -2197,7 +2186,7 @@ int srslte_precoding_multiplex(cf_t* x[SRSLTE_MAX_LAYERS], break; case 3: default: - ERROR("Invalid multiplex combination: codebook_idx=%d, nof_layers=%d, nof_ports=%d\n", + ERROR("Invalid multiplex combination: codebook_idx=%d, nof_layers=%d, nof_ports=%d", codebook_idx, nof_layers, nof_ports); @@ -2222,13 +2211,12 @@ int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS], float scaling, srslte_tx_scheme_t type) { - if (nof_ports > SRSLTE_MAX_PORTS) { - ERROR("Maximum number of ports is %d (nof_ports=%d)\n", SRSLTE_MAX_PORTS, nof_ports); + ERROR("Maximum number of ports is %d (nof_ports=%d)", SRSLTE_MAX_PORTS, nof_ports); return -1; } if (nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("Maximum number of layers is %d (nof_layers=%d)\n", SRSLTE_MAX_LAYERS, nof_layers); + ERROR("Maximum number of layers is %d (nof_layers=%d)", SRSLTE_MAX_LAYERS, nof_layers); return -1; } @@ -2239,7 +2227,7 @@ int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS], if (nof_ports == 1 && nof_layers == 1) { return srslte_precoding_single(x[0], y[0], nof_symbols, scaling); } else { - ERROR("Number of ports and layers must be 1 for transmission on single antenna ports\n"); + ERROR("Number of ports and layers must be 1 for transmission on single antenna ports"); return -1; } break; @@ -2247,7 +2235,7 @@ int srslte_precoding_type(cf_t* x[SRSLTE_MAX_LAYERS], if (nof_ports == nof_layers) { return srslte_precoding_diversity(x, y, nof_ports, nof_symbols, scaling); } else { - ERROR("Error number of layers must equal number of ports in transmit diversity\n"); + ERROR("Error number of layers must equal number of ports in transmit diversity"); return -1; } case SRSLTE_TXSCHEME_SPATIALMUX: @@ -2267,7 +2255,6 @@ int srslte_precoding_pmi_select_1l_gen(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_ uint32_t* pmi, float sinr_list[SRSLTE_MAX_CODEBOOKS]) { - #define SQRT1_2 ((float)M_SQRT1_2) float max_sinr = 0.0; uint32_t i, count; @@ -2482,7 +2469,7 @@ int srslte_precoding_pmi_select_1l(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT #else ret = srslte_precoding_pmi_select_1l_gen(h, nof_symbols, noise_estimate, pmi, sinr_list); #endif /* SRSLTE_SIMD_CF_SIZE != 0 */ - INFO("Precoder PMI Select for 1 layer SINR=[%.1fdB; %.1fdB; %.1fdB; %.1fdB] PMI=%d\n", + INFO("Precoder PMI Select for 1 layer SINR=[%.1fdB; %.1fdB; %.1fdB; %.1fdB] PMI=%d", srslte_convert_power_to_dB(sinr_list[0]), srslte_convert_power_to_dB(sinr_list[1]), srslte_convert_power_to_dB(sinr_list[2]), @@ -2498,7 +2485,6 @@ int srslte_precoding_pmi_select_2l_gen(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_ uint32_t* pmi, float sinr_list[SRSLTE_MAX_CODEBOOKS]) { - float max_sinr = 0.0; uint32_t i, count; @@ -2758,7 +2744,6 @@ int srslte_precoding_pmi_select_2l(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT uint32_t* pmi, float sinr_list[SRSLTE_MAX_CODEBOOKS]) { - int ret; #if SRSLTE_SIMD_CF_SIZE != 0 ret = srslte_precoding_pmi_select_2l_simd(h, nof_symbols, noise_estimate, pmi, sinr_list); @@ -2766,7 +2751,7 @@ int srslte_precoding_pmi_select_2l(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT ret = srslte_precoding_pmi_select_2l_gen(h, nof_symbols, noise_estimate, pmi, sinr_list); #endif /* SRSLTE_SIMD_CF_SIZE != 0 */ - INFO("Precoder PMI Select for 2 layers SINR=[%.1fdB; %.1fdB] PMI=%d\n", + INFO("Precoder PMI Select for 2 layers SINR=[%.1fdB; %.1fdB] PMI=%d", srslte_convert_power_to_dB(sinr_list[0]), srslte_convert_power_to_dB(sinr_list[1]), *pmi); @@ -2839,7 +2824,7 @@ int srslte_precoding_cn(cf_t* h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], *cn = srslte_precoding_2x2_cn_gen(h, nof_symbols); return SRSLTE_SUCCESS; } else { - ERROR("MIMO Condition Number calculation not implemented for %d×%d\n", nof_tx_antennas, nof_rx_antennas); + ERROR("MIMO Condition Number calculation not implemented for %d×%d", nof_tx_antennas, nof_rx_antennas); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/mimo/test/layermap_test.c b/lib/src/phy/mimo/test/layermap_test.c index 1510be6d4..83e2ac486 100644 --- a/lib/src/phy/mimo/test/layermap_test.c +++ b/lib/src/phy/mimo/test/layermap_test.c @@ -77,7 +77,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (srslte_str2mimotype(mimo_type_name, &type)) { - ERROR("Invalid MIMO type %s\n", mimo_type_name); + ERROR("Invalid MIMO type %s", mimo_type_name); exit(-1); } @@ -120,13 +120,13 @@ int main(int argc, char** argv) /* layer mapping */ if ((symbols_layer = srslte_layermap_type(d, x, nof_cw, nof_layers, nof_symb_cw, type)) < 0) { - ERROR("Error layer mapper encoder\n"); + ERROR("Error layer mapper encoder"); exit(-1); } /* layer de-mapping */ if (srslte_layerdemap_type(x, dp, nof_layers, nof_cw, nof_symbols / nof_layers, nof_symb_cw, type) < 0) { - ERROR("Error layer mapper encoder\n"); + ERROR("Error layer mapper encoder"); exit(-1); } diff --git a/lib/src/phy/mimo/test/pmi_select_test.c b/lib/src/phy/mimo/test/pmi_select_test.c index 63732ba59..1f56aa325 100644 --- a/lib/src/phy/mimo/test/pmi_select_test.c +++ b/lib/src/phy/mimo/test/pmi_select_test.c @@ -81,7 +81,7 @@ int main(int argc, char** argv) } if (err > 0.1f) { - ERROR("Test case %d failed computing 1 layer SINR for codebook %d (test=%.2f; gold=%.2f)\n", + ERROR("Test case %d failed computing 1 layer SINR for codebook %d (test=%.2f; gold=%.2f)", c + 1, i, sinr_1l[i], @@ -92,7 +92,7 @@ int main(int argc, char** argv) /* Check PMI select for 1 layer*/ if (pmi[0] != gold->pmi[0]) { - ERROR("Test case %d failed computing 1 layer PMI (test=%d; gold=%d)\n", c + 1, pmi[0], gold->pmi[0]); + ERROR("Test case %d failed computing 1 layer PMI (test=%d; gold=%d)", c + 1, pmi[0], gold->pmi[0]); goto clean; } @@ -113,7 +113,7 @@ int main(int argc, char** argv) } if (err > 0.1f) { - ERROR("Test case %d failed computing 2 layer SINR for codebook %d (test=%.2f; gold=%.2f)\n", + ERROR("Test case %d failed computing 2 layer SINR for codebook %d (test=%.2f; gold=%.2f)", c + 1, i, sinr_2l[i], @@ -124,19 +124,19 @@ int main(int argc, char** argv) /* Check PMI select for 2 layer*/ if (pmi[1] != gold->pmi[1]) { - ERROR("Test case %d failed computing 2 layer PMI (test=%d; gold=%d)\n", c + 1, pmi[1], gold->pmi[1]); + ERROR("Test case %d failed computing 2 layer PMI (test=%d; gold=%d)", c + 1, pmi[1], gold->pmi[1]); goto clean; } /* Condition number */ if (srslte_precoding_cn(h, 2, 2, nof_symbols, &cn)) { - ERROR("Test case %d condition number returned error\n", c + 1); + ERROR("Test case %d condition number returned error", c + 1); goto clean; } /* Check condition number */ if (fabsf(gold->k - cn) > 0.1) { - ERROR("Test case %d failed computing condition number (test=%.2f; gold=%.2f)\n", c + 1, cn, gold->k); + ERROR("Test case %d failed computing condition number (test=%.2f; gold=%.2f)", c + 1, cn, gold->k); goto clean; } } diff --git a/lib/src/phy/mimo/test/precoder_test.c b/lib/src/phy/mimo/test/precoder_test.c index 7fe56a585..38f8a0971 100644 --- a/lib/src/phy/mimo/test/precoder_test.c +++ b/lib/src/phy/mimo/test/precoder_test.c @@ -173,13 +173,13 @@ int main(int argc, char** argv) /* Check input ranges */ if (nof_tx_ports > SRSLTE_MAX_PORTS || nof_rx_ports > SRSLTE_MAX_PORTS || nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("Invalid number of layers or ports\n"); + ERROR("Invalid number of layers or ports"); exit(-1); } /* Parse MIMO Type */ if (srslte_str2mimotype(mimo_type_name, &type)) { - ERROR("Invalid MIMO type %s\n", mimo_type_name); + ERROR("Invalid MIMO type %s", mimo_type_name); exit(-1); } @@ -194,7 +194,7 @@ int main(int argc, char** argv) case SRSLTE_TXSCHEME_CDD: nof_re = nof_symbols * nof_tx_ports / nof_layers; if (nof_rx_ports != 2 || nof_tx_ports != 2) { - ERROR("CDD nof_tx_ports=%d nof_rx_ports=%d is not currently supported\n", nof_tx_ports, nof_rx_ports); + ERROR("CDD nof_tx_ports=%d nof_rx_ports=%d is not currently supported", nof_tx_ports, nof_rx_ports); exit(-1); } break; @@ -259,7 +259,7 @@ int main(int argc, char** argv) /* Execute Precoding (Tx) */ if (srslte_precoding_type(x, y, nof_layers, nof_tx_ports, codebook_idx, nof_symbols, scaling, type) < 0) { - ERROR("Error layer mapper encoder\n"); + ERROR("Error layer mapper encoder"); exit(-1); } diff --git a/lib/src/phy/modem/demod_soft.c b/lib/src/phy/modem/demod_soft.c index 243b9ad51..3048a0d82 100644 --- a/lib/src/phy/modem/demod_soft.c +++ b/lib/src/phy/modem/demod_soft.c @@ -214,7 +214,6 @@ void demod_16qam_lte_b_neon(const cf_t* symbols, int8_t* llr, int nsymbols) result1n = vdupq_n_s8(0); result2n = vdupq_n_s8(0); for (int i = 0; i < nsymbols / 8; i++) { - symbol1 = vld1q_f32(symbolsPtr); symbolsPtr += 4; symbol2 = vld1q_f32(symbolsPtr); @@ -448,7 +447,6 @@ void demod_64qam_lte_s_neon(const cf_t* symbols, short* llr, int nsymbols) int16x8_t result31 = vdupq_n_s16(0); for (int i = 0; i < nsymbols / 4; i++) { - symbol1 = vld1q_f32(symbolsPtr); symbolsPtr += 4; symbol2 = vld1q_f32(symbolsPtr); @@ -511,7 +509,6 @@ void demod_64qam_lte_b_neon(const cf_t* symbols, int8_t* llr, int nsymbols) int8x16_t result31 = vdupq_n_s8(0); for (int i = 0; i < nsymbols / 8; i++) { - symbol1 = vld1q_f32(symbolsPtr); symbolsPtr += 4; symbol2 = vld1q_f32(symbolsPtr); @@ -878,7 +875,7 @@ int srslte_demod_soft_demodulate(srslte_mod_t modulation, const cf_t* symbols, f demod_256qam_lte(symbols, llr, nsymbols); break; default: - ERROR("Invalid modulation %d\n", modulation); + ERROR("Invalid modulation %d", modulation); return -1; } return 0; @@ -903,7 +900,7 @@ int srslte_demod_soft_demodulate_s(srslte_mod_t modulation, const cf_t* symbols, demod_256qam_lte_s(symbols, llr, nsymbols); break; default: - ERROR("Invalid modulation %d\n", modulation); + ERROR("Invalid modulation %d", modulation); return -1; } return 0; @@ -928,7 +925,7 @@ int srslte_demod_soft_demodulate_b(srslte_mod_t modulation, const cf_t* symbols, demod_256qam_lte_b(symbols, llr, nsymbols); break; default: - ERROR("Invalid modulation %d\n", modulation); + ERROR("Invalid modulation %d", modulation); return -1; } return 0; diff --git a/lib/src/phy/modem/mod.c b/lib/src/phy/modem/mod.c index 4326bbeb3..7fd445386 100644 --- a/lib/src/phy/modem/mod.c +++ b/lib/src/phy/modem/mod.c @@ -125,13 +125,12 @@ static void mod_256qam_bytes(const srslte_modem_table_t* q, const uint8_t* bits, /* Assumes packet bits as input */ int srslte_mod_modulate_bytes(const srslte_modem_table_t* q, const uint8_t* bits, cf_t* symbols, uint32_t nbits) { - if (!q->byte_tables_init) { - ERROR("Error need to initiated modem tables for packeted bits before calling srslte_mod_modulate_bytes()\n"); + ERROR("Error need to initiated modem tables for packeted bits before calling srslte_mod_modulate_bytes()"); return SRSLTE_ERROR; } if (nbits % q->nbits_x_symbol) { - ERROR("Error modulator expects number of bits (%d) to be multiple of %d\n", nbits, q->nbits_x_symbol); + ERROR("Error modulator expects number of bits (%d) to be multiple of %d", nbits, q->nbits_x_symbol); return -1; } switch (q->nbits_x_symbol) { @@ -151,7 +150,7 @@ int srslte_mod_modulate_bytes(const srslte_modem_table_t* q, const uint8_t* bits mod_256qam_bytes(q, bits, symbols, nbits); break; default: - ERROR("srslte_mod_modulate_bytes() accepts QPSK/16QAM/64QAM modulations only\n"); + ERROR("srslte_mod_modulate_bytes() accepts QPSK/16QAM/64QAM modulations only"); return SRSLTE_ERROR; } return nbits / q->nbits_x_symbol; diff --git a/lib/src/phy/modem/test/modem_test.c b/lib/src/phy/modem/test/modem_test.c index d98e5975e..690850e83 100644 --- a/lib/src/phy/modem/test/modem_test.c +++ b/lib/src/phy/modem/test/modem_test.c @@ -86,7 +86,7 @@ int main(int argc, char** argv) /* initialize objects */ if (srslte_modem_table_lte(&mod, modulation)) { - ERROR("Error initializing modem table\n"); + ERROR("Error initializing modem table"); exit(-1); } @@ -94,7 +94,7 @@ int main(int argc, char** argv) /* check that num_bits is multiple of num_bits x symbol */ if (num_bits % mod.nbits_x_symbol) { - ERROR("Error num_bits must be multiple of %d\n", mod.nbits_x_symbol); + ERROR("Error num_bits must be multiple of %d", mod.nbits_x_symbol); exit(-1); } @@ -180,7 +180,7 @@ int main(int argc, char** argv) /* check errors */ for (i = 0; i < num_bits && ret == SRSLTE_SUCCESS; i++) { if (input[i] != output[i]) { - ERROR("Error in bit %d\n", i); + ERROR("Error in bit %d", i); ret = SRSLTE_ERROR; } } diff --git a/lib/src/phy/modem/test/soft_demod_test.c b/lib/src/phy/modem/test/soft_demod_test.c index fffc7b559..83ecc86ef 100644 --- a/lib/src/phy/modem/test/soft_demod_test.c +++ b/lib/src/phy/modem/test/soft_demod_test.c @@ -66,7 +66,7 @@ void parse_args(int argc, char** argv) break; default: ERROR("Invalid modulation %d. Possible values: " - "(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64)\n", + "(1: BPSK, 2: QPSK, 4: QAM16, 6: QAM64)", (int)strtol(argv[optind], NULL, 10)); break; } @@ -114,7 +114,7 @@ int main(int argc, char** argv) /* initialize objects */ if (srslte_modem_table_lte(&mod, modulation)) { - ERROR("Error initializing modem table\n"); + ERROR("Error initializing modem table"); exit(-1); } diff --git a/lib/src/phy/phch/dci.c b/lib/src/phy/phch/dci.c index e5b14578f..1c8553c81 100644 --- a/lib/src/phy/phch/dci.c +++ b/lib/src/phy/phch/dci.c @@ -63,7 +63,7 @@ int srslte_dci_rar_to_ul_dci(srslte_cell_t* cell, srslte_dci_rar_grant_t* rar, s if (!rar->hopping_flag) { dci_ul->freq_hop_fl = SRSLTE_RA_PUSCH_HOP_DISABLED; } else { - ERROR("TODO: Frequency hopping in RAR not implemented\n"); + ERROR("TODO: Frequency hopping in RAR not implemented"); dci_ul->freq_hop_fl = 1; } uint32_t riv = rar->rba; @@ -204,7 +204,6 @@ static uint32_t dci_format0_sizeof(const srslte_cell_t* cell, srslte_dl_sf_cfg_t static uint32_t dci_format1_sizeof(const srslte_cell_t* cell, srslte_dl_sf_cfg_t* sf, srslte_dci_cfg_t* cfg) { - uint32_t n = (uint32_t)ceilf((float)cell->nof_prb / srslte_ra_type0_P(cell->nof_prb)) + 5 + HARQ_PID_LEN + 1 + 2 + 2 + (cfg->cif_enabled ? 3 : 0) + (IS_TDD ? 2 : 0); if (cell->nof_prb > 10) { @@ -410,7 +409,6 @@ static int dci_format0_pack(srslte_cell_t* cell, srslte_dci_ul_t* dci, srslte_dci_msg_t* msg) { - /* pack bits */ uint8_t* y = msg->payload; uint32_t n_ul_hop; @@ -488,7 +486,6 @@ static int dci_format0_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_ul_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; uint32_t n_ul_hop; @@ -499,7 +496,7 @@ static int dci_format0_unpack(srslte_cell_t* cell, } if (*y++ != 0) { - INFO("DCI message is Format1A\n"); + INFO("DCI message is Format1A"); return SRSLTE_ERROR; } @@ -602,7 +599,7 @@ static int dci_format1_pack(srslte_cell_t* cell, srslte_bit_unpack((uint32_t)dci->type1_alloc.vrb_bitmask, &y, alloc_size - (int)ceilf(log2f(P)) - 1); break; default: - ERROR("Format 1 accepts type0 or type1 resource allocation only\n"); + ERROR("Format 1 accepts type0 or type1 resource allocation only"); return SRSLTE_ERROR; } /* pack MCS */ @@ -626,7 +623,7 @@ static int dci_format1_pack(srslte_cell_t* cell, msg->nof_bits = (y - msg->payload); if (msg->nof_bits != dci_format1_sizeof(cell, sf, cfg)) { - ERROR("Invalid message length for format 1 (Cross scheduling %s)\n", dci->cif_present ? "enabled" : "disabled"); + ERROR("Invalid message length for format 1 (Cross scheduling %s)", dci->cif_present ? "enabled" : "disabled"); } return SRSLTE_SUCCESS; @@ -638,14 +635,13 @@ static int dci_format1_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_dl_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; /* Make sure it's a SRSLTE_DCI_FORMAT1 message */ uint32_t msg_len = srslte_dci_format_sizeof(cell, sf, cfg, SRSLTE_DCI_FORMAT1); if (msg->nof_bits != msg_len) { - ERROR("Invalid message length (%d!=%d) for format 1\n", msg->nof_bits, msg_len); + ERROR("Invalid message length (%d!=%d) for format 1", msg->nof_bits, msg_len); return SRSLTE_ERROR; } @@ -673,7 +669,7 @@ static int dci_format1_unpack(srslte_cell_t* cell, dci->type1_alloc.vrb_bitmask = srslte_bit_pack(&y, alloc_size - (int)ceilf(log2f(P)) - 1); break; default: - ERROR("Format 1 accepts type0 or type1 resource allocation only\n"); + ERROR("Format 1 accepts type0 or type1 resource allocation only"); return SRSLTE_ERROR; } /* unpack MCS according to 7.1.7 of 36.213 */ @@ -719,7 +715,7 @@ static int dci_format1As_pack(srslte_cell_t* cell, *y++ = 1; // format differentiation if (dci->alloc_type != SRSLTE_RA_ALLOC_TYPE2) { - ERROR("Format 1A accepts type2 resource allocation only\n"); + ERROR("Format 1A accepts type2 resource allocation only"); return SRSLTE_ERROR; } @@ -780,7 +776,6 @@ static int dci_format1As_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_dl_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; @@ -790,7 +785,7 @@ static int dci_format1As_unpack(srslte_cell_t* cell, } if (*y++ != 1) { - INFO("DCI message is Format0\n"); + INFO("DCI message is Format0"); return SRSLTE_ERROR; } @@ -883,7 +878,6 @@ static int dci_format1B_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_dl_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; @@ -937,7 +931,6 @@ static int dci_format1Cs_pack(srslte_cell_t* cell, srslte_dci_dl_t* dci, srslte_dci_msg_t* msg) { - uint32_t nof_prb = cell->nof_prb; /* pack bits */ @@ -948,7 +941,7 @@ static int dci_format1Cs_pack(srslte_cell_t* cell, } if (dci->alloc_type != SRSLTE_RA_ALLOC_TYPE2 || dci->type2_alloc.mode != SRSLTE_RA_TYPE2_DIST) { - ERROR("Format 1C accepts distributed type2 resource allocation only\n"); + ERROR("Format 1C accepts distributed type2 resource allocation only"); return SRSLTE_ERROR; } @@ -980,7 +973,7 @@ static int dci_format1Cs_unpack(srslte_cell_t* cell, uint8_t* y = msg->payload; if (msg->nof_bits != srslte_dci_format_sizeof(cell, sf, cfg, SRSLTE_DCI_FORMAT1C)) { - ERROR("Invalid message length for format 1C\n"); + ERROR("Invalid message length for format 1C"); return SRSLTE_ERROR; } @@ -1011,7 +1004,6 @@ static int dci_format1D_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_dl_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; @@ -1063,7 +1055,6 @@ static int dci_format2AB_pack(srslte_cell_t* cell, srslte_dci_dl_t* dci, srslte_dci_msg_t* msg) { - uint32_t nof_prb = cell->nof_prb; uint32_t nof_ports = cell->nof_ports; @@ -1091,7 +1082,7 @@ static int dci_format2AB_pack(srslte_cell_t* cell, srslte_bit_unpack((uint32_t)dci->type1_alloc.vrb_bitmask, &y, alloc_size - (int)ceilf(log2f(P)) - 1); break; default: - ERROR("Format 1 accepts type0 or type1 resource allocation only\n"); + ERROR("Format 1 accepts type0 or type1 resource allocation only"); return SRSLTE_ERROR; } @@ -1141,7 +1132,6 @@ static int dci_format2AB_unpack(srslte_cell_t* cell, srslte_dci_msg_t* msg, srslte_dci_dl_t* dci) { - /* pack bits */ uint8_t* y = msg->payload; @@ -1169,7 +1159,7 @@ static int dci_format2AB_unpack(srslte_cell_t* cell, dci->type1_alloc.vrb_bitmask = srslte_bit_pack(&y, alloc_size - (int)ceilf(log2f(P)) - 1); break; default: - ERROR("Format2 accepts type0 or type1 resource allocation only\n"); + ERROR("Format2 accepts type0 or type1 resource allocation only"); return SRSLTE_ERROR; } @@ -1260,7 +1250,7 @@ int srslte_dci_msg_pack_pdsch(srslte_cell_t* cell, ret = dci_format2AB_pack(cell, sf, cfg, dci, msg); break; default: - ERROR("DCI pack pdsch: Invalid DCI format %s\n", srslte_dci_format_string(msg->format)); + ERROR("DCI pack pdsch: Invalid DCI format %s", srslte_dci_format_string(msg->format)); } #if SRSLTE_DCI_HEXDEBUG @@ -1320,7 +1310,7 @@ int srslte_dci_msg_unpack_pdsch(srslte_cell_t* cell, case SRSLTE_DCI_FORMAT2B: return dci_format2AB_unpack(cell, sf, cfg, msg, dci); default: - ERROR("DCI unpack pdsch: Invalid DCI format %s\n", srslte_dci_format_string(msg->format)); + ERROR("DCI unpack pdsch: Invalid DCI format %s", srslte_dci_format_string(msg->format)); return SRSLTE_ERROR; } } @@ -1411,13 +1401,13 @@ int srslte_dci_location_set(srslte_dci_location_t* c, uint32_t L, uint32_t nCCE) if (L <= 3) { c->L = L; } else { - ERROR("Invalid L %d\n", L); + ERROR("Invalid L %d", L); return SRSLTE_ERROR; } if (nCCE <= 87) { c->ncce = nCCE; } else { - ERROR("Invalid nCCE %d\n", nCCE); + ERROR("Invalid nCCE %d", nCCE); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; diff --git a/lib/src/phy/phch/npbch.c b/lib/src/phy/phch/npbch.c index ef39804cd..679b53cc4 100644 --- a/lib/src/phy/phch/npbch.c +++ b/lib/src/phy/phch/npbch.c @@ -282,7 +282,7 @@ int srslte_npbch_encode(srslte_npbch_t* q, // generate new BCH message every 64 frames if ((frame_idx % SRSLTE_NPBCH_NUM_FRAMES) == 0) { - INFO("Encoding new NPBCH signal in frame %d.\n", frame_idx); + INFO("Encoding new NPBCH signal in frame %d.", frame_idx); memcpy(q->data, bch_payload, sizeof(uint8_t) * SRSLTE_MIB_NB_LEN); @@ -297,7 +297,7 @@ int srslte_npbch_encode(srslte_npbch_t* q, // Scramble and modulate a new block every 8 frames if (frame_idx % SRSLTE_NPBCH_NUM_REP == 0) { - INFO("Modulating MIB-NB block %d in frame %d.\n", block_idx, frame_idx); + INFO("Modulating MIB-NB block %d in frame %d.", block_idx, frame_idx); srslte_scrambling_b_offset(&q->seq, &q->rm_b[block_idx * nof_bits], block_idx * nof_bits, nof_bits); srslte_mod_modulate(&q->mod, &q->rm_b[block_idx * nof_bits], q->d, nof_bits); @@ -313,12 +313,12 @@ int srslte_npbch_encode(srslte_npbch_t* q, // Write exactly SRSLTE_NPBCH_NUM_RE (assumes symbols have been modulated before) for (int i = 0; i < q->cell.nof_ports; i++) { if (q->cell.is_r14) { - DEBUG("Applying phase rotation on port %d in frame %d.\n", i, frame_idx); + DEBUG("Applying phase rotation on port %d in frame %d.", i, frame_idx); srslte_npbch_rotate(q, frame_idx, q->symbols[i], q->symbols[i], q->nof_symbols, false); } - DEBUG("Putting MIB-NB block %d on port %d in frame %d.\n", block_idx, i, frame_idx); + DEBUG("Putting MIB-NB block %d on port %d in frame %d.", block_idx, i, frame_idx); if (srslte_npbch_cp(q->symbols[i], sf[i], q->cell, true) != SRSLTE_NPBCH_NUM_RE) { - INFO("Error while mapping NPBCH symbols.\n"); + INFO("Error while mapping NPBCH symbols."); return SRSLTE_ERROR; } } @@ -337,7 +337,7 @@ int srslte_npbch_rotate(srslte_npbch_t* q, bool back) { // Generate frame specific scrambling sequence for symbol rotation - DEBUG("%sotating NPBCH in SFN=%d\n", back ? "De-R" : "R", nf); + DEBUG("%sotating NPBCH in SFN=%d", back ? "De-R" : "R", nf); for (int i = 0; i < num_samples; i++) { int c_2i = q->seq_r14[nf % 8].c[2 * i]; @@ -443,7 +443,7 @@ int srslte_npbch_decode_nf(srslte_npbch_t* q, } do { if (nant != 3) { - DEBUG("Trying %d TX antennas with %d frames\n", nant, q->frame_idx); + DEBUG("Trying %d TX antennas with %d frames", nant, q->frame_idx); // in control channels, only diversity is supported if (nant == 1) { @@ -458,7 +458,7 @@ int srslte_npbch_decode_nf(srslte_npbch_t* q, srslte_demod_soft_demodulate(SRSLTE_MOD_QPSK, q->d, &q->llr[nof_bits * (q->frame_idx - 1)], q->nof_symbols); // only one subframe - DEBUG("Trying to decode NPBCH ..\n"); + DEBUG("Trying to decode NPBCH .."); // TODO: simplified decoding only using first MIB block ret = srslte_npbch_decode_frame(q, 0, nf, 1, nof_bits, nant); @@ -472,7 +472,7 @@ int srslte_npbch_decode_nf(srslte_npbch_t* q, if (bch_payload) { memcpy(bch_payload, q->data, sizeof(uint8_t) * SRSLTE_MIB_NB_LEN); } - INFO("Successfully decoded NPBCH sfn_offset=%d\n", q->frame_idx - 1); + INFO("Successfully decoded NPBCH sfn_offset=%d", q->frame_idx - 1); q->frame_idx = 0; return ret; } diff --git a/lib/src/phy/phch/npdcch.c b/lib/src/phy/phch/npdcch.c index 3a8f062f3..4eae7c836 100644 --- a/lib/src/phy/phch/npdcch.c +++ b/lib/src/phy/phch/npdcch.c @@ -43,7 +43,7 @@ int srslte_npdcch_init(srslte_npdcch_t* q) q->max_bits = SRSLTE_CP_NORM_SF_NSYMB * SRSLTE_NRE * 2; q->ncce_bits = q->max_bits / 2; - INFO("Init NPDCCH: Max bits: %d, %d ports.\n", q->max_bits, q->cell.nof_ports); + INFO("Init NPDCCH: Max bits: %d, %d ports.", q->max_bits, q->cell.nof_ports); if (srslte_modem_table_lte(&q->mod, SRSLTE_MOD_QPSK)) { goto clean; @@ -239,7 +239,7 @@ int srslte_npdcch_decode_msg(srslte_npdcch_t* q, // Get the right softbits for this aggregation level float* llr = (location->L == 1) ? q->llr[0] : q->llr[1]; if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("LLR:\n"); + DEBUG("LLR:"); srslte_vec_fprint_f(stdout, llr, q->max_bits); } @@ -263,7 +263,7 @@ int srslte_npdcch_decode_msg(srslte_npdcch_t* q, fprintf(stderr, "Error calling npdcch_dci_decode\n"); } if (crc_rem) { - DEBUG("Decoded DCI: nCCE=%d, L=%d, format=%s, msg_len=%d, mean=%f, crc_rem=0x%x\n", + DEBUG("Decoded DCI: nCCE=%d, L=%d, format=%s, msg_len=%d, mean=%f, crc_rem=0x%x", location->ncce, location->L, srslte_dci_format_string(msg->format), @@ -272,7 +272,7 @@ int srslte_npdcch_decode_msg(srslte_npdcch_t* q, *crc_rem); } } else { - DEBUG("Skipping DCI: nCCE=%d, L=%d, msg_len=%d, mean=%f\n", location->ncce, location->L, nof_bits, mean); + DEBUG("Skipping DCI: nCCE=%d, L=%d, msg_len=%d, mean=%f", location->ncce, location->L, nof_bits, mean); } ret = SRSLTE_SUCCESS; } else { @@ -324,7 +324,7 @@ int srslte_npdcch_extract_llr(srslte_npdcch_t* q, } num_symbols = e_bits / 2; - DEBUG("Extracting LLRs for NPDCCH %s: E: %d, SF: %d\n", srslte_npdcch_format_text[i], e_bits, sf_idx); + DEBUG("Extracting LLRs for NPDCCH %s: E: %d, SF: %d", srslte_npdcch_format_text[i], e_bits, sf_idx); if (i != SRSLTE_NPDCCH_FORMAT0_UPPER_HALF) { // don't overwrite lower half LLRs @@ -346,7 +346,7 @@ int srslte_npdcch_extract_llr(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_rx_mapping_output.bin: NPDCCH after extracting symbols\n"); + DEBUG("SAVED FILE npdcch_rx_mapping_output.bin: NPDCCH after extracting symbols"); srslte_vec_save_file("npdcch_rx_mapping_output.bin", q->symbols[0], n * sizeof(cf_t)); } #endif @@ -371,7 +371,7 @@ int srslte_npdcch_extract_llr(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_rx_predecode_output.bin: NPDCCH after predecoding symbols\n"); + DEBUG("SAVED FILE npdcch_rx_predecode_output.bin: NPDCCH after predecoding symbols"); srslte_vec_save_file("npdcch_rx_predecode_output.bin", q->d, q->num_decoded_symbols * sizeof(cf_t)); } #endif @@ -384,7 +384,7 @@ int srslte_npdcch_extract_llr(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_rx_descramble_output.bin: NPDCCH after de-scrambling\n"); + DEBUG("SAVED FILE npdcch_rx_descramble_output.bin: NPDCCH after de-scrambling"); srslte_vec_save_file("npdcch_rx_descramble_output.bin", llr, e_bits); } #endif @@ -398,9 +398,9 @@ int srslte_npdcch_extract_llr(srslte_npdcch_t* q, static void crc_set_mask_rnti(uint8_t* crc, uint16_t rnti) { uint8_t mask[16] = {}; - uint8_t* r = mask; + uint8_t* r = mask; - DEBUG("Mask CRC with RNTI 0x%x\n", rnti); + DEBUG("Mask CRC with RNTI 0x%x", rnti); srslte_bit_unpack(rnti, &r, 16); for (uint32_t i = 0; i < 16; i++) { @@ -426,7 +426,7 @@ void srslte_npdcch_dci_encode_conv(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_tx_convcoder_input.bin: NPDCCH before convolution coding\n"); + DEBUG("SAVED FILE npdcch_tx_convcoder_input.bin: NPDCCH before convolution coding"); srslte_vec_save_file("npdcch_tx_convcoder_input.bin", data, nof_bits + 16); } #endif @@ -472,12 +472,12 @@ int srslte_npdcch_encode(srslte_npdcch_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && sf_symbols != NULL && nsubframe < 10 && srslte_nbiot_dci_location_isvalid(&location)) { - ret = SRSLTE_ERROR; + ret = SRSLTE_ERROR; uint32_t e_bits = q->nof_cce * q->ncce_bits; uint32_t nof_symbols = e_bits / 2; if (msg->nof_bits < SRSLTE_DCI_MAX_BITS - 16) { - DEBUG("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x, sf_idx: %d\n", + DEBUG("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x, sf_idx: %d", msg->nof_bits, e_bits, location.ncce, @@ -499,7 +499,7 @@ int srslte_npdcch_encode(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_tx_scramble_input.bin: NPDCCH before scrambling\n"); + DEBUG("SAVED FILE npdcch_tx_scramble_input.bin: NPDCCH before scrambling"); srslte_vec_save_file("npdcch_tx_scramble_input.bin", q->e, e_bits); } #endif @@ -508,7 +508,7 @@ int srslte_npdcch_encode(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_tx_mod_input.bin: NPDCCH before modulation\n"); + DEBUG("SAVED FILE npdcch_tx_mod_input.bin: NPDCCH before modulation"); srslte_vec_save_file("npdcch_tx_mod_input.bin", q->e, e_bits); } #endif @@ -517,7 +517,7 @@ int srslte_npdcch_encode(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_tx_precode_input.bin: NPDCCH before precoding symbols\n"); + DEBUG("SAVED FILE npdcch_tx_precode_input.bin: NPDCCH before precoding symbols"); srslte_vec_save_file("npdcch_tx_precode_input.bin", q->d, nof_symbols * sizeof(cf_t)); } #endif @@ -532,7 +532,7 @@ int srslte_npdcch_encode(srslte_npdcch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdcch_tx_mapping_input.bin: NPDCCH before mapping to resource elements\n"); + DEBUG("SAVED FILE npdcch_tx_mapping_input.bin: NPDCCH before mapping to resource elements"); srslte_vec_save_file("npdcch_tx_mapping_input.bin", q->symbols[0], nof_symbols * sizeof(cf_t)); } #endif diff --git a/lib/src/phy/phch/npdsch.c b/lib/src/phy/phch/npdsch.c index 71c673a74..a48bc5d1f 100644 --- a/lib/src/phy/phch/npdsch.c +++ b/lib/src/phy/phch/npdsch.c @@ -182,7 +182,7 @@ int srslte_npdsch_init(srslte_npdsch_t* q) q->max_re = SRSLTE_NPDSCH_MAX_RE * SRSLTE_NPDSCH_MAX_NOF_SF; q->rnti_is_set = false; - INFO("Init NPDSCH: max_re's: %d\n", q->max_re); + INFO("Init NPDSCH: max_re's: %d", q->max_re); if (srslte_modem_table_lte(&q->mod, SRSLTE_MOD_QPSK)) { goto clean; @@ -292,7 +292,7 @@ int srslte_npdsch_set_cell(srslte_npdsch_t* q, srslte_nbiot_cell_t cell) if (q != NULL && srslte_nbiot_cell_isvalid(&cell)) { q->cell = cell; - INFO("NPDSCH: Cell config n_id_ncell=%d, %d ports, %d PRBs base cell, max_symbols: %d\n", + INFO("NPDSCH: Cell config n_id_ncell=%d, %d ports, %d PRBs base cell, max_symbols: %d", q->cell.n_id_ncell, q->cell.nof_ports, q->cell.base.nof_prb, @@ -367,7 +367,7 @@ int srslte_npdsch_decode_rnti(srslte_npdsch_t* q, cf_t* x[SRSLTE_MAX_LAYERS]; if (q != NULL && sf_symbols != NULL && data != NULL && cfg != NULL) { - INFO("%d.x: Decoding NPDSCH: RNTI: 0x%x, Mod %s, TBS: %d, NofSymbols: %d * %d, NofBitsE: %d * %d\n", + INFO("%d.x: Decoding NPDSCH: RNTI: 0x%x, Mod %s, TBS: %d, NofSymbols: %d * %d, NofBitsE: %d * %d", sfn, rnti, srslte_mod_string(cfg->grant.mcs[0].mod), @@ -411,7 +411,7 @@ int srslte_npdsch_decode_rnti(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_rx_mapping_output.bin: NPDSCH after extracting symbols\n", 0); + DEBUG("SAVED FILE npdsch_rx_mapping_output.bin: NPDSCH after extracting symbols", 0); srslte_vec_save_file( "npdsch_rx_mapping_output.bin", q->symbols[0], cfg->grant.nof_sf * cfg->nbits.nof_re * sizeof(cf_t)); } @@ -431,7 +431,7 @@ int srslte_npdsch_decode_rnti(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_rx_predecode_output.bin: NPDSCH after predecoding symbols\n", 0); + DEBUG("SAVED FILE npdsch_rx_predecode_output.bin: NPDSCH after predecoding symbols", 0); srslte_vec_save_file( "npdsch_rx_predecode_output.bin", q->d, cfg->grant.nof_sf * cfg->nbits.nof_re * sizeof(cf_t)); } @@ -442,10 +442,10 @@ int srslte_npdsch_decode_rnti(srslte_npdsch_t* q, #if DUMP_SIGNALS uint8_t demodbuf[320]; - hard_qpsk_demod(q->d,demodbuf,cfg->nbits.nof_re); + hard_qpsk_demod(q->d, demodbuf, cfg->nbits.nof_re); if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_rx_demod_output.bin: NPDSCH after (hard) de-modulation\n",0); + DEBUG("SAVED FILE npdsch_rx_demod_output.bin: NPDSCH after (hard) de-modulation", 0); srslte_vec_save_file("npdsch_rx_demod_output.bin", demodbuf, cfg->nbits.nof_bits); } #endif @@ -482,7 +482,7 @@ int srslte_npdsch_decode_rnti(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_rx_descramble_output.bin: NPDSCH after de-scrambling\n", 0); + DEBUG("SAVED FILE npdsch_rx_descramble_output.bin: NPDSCH after de-scrambling", 0); srslte_vec_save_file("npdsch_rx_descramble_output.bin", q->llr, cfg->nbits.nof_bits); } #endif @@ -509,7 +509,7 @@ int srslte_npdsch_rm_and_decode(srslte_npdsch_t* q, srslte_npdsch_cfg_t* cfg, fl #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_rx_viterbidecode_output.bin: NPDSCH after viterbi decoding\n", 0); + DEBUG("SAVED FILE npdsch_rx_viterbidecode_output.bin: NPDSCH after viterbi decoding", 0); srslte_vec_save_file("npdsch_rx_viterbidecode_output.bin", q->temp, cfg->grant.mcs[0].tbs + SRSLTE_NPDSCH_CRC_LEN); } #endif @@ -624,7 +624,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, // make sure to run run full NPDSCH procedure only once if (!cfg->is_encoded) { - INFO("Encoding NPDSCH: Mod %s, NofBits: %d, NofSymbols: %d * %d, NofBitsE: %d * %d\n", + INFO("Encoding NPDSCH: Mod %s, NofBits: %d, NofSymbols: %d * %d, NofBitsE: %d * %d", srslte_mod_string(cfg->grant.mcs[0].mod), cfg->grant.mcs[0].tbs, cfg->grant.nof_sf, @@ -649,7 +649,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_convcoder_input.bin: NPDSCH before convolution coding\n", 0); + DEBUG("SAVED FILE npdsch_tx_convcoder_input.bin: NPDSCH before convolution coding", 0); srslte_vec_save_file("npdsch_tx_convcoder_input.bin", q->data, len); } #endif @@ -664,7 +664,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_scramble_input.bin: NPDSCH before scrambling\n", 0); + DEBUG("SAVED FILE npdsch_tx_scramble_input.bin: NPDSCH before scrambling", 0); srslte_vec_save_file("npdsch_tx_scramble_input.bin", q->rm_b, len); } #endif @@ -674,7 +674,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_mod_input.bin: NPDSCH before modulation\n", 0); + DEBUG("SAVED FILE npdsch_tx_mod_input.bin: NPDSCH before modulation", 0); srslte_vec_save_file("npdsch_tx_mod_input.bin", q->rm_b, len); } #endif @@ -685,7 +685,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_precode_input.bin: NPDSCH before precoding symbols\n", 0); + DEBUG("SAVED FILE npdsch_tx_precode_input.bin: NPDSCH before precoding symbols", 0); srslte_vec_save_file("npdsch_tx_precode_input.bin", q->d, len * sizeof(cf_t)); } #endif @@ -700,7 +700,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, #if DUMP_SIGNALS if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_mapping_input.bin: NPDSCH before mapping to resource elements\n", 0); + DEBUG("SAVED FILE npdsch_tx_mapping_input.bin: NPDSCH before mapping to resource elements", 0); srslte_vec_save_file("npdsch_tx_mapping_input.bin", q->tx_syms[0], len * sizeof(cf_t)); } #endif @@ -710,7 +710,7 @@ int srslte_npdsch_encode_seq(srslte_npdsch_t* q, // mapping to resource elements if (cfg->is_encoded) { - INFO("Mapping %d NPDSCH REs, sf_idx=%d/%d rep=%d/%d total=%d/%d\n", + INFO("Mapping %d NPDSCH REs, sf_idx=%d/%d rep=%d/%d total=%d/%d", cfg->nbits.nof_re, cfg->sf_idx + 1, cfg->grant.nof_sf, diff --git a/lib/src/phy/phch/pbch.c b/lib/src/phy/phch/pbch.c index 8ebb77ee2..6ebabe2ca 100644 --- a/lib/src/phy/phch/pbch.c +++ b/lib/src/phy/phch/pbch.c @@ -419,7 +419,7 @@ int decode_frame(srslte_pbch_t* q, uint32_t src, uint32_t dst, uint32_t n, uint3 return SRSLTE_SUCCESS; } } else { - ERROR("Error in PBCH decoder: Invalid frame pointers dst=%d, src=%d, n=%d\n", src, dst, n); + ERROR("Error in PBCH decoder: Invalid frame pointers dst=%d, src=%d, n=%d", src, dst, n); return -1; } } @@ -465,14 +465,14 @@ int srslte_pbch_decode(srslte_pbch_t* q, /* extract symbols */ if (q->nof_symbols != srslte_pbch_get(slot1_symbols, q->symbols[0], q->cell)) { - ERROR("There was an error getting the PBCH symbols\n"); + ERROR("There was an error getting the PBCH symbols"); return SRSLTE_ERROR; } /* extract channel estimates */ for (i = 0; i < q->cell.nof_ports; i++) { if (q->nof_symbols != srslte_pbch_get(ce_slot1[i], q->ce[i], q->cell)) { - ERROR("There was an error getting the PBCH symbols\n"); + ERROR("There was an error getting the PBCH symbols"); return SRSLTE_ERROR; } } @@ -491,7 +491,7 @@ int srslte_pbch_decode(srslte_pbch_t* q, do { if (nant != 3) { - DEBUG("Trying %d TX antennas with %d frames\n", nant, frame_idx); + DEBUG("Trying %d TX antennas with %d frames", nant, frame_idx); /* in control channels, only diversity is supported */ if (nant == 1) { @@ -523,7 +523,7 @@ int srslte_pbch_decode(srslte_pbch_t* q, if (bch_payload) { memcpy(bch_payload, q->data, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN); } - INFO("Decoded PBCH: src=%d, dst=%d, nb=%d, sfn_offset=%d\n", + INFO("Decoded PBCH: src=%d, dst=%d, nb=%d, sfn_offset=%d", src, dst, nb + 1, diff --git a/lib/src/phy/phch/pcfich.c b/lib/src/phy/phch/pcfich.c index 950533784..bc56e568f 100644 --- a/lib/src/phy/phch/pcfich.c +++ b/lib/src/phy/phch/pcfich.c @@ -150,7 +150,6 @@ int srslte_pcfich_decode(srslte_pcfich_t* q, cf_t* sf_symbols[SRSLTE_MAX_PORTS], float* corr_result) { - /* Set pointers for layermapping & precoding */ int i; cf_t* x[SRSLTE_MAX_LAYERS]; @@ -169,7 +168,7 @@ int srslte_pcfich_decode(srslte_pcfich_t* q, /* extract symbols */ for (int j = 0; j < q->nof_rx_antennas; j++) { if (q->nof_symbols != srslte_regs_pcfich_get(q->regs, sf_symbols[j], q->symbols[j])) { - ERROR("There was an error getting the PCFICH symbols\n"); + ERROR("There was an error getting the PCFICH symbols"); return SRSLTE_ERROR; } @@ -178,7 +177,7 @@ int srslte_pcfich_decode(srslte_pcfich_t* q, /* extract channel estimates */ for (i = 0; i < q->cell.nof_ports; i++) { if (q->nof_symbols != srslte_regs_pcfich_get(q->regs, channel->ce[i][j], q->ce[i][j])) { - ERROR("There was an error getting the PCFICH symbols\n"); + ERROR("There was an error getting the PCFICH symbols"); return SRSLTE_ERROR; } q_ce[i][j] = q->ce[i][j]; @@ -220,7 +219,6 @@ int srslte_pcfich_encode(srslte_pcfich_t* q, srslte_dl_sf_cfg_t* sf, cf_t* slot_ int i; if (q != NULL && slot_symbols != NULL) { - uint32_t sf_idx = sf->tti % 10; /* Set pointers for layermapping & precoding */ @@ -254,7 +252,7 @@ int srslte_pcfich_encode(srslte_pcfich_t* q, srslte_dl_sf_cfg_t* sf, cf_t* slot_ /* mapping to resource elements */ for (i = 0; i < q->cell.nof_ports; i++) { if (srslte_regs_pcfich_put(q->regs, q->symbols[i], slot_symbols[i]) < 0) { - ERROR("Error putting PCHICH resource elements\n"); + ERROR("Error putting PCHICH resource elements"); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/phch/pdcch.c b/lib/src/phy/phch/pdcch.c index 6c8e61c5a..3f7324939 100644 --- a/lib/src/phy/phch/pdcch.c +++ b/lib/src/phy/phch/pdcch.c @@ -52,7 +52,7 @@ static int pdcch_init(srslte_pdcch_t* q, uint32_t max_prb, uint32_t nof_rx_anten /* Allocate memory for the maximum number of PDCCH bits (CFI=3) */ q->max_bits = max_prb * 3 * 12 * 2; - INFO("Init PDCCH: Max bits: %d\n", q->max_bits); + INFO("Init PDCCH: Max bits: %d", q->max_bits); if (srslte_modem_table_lte(&q->mod, SRSLTE_MOD_QPSK)) { goto clean; @@ -123,7 +123,6 @@ int srslte_pdcch_init_ue(srslte_pdcch_t* q, uint32_t max_prb, uint32_t nof_rx_an void srslte_pdcch_free(srslte_pdcch_t* q) { - if (q->e) { free(q->e); } @@ -176,10 +175,9 @@ int srslte_pdcch_set_cell(srslte_pdcch_t* q, srslte_regs_t* regs, srslte_cell_t int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && regs != NULL && srslte_cell_isvalid(&cell)) { - srslte_pdcch_set_regs(q, regs); - INFO("PDCCH: Cell config PCI=%d, %d ports.\n", q->cell.id, q->cell.nof_ports); + INFO("PDCCH: Cell config PCI=%d, %d ports.", q->cell.id, q->cell.nof_ports); if (q->cell.id != cell.id || q->cell.nof_prb == 0) { q->cell = cell; @@ -227,7 +225,6 @@ uint32_t srslte_pdcch_ue_locations_ncce_L(uint32_t nof_cce, uint16_t rnti, int Ls) { - int l; // this must be int because of the for(;;--) loop uint32_t i, k, L, m; uint32_t Yk, ncce; @@ -265,7 +262,7 @@ uint32_t srslte_pdcch_ue_locations_ncce_L(uint32_t nof_cce, c[k].L = l; c[k].ncce = ncce; - DEBUG("UE-specific SS Candidate %d: nCCE: %d, L: %d\n", k, c[k].ncce, c[k].L); + DEBUG("UE-specific SS Candidate %d: nCCE: %d, L: %d", k, c[k].ncce, c[k].L); k++; } @@ -274,7 +271,7 @@ uint32_t srslte_pdcch_ue_locations_ncce_L(uint32_t nof_cce, } } - DEBUG("Initiated %d candidate(s) in the UE-specific search space for C-RNTI: 0x%x, sf_idx=%d, nof_cce=%d\n", + DEBUG("Initiated %d candidate(s) in the UE-specific search space for C-RNTI: 0x%x, sf_idx=%d, nof_cce=%d", k, rnti, sf_idx, @@ -309,13 +306,13 @@ uint32_t srslte_pdcch_common_locations_ncce(uint32_t nof_cce, srslte_dci_locatio if (k < max_candidates && ncce + L <= nof_cce) { c[k].L = l; c[k].ncce = ncce; - DEBUG("Common SS Candidate %d: nCCE: %d/%d, L: %d\n", k, c[k].ncce, nof_cce, c[k].L); + DEBUG("Common SS Candidate %d: nCCE: %d/%d, L: %d", k, c[k].ncce, nof_cce, c[k].L); k++; } } } - INFO("Initiated %d candidate(s) in the Common search space\n", k); + INFO("Initiated %d candidate(s) in the Common search space", k); return k; } @@ -328,7 +325,6 @@ uint32_t srslte_pdcch_common_locations_ncce(uint32_t nof_cce, srslte_dci_locatio */ int srslte_pdcch_dci_decode(srslte_pdcch_t* q, float* e, uint8_t* data, uint32_t E, uint32_t nof_bits, uint16_t* crc) { - uint16_t p_bits, crc_res; uint8_t* x; @@ -354,7 +350,7 @@ int srslte_pdcch_dci_decode(srslte_pdcch_t* q, float* e, uint8_t* data, uint32_t return SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters: E: %d, max_bits: %d, nof_bits: %d\n", E, q->max_bits, nof_bits); + ERROR("Invalid parameters: E: %d, max_bits: %d, nof_bits: %d", E, q->max_bits, nof_bits); return SRSLTE_ERROR_INVALID_INPUTS; } } else { @@ -373,7 +369,7 @@ int srslte_pdcch_decode_msg(srslte_pdcch_t* q, srslte_dl_sf_cfg_t* sf, srslte_dc int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && msg != NULL && srslte_dci_location_isvalid(&msg->location)) { if (msg->location.ncce * 72 + PDCCH_FORMAT_NOF_BITS(msg->location.L) > NOF_CCE(sf->cfi) * 72) { - ERROR("Invalid location: nCCE: %d, L: %d, NofCCE: %d\n", msg->location.ncce, msg->location.L, NOF_CCE(sf->cfi)); + ERROR("Invalid location: nCCE: %d, L: %d, NofCCE: %d", msg->location.ncce, msg->location.L, NOF_CCE(sf->cfi)); } else { ret = SRSLTE_SUCCESS; @@ -394,9 +390,9 @@ int srslte_pdcch_decode_msg(srslte_pdcch_t* q, srslte_dl_sf_cfg_t* sf, srslte_dc msg->format = (msg->payload[dci_cfg->cif_enabled ? 3 : 0] == 0) ? SRSLTE_DCI_FORMAT0 : SRSLTE_DCI_FORMAT1A; } } else { - ERROR("Error calling pdcch_dci_decode\n"); + ERROR("Error calling pdcch_dci_decode"); } - INFO("Decoded DCI: nCCE=%d, L=%d, format=%s, msg_len=%d, mean=%f, crc_rem=0x%x\n", + INFO("Decoded DCI: nCCE=%d, L=%d, format=%s, msg_len=%d, mean=%f, crc_rem=0x%x", msg->location.ncce, msg->location.L, srslte_dci_format_string(msg->format), @@ -404,12 +400,11 @@ int srslte_pdcch_decode_msg(srslte_pdcch_t* q, srslte_dl_sf_cfg_t* sf, srslte_dc mean, msg->rnti); } else { - INFO( - "Skipping DCI: nCCE=%d, L=%d, msg_len=%d, mean=%f\n", msg->location.ncce, msg->location.L, nof_bits, mean); + INFO("Skipping DCI: nCCE=%d, L=%d, msg_len=%d, mean=%f", msg->location.ncce, msg->location.L, nof_bits, mean); } } } else { - ERROR("Invalid parameters, location=%d,%d\n", msg->location.ncce, msg->location.L); + ERROR("Invalid parameters, location=%d,%d", msg->location.ncce, msg->location.L); } return ret; } @@ -422,7 +417,6 @@ int srslte_pdcch_extract_llr(srslte_pdcch_t* q, srslte_chest_dl_res_t* channel, cf_t* sf_symbols[SRSLTE_MAX_PORTS]) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; /* Set pointers for layermapping & precoding */ @@ -430,13 +424,12 @@ int srslte_pdcch_extract_llr(srslte_pdcch_t* q, cf_t* x[SRSLTE_MAX_LAYERS]; if (q != NULL && sf->cfi > 0 && sf->cfi < 4) { - uint32_t e_bits = 72 * NOF_CCE(sf->cfi); nof_symbols = e_bits / 2; ret = SRSLTE_ERROR; srslte_vec_f_zero(q->llr, q->max_bits); - DEBUG("Extracting LLRs: E: %d, SF: %d, CFI: %d\n", e_bits, sf->tti % 10, sf->cfi); + DEBUG("Extracting LLRs: E: %d, SF: %d, CFI: %d", e_bits, sf->tti % 10, sf->cfi); /* number of layers equals number of ports */ for (i = 0; i < q->cell.nof_ports; i++) { @@ -448,7 +441,7 @@ int srslte_pdcch_extract_llr(srslte_pdcch_t* q, for (int j = 0; j < q->nof_rx_antennas; j++) { int n = srslte_regs_pdcch_get(q->regs, sf->cfi, sf_symbols[j], q->symbols[j]); if (nof_symbols != n) { - ERROR("Expected %d PDCCH symbols but got %d symbols\n", nof_symbols, n); + ERROR("Expected %d PDCCH symbols but got %d symbols", nof_symbols, n); return ret; } @@ -456,7 +449,7 @@ int srslte_pdcch_extract_llr(srslte_pdcch_t* q, for (i = 0; i < q->cell.nof_ports; i++) { n = srslte_regs_pdcch_get(q->regs, sf->cfi, channel->ce[i][j], q->ce[i][j]); if (nof_symbols != n) { - ERROR("Expected %d PDCCH symbols but got %d symbols\n", nof_symbols, n); + ERROR("Expected %d PDCCH symbols but got %d symbols", nof_symbols, n); return ret; } } @@ -490,7 +483,7 @@ static void crc_set_mask_rnti(uint8_t* crc, uint16_t rnti) uint8_t mask[16]; uint8_t* r = mask; - DEBUG("Mask CRC with RNTI 0x%x\n", rnti); + DEBUG("Mask CRC with RNTI 0x%x", rnti); srslte_bit_unpack(rnti, &r, 16); for (i = 0; i < 16; i++) { @@ -525,7 +518,6 @@ int srslte_pdcch_dci_encode(srslte_pdcch_t* q, uint8_t* data, uint8_t* e, uint32 uint8_t tmp[3 * (SRSLTE_DCI_MAX_BITS + 16)]; if (q != NULL && data != NULL && e != NULL && nof_bits < SRSLTE_DCI_MAX_BITS && E < q->max_bits) { - srslte_pdcch_dci_encode_conv(q, data, nof_bits, tmp, rnti); DEBUG("CConv output: "); @@ -554,21 +546,19 @@ int srslte_pdcch_encode(srslte_pdcch_t* q, srslte_dci_msg_t* msg, cf_t* sf_symbols[SRSLTE_MAX_PORTS]) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; uint32_t i; cf_t* x[SRSLTE_MAX_LAYERS]; uint32_t nof_symbols; if (q != NULL && sf_symbols != NULL && sf->cfi > 0 && sf->cfi < 4 && srslte_dci_location_isvalid(&msg->location)) { - uint32_t e_bits = PDCCH_FORMAT_NOF_BITS(msg->location.L); nof_symbols = e_bits / 2; ret = SRSLTE_ERROR; if (msg->location.ncce + PDCCH_FORMAT_NOF_CCE(msg->location.L) <= NOF_CCE(sf->cfi) && msg->nof_bits < SRSLTE_DCI_MAX_BITS - 16) { - DEBUG("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x\n", + DEBUG("Encoding DCI: Nbits: %d, E: %d, nCCE: %d, L: %d, RNTI: 0x%x", msg->nof_bits, e_bits, msg->location.ncce, @@ -613,14 +603,14 @@ int srslte_pdcch_encode(srslte_pdcch_t* q, ret = SRSLTE_SUCCESS; } else { - ERROR("Illegal DCI message nCCE: %d, L: %d, nof_cce: %d, nof_bits=%d\n", + ERROR("Illegal DCI message nCCE: %d, L: %d, nof_cce: %d, nof_bits=%d", msg->location.ncce, msg->location.L, NOF_CCE(sf->cfi), msg->nof_bits); } } else { - ERROR("Invalid parameters: cfi=%d, L=%d, nCCE=%d\n", sf->cfi, msg->location.L, msg->location.ncce); + ERROR("Invalid parameters: cfi=%d, L=%d, nCCE=%d", sf->cfi, msg->location.L, msg->location.ncce); } return ret; } diff --git a/lib/src/phy/phch/pdcch_nr.c b/lib/src/phy/phch/pdcch_nr.c index 7ec569120..c657287df 100644 --- a/lib/src/phy/phch/pdcch_nr.c +++ b/lib/src/phy/phch/pdcch_nr.c @@ -53,7 +53,7 @@ static int srslte_pdcch_nr_get_ncce(const srslte_coreset_t* coreset, uint32_t candidate) { if (aggregation_level >= SRSLTE_SEARCH_SPACE_NOF_AGGREGATION_LEVELS_NR) { - ERROR("Invalid aggregation level %d;\n", aggregation_level); + ERROR("Invalid aggregation level %d;", aggregation_level); return SRSLTE_ERROR; } @@ -63,7 +63,7 @@ static int srslte_pdcch_nr_get_ncce(const srslte_coreset_t* coreset, uint32_t M = search_space->nof_candidates[aggregation_level]; // Number of aggregation levels if (M == 0) { - ERROR("Invalid number of candidates %d for aggregation level %d\n", M, aggregation_level); + ERROR("Invalid number of candidates %d for aggregation level %d", M, aggregation_level); return SRSLTE_ERROR; } @@ -72,7 +72,7 @@ static int srslte_pdcch_nr_get_ncce(const srslte_coreset_t* coreset, uint32_t N_cce = srslte_coreset_get_bw(coreset) * coreset->duration / 6; if (N_cce < L) { - ERROR("Error number of CCE %d is lower than the aggregation level %d\n", N_cce, L); + ERROR("Error number of CCE %d is lower than the aggregation level %d", N_cce, L); return SRSLTE_ERROR; } @@ -334,7 +334,6 @@ static uint32_t pdcch_nr_c_init(const srslte_pdcch_nr_t* q, const srslte_dci_msg int srslte_pdcch_nr_encode(srslte_pdcch_nr_t* q, const srslte_dci_msg_nr_t* dci_msg, cf_t* slot_symbols) { - if (q == NULL || dci_msg == NULL || slot_symbols == NULL) { return SRSLTE_ERROR; } @@ -354,7 +353,7 @@ int srslte_pdcch_nr_encode(srslte_pdcch_nr_t* q, const srslte_dci_msg_nr_t* dci_ if (srslte_polar_code_get(&q->code, q->K, q->E, 9U) < SRSLTE_SUCCESS) { return SRSLTE_ERROR; } - PDCCH_INFO_TX("K=%d; E=%d; M=%d; n=%d; cinit=%08x;\n", q->K, q->E, q->M, q->code.n, cinit); + PDCCH_INFO_TX("K=%d; E=%d; M=%d; n=%d; cinit=%08x;", q->K, q->E, q->M, q->code.n, cinit); // Set first L bits to ones, c will have an offset of 24 bits uint8_t* c = q->c; @@ -366,7 +365,7 @@ int srslte_pdcch_nr_encode(srslte_pdcch_nr_t* q, const srslte_dci_msg_nr_t* dci_ // Append CRC srslte_crc_attach(&q->crc24c, q->c, q->K); - PDCCH_INFO_TX("Append CRC %06x\n", (uint32_t)srslte_crc_checksum_get(&q->crc24c)); + PDCCH_INFO_TX("Append CRC %06x", (uint32_t)srslte_crc_checksum_get(&q->crc24c)); // Unpack RNTI uint8_t unpacked_rnti[16] = {}; @@ -414,7 +413,7 @@ int srslte_pdcch_nr_encode(srslte_pdcch_nr_t* q, const srslte_dci_msg_nr_t* dci_ // Put symbols in grid uint32_t m = pdcch_nr_cp(q, &dci_msg->location, slot_symbols, q->symbols, true); if (q->M != m) { - ERROR("Unmatch number of RE (%d != %d)\n", m, q->M); + ERROR("Unmatch number of RE (%d != %d)", m, q->M); return SRSLTE_ERROR; } @@ -427,7 +426,7 @@ int srslte_pdcch_nr_encode(srslte_pdcch_nr_t* q, const srslte_dci_msg_nr_t* dci_ if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { char str[128] = {}; srslte_pdcch_nr_info(q, NULL, str, sizeof(str)); - PDCCH_INFO_TX("%s\n", str); + PDCCH_INFO_TX("%s", str); } return SRSLTE_SUCCESS; @@ -455,7 +454,7 @@ int srslte_pdcch_nr_decode(srslte_pdcch_nr_t* q, // Check number of estimates is correct if (ce->nof_re != q->M) { - ERROR("Invalid number of channel estimates (%d != %d)\n", q->M, ce->nof_re); + ERROR("Invalid number of channel estimates (%d != %d)", q->M, ce->nof_re); return SRSLTE_ERROR; } @@ -463,12 +462,12 @@ int srslte_pdcch_nr_decode(srslte_pdcch_nr_t* q, if (srslte_polar_code_get(&q->code, q->K, q->E, 9U) < SRSLTE_SUCCESS) { return SRSLTE_ERROR; } - PDCCH_INFO_RX("K=%d; E=%d; M=%d; n=%d;\n", q->K, q->E, q->M, q->code.n); + PDCCH_INFO_RX("K=%d; E=%d; M=%d; n=%d;", q->K, q->E, q->M, q->code.n); // Get symbols from grid uint32_t m = pdcch_nr_cp(q, &dci_msg->location, slot_symbols, q->symbols, false); if (q->M != m) { - ERROR("Unmatch number of RE (%d != %d)\n", m, q->M); + ERROR("Unmatch number of RE (%d != %d)", m, q->M); return SRSLTE_ERROR; } @@ -574,7 +573,7 @@ int srslte_pdcch_nr_decode(srslte_pdcch_nr_t* q, if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { char str[128] = {}; srslte_pdcch_nr_info(q, res, str, sizeof(str)); - PDCCH_INFO_RX("%s\n", str); + PDCCH_INFO_RX("%s", str); } return SRSLTE_SUCCESS; diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index aff49f17a..353099ff3 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -151,7 +151,6 @@ static int srslte_pdsch_cp(const srslte_pdsch_t* q, // Iterate over PRB for (uint32_t n = 0; n < q->cell.nof_prb; n++) { - // If this PRB is assigned if (grant->prb_idx[s][n]) { bool skip = pdsch_cp_skip_symbol(&q->cell, grant, sf_idx, s, l, n); @@ -251,7 +250,6 @@ static int pdsch_init(srslte_pdsch_t* q, uint32_t max_prb, bool is_ue, uint32_t int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - bzero(q, sizeof(srslte_pdsch_t)); ret = SRSLTE_ERROR; @@ -259,7 +257,7 @@ static int pdsch_init(srslte_pdsch_t* q, uint32_t max_prb, bool is_ue, uint32_t q->is_ue = is_ue; q->nof_rx_antennas = nof_antennas; - INFO("Init PDSCH: %d PRBs, max_symbols: %d\n", max_prb, q->max_re); + INFO("Init PDSCH: %d PRBs, max_symbols: %d", max_prb, q->max_re); for (int i = 0; i < SRSLTE_MOD_NITEMS; i++) { if (srslte_modem_table_lte(&q->mod[i], modulations[i])) { @@ -289,7 +287,7 @@ static int pdsch_init(srslte_pdsch_t* q, uint32_t max_prb, bool is_ue, uint32_t if (is_ue) { q->evm_buffer[i] = srslte_evm_buffer_alloc(srslte_ra_tbs_from_idx(SRSLTE_RA_NOF_TBS_IDX - 1, 6)); if (!q->evm_buffer[i]) { - ERROR("Allocating EVM buffer\n"); + ERROR("Allocating EVM buffer"); goto clean; } } @@ -417,7 +415,6 @@ void srslte_pdsch_free(srslte_pdsch_t* q) srslte_pdsch_disable_coworker(q); for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { - if (q->e[i]) { free(q->e[i]); } @@ -490,7 +487,7 @@ int srslte_pdsch_set_cell(srslte_pdsch_t* q, srslte_cell_t cell) } } - INFO("PDSCH: Cell config PCI=%d, %d ports, %d PRBs, max_symbols: %d\n", + INFO("PDSCH: Cell config PCI=%d, %d ports, %d PRBs, max_symbols: %d", q->cell.id, q->cell.nof_ports, q->cell.nof_prb, @@ -513,7 +510,7 @@ int srslte_pdsch_set_rnti(srslte_pdsch_t* q, uint16_t rnti) // If the sequence is not allocated generate q->users[rnti_idx] = calloc(1, sizeof(srslte_pdsch_user_t)); if (!q->users[rnti_idx]) { - ERROR("Alocating PDSCH user\n"); + ERROR("Alocating PDSCH user"); return SRSLTE_ERROR; } } else if (q->users[rnti_idx]->sequence_generated && q->users[rnti_idx]->cell_id == q->cell.id && !q->is_ue) { @@ -534,7 +531,7 @@ int srslte_pdsch_set_rnti(srslte_pdsch_t* q, uint16_t rnti) SRSLTE_NOF_SLOTS_PER_SF * sf_idx, q->cell.id, q->max_re * srslte_mod_bits_x_symbol(SRSLTE_MOD_256QAM))) { - ERROR("Error initializing PDSCH scrambling sequence\n"); + ERROR("Error initializing PDSCH scrambling sequence"); srslte_pdsch_free_rnti(q, rnti); return SRSLTE_ERROR; } @@ -565,7 +562,6 @@ void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti) } static float apply_power_allocation(srslte_pdsch_t* q, srslte_pdsch_cfg_t* cfg, cf_t* sf_symbols_m[SRSLTE_MAX_PORTS]) { - uint32_t nof_symbols_slot = cfg->grant.nof_symb_slot[0]; uint32_t nof_re_symbol = SRSLTE_NRE * q->cell.nof_prb; @@ -618,10 +614,8 @@ get_user_sequence(srslte_pdsch_t* q, uint16_t rnti, uint32_t codeword_idx, uint3 static void csi_correction(srslte_pdsch_t* q, srslte_pdsch_cfg_t* cfg, uint32_t codeword_idx, uint32_t tb_idx, void* e) { - uint32_t qm = 0; switch (cfg->grant.tb[tb_idx].mod) { - case SRSLTE_MOD_BPSK: qm = 1; break; @@ -743,7 +737,7 @@ static void pdsch_decode_debug(srslte_pdsch_t* q, ERROR("Generating file name"); break; } - DEBUG("SAVED FILE %s: received subframe symbols\n", filename); + DEBUG("SAVED FILE %s: received subframe symbols", filename); srslte_vec_save_file(filename, sf_symbols[j], SRSLTE_NOF_RE(q->cell) * sizeof(cf_t)); for (int i = 0; i < q->cell.nof_ports; i++) { @@ -751,7 +745,7 @@ static void pdsch_decode_debug(srslte_pdsch_t* q, ERROR("Generating file name"); break; } - DEBUG("SAVED FILE %s: channel estimates for Tx %d and Rx %d\n", filename, j, i); + DEBUG("SAVED FILE %s: channel estimates for Tx %d and Rx %d", filename, j, i); srslte_vec_save_file(filename, ce[i][j], SRSLTE_NOF_RE(q->cell) * sizeof(cf_t)); } } @@ -760,14 +754,14 @@ static void pdsch_decode_debug(srslte_pdsch_t* q, ERROR("Generating file name"); break; } - DEBUG("SAVED FILE %s: symbols after equalization\n", filename); + DEBUG("SAVED FILE %s: symbols after equalization", filename); srslte_vec_save_file(filename, q->d[i], cfg->grant.nof_re * sizeof(cf_t)); if (snprintf(filename, FILENAME_MAX, "llr_%d.dat", i) < 0) { ERROR("Generating file name"); break; } - DEBUG("SAVED FILE %s: LLR estimates after demodulation and descrambling\n", filename); + DEBUG("SAVED FILE %s: LLR estimates after demodulation and descrambling", filename); srslte_vec_save_file(filename, q->e[i], cfg->grant.tb[0].nof_bits * sizeof(int16_t)); } } @@ -790,7 +784,7 @@ static int srslte_pdsch_codeword_decode(srslte_pdsch_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (softbuffer && data && ack && cfg->grant.tb[tb_idx].nof_bits && cfg->grant.nof_re) { - INFO("Decoding PDSCH SF: %d (CW%d -> TB%d), Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n", + INFO("Decoding PDSCH SF: %d (CW%d -> TB%d), Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d", sf->tti % 10, codeword_idx, tb_idx, @@ -831,7 +825,7 @@ static int srslte_pdsch_codeword_decode(srslte_pdsch_t* q, srslte_sequence_t* seq = get_user_sequence(q, cfg->rnti, codeword_idx, sf->tti % 10, cfg->grant.tb[tb_idx].nof_bits); if (!seq) { - ERROR("Error getting user sequence for rnti=0x%x\n", cfg->rnti); + ERROR("Error getting user sequence for rnti=0x%x", cfg->rnti); return -1; } @@ -859,7 +853,7 @@ static int srslte_pdsch_codeword_decode(srslte_pdsch_t* q, ret = SRSLTE_ERROR; } } else { - ERROR("Invalid parameters in TB%d &softbuffer=%p &data=%p &ack=%p, nbits=%d, nof_re=%d\n", + ERROR("Invalid parameters in TB%d &softbuffer=%p &data=%p &ack=%p, nbits=%d, nof_re=%d", codeword_idx, softbuffer, (void*)data, @@ -875,7 +869,7 @@ static void* srslte_pdsch_decode_thread(void* arg) { srslte_pdsch_coworker_t* q = (srslte_pdsch_coworker_t*)arg; - INFO("[PDSCH Coworker] waiting for data\n"); + INFO("[PDSCH Coworker] waiting for data"); sem_wait(&q->start); while (!q->quit) { @@ -902,13 +896,11 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, cf_t* sf_symbols[SRSLTE_MAX_PORTS], srslte_pdsch_res_t data[SRSLTE_MAX_CODEWORDS]) { - /* Set pointers for layermapping & precoding */ uint32_t i; cf_t** x; if (q != NULL && sf_symbols != NULL && data != NULL && cfg != NULL) { - struct timeval t[3]; if (cfg->meas_time_en) { gettimeofday(&t[1], NULL); @@ -930,7 +922,7 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, float noise_estimate = cfg->decoder_type == SRSLTE_MIMO_DECODER_ZF ? 0 : channel->noise_estimate; - INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mod=%s, nof_layers=%d, nof_tb=%d\n", + INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mod=%s, nof_layers=%d, nof_tb=%d", sf->tti % 10, cfg->rnti, cfg->grant.nof_re, @@ -944,21 +936,21 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, for (int j = 0; j < q->nof_rx_antennas; j++) { int n = srslte_pdsch_get(q, sf_symbols[j], q->symbols[j], &cfg->grant, lstart, sf->tti % 10); if (n != cfg->grant.nof_re) { - ERROR("Error expecting %d symbols but got %d\n", cfg->grant.nof_re, n); + ERROR("Error expecting %d symbols but got %d", cfg->grant.nof_re, n); return SRSLTE_ERROR; } for (i = 0; i < q->cell.nof_ports; i++) { n = srslte_pdsch_get(q, channel->ce[i][j], q->ce[i][j], &cfg->grant, lstart, sf->tti % 10); if (n != cfg->grant.nof_re) { - ERROR("Error expecting %d symbols but got %d\n", cfg->grant.nof_re, n); + ERROR("Error expecting %d symbols but got %d", cfg->grant.nof_re, n); return SRSLTE_ERROR; } } } if (cfg->grant.nof_layers == 0 || cfg->grant.nof_layers > SRSLTE_MAX_LAYERS) { - ERROR("PDSCH Number of layers (%d) is out-of-bounds\n", cfg->grant.nof_layers); + ERROR("PDSCH Number of layers (%d) is out-of-bounds", cfg->grant.nof_layers); return SRSLTE_ERROR_OUT_OF_BOUNDS; } @@ -989,7 +981,7 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, cfg->grant.tx_scheme, pdsch_scaling, noise_estimate) < 0) { - ERROR("Error predecoding\n"); + ERROR("Error predecoding"); return SRSLTE_ERROR; } @@ -1000,7 +992,6 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, /* Codeword decoding: Implementation of 3GPP 36.212 Table 5.3.3.1.5-1 and Table 5.3.3.1.5-2 */ for (uint32_t tb_idx = 0; tb_idx < SRSLTE_MAX_TB; tb_idx++) { - /* Decode only if transport block is enabled and the default ACK is not true */ if (cfg->grant.tb[tb_idx].enabled) { if (!data[tb_idx].crc) { @@ -1065,7 +1056,7 @@ int srslte_pdsch_decode(srslte_pdsch_t* q, return SRSLTE_SUCCESS; } else { - ERROR("Invalid inputs\n"); + ERROR("Invalid inputs"); return SRSLTE_ERROR_INVALID_INPUTS; } } @@ -1090,7 +1081,7 @@ static int srslte_pdsch_codeword_encode(srslte_pdsch_t* q, if (cfg->grant.tb[tb_idx].enabled) { if (cfg->rnti != SRSLTE_SIRNTI) { - INFO("Encoding PDSCH SF: %d (TB%d -> CW%d), Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n", + INFO("Encoding PDSCH SF: %d (TB%d -> CW%d), Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d", sf->tti % 10, tb_idx, codeword_idx, @@ -1111,7 +1102,7 @@ static int srslte_pdsch_codeword_encode(srslte_pdsch_t* q, srslte_sequence_t* seq = get_user_sequence(q, cfg->rnti, codeword_idx, sf->tti % 10, cfg->grant.tb[tb_idx].nof_bits); if (!seq) { - ERROR("Error getting user sequence for rnti=0x%x\n", cfg->rnti); + ERROR("Error getting user sequence for rnti=0x%x", cfg->rnti); return -1; } @@ -1135,7 +1126,6 @@ int srslte_pdsch_encode(srslte_pdsch_t* q, uint8_t* data[SRSLTE_MAX_CODEWORDS], cf_t* sf_symbols[SRSLTE_MAX_PORTS]) { - int i; /* Set pointers for layermapping & precoding */ cf_t* x[SRSLTE_MAX_LAYERS]; @@ -1151,19 +1141,19 @@ int srslte_pdsch_encode(srslte_pdsch_t* q, for (i = 0; i < q->cell.nof_ports; i++) { if (sf_symbols[i] == NULL) { - ERROR("Error NULL pointer in sf_symbols[%d]\n", i); + ERROR("Error NULL pointer in sf_symbols[%d]", i); return SRSLTE_ERROR_INVALID_INPUTS; } } /* If both transport block size is zero return error */ if (!nof_tb) { - ERROR("Error number of TB is zero\n"); + ERROR("Error number of TB is zero"); return SRSLTE_ERROR_INVALID_INPUTS; } if (cfg->grant.nof_re > q->max_re) { - ERROR("Error too many RE per subframe (%d). PDSCH configured for %d RE (%d PRB)\n", + ERROR("Error too many RE per subframe (%d). PDSCH configured for %d RE (%d PRB)", cfg->grant.nof_re, q->max_re, q->cell.nof_prb); @@ -1187,7 +1177,7 @@ int srslte_pdsch_encode(srslte_pdsch_t* q, } if (cfg->rnti != SRSLTE_SIRNTI) { - INFO("Encoding PDSCH SF: %d rho_a=%f, nof_ports=%d, nof_layers=%d, nof_tb=%d, pmi=%d, tx_scheme=%s\n", + INFO("Encoding PDSCH SF: %d rho_a=%f, nof_ports=%d, nof_layers=%d, nof_tb=%d, pmi=%d, tx_scheme=%s", sf->tti % 10, rho_a, q->cell.nof_ports, @@ -1287,7 +1277,6 @@ uint32_t srslte_pdsch_grant_rx_info(srslte_pdsch_grant_t* grant, char* str, uint32_t str_len) { - uint32_t len = srslte_ra_dl_info(grant, str, str_len); len = srslte_print_check(str, str_len, len, ", crc={", 0); @@ -1332,7 +1321,7 @@ srslte_pdsch_rx_info(srslte_pdsch_cfg_t* cfg, srslte_pdsch_res_t res[SRSLTE_MAX_ } if (cfg->meas_time_en) { - len = srslte_print_check(str, str_len, len, ", t=%d us\n", cfg->meas_time_value); + len = srslte_print_check(str, str_len, len, ", t=%d us", cfg->meas_time_value); } return len; @@ -1340,7 +1329,6 @@ srslte_pdsch_rx_info(srslte_pdsch_cfg_t* cfg, srslte_pdsch_res_t res[SRSLTE_MAX_ uint32_t srslte_pdsch_tx_info(srslte_pdsch_cfg_t* cfg, char* str, uint32_t str_len) { - uint32_t len = srslte_print_check(str, str_len, 0, "rnti=0x%x", cfg->rnti); len += srslte_ra_dl_info(&cfg->grant, &str[len], str_len); diff --git a/lib/src/phy/phch/pdsch_nr.c b/lib/src/phy/phch/pdsch_nr.c index 7f0c9e210..8ad4b2499 100644 --- a/lib/src/phy/phch/pdsch_nr.c +++ b/lib/src/phy/phch/pdsch_nr.c @@ -21,7 +21,7 @@ int pdsch_nr_init_common(srslte_pdsch_nr_t* q, const srslte_pdsch_nr_args_t* arg { for (srslte_mod_t mod = SRSLTE_MOD_BPSK; mod < SRSLTE_MOD_NITEMS; mod++) { if (srslte_modem_table_lte(&q->modem_tables[mod], mod) < SRSLTE_SUCCESS) { - ERROR("Error initialising modem table for %s\n", srslte_mod_string(mod)); + ERROR("Error initialising modem table for %s", srslte_mod_string(mod)); return SRSLTE_ERROR; } if (args->measure_evm) { @@ -43,7 +43,7 @@ int srslte_pdsch_nr_init_enb(srslte_pdsch_nr_t* q, const srslte_pdsch_nr_args_t* } if (srslte_sch_nr_init_tx(&q->sch, &args->sch)) { - ERROR("Initialising SCH\n"); + ERROR("Initialising SCH"); return SRSLTE_ERROR; } @@ -61,14 +61,14 @@ int srslte_pdsch_nr_init_ue(srslte_pdsch_nr_t* q, const srslte_pdsch_nr_args_t* } if (srslte_sch_nr_init_rx(&q->sch, &args->sch)) { - ERROR("Initialising SCH\n"); + ERROR("Initialising SCH"); return SRSLTE_ERROR; } if (args->measure_evm) { q->evm_buffer = srslte_evm_buffer_alloc(8); if (q->evm_buffer == NULL) { - ERROR("Initialising EVM\n"); + ERROR("Initialising EVM"); return SRSLTE_ERROR; } } @@ -411,7 +411,7 @@ pdsch_nr_cinit(const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_nr_t* cf } uint32_t cinit = (((uint32_t)rnti) << 15U) + (cw_idx << 14U) + n_id; - INFO("PDSCH: RNTI=%d (0x%x); nid=%d; cinit=%d (0x%x);\n", rnti, rnti, n_id, cinit, cinit); + INFO("PDSCH: RNTI=%d (0x%x); nid=%d; cinit=%d (0x%x);", rnti, rnti, n_id, cinit, cinit); return cinit; } @@ -429,19 +429,19 @@ static inline int pdsch_nr_encode_codeword(srslte_pdsch_nr_t* q, // Check codeword index if (tb->cw_idx >= q->max_cw) { - ERROR("Unsupported codeword index %d\n", tb->cw_idx); + ERROR("Unsupported codeword index %d", tb->cw_idx); return SRSLTE_ERROR; } // Check modulation if (tb->mod >= SRSLTE_MOD_NITEMS) { - ERROR("Invalid modulation %s\n", srslte_mod_string(tb->mod)); + ERROR("Invalid modulation %s", srslte_mod_string(tb->mod)); return SRSLTE_ERROR_OUT_OF_BOUNDS; } // Encode SCH if (srslte_dlsch_nr_encode(&q->sch, &cfg->sch_cfg, tb, data, q->b[tb->cw_idx]) < SRSLTE_SUCCESS) { - ERROR("Error in DL-SCH encoding\n"); + ERROR("Error in DL-SCH encoding"); return SRSLTE_ERROR; } @@ -483,7 +483,7 @@ int srslte_pdsch_nr_encode(srslte_pdsch_nr_t* q, // Check number of layers if (q->max_layers < grant->nof_layers) { - ERROR("Error number of layers (%d) exceeds configured maximum (%d)\n", grant->nof_layers, q->max_layers); + ERROR("Error number of layers (%d) exceeds configured maximum (%d)", grant->nof_layers, q->max_layers); return SRSLTE_ERROR; } @@ -493,7 +493,7 @@ int srslte_pdsch_nr_encode(srslte_pdsch_nr_t* q, nof_cw += grant->tb[tb].enabled ? 1 : 0; if (pdsch_nr_encode_codeword(q, cfg, &grant->tb[tb], data[tb], grant->rnti) < SRSLTE_SUCCESS) { - ERROR("Error encoding TB %d\n", tb); + ERROR("Error encoding TB %d", tb); return SRSLTE_ERROR; } } @@ -514,12 +514,12 @@ int srslte_pdsch_nr_encode(srslte_pdsch_nr_t* q, // 7.3.1.6 Mapping from virtual to physical resource blocks int n = srslte_pdsch_nr_put(q, cfg, grant, x[0], sf_symbols[0]); if (n < SRSLTE_SUCCESS) { - ERROR("Putting NR PDSCH resources\n"); + ERROR("Putting NR PDSCH resources"); return SRSLTE_ERROR; } if (n != grant->tb[0].nof_re) { - ERROR("Unmatched number of RE (%d != %d)\n", n, grant->tb[0].nof_re); + ERROR("Unmatched number of RE (%d != %d)", n, grant->tb[0].nof_re); return SRSLTE_ERROR; } @@ -545,13 +545,13 @@ static inline int pdsch_nr_decode_codeword(srslte_pdsch_nr_t* q, // Check codeword index if (tb->cw_idx >= q->max_cw) { - ERROR("Unsupported codeword index %d\n", tb->cw_idx); + ERROR("Unsupported codeword index %d", tb->cw_idx); return SRSLTE_ERROR; } // Check modulation if (tb->mod >= SRSLTE_MOD_NITEMS) { - ERROR("Invalid modulation %s\n", srslte_mod_string(tb->mod)); + ERROR("Invalid modulation %s", srslte_mod_string(tb->mod)); return SRSLTE_ERROR_OUT_OF_BOUNDS; } @@ -586,7 +586,7 @@ static inline int pdsch_nr_decode_codeword(srslte_pdsch_nr_t* q, // Decode SCH if (srslte_dlsch_nr_decode(&q->sch, &cfg->sch_cfg, tb, llr, res->payload, &res->crc) < SRSLTE_SUCCESS) { - ERROR("Error in DL-SCH encoding\n"); + ERROR("Error in DL-SCH encoding"); return SRSLTE_ERROR; } @@ -618,14 +618,14 @@ int srslte_pdsch_nr_decode(srslte_pdsch_nr_t* q, uint32_t nof_re = srslte_ra_dl_nr_slot_nof_re(cfg, grant); if (channel->nof_re != nof_re) { - ERROR("Inconsistent number of RE (%d!=%d)\n", channel->nof_re, nof_re); + ERROR("Inconsistent number of RE (%d!=%d)", channel->nof_re, nof_re); return SRSLTE_ERROR; } // Demapping from virtual to physical resource blocks uint32_t nof_re_get = srslte_pdsch_nr_get(q, cfg, grant, q->x[0], sf_symbols[0]); if (nof_re_get != nof_re) { - ERROR("Inconsistent number of RE (%d!=%d)\n", nof_re_get, nof_re); + ERROR("Inconsistent number of RE (%d!=%d)", nof_re_get, nof_re); return SRSLTE_ERROR; } @@ -654,7 +654,7 @@ int srslte_pdsch_nr_decode(srslte_pdsch_nr_t* q, nof_cw += grant->tb[tb].enabled ? 1 : 0; if (pdsch_nr_decode_codeword(q, cfg, &grant->tb[tb], &data[tb], grant->rnti) < SRSLTE_SUCCESS) { - ERROR("Error encoding TB %d\n", tb); + ERROR("Error encoding TB %d", tb); return SRSLTE_ERROR; } } @@ -773,7 +773,7 @@ uint32_t srslte_pdsch_nr_tx_info(const srslte_pdsch_nr_t* q, len += srslte_pdsch_nr_grant_info(cfg, grant, &str[len], str_len - len); if (q->meas_time_en) { - len = srslte_print_check(str, str_len, len, ", t=%d us\n", q->meas_time_us); + len = srslte_print_check(str, str_len, len, ", t=%d us", q->meas_time_us); } return len; diff --git a/lib/src/phy/phch/phich.c b/lib/src/phy/phch/phich.c index 97400f0ed..f71980c61 100644 --- a/lib/src/phy/phch/phich.c +++ b/lib/src/phy/phch/phich.c @@ -66,7 +66,6 @@ int srslte_phich_init(srslte_phich_t* q, uint32_t nof_rx_antennas) int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - bzero(q, sizeof(srslte_phich_t)); ret = SRSLTE_ERROR; @@ -104,7 +103,6 @@ int srslte_phich_set_cell(srslte_phich_t* q, srslte_regs_t* regs, srslte_cell_t int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && regs != NULL && srslte_cell_isvalid(&cell)) { - q->regs = regs; if (cell.id != q->cell.id || q->cell.nof_prb == 0) { @@ -130,7 +128,7 @@ void srslte_phich_calc(srslte_phich_t* q, srslte_phich_grant_t* grant, srslte_ph n_phich->nseq = ((grant->n_prb_lowest / Ngroups) + grant->n_dmrs) % (2 * srslte_phich_nsf(q)); } } else { - ERROR("PHICH: Error computing PHICH groups. Ngroups is zero\n"); + ERROR("PHICH: Error computing PHICH groups. Ngroups is zero"); } } @@ -151,7 +149,7 @@ uint8_t srslte_phich_ack_decode(float bits[SRSLTE_PHICH_NBITS], float* distance) for (i = 0; i < 2; i++) { float corr = srslte_vec_dot_prod_fff(ack_table[i], bits, SRSLTE_PHICH_NBITS) / SRSLTE_PHICH_NBITS; - INFO("Corr%d=%f\n", i, corr); + INFO("Corr%d=%f", i, corr); if (corr > max_corr) { max_corr = corr; if (distance) { @@ -178,7 +176,6 @@ int srslte_phich_decode(srslte_phich_t* q, cf_t* sf_symbols[SRSLTE_MAX_PORTS], srslte_phich_res_t* result) { - /* Set pointers for layermapping & precoding */ int i, j; cf_t* x[SRSLTE_MAX_LAYERS]; @@ -190,27 +187,27 @@ int srslte_phich_decode(srslte_phich_t* q, uint32_t sf_idx = sf->tti % 10; if (sf_idx >= SRSLTE_NOF_SF_X_FRAME) { - ERROR("Invalid nslot %d\n", sf_idx); + ERROR("Invalid nslot %d", sf_idx); return SRSLTE_ERROR_INVALID_INPUTS; } if (SRSLTE_CP_ISEXT(q->cell.cp)) { if (n_phich.nseq >= SRSLTE_PHICH_EXT_NSEQUENCES) { - ERROR("Invalid nseq %d\n", n_phich.nseq); + ERROR("Invalid nseq %d", n_phich.nseq); return SRSLTE_ERROR_INVALID_INPUTS; } } else { if (n_phich.nseq >= SRSLTE_PHICH_NORM_NSEQUENCES) { - ERROR("Invalid nseq %d\n", n_phich.nseq); + ERROR("Invalid nseq %d", n_phich.nseq); return SRSLTE_ERROR_INVALID_INPUTS; } } if (n_phich.ngroup >= srslte_regs_phich_ngroups(q->regs)) { - ERROR("Invalid ngroup %d\n", n_phich.ngroup); + ERROR("Invalid ngroup %d", n_phich.ngroup); return SRSLTE_ERROR_INVALID_INPUTS; } - DEBUG("Decoding PHICH Ngroup: %d, Nseq: %d\n", n_phich.ngroup, n_phich.nseq); + DEBUG("Decoding PHICH Ngroup: %d, Nseq: %d", n_phich.ngroup, n_phich.nseq); /* number of layers equals number of ports */ for (i = 0; i < SRSLTE_MAX_PORTS; i++) { @@ -223,7 +220,7 @@ int srslte_phich_decode(srslte_phich_t* q, /* extract symbols */ for (int j = 0; j < q->nof_rx_antennas; j++) { if (SRSLTE_PHICH_MAX_NSYMB != srslte_regs_phich_get(q->regs, sf_symbols[j], q->sf_symbols[j], n_phich.ngroup)) { - ERROR("There was an error getting the phich symbols\n"); + ERROR("There was an error getting the phich symbols"); return SRSLTE_ERROR; } q_sf_symbols[j] = q->sf_symbols[j]; @@ -231,7 +228,7 @@ int srslte_phich_decode(srslte_phich_t* q, /* extract channel estimates */ for (i = 0; i < q->cell.nof_ports; i++) { if (SRSLTE_PHICH_MAX_NSYMB != srslte_regs_phich_get(q->regs, channel->ce[i][j], q->ce[i][j], n_phich.ngroup)) { - ERROR("There was an error getting the phich symbols\n"); + ERROR("There was an error getting the phich symbols"); return SRSLTE_ERROR; } q_ce[i][j] = q->ce[i][j]; @@ -248,7 +245,7 @@ int srslte_phich_decode(srslte_phich_t* q, q_sf_symbols, q_ce, x, NULL, q->nof_rx_antennas, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB, 1.0f); srslte_layerdemap_diversity(x, q->d0, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB / q->cell.nof_ports); } - DEBUG("Recv!!: \n"); + DEBUG("Recv!!: "); DEBUG("d0: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB); @@ -323,23 +320,23 @@ int srslte_phich_encode(srslte_phich_t* q, uint32_t sf_idx = sf->tti % 10; if (sf_idx >= SRSLTE_NOF_SF_X_FRAME) { - ERROR("Invalid nslot %d\n", sf_idx); + ERROR("Invalid nslot %d", sf_idx); return SRSLTE_ERROR_INVALID_INPUTS; } if (SRSLTE_CP_ISEXT(q->cell.cp)) { if (n_phich.nseq >= SRSLTE_PHICH_EXT_NSEQUENCES) { - ERROR("Invalid nseq %d\n", n_phich.nseq); + ERROR("Invalid nseq %d", n_phich.nseq); return SRSLTE_ERROR_INVALID_INPUTS; } } else { if (n_phich.nseq >= SRSLTE_PHICH_NORM_NSEQUENCES) { - ERROR("Invalid nseq %d\n", n_phich.nseq); + ERROR("Invalid nseq %d", n_phich.nseq); return SRSLTE_ERROR_INVALID_INPUTS; } } if (n_phich.ngroup >= srslte_regs_phich_ngroups(q->regs)) { - ERROR("Invalid ngroup %d\n", n_phich.ngroup); + ERROR("Invalid ngroup %d", n_phich.ngroup); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -419,7 +416,7 @@ int srslte_phich_encode(srslte_phich_t* q, /* mapping to resource elements */ for (i = 0; i < q->cell.nof_ports; i++) { if (srslte_regs_phich_add(q->regs, q->sf_symbols[i], n_phich.ngroup, sf_symbols[i]) < 0) { - ERROR("Error putting PCHICH resource elements\n"); + ERROR("Error putting PCHICH resource elements"); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/phch/pmch.c b/lib/src/phy/phch/pmch.c index 809be5b19..903c9d434 100644 --- a/lib/src/phy/phch/pmch.c +++ b/lib/src/phy/phch/pmch.c @@ -119,7 +119,6 @@ int srslte_pmch_init(srslte_pmch_t* q, uint32_t max_prb, uint32_t nof_rx_antenna int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && nof_rx_antennas <= SRSLTE_MAX_PORTS) { - bzero(q, sizeof(srslte_pmch_t)); ret = SRSLTE_ERROR; @@ -128,7 +127,7 @@ int srslte_pmch_init(srslte_pmch_t* q, uint32_t max_prb, uint32_t nof_rx_antenna q->max_re = max_prb * MAX_PMCH_RE; q->nof_rx_antennas = nof_rx_antennas; - INFO("Init PMCH: %d PRBs, max_symbols: %d\n", max_prb, q->max_re); + INFO("Init PMCH: %d PRBs, max_symbols: %d", max_prb, q->max_re); for (int i = 0; i < 4; i++) { if (srslte_modem_table_lte(&q->mod[i], modulations[i])) { @@ -232,7 +231,7 @@ int srslte_pmch_set_cell(srslte_pmch_t* q, srslte_cell_t cell) q->cell = cell; q->max_re = q->cell.nof_prb * MAX_PMCH_RE; - INFO("PMCH: Cell config PCI=%d, %d ports, %d PRBs, max_symbols: %d\n", + INFO("PMCH: Cell config PCI=%d, %d ports, %d PRBs, max_symbols: %d", q->cell.nof_ports, q->cell.id, q->cell.nof_prb, @@ -283,14 +282,13 @@ int srslte_pmch_decode(srslte_pmch_t* q, cf_t* sf_symbols[SRSLTE_MAX_PORTS], srslte_pdsch_res_t* out) { - /* Set pointers for layermapping & precoding */ uint32_t i, n; cf_t* x[SRSLTE_MAX_LAYERS]; if (q != NULL && sf_symbols != NULL && out != NULL && cfg != NULL) { INFO("Decoding PMCH SF: %d, MBSFN area ID: 0x%x, Mod %s, TBS: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d, " - "C_prb=%d, cfi=%d\n", + "C_prb=%d, cfi=%d", sf->tti % 10, cfg->area_id, srslte_mod_string(cfg->pdsch_cfg.grant.tb[0].mod), @@ -312,8 +310,7 @@ int srslte_pmch_decode(srslte_pmch_t* q, /* extract symbols */ n = pmch_get(q, sf_symbols[j], q->symbols[j], lstart); if (n != cfg->pdsch_cfg.grant.nof_re) { - - ERROR("PMCH 1 extract symbols error expecting %d symbols but got %d, lstart %d\n", + ERROR("PMCH 1 extract symbols error expecting %d symbols but got %d, lstart %d", cfg->pdsch_cfg.grant.nof_re, n, lstart); @@ -324,7 +321,7 @@ int srslte_pmch_decode(srslte_pmch_t* q, for (i = 0; i < q->cell.nof_ports; i++) { n = pmch_get(q, channel->ce[i][j], q->ce[i][j], lstart); if (n != cfg->pdsch_cfg.grant.nof_re) { - ERROR("PMCH 2 extract chest error expecting %d symbols but got %d\n", cfg->pdsch_cfg.grant.nof_re, n); + ERROR("PMCH 2 extract chest error expecting %d symbols but got %d", cfg->pdsch_cfg.grant.nof_re, n); return SRSLTE_ERROR; } } @@ -341,16 +338,16 @@ int srslte_pmch_decode(srslte_pmch_t* q, channel->noise_estimate); if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE subframe.dat: received subframe symbols\n"); + DEBUG("SAVED FILE subframe.dat: received subframe symbols"); srslte_vec_save_file("subframe2.dat", q->symbols[0], cfg->pdsch_cfg.grant.nof_re * sizeof(cf_t)); - DEBUG("SAVED FILE hest0.dat: channel estimates for port 4\n"); + DEBUG("SAVED FILE hest0.dat: channel estimates for port 4"); printf("nof_prb=%d, cp=%d, nof_re=%d, grant_re=%d\n", q->cell.nof_prb, q->cell.cp, SRSLTE_NOF_RE(q->cell), cfg->pdsch_cfg.grant.nof_re); srslte_vec_save_file("hest2.dat", channel->ce[0][0], SRSLTE_NOF_RE(q->cell) * sizeof(cf_t)); - DEBUG("SAVED FILE pmch_symbols.dat: symbols after equalization\n"); + DEBUG("SAVED FILE pmch_symbols.dat: symbols after equalization"); srslte_vec_save_file("pmch_symbols.bin", q->d, cfg->pdsch_cfg.grant.nof_re * sizeof(cf_t)); } @@ -364,7 +361,7 @@ int srslte_pmch_decode(srslte_pmch_t* q, srslte_scrambling_s_offset(&q->seqs[cfg->area_id]->seq[sf->tti % 10], q->e, 0, cfg->pdsch_cfg.grant.tb[0].nof_bits); if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE llr.dat: LLR estimates after demodulation and descrambling\n"); + DEBUG("SAVED FILE llr.dat: LLR estimates after demodulation and descrambling"); srslte_vec_save_file("llr.dat", q->e, cfg->pdsch_cfg.grant.tb[0].nof_bits * sizeof(int16_t)); } out[0].crc = (srslte_dlsch_decode(&q->dl_sch, &cfg->pdsch_cfg, q->e, out[0].payload) == 0); @@ -403,7 +400,6 @@ int srslte_pmch_encode(srslte_pmch_t* q, uint8_t* data, cf_t* sf_symbols[SRSLTE_MAX_PORTS]) { - int i; /* Set pointers for layermapping & precoding */ cf_t* x[SRSLTE_MAX_LAYERS]; @@ -420,14 +416,14 @@ int srslte_pmch_encode(srslte_pmch_t* q, } if (cfg->pdsch_cfg.grant.nof_re > q->max_re) { - ERROR("Error too many RE per subframe (%d). PMCH configured for %d RE (%d PRB)\n", + ERROR("Error too many RE per subframe (%d). PMCH configured for %d RE (%d PRB)", cfg->pdsch_cfg.grant.nof_re, q->max_re, q->cell.nof_prb); return SRSLTE_ERROR_INVALID_INPUTS; } - INFO("Encoding PMCH SF: %d, Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n", + INFO("Encoding PMCH SF: %d, Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d", sf->tti % 10, srslte_mod_string(cfg->pdsch_cfg.grant.tb[0].mod), cfg->pdsch_cfg.grant.tb[0].tbs, @@ -443,7 +439,7 @@ int srslte_pmch_encode(srslte_pmch_t* q, // TODO: use tb_encode directly if (srslte_dlsch_encode(&q->dl_sch, &cfg->pdsch_cfg, data, q->e)) { - ERROR("Error encoding TB\n"); + ERROR("Error encoding TB"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/prach.c b/lib/src/phy/phch/prach.c index 5fa3329d9..154840518 100644 --- a/lib/src/phy/phch/prach.c +++ b/lib/src/phy/phch/prach.c @@ -99,7 +99,7 @@ uint32_t srslte_prach_nof_f_idx_tdd(uint32_t config_idx, uint32_t tdd_ul_dl_conf if (config_idx < 64 && tdd_ul_dl_config < 7) { return prach_tdd_loc_table[config_idx][tdd_ul_dl_config].nof_elems; } else { - ERROR("PRACH: Invalid parmeters config_idx=%d, tdd_ul_config=%d\n", config_idx, tdd_ul_dl_config); + ERROR("PRACH: Invalid parmeters config_idx=%d, tdd_ul_config=%d", config_idx, tdd_ul_dl_config); return 0; } } @@ -109,7 +109,7 @@ uint32_t srslte_prach_f_id_tdd(uint32_t config_idx, uint32_t tdd_ul_dl_config, u if (config_idx < 64 && tdd_ul_dl_config < 7) { return prach_tdd_loc_table[config_idx][tdd_ul_dl_config].elems[prach_idx].f; } else { - ERROR("PRACH: Invalid parmeters config_idx=%d, tdd_ul_config=%d\n", config_idx, tdd_ul_dl_config); + ERROR("PRACH: Invalid parmeters config_idx=%d, tdd_ul_config=%d", config_idx, tdd_ul_dl_config); return 0; } } @@ -121,9 +121,8 @@ uint32_t srslte_prach_f_ra_tdd(uint32_t config_idx, uint32_t prach_offset, uint32_t n_rb_ul) { - if (config_idx >= 64 || tdd_ul_dl_config >= 7) { - ERROR("PRACH: Invalid parameters config_idx=%d, tdd_ul_config=%d\n", config_idx, tdd_ul_dl_config); + ERROR("PRACH: Invalid parameters config_idx=%d, tdd_ul_config=%d", config_idx, tdd_ul_dl_config); return 0; } uint32_t f_ra = prach_tdd_loc_table[config_idx][tdd_ul_dl_config].elems[prach_idx].f; @@ -160,7 +159,7 @@ bool srslte_prach_tti_opportunity_config_tdd(uint32_t config_idx, uint32_t* prach_idx) { if (config_idx >= 64 || tdd_ul_dl_config >= 7) { - ERROR("PRACH: Invalid parameters config_idx=%d, tdd_ul_config=%d\n", config_idx, tdd_ul_dl_config); + ERROR("PRACH: Invalid parameters config_idx=%d, tdd_ul_config=%d", config_idx, tdd_ul_dl_config); return 0; } @@ -244,7 +243,6 @@ int srslte_prach_gen_seqs(srslte_prach_t* p) // Generate our 64 preamble sequences for (int i = 0; i < N_SEQS; i++) { - if (v > v_max) { // Get a new root sequence if (4 == p->f) { @@ -367,20 +365,20 @@ int srslte_prach_init(srslte_prach_t* p, uint32_t max_N_ifft_ul) p->ifft_in = srslte_vec_cf_malloc(fft_size_alloc); p->ifft_out = srslte_vec_cf_malloc(fft_size_alloc); if (srslte_dft_plan(&p->ifft, fft_size_alloc, SRSLTE_DFT_BACKWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error creating DFT plan\n"); + ERROR("Error creating DFT plan"); return -1; } srslte_dft_plan_set_mirror(&p->ifft, true); srslte_dft_plan_set_norm(&p->ifft, true); if (srslte_dft_plan(&p->fft, fft_size_alloc, SRSLTE_DFT_FORWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error creating DFT plan\n"); + ERROR("Error creating DFT plan"); return -1; } p->signal_fft = srslte_vec_cf_malloc(fft_size_alloc); if (!p->signal_fft) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return -1; } @@ -389,7 +387,7 @@ int srslte_prach_init(srslte_prach_t* p, uint32_t max_N_ifft_ul) ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters\n"); + ERROR("Invalid parameters"); } return ret; @@ -403,7 +401,7 @@ int srslte_prach_set_cell_(srslte_prach_t* p, int ret = SRSLTE_ERROR; if (p != NULL && N_ifft_ul < 2049 && cfg->config_idx < 64 && cfg->root_seq_idx < MAX_ROOTS) { if (N_ifft_ul > p->max_N_ifft_ul) { - ERROR("PRACH: Error in set_cell(): N_ifft_ul must be lower or equal max_N_ifft_ul in init()\n"); + ERROR("PRACH: Error in set_cell(): N_ifft_ul must be lower or equal max_N_ifft_ul in init()"); return -1; } @@ -433,7 +431,7 @@ int srslte_prach_set_cell_(srslte_prach_t* p, p->N_zc = 139; p->N_cs = prach_Ncs_format4[p->zczc]; } else { - ERROR("Invalid zeroCorrelationZoneConfig=%d for format4\n", p->zczc); + ERROR("Invalid zeroCorrelationZoneConfig=%d for format4", p->zczc); return SRSLTE_ERROR; } } else { @@ -442,14 +440,14 @@ int srslte_prach_set_cell_(srslte_prach_t* p, if (p->zczc < 15) { p->N_cs = prach_Ncs_restricted[p->zczc]; } else { - ERROR("Invalid zeroCorrelationZoneConfig=%d for restricted set\n", p->zczc); + ERROR("Invalid zeroCorrelationZoneConfig=%d for restricted set", p->zczc); return SRSLTE_ERROR; } } else { if (p->zczc < 16) { p->N_cs = prach_Ncs_unrestricted[p->zczc]; } else { - ERROR("Invalid zeroCorrelationZoneConfig=%d\n", p->zczc); + ERROR("Invalid zeroCorrelationZoneConfig=%d", p->zczc); return SRSLTE_ERROR; } } @@ -492,11 +490,11 @@ int srslte_prach_set_cell_(srslte_prach_t* p, }*/ if (srslte_dft_replan(&p->ifft, p->N_ifft_prach)) { - ERROR("Error creating DFT plan\n"); + ERROR("Error creating DFT plan"); return -1; } if (srslte_dft_replan(&p->fft, p->N_ifft_prach)) { - ERROR("Error creating DFT plan\n"); + ERROR("Error creating DFT plan"); return -1; } @@ -514,7 +512,7 @@ int srslte_prach_set_cell_(srslte_prach_t* p, } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters N_ifft_ul=%d; config_idx=%d; root_seq_idx=%d;\n", + ERROR("Invalid parameters N_ifft_ul=%d; config_idx=%d; root_seq_idx=%d;", N_ifft_ul, cfg->config_idx, cfg->root_seq_idx); @@ -534,16 +532,12 @@ int srslte_prach_gen(srslte_prach_t* p, uint32_t seq_index, uint32_t freq_offset uint32_t begin = PHI + (K * k_0) + (p->is_nr ? 1 : (K / 2)); if (6 + freq_offset > N_rb_ul) { - ERROR("Error no space for PRACH: frequency offset=%d, N_rb_ul=%d\n", freq_offset, N_rb_ul); + ERROR("Error no space for PRACH: frequency offset=%d, N_rb_ul=%d", freq_offset, N_rb_ul); return ret; } - DEBUG("N_zc: %d, N_cp: %d, N_seq: %d, N_ifft_prach=%d begin: %d\n", - p->N_zc, - p->N_cp, - p->N_seq, - p->N_ifft_prach, - begin); + DEBUG( + "N_zc: %d, N_cp: %d, N_seq: %d, N_ifft_prach=%d begin: %d", p->N_zc, p->N_cp, p->N_seq, p->N_ifft_prach, begin); // Map dft-precoded sequence to ifft bins memset(p->ifft_in, 0, begin * sizeof(cf_t)); @@ -753,9 +747,8 @@ int srslte_prach_detect_offset(srslte_prach_t* p, { int ret = SRSLTE_ERROR; if (p != NULL && signal != NULL && sig_len > 0 && indices != NULL) { - if (sig_len < p->N_ifft_prach) { - ERROR("srslte_prach_detect: Signal length is %d and should be %d\n", sig_len, p->N_ifft_prach); + ERROR("srslte_prach_detect: Signal length is %d and should be %d", sig_len, p->N_ifft_prach); return SRSLTE_ERROR_INVALID_INPUTS; } int cancellation_idx = -2; diff --git a/lib/src/phy/phch/psbch.c b/lib/src/phy/phch/psbch.c index cfa49a2a1..380f6363f 100644 --- a/lib/src/phy/phch/psbch.c +++ b/lib/src/phy/phch/psbch.c @@ -53,19 +53,19 @@ int srslte_psbch_init(srslte_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srs q->c = srslte_vec_u8_malloc(q->sl_bch_tb_crc_len); if (!q->c) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->d = srslte_vec_u8_malloc(q->sl_bch_encoded_len); if (!q->d) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->d_16 = srslte_vec_i16_malloc(q->sl_bch_encoded_len); if (!q->d_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -77,7 +77,7 @@ int srslte_psbch_init(srslte_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srs q->crc_temp = srslte_vec_u8_malloc(SRSLTE_SL_BCH_CRC_LEN); if (!q->crc_temp) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -99,84 +99,84 @@ int srslte_psbch_init(srslte_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srs q->e = srslte_vec_u8_malloc(q->E); if (!q->e) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->e_16 = srslte_vec_i16_malloc(q->E); if (!q->e_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->e_bytes = srslte_vec_u8_malloc(q->E / 8); if (!q->e_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Scrambling bzero(&q->seq, sizeof(srslte_sequence_t)); if (srslte_sequence_LTE_pr(&q->seq, q->E, N_sl_id) != SRSLTE_SUCCESS) { - ERROR("Error srslte_sequence_LTE_pr\n"); + ERROR("Error srslte_sequence_LTE_pr"); return SRSLTE_ERROR; } q->codeword = srslte_vec_u8_malloc(q->E); if (!q->codeword) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->codeword_bytes = srslte_vec_u8_malloc(q->E / 8); if (!q->codeword_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Interleaving q->interleaver_lut = srslte_vec_u32_malloc(q->E); if (!q->interleaver_lut) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Modulation QPSK if (srslte_modem_table_lte(&q->mod, SRSLTE_MOD_QPSK) != SRSLTE_SUCCESS) { - ERROR("Error srslte_modem_table_lte\n"); + ERROR("Error srslte_modem_table_lte"); return SRSLTE_ERROR; } q->mod_symbols = srslte_vec_cf_malloc(q->nof_data_re); if (!q->mod_symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Soft-demod q->llr = srslte_vec_i16_malloc(q->E); if (!q->llr) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Transform precoding q->precoding_scaling = 1.0f; if (srslte_dft_precoding_init_tx(&q->dft_precoder, SRSLTE_PSBCH_NOF_PRB) != SRSLTE_SUCCESS) { - ERROR("Error srslte_dft_precoding_init\n"); + ERROR("Error srslte_dft_precoding_init"); return SRSLTE_ERROR; } q->scfdma_symbols = srslte_vec_cf_malloc(q->nof_data_re); if (!q->scfdma_symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } ///< Make sure last bits are zero as they are not considered during unpack srslte_vec_cf_zero(q->scfdma_symbols, q->nof_data_re); if (srslte_dft_precoding_init_rx(&q->idft_precoder, SRSLTE_PSBCH_NOF_PRB) != SRSLTE_SUCCESS) { - ERROR("Error srslte_idft_precoding_init\n"); + ERROR("Error srslte_idft_precoding_init"); return SRSLTE_ERROR; } @@ -186,7 +186,7 @@ int srslte_psbch_init(srslte_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srs int srslte_psbch_encode(srslte_psbch_t* q, uint8_t* input, uint32_t input_len, cf_t* sf_buffer) { if (input == NULL || input_len > q->sl_bch_tb_len) { - ERROR("Can't encode PSBCH, input too long (%d > %d)\n", input_len, q->sl_bch_tb_len); + ERROR("Can't encode PSBCH, input too long (%d > %d)", input_len, q->sl_bch_tb_len); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -238,13 +238,13 @@ int srslte_psbch_encode(srslte_psbch_t* q, uint8_t* input, uint32_t input_len, c int srslte_psbch_decode(srslte_psbch_t* q, cf_t* equalized_sf_syms, uint8_t* output, uint32_t max_output_len) { if (max_output_len < q->sl_bch_tb_len) { - ERROR("Can't decode PSBCH, provided buffer too small (%d < %d)\n", max_output_len, q->sl_bch_tb_len); + ERROR("Can't decode PSBCH, provided buffer too small (%d < %d)", max_output_len, q->sl_bch_tb_len); return SRSLTE_ERROR; } // RE extraction if (q->nof_tx_re != srslte_psbch_get(q, equalized_sf_syms, q->scfdma_symbols)) { - ERROR("There was an error getting the PSBCH symbols\n"); + ERROR("There was an error getting the PSBCH symbols"); return SRSLTE_ERROR; } @@ -300,7 +300,7 @@ int srslte_psbch_reset(srslte_psbch_t* q, uint32_t N_sl_id) // Regen scrambling sequence if (srslte_sequence_LTE_pr(&q->seq, q->E, N_sl_id) != SRSLTE_SUCCESS) { - ERROR("Error srslte_sequence_LTE_pr\n"); + ERROR("Error srslte_sequence_LTE_pr"); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/phch/pscch.c b/lib/src/phy/phch/pscch.c index de6bfc663..afa48ef6f 100644 --- a/lib/src/phy/phch/pscch.c +++ b/lib/src/phy/phch/pscch.c @@ -40,12 +40,12 @@ int srslte_pscch_init(srslte_pscch_t* q, uint32_t max_prb) } q->c = srslte_vec_u8_malloc(SRSLTE_SCI_MAX_LEN + SRSLTE_SCI_CRC_LEN); if (!q->c) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->sci_crc = srslte_vec_u8_malloc(SRSLTE_SCI_CRC_LEN); if (!q->sci_crc) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -60,50 +60,50 @@ int srslte_pscch_init(srslte_pscch_t* q, uint32_t max_prb) memcpy(q->encoder.poly, poly, 3 * sizeof(int)); q->d = srslte_vec_u8_malloc(E_max); if (!q->d) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_u8_zero(q->d, E_max); q->d_16 = srslte_vec_i16_malloc(E_max); if (!q->d_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_viterbi_init( &q->dec, SRSLTE_VITERBI_37, q->encoder.poly, SRSLTE_SCI_MAX_LEN + SRSLTE_SCI_CRC_LEN, q->encoder.tail_biting); - q->e = srslte_vec_u8_malloc(E_max); + q->e = srslte_vec_u8_malloc(E_max); if (!q->e) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->e_16 = srslte_vec_i16_malloc(E_max); if (!q->e_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->e_bytes = srslte_vec_u8_malloc(E_max / 8); if (!q->e_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->interleaver_lut = srslte_vec_u32_malloc(E_max); if (!q->interleaver_lut) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->codeword = srslte_vec_u8_malloc(E_max); if (!q->codeword) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->codeword_bytes = srslte_vec_u8_malloc(E_max / 8); if (!q->codeword_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -118,14 +118,14 @@ int srslte_pscch_init(srslte_pscch_t* q, uint32_t max_prb) q->mod_symbols = srslte_vec_cf_malloc(E_max / SRSLTE_PSCCH_QM); if (!q->mod_symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(q->mod_symbols, E_max / SRSLTE_PSCCH_QM); q->llr = srslte_vec_i16_malloc(E_max); if (!q->llr) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -135,7 +135,7 @@ int srslte_pscch_init(srslte_pscch_t* q, uint32_t max_prb) } q->scfdma_symbols = srslte_vec_cf_malloc(E_max / SRSLTE_PSCCH_QM); if (!q->scfdma_symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(q->scfdma_symbols, E_max / SRSLTE_PSCCH_QM); diff --git a/lib/src/phy/phch/pssch.c b/lib/src/phy/phch/pssch.c index d9d603b8a..965d7dc20 100644 --- a/lib/src/phy/phch/pssch.c +++ b/lib/src/phy/phch/pssch.c @@ -40,57 +40,57 @@ int srslte_pssch_init(srslte_pssch_t* q, srslte_cell_sl_t cell, srslte_sl_comm_r if (cell.cp == SRSLTE_CP_NORM) { q->nof_data_symbols = SRSLTE_PSSCH_TM34_NUM_DATA_SYMBOLS; } else { - ERROR("Invalid CP for PSSCH, SL TM 3/4\n"); + ERROR("Invalid CP for PSSCH, SL TM 3/4"); return SRSLTE_ERROR_INVALID_INPUTS; } } else { - ERROR("Invalid SL TM\n"); + ERROR("Invalid SL TM"); return SRSLTE_ERROR_INVALID_INPUTS; } // Transport Block q->b = srslte_vec_u8_malloc(SRSLTE_SL_SCH_MAX_TB_LEN + SRSLTE_PSSCH_CRC_LEN); if (!q->b) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Transport Block CRC if (srslte_crc_init(&q->tb_crc, SRSLTE_LTE_CRC24A, SRSLTE_PSSCH_CRC_LEN)) { - ERROR("Error Transport Block CRC init\n"); + ERROR("Error Transport Block CRC init"); return SRSLTE_ERROR; } q->tb_crc_temp = srslte_vec_u8_malloc(SRSLTE_PSSCH_CRC_LEN); if (!q->tb_crc_temp) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Code Block Segmentation q->c_r = srslte_vec_u8_malloc(SRSLTE_TCOD_MAX_LEN_CB); if (!q->c_r) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->f_16 = srslte_vec_i16_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->f_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->c_r_bytes = srslte_vec_u8_malloc(SRSLTE_TCOD_MAX_LEN_CB / 8); if (!q->c_r_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Code Block CRC if (srslte_crc_init(&q->cb_crc, SRSLTE_LTE_CRC24B, SRSLTE_PSSCH_CRC_LEN)) { - ERROR("Error Code Block CRC init\n"); + ERROR("Error Code Block CRC init"); return SRSLTE_ERROR; } q->cb_crc_temp = srslte_vec_u8_malloc(SRSLTE_PSSCH_CRC_LEN); if (!q->cb_crc_temp) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } @@ -98,32 +98,32 @@ int srslte_pssch_init(srslte_pssch_t* q, srslte_cell_sl_t cell, srslte_sl_comm_r srslte_tcod_init(&q->tcod, SRSLTE_TCOD_MAX_LEN_CB); q->d_r = srslte_vec_u8_malloc(SRSLTE_PSSCH_MAX_CODED_BITS); if (!q->d_r) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_tdec_init(&q->tdec, SRSLTE_TCOD_MAX_LEN_CB); srslte_tdec_force_not_sb(&q->tdec); q->d_r_16 = srslte_vec_i16_malloc(SRSLTE_PSSCH_MAX_CODED_BITS); if (!q->d_r_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Rate Matching q->e_r = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->e_r) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->buff_b = srslte_vec_u8_malloc(SRSLTE_PSSCH_MAX_CODED_BITS); if (!q->buff_b) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_u8_zero(q->buff_b, SRSLTE_PSSCH_MAX_CODED_BITS); q->e_r_16 = srslte_vec_i16_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->e_r_16) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_rm_turbo_gentables(); @@ -131,19 +131,19 @@ int srslte_pssch_init(srslte_pssch_t* q, srslte_cell_sl_t cell, srslte_sl_comm_r // Code Block Concatenation q->f = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->f) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Interleaving q->f_bytes = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN / 8); if (!q->f_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->interleaver_lut = srslte_vec_u32_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->interleaver_lut) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_u32_zero(q->interleaver_lut, SRSLTE_MAX_CODEWORD_LEN); @@ -151,37 +151,37 @@ int srslte_pssch_init(srslte_pssch_t* q, srslte_cell_sl_t cell, srslte_sl_comm_r // Scrambling q->codeword = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->codeword) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->codeword_bytes = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN / 8); if (!q->codeword_bytes) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Modulation q->symbols = srslte_vec_cf_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(q->symbols, SRSLTE_MAX_CODEWORD_LEN); q->bits_after_demod = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->bits_after_demod) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } q->bytes_after_demod = srslte_vec_u8_malloc(SRSLTE_MAX_CODEWORD_LEN / 8); if (!q->bytes_after_demod) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } for (int i = 0; i < SRSLTE_MOD_NITEMS; i++) { if (srslte_modem_table_lte(&q->mod[i], (srslte_mod_t)i)) { - ERROR("Error initiating modem tables\n"); + ERROR("Error initiating modem tables"); return SRSLTE_ERROR; } } @@ -189,22 +189,22 @@ int srslte_pssch_init(srslte_pssch_t* q, srslte_cell_sl_t cell, srslte_sl_comm_r // Demodulation q->llr = srslte_vec_i16_malloc(SRSLTE_MAX_CODEWORD_LEN); if (!q->llr) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } // Transform Precoding q->scfdma_symbols = srslte_vec_cf_malloc(q->nof_data_symbols * SRSLTE_NRE * SRSLTE_MAX_PRB); if (!q->scfdma_symbols) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } if (srslte_dft_precoding_init(&q->dft_precoder, SRSLTE_MAX_PRB, true)) { - ERROR("Error DFT precoder init\n"); + ERROR("Error DFT precoder init"); return SRSLTE_ERROR; } if (srslte_dft_precoding_init(&q->idft_precoder, SRSLTE_MAX_PRB, false)) { - ERROR("Error in DFT precoder init\n"); + ERROR("Error in DFT precoder init"); return SRSLTE_ERROR; } @@ -250,7 +250,7 @@ int srslte_pssch_set_cfg(srslte_pssch_t* q, srslte_pssch_cfg_t pssch_cfg) int srslte_pssch_encode(srslte_pssch_t* q, uint8_t* input, uint32_t input_len, cf_t* sf_buffer) { if (!input || input_len > q->sl_sch_tb_len) { - ERROR("Can't encode PSSCH, input too long (%d > %d)\n", input_len, q->sl_sch_tb_len); + ERROR("Can't encode PSSCH, input too long (%d > %d)", input_len, q->sl_sch_tb_len); return SRSLTE_ERROR; } @@ -274,7 +274,6 @@ int srslte_pssch_encode(srslte_pssch_t* q, uint8_t* input, uint32_t input_len, c srslte_crc_attach(&q->tb_crc, q->b, q->sl_sch_tb_len); for (int r = 0; r < q->cb_segm.C; r++) { - // Code block segmentation if (r < q->cb_segm.C2) { K_r = q->cb_segm.K2; @@ -356,7 +355,7 @@ int srslte_pssch_encode(srslte_pssch_t* q, uint8_t* input, uint32_t input_len, c // RE mapping if (q->nof_tx_re != srslte_pssch_put(q, sf_buffer, q->scfdma_symbols)) { - ERROR("There was an error mapping the PSSCH symbols\n"); + ERROR("There was an error mapping the PSSCH symbols"); return SRSLTE_ERROR; } @@ -366,13 +365,13 @@ int srslte_pssch_encode(srslte_pssch_t* q, uint8_t* input, uint32_t input_len, c int srslte_pssch_decode(srslte_pssch_t* q, cf_t* equalized_sf_syms, uint8_t* output, uint32_t output_len) { if (output_len < q->sl_sch_tb_len) { - ERROR("Can't decode PSSCH, provided buffer too small (%d < %d)\n", output_len, q->sl_sch_tb_len); + ERROR("Can't decode PSSCH, provided buffer too small (%d < %d)", output_len, q->sl_sch_tb_len); return SRSLTE_ERROR; } // RE extraction if (q->nof_tx_re != srslte_pssch_get(q, equalized_sf_syms, q->scfdma_symbols)) { - ERROR("There was an error getting the PSSCH symbols\n"); + ERROR("There was an error getting the PSSCH symbols"); return SRSLTE_ERROR; } @@ -443,7 +442,6 @@ int srslte_pssch_decode(srslte_pssch_t* q, cf_t* equalized_sf_syms, uint8_t* out srslte_bit_unpack_vector(q->c_r_bytes, q->c_r, K_r); if (q->cb_segm.C > 1) { - // Copy received crc to temp memcpy(q->cb_crc_temp, &q->c_r[(K_r - L)], sizeof(uint8_t) * L); @@ -489,7 +487,6 @@ int srslte_pssch_put(srslte_pssch_t* q, cf_t* sf_buffer, cf_t* symbols) uint32_t k = q->pssch_cfg.prb_start_idx * SRSLTE_NRE; for (int i = 0; i < srslte_sl_get_num_symbols(q->cell.tm, q->cell.cp); i++) { if (srslte_pssch_is_symbol(SRSLTE_SIDELINK_DATA_SYMBOL, q->cell.tm, i, q->cell.cp)) { - if (q->cell.tm == SRSLTE_SIDELINK_TM1 || q->cell.tm == SRSLTE_SIDELINK_TM2) { if (q->pssch_cfg.nof_prb <= q->sl_comm_resource_pool.prb_num) { k = q->pssch_cfg.prb_start_idx * SRSLTE_NRE; diff --git a/lib/src/phy/phch/pucch.c b/lib/src/phy/phch/pucch.c index 9915cb0de..d21007244 100644 --- a/lib/src/phy/phch/pucch.c +++ b/lib/src/phy/phch/pucch.c @@ -121,7 +121,6 @@ int srslte_pucch_set_cell(srslte_pucch_t* q, srslte_cell_t cell) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && srslte_cell_isvalid(&cell)) { - if (cell.id != q->cell.id || q->cell.nof_prb == 0) { q->cell = cell; @@ -163,7 +162,7 @@ int srslte_pucch_set_rnti(srslte_pucch_t* q, uint16_t rnti) // If the sequence is not allocated generate q->users[rnti_idx] = calloc(1, sizeof(srslte_pdsch_user_t)); if (!q->users[rnti_idx]) { - ERROR("Alocating PDSCH user\n"); + ERROR("Alocating PDSCH user"); return SRSLTE_ERROR; } } else if (q->users[rnti_idx]->sequence_generated && q->users[rnti_idx]->cell_id == q->cell.id && !q->is_ue) { @@ -178,7 +177,7 @@ int srslte_pucch_set_rnti(srslte_pucch_t* q, uint16_t rnti) for (int sf_idx = 0; sf_idx < SRSLTE_NOF_SF_X_FRAME; sf_idx++) { if (srslte_sequence_pucch( &q->users[rnti_idx]->seq_f2[sf_idx], rnti, SRSLTE_NOF_SLOTS_PER_SF * sf_idx, q->cell.id)) { - ERROR("Error initializing PUCCH scrambling sequence\n"); + ERROR("Error initializing PUCCH scrambling sequence"); srslte_pucch_free_rnti(q, rnti); return SRSLTE_ERROR; } @@ -230,13 +229,13 @@ static srslte_sequence_t* get_user_sequence(srslte_pucch_t* q, uint16_t rnti, ui return &q->users[rnti_idx]->seq_f2[sf_idx]; } else { if (srslte_sequence_pucch(&q->tmp_seq, rnti, 2 * sf_idx, q->cell.id)) { - ERROR("Error computing PUCCH Format 2 scrambling sequence\n"); + ERROR("Error computing PUCCH Format 2 scrambling sequence"); return NULL; } return &q->tmp_seq; } } else { - ERROR("Invalid RNTI=0x%x\n", rnti); + ERROR("Invalid RNTI=0x%x", rnti); return NULL; } } @@ -268,7 +267,7 @@ uci_mod_bits(srslte_pucch_t* q, srslte_ul_sf_cfg_t* sf, srslte_pucch_cfg_t* cfg, srslte_scrambling_b_offset(seq, q->bits_scram, 0, SRSLTE_PUCCH2_NOF_BITS); srslte_mod_modulate(&q->mod, q->bits_scram, q->d, SRSLTE_PUCCH2_NOF_BITS); } else { - ERROR("Error modulating PUCCH2 bits: could not generate sequence\n"); + ERROR("Error modulating PUCCH2 bits: could not generate sequence"); return -1; } break; @@ -279,12 +278,12 @@ uci_mod_bits(srslte_pucch_t* q, srslte_ul_sf_cfg_t* sf, srslte_pucch_cfg_t* cfg, srslte_scrambling_b_offset(seq, q->bits_scram, 0, SRSLTE_PUCCH3_NOF_BITS); srslte_mod_modulate(&q->mod, q->bits_scram, q->d, SRSLTE_PUCCH3_NOF_BITS); } else { - ERROR("Error modulating PUCCH3 bits: rnti not set\n"); + ERROR("Error modulating PUCCH3 bits: rnti not set"); return SRSLTE_ERROR; } break; default: - ERROR("PUCCH format %s not supported\n", srslte_pucch_format_text(cfg->format)); + ERROR("PUCCH format %s not supported", srslte_pucch_format_text(cfg->format)); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -440,7 +439,7 @@ static int pucch_cp(srslte_pucch_t* q, n_re += SRSLTE_NRE; } } else { - ERROR("Invalid PUCCH n_prb=%d\n", n_prb); + ERROR("Invalid PUCCH n_prb=%d", n_prb); return SRSLTE_ERROR; } } @@ -468,7 +467,7 @@ static int encode_signal_format12(srslte_pucch_t* q, { if (!signal_only) { if (uci_mod_bits(q, sf, cfg, bits)) { - ERROR("Error encoding PUCCH bits\n"); + ERROR("Error encoding PUCCH bits"); return SRSLTE_ERROR; } } else { @@ -481,7 +480,7 @@ static int encode_signal_format12(srslte_pucch_t* q, uint32_t sf_idx = sf->tti % SRSLTE_NOF_SF_X_FRAME; for (uint32_t ns = SRSLTE_NOF_SLOTS_PER_SF * sf_idx; ns < SRSLTE_NOF_SLOTS_PER_SF * (sf_idx + 1); ns++) { uint32_t N_sf = get_N_sf(cfg->format, ns % 2, sf->shortened); - DEBUG("ns=%d, N_sf=%d\n", ns, N_sf); + DEBUG("ns=%d, N_sf=%d", ns, N_sf); // Get group hopping number u uint32_t f_gh = 0; if (cfg->group_hopping_en) { @@ -505,11 +504,11 @@ static int encode_signal_format12(srslte_pucch_t* q, uint32_t n_prime_ns = 0; uint32_t n_oc = 0; float alpha = srslte_pucch_alpha_format1(q->n_cs_cell, cfg, q->cell.cp, true, ns, l, &n_oc, &n_prime_ns); - float S_ns = 0; + float S_ns = 0; if (n_prime_ns % 2) { S_ns = M_PI / 2; } - DEBUG("PUCCH d_0: %.1f+%.1fi, alpha: %.1f, n_oc: %d, n_prime_ns: %d, n_rb_2=%d\n", + DEBUG("PUCCH d_0: %.1f+%.1fi, alpha: %.1f, n_oc: %d, n_prime_ns: %d, n_rb_2=%d", __real__ q->d[0], __imag__ q->d[0], alpha, @@ -536,7 +535,7 @@ static int encode_signal_format3(srslte_pucch_t* q, { if (!signal_only) { if (uci_mod_bits(q, sf, cfg, bits)) { - ERROR("Error encoding PUCCH bits\n"); + ERROR("Error encoding PUCCH bits"); return SRSLTE_ERROR; } } else { @@ -641,7 +640,7 @@ static int decode_signal_format3(srslte_pucch_t* q, return (int)srslte_block_decode_i16(q->llr, SRSLTE_PUCCH3_NOF_BITS, bits, SRSLTE_UCI_MAX_ACK_SR_BITS); } else { - ERROR("Error modulating PUCCH3 bits: rnti not set\n"); + ERROR("Error modulating PUCCH3 bits: rnti not set"); return SRSLTE_ERROR; } @@ -680,7 +679,7 @@ static int encode_bits(srslte_pucch_cfg_t* cfg, uint8_t buff[SRSLTE_CQI_MAX_BITS]; int uci_cqi_len = srslte_cqi_value_pack(&cfg->uci_cfg.cqi, &uci_data->cqi, buff); if (uci_cqi_len < 0) { - ERROR("Error encoding CQI\n"); + ERROR("Error encoding CQI"); return SRSLTE_ERROR; } srslte_uci_encode_cqi_pucch(buff, (uint32_t)uci_cqi_len, pucch_bits); @@ -727,7 +726,7 @@ static bool decode_signal(srslte_pucch_t* q, if (corr >= cfg->threshold_format1) { detected = true; } - DEBUG("format1 corr=%f, nof_re=%d, th=%f\n", corr, nof_re, cfg->threshold_format1); + DEBUG("format1 corr=%f, nof_re=%d, th=%f", corr, nof_re, cfg->threshold_format1); break; case SRSLTE_PUCCH_FORMAT_1A: detected = 0; @@ -742,7 +741,7 @@ static bool decode_signal(srslte_pucch_t* q, if (corr_max > cfg->threshold_format1) { // check with format1 in case ack+sr because ack only is binary detected = true; } - DEBUG("format1a b=%d, corr=%f, nof_re=%d\n", b, corr, nof_re); + DEBUG("format1a b=%d, corr=%f, nof_re=%d", b, corr, nof_re); } corr = corr_max; pucch_bits[0] = b_max; @@ -763,7 +762,7 @@ static bool decode_signal(srslte_pucch_t* q, if (corr_max > cfg->threshold_format1) { // check with format1 in case ack+sr because ack only is binary detected = true; } - DEBUG("format1b b=%d, corr=%f, nof_re=%d\n", b, corr, nof_re); + DEBUG("format1b b=%d, corr=%f, nof_re=%d", b, corr, nof_re); } } corr = corr_max; @@ -794,7 +793,7 @@ static bool decode_signal(srslte_pucch_t* q, } detected = true; } else { - ERROR("Decoding PUCCH2: could not generate sequence\n"); + ERROR("Decoding PUCCH2: could not generate sequence"); return -1; } break; @@ -803,7 +802,7 @@ static bool decode_signal(srslte_pucch_t* q, detected = corr > cfg->threshold_data_valid_format3; break; default: - ERROR("PUCCH format %d not implemented\n", cfg->format); + ERROR("PUCCH format %d not implemented", cfg->format); return SRSLTE_ERROR; } if (correlation) { @@ -869,7 +868,7 @@ int srslte_pucch_encode(srslte_pucch_t* q, } if (pucch_put(q, sf, cfg, q->z, sf_symbols) < 0) { - ERROR("Error putting PUCCH symbols\n"); + ERROR("Error putting PUCCH symbols"); return SRSLTE_ERROR; } ret = SRSLTE_SUCCESS; @@ -892,18 +891,17 @@ int srslte_pucch_decode(srslte_pucch_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && cfg != NULL && channel != NULL && data != NULL) { - uint32_t nof_cqi_bits = srslte_cqi_size(&cfg->uci_cfg.cqi); uint32_t nof_uci_bits = cfg->uci_cfg.cqi.ri_len ? cfg->uci_cfg.cqi.ri_len : nof_cqi_bits; int nof_re = pucch_get(q, sf, cfg, sf_symbols, q->z_tmp); if (nof_re < 0) { - ERROR("Error getting PUCCH symbols\n"); + ERROR("Error getting PUCCH symbols"); return SRSLTE_ERROR; } if (pucch_get(q, sf, cfg, channel->ce, q->ce) < 0) { - ERROR("Error getting PUCCH symbols\n"); + ERROR("Error getting PUCCH symbols"); return SRSLTE_ERROR; } @@ -962,7 +960,6 @@ char* srslte_pucch_format_text(srslte_pucch_format_t format) char* ret = NULL; switch (format) { - case SRSLTE_PUCCH_FORMAT_1: ret = "Format 1"; break; @@ -997,7 +994,6 @@ char* srslte_pucch_format_text_short(srslte_pucch_format_t format) char* ret = NULL; switch (format) { - case SRSLTE_PUCCH_FORMAT_1: ret = "1"; break; @@ -1033,7 +1029,6 @@ uint32_t srslte_pucch_nof_ack_format(srslte_pucch_format_t format) uint32_t ret = 0; switch (format) { - case SRSLTE_PUCCH_FORMAT_1A: case SRSLTE_PUCCH_FORMAT_2A: ret = 1; @@ -1159,7 +1154,6 @@ int srslte_pucch_collision(const srslte_cell_t* cell, const srslte_pucch_cfg_t* uint32_t n_prime2 = 0; switch (cfg1->format) { - case SRSLTE_PUCCH_FORMAT_1: case SRSLTE_PUCCH_FORMAT_1A: case SRSLTE_PUCCH_FORMAT_1B: @@ -1284,7 +1278,7 @@ float srslte_pucch_alpha_format1(const uint32_t n_cs_cell[SRSLTE_NSLO n_cs = (n_cs_cell[ns][l] + (n_prime * cfg->delta_pucch_shift + n_oc / n_oc_div) % N_prime) % SRSLTE_NRE; } - DEBUG("n_cs=%d, N_prime=%d, delta_pucch=%d, n_prime=%d, ns=%d, l=%d, ns_cs_cell=%d\n", + DEBUG("n_cs=%d, N_prime=%d, delta_pucch=%d, n_prime=%d, ns=%d, l=%d, ns_cs_cell=%d", n_cs, N_prime, cfg->delta_pucch_shift, @@ -1319,7 +1313,7 @@ float srslte_pucch_alpha_format2(const uint32_t n_cs_cell[SRSLTE_NSLO } uint32_t n_cs = (n_cs_cell[ns][l] + n_prime) % SRSLTE_NRE; float alpha = 2 * M_PI * (n_cs) / SRSLTE_NRE; - DEBUG("n_pucch: %d, ns: %d, l: %d, n_prime: %d, n_cs: %d, alpha=%f\n", cfg->n_pucch, ns, l, n_prime, n_cs, alpha); + DEBUG("n_pucch: %d, ns: %d, l: %d, n_prime: %d, n_cs: %d, alpha=%f", cfg->n_pucch, ns, l, n_prime, n_cs, alpha); return alpha; } diff --git a/lib/src/phy/phch/pucch_cfg_nr.c b/lib/src/phy/phch/pucch_cfg_nr.c index c52e5d775..8aa2702db 100644 --- a/lib/src/phy/phch/pucch_cfg_nr.c +++ b/lib/src/phy/phch/pucch_cfg_nr.c @@ -17,23 +17,23 @@ static int pucch_nr_cfg_format0_resource_valid(const srslte_pucch_nr_resource_t* resource) { if (resource->format != SRSLTE_PUCCH_NR_FORMAT_0) { - ERROR("Invalid format (%d)\n", resource->format); + ERROR("Invalid format (%d)", resource->format); return SRSLTE_ERROR; } if (resource->nof_symbols < SRSLTE_PUCCH_NR_FORMAT0_MIN_NSYMB || resource->nof_symbols > SRSLTE_PUCCH_NR_FORMAT0_MAX_NSYMB) { - ERROR("Invalid number of symbols (%d)\n", resource->nof_symbols); + ERROR("Invalid number of symbols (%d)", resource->nof_symbols); return SRSLTE_ERROR; } if (resource->initial_cyclic_shift > SRSLTE_PUCCH_NR_FORMAT0_MAX_CS) { - ERROR("Invalid initial cyclic shift (%d)\n", resource->initial_cyclic_shift); + ERROR("Invalid initial cyclic shift (%d)", resource->initial_cyclic_shift); return SRSLTE_ERROR; } if (resource->start_symbol_idx > SRSLTE_PUCCH_NR_FORMAT0_MAX_STARTSYMB) { - ERROR("Invalid initial start symbol idx (%d)\n", resource->start_symbol_idx); + ERROR("Invalid initial start symbol idx (%d)", resource->start_symbol_idx); return SRSLTE_ERROR; } @@ -43,28 +43,28 @@ static int pucch_nr_cfg_format0_resource_valid(const srslte_pucch_nr_resource_t* static int pucch_nr_cfg_format1_resource_valid(const srslte_pucch_nr_resource_t* resource) { if (resource->format != SRSLTE_PUCCH_NR_FORMAT_1) { - ERROR("Invalid format (%d)\n", resource->format); + ERROR("Invalid format (%d)", resource->format); return SRSLTE_ERROR; } if (resource->nof_symbols < SRSLTE_PUCCH_NR_FORMAT1_MIN_NSYMB || resource->nof_symbols > SRSLTE_PUCCH_NR_FORMAT1_MAX_NSYMB) { - ERROR("Invalid number of symbols (%d)\n", resource->nof_symbols); + ERROR("Invalid number of symbols (%d)", resource->nof_symbols); return SRSLTE_ERROR; } if (resource->initial_cyclic_shift > SRSLTE_PUCCH_NR_FORMAT1_MAX_CS) { - ERROR("Invalid initial cyclic shift (%d)\n", resource->initial_cyclic_shift); + ERROR("Invalid initial cyclic shift (%d)", resource->initial_cyclic_shift); return SRSLTE_ERROR; } if (resource->start_symbol_idx > SRSLTE_PUCCH_NR_FORMAT1_MAX_STARTSYMB) { - ERROR("Invalid initial start symbol idx (%d)\n", resource->start_symbol_idx); + ERROR("Invalid initial start symbol idx (%d)", resource->start_symbol_idx); return SRSLTE_ERROR; } if (resource->time_domain_occ > SRSLTE_PUCCH_NR_FORMAT1_MAX_TOCC) { - ERROR("Invalid time domain occ (%d)\n", resource->time_domain_occ); + ERROR("Invalid time domain occ (%d)", resource->time_domain_occ); return SRSLTE_ERROR; } @@ -74,23 +74,23 @@ static int pucch_nr_cfg_format1_resource_valid(const srslte_pucch_nr_resource_t* static int pucch_nr_cfg_format2_resource_valid(const srslte_pucch_nr_resource_t* resource) { if (resource->format != SRSLTE_PUCCH_NR_FORMAT_2) { - ERROR("Invalid format (%d)\n", resource->format); + ERROR("Invalid format (%d)", resource->format); return SRSLTE_ERROR; } if (resource->nof_symbols < SRSLTE_PUCCH_NR_FORMAT2_MIN_NSYMB || resource->nof_symbols > SRSLTE_PUCCH_NR_FORMAT2_MAX_NSYMB) { - ERROR("Invalid number of symbols (%d)\n", resource->nof_symbols); + ERROR("Invalid number of symbols (%d)", resource->nof_symbols); return SRSLTE_ERROR; } if (resource->nof_prb < SRSLTE_PUCCH_NR_FORMAT2_MIN_NPRB || resource->nof_prb > SRSLTE_PUCCH_NR_FORMAT2_MAX_NPRB) { - ERROR("Invalid number of prb (%d)\n", resource->nof_prb); + ERROR("Invalid number of prb (%d)", resource->nof_prb); return SRSLTE_ERROR; } if (resource->start_symbol_idx > SRSLTE_PUCCH_NR_FORMAT2_MAX_STARTSYMB) { - ERROR("Invalid initial start symbol idx (%d)\n", resource->start_symbol_idx); + ERROR("Invalid initial start symbol idx (%d)", resource->start_symbol_idx); return SRSLTE_ERROR; } @@ -100,23 +100,23 @@ static int pucch_nr_cfg_format2_resource_valid(const srslte_pucch_nr_resource_t* static int pucch_nr_cfg_format3_resource_valid(const srslte_pucch_nr_resource_t* resource) { if (resource->format != SRSLTE_PUCCH_NR_FORMAT_3) { - ERROR("Invalid format (%d)\n", resource->format); + ERROR("Invalid format (%d)", resource->format); return SRSLTE_ERROR; } if (resource->nof_symbols < SRSLTE_PUCCH_NR_FORMAT3_MIN_NSYMB || resource->nof_symbols > SRSLTE_PUCCH_NR_FORMAT3_MAX_NSYMB) { - ERROR("Invalid number of symbols (%d)\n", resource->nof_symbols); + ERROR("Invalid number of symbols (%d)", resource->nof_symbols); return SRSLTE_ERROR; } if (resource->nof_prb < SRSLTE_PUCCH_NR_FORMAT3_MIN_NPRB || resource->nof_prb > SRSLTE_PUCCH_NR_FORMAT3_MAX_NPRB) { - ERROR("Invalid number of prb (%d)\n", resource->nof_prb); + ERROR("Invalid number of prb (%d)", resource->nof_prb); return SRSLTE_ERROR; } if (resource->start_symbol_idx > SRSLTE_PUCCH_NR_FORMAT3_MAX_STARTSYMB) { - ERROR("Invalid initial start symbol idx (%d)\n", resource->start_symbol_idx); + ERROR("Invalid initial start symbol idx (%d)", resource->start_symbol_idx); return SRSLTE_ERROR; } @@ -126,23 +126,23 @@ static int pucch_nr_cfg_format3_resource_valid(const srslte_pucch_nr_resource_t* static int pucch_nr_cfg_format4_resource_valid(const srslte_pucch_nr_resource_t* resource) { if (resource->format != SRSLTE_PUCCH_NR_FORMAT_4) { - ERROR("Invalid format (%d)\n", resource->format); + ERROR("Invalid format (%d)", resource->format); return SRSLTE_ERROR; } if (resource->nof_symbols < SRSLTE_PUCCH_NR_FORMAT4_MIN_NSYMB || resource->nof_symbols > SRSLTE_PUCCH_NR_FORMAT4_MAX_NSYMB) { - ERROR("Invalid number of symbols (%d)\n", resource->nof_symbols); + ERROR("Invalid number of symbols (%d)", resource->nof_symbols); return SRSLTE_ERROR; } if (resource->start_symbol_idx > SRSLTE_PUCCH_NR_FORMAT4_MAX_STARTSYMB) { - ERROR("Invalid initial start symbol idx (%d)\n", resource->start_symbol_idx); + ERROR("Invalid initial start symbol idx (%d)", resource->start_symbol_idx); return SRSLTE_ERROR; } if (resource->occ_lenth != 2 && resource->occ_lenth != 4) { - ERROR("Invalid OCC length (%d)\n", resource->occ_lenth); + ERROR("Invalid OCC length (%d)", resource->occ_lenth); return SRSLTE_ERROR; } @@ -161,7 +161,7 @@ int srslte_pucch_nr_cfg_resource_valid(const srslte_pucch_nr_resource_t* resourc } if (resource->intra_slot_hopping) { - ERROR("Intra-slot hopping is not implemented\n"); + ERROR("Intra-slot hopping is not implemented"); return SRSLTE_ERROR; } @@ -170,7 +170,7 @@ int srslte_pucch_nr_cfg_resource_valid(const srslte_pucch_nr_resource_t* resourc } if (resource->max_code_rate > SRSLTE_PUCCH_NR_MAX_CODE_RATE) { - ERROR("Invalid maximum code rate (%d)\n", resource->max_code_rate); + ERROR("Invalid maximum code rate (%d)", resource->max_code_rate); return SRSLTE_ERROR; } @@ -187,7 +187,7 @@ int srslte_pucch_nr_cfg_resource_valid(const srslte_pucch_nr_resource_t* resourc return pucch_nr_cfg_format4_resource_valid(resource); case SRSLTE_PUCCH_NR_FORMAT_ERROR: default: - ERROR("Invalid case\n"); + ERROR("Invalid case"); break; } diff --git a/lib/src/phy/phch/pucch_nr.c b/lib/src/phy/phch/pucch_nr.c index 7dda3cfef..81c1aa987 100644 --- a/lib/src/phy/phch/pucch_nr.c +++ b/lib/src/phy/phch/pucch_nr.c @@ -35,10 +35,10 @@ int srslte_pucch_nr_group_sequence(const srslte_carrier_nr_t* carrier, f_ss = n_id % SRSLTE_ZC_SEQUENCE_NOF_GROUPS; break; case SRSLTE_PUCCH_NR_GROUP_HOPPING_ENABLE: - ERROR("Group hopping is not implemented\n"); + ERROR("Group hopping is not implemented"); return SRSLTE_ERROR; case SRSLTE_PUCCH_NR_GROUP_HOPPING_DISABLE: - ERROR("Hopping is not implemented\n"); + ERROR("Hopping is not implemented"); return SRSLTE_ERROR; } @@ -125,13 +125,13 @@ int srslte_pucch_nr_init(srslte_pucch_nr_t* q, const srslte_pucch_nr_args_t* arg // Initialise BPSK modulation table if (srslte_modem_table_lte(&q->bpsk, SRSLTE_MOD_BPSK) < SRSLTE_SUCCESS) { - ERROR("Initiating modem table\n"); + ERROR("Initiating modem table"); return SRSLTE_ERROR; } // Initialise QPSK modulation table if (srslte_modem_table_lte(&q->qpsk, SRSLTE_MOD_QPSK) < SRSLTE_SUCCESS) { - ERROR("Initiating modem table\n"); + ERROR("Initiating modem table"); return SRSLTE_ERROR; } @@ -145,7 +145,7 @@ int srslte_pucch_nr_init(srslte_pucch_nr_t* q, const srslte_pucch_nr_args_t* arg } if (srslte_uci_nr_init(&q->uci, &args->uci) < SRSLTE_SUCCESS) { - ERROR("Initiating UCI encoder/decoder\n"); + ERROR("Initiating UCI encoder/decoder"); return SRSLTE_ERROR; } @@ -153,21 +153,21 @@ int srslte_pucch_nr_init(srslte_pucch_nr_t* q, const srslte_pucch_nr_args_t* arg uint32_t max_encoded_bits = q->max_prb * SRSLTE_NRE * 2 * SRSLTE_NSYMB_PER_SLOT_NR; // Assumes QPSK (Qm = 2) q->b = srslte_vec_u8_malloc(max_encoded_bits); if (q->b == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } // Allocate encoded symbols d q->d = srslte_vec_cf_malloc(max_encoded_bits / 2); if (q->d == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } // Allocate temporal channel estimates q->ce = srslte_vec_cf_malloc(max_encoded_bits / 2); if (q->ce == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } @@ -213,14 +213,14 @@ int srslte_pucch_nr_format0_encode(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 0 resource\n"); + ERROR("Invalid PUCCH format 0 resource"); return SRSLTE_SUCCESS; } uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } @@ -236,7 +236,7 @@ int srslte_pucch_nr_format0_encode(const srslte_pucch_nr_t* q, // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } @@ -264,14 +264,14 @@ int srslte_pucch_nr_format0_measure(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 0 resource\n"); + ERROR("Invalid PUCCH format 0 resource"); return SRSLTE_SUCCESS; } uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } @@ -289,7 +289,7 @@ int srslte_pucch_nr_format0_measure(const srslte_pucch_nr_t* q, // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } @@ -343,15 +343,15 @@ static uint32_t pucch_nr_format1_n_pucch(const srslte_pucch_nr_resource_t* resou cf_t srslte_pucch_nr_format1_w(const srslte_pucch_nr_t* q, uint32_t n_pucch, uint32_t i, uint32_t m) { if (n_pucch < 1 || n_pucch > SRSLTE_PUCCH_NR_FORMAT1_N_MAX) { - ERROR("Invalid n_pucch\n"); + ERROR("Invalid n_pucch"); return NAN; } if (i >= SRSLTE_PUCCH_NR_FORMAT1_N_MAX) { - ERROR("Invalid i\n"); + ERROR("Invalid i"); return NAN; } if (m >= SRSLTE_PUCCH_NR_FORMAT1_N_MAX) { - ERROR("Invalid m\n"); + ERROR("Invalid m"); return NAN; } @@ -375,12 +375,12 @@ int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q, } if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_SUCCESS; } if (nof_bits > SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS) { - ERROR("Invalid number of bits (%d)\n", nof_bits); + ERROR("Invalid number of bits (%d)", nof_bits); return SRSLTE_ERROR; } @@ -396,7 +396,7 @@ int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q, uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } @@ -418,7 +418,7 @@ int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q, // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } @@ -453,12 +453,12 @@ int srslte_pucch_nr_format1_decode(srslte_pucch_nr_t* q, uint32_t m_cs = 0; if (srslte_pucch_nr_cfg_resource_valid(resource) < SRSLTE_SUCCESS) { - ERROR("Invalid PUCCH format 1 resource\n"); + ERROR("Invalid PUCCH format 1 resource"); return SRSLTE_SUCCESS; } if (nof_bits > SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS) { - ERROR("Invalid number of bits (%d)\n", nof_bits); + ERROR("Invalid number of bits (%d)", nof_bits); return SRSLTE_ERROR; } @@ -469,7 +469,7 @@ int srslte_pucch_nr_format1_decode(srslte_pucch_nr_t* q, uint32_t u = 0; uint32_t v = 0; if (srslte_pucch_nr_group_sequence(carrier, cfg, &u, &v) < SRSLTE_SUCCESS) { - ERROR("Error getting group sequence\n"); + ERROR("Error getting group sequence"); return SRSLTE_ERROR; } @@ -496,7 +496,7 @@ int srslte_pucch_nr_format1_decode(srslte_pucch_nr_t* q, // get r_uv sequence from LUT object const cf_t* r_uv = srslte_zc_sequence_lut_get(&q->r_uv_1prb, u, v, alpha_idx); if (r_uv == NULL) { - ERROR("Getting r_uv sequence\n"); + ERROR("Getting r_uv sequence"); return SRSLTE_ERROR; } // Get w_i_m @@ -612,13 +612,13 @@ static int pucch_nr_format2_decode(srslte_pucch_nr_t* q, // Equalise if (srslte_predecoding_single(q->d, q->ce, q->d, NULL, E, 1.0f, chest_res->noise_estimate) < SRSLTE_SUCCESS) { - ERROR("Error Pre-decoding\n"); + ERROR("Error Pre-decoding"); return SRSLTE_ERROR; } // Soft-demodulate if (srslte_demod_soft_demodulate_b(SRSLTE_MOD_QPSK, q->d, llr, E) < SRSLTE_SUCCESS) { - ERROR("Error soft-demodulate\n"); + ERROR("Error soft-demodulate"); return SRSLTE_ERROR; } @@ -646,7 +646,7 @@ int srslte_pucch_nr_format_2_3_4_encode(srslte_pucch_nr_t* q, // Encode PUCCH message if (srslte_uci_nr_encode_pucch(&q->uci, resource, uci_cfg, uci_value, q->b) < SRSLTE_SUCCESS) { - ERROR("Error encoding UCI\n"); + ERROR("Error encoding UCI"); return SRSLTE_ERROR; } @@ -656,11 +656,11 @@ int srslte_pucch_nr_format_2_3_4_encode(srslte_pucch_nr_t* q, return pucch_nr_format2_encode(q, carrier, cfg, resource, uci_cfg, slot_symbols); case SRSLTE_PUCCH_NR_FORMAT_3: case SRSLTE_PUCCH_NR_FORMAT_4: - ERROR("Not implemented\n"); + ERROR("Not implemented"); return SRSLTE_ERROR; default: case SRSLTE_PUCCH_NR_FORMAT_ERROR: - ERROR("Invalid format\n"); + ERROR("Invalid format"); } return SRSLTE_ERROR; @@ -687,22 +687,22 @@ int srslte_pucch_nr_format_2_3_4_decode(srslte_pucch_nr_t* q, switch (resource->format) { case SRSLTE_PUCCH_NR_FORMAT_2: if (pucch_nr_format2_decode(q, carrier, cfg, resource, uci_cfg, chest_res, slot_symbols, llr) < SRSLTE_SUCCESS) { - ERROR("Demodulating PUCCH format 2\n"); + ERROR("Demodulating PUCCH format 2"); return SRSLTE_ERROR; } break; case SRSLTE_PUCCH_NR_FORMAT_3: case SRSLTE_PUCCH_NR_FORMAT_4: - ERROR("Not implemented\n"); + ERROR("Not implemented"); return SRSLTE_ERROR; default: case SRSLTE_PUCCH_NR_FORMAT_ERROR: - ERROR("Invalid format\n"); + ERROR("Invalid format"); } // Decode PUCCH message if (srslte_uci_nr_decode_pucch(&q->uci, resource, uci_cfg, llr, uci_value) < SRSLTE_SUCCESS) { - ERROR("Error encoding UCI\n"); + ERROR("Error encoding UCI"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/pucch_proc.c b/lib/src/phy/phch/pucch_proc.c index cb6aa48a1..73956f363 100644 --- a/lib/src/phy/phch/pucch_proc.c +++ b/lib/src/phy/phch/pucch_proc.c @@ -50,7 +50,7 @@ srslte_pucch_format_t srslte_pucch_proc_select_format(const srslte_cell_t* else if (pucch_proc_tx_sr(uci_cfg, uci_value)) { format = SRSLTE_PUCCH_FORMAT_1; } else { - ERROR("Error selecting PUCCH format: Unsupported number of ACK bits %d\n", total_ack); + ERROR("Error selecting PUCCH format: Unsupported number of ACK bits %d", total_ack); } } // CQI data @@ -73,7 +73,7 @@ srslte_pucch_format_t srslte_pucch_proc_select_format(const srslte_cell_t* } } if (format == SRSLTE_PUCCH_FORMAT_ERROR) { - ERROR("Returned Error while selecting PUCCH format\n"); + ERROR("Returned Error while selecting PUCCH format"); } return format; @@ -216,7 +216,7 @@ int srslte_pucch_cs_get_ack(const srslte_pucch_cfg_t* cfg, break; default: // Unhandled case - ERROR("Unexpected number of ACK (%d)\n", nof_ack); + ERROR("Unexpected number of ACK (%d)", nof_ack); ret = SRSLTE_ERROR; } } @@ -256,7 +256,7 @@ static uint32_t n_pucch_i_tdd(uint32_t ncce, uint32_t N_pucch_1, uint32_t nof_pr return npucch; } } - ERROR("Could not find Np value for ncce=%d\n", ncce); + ERROR("Could not find Np value for ncce=%d", ncce); return 0; } @@ -282,7 +282,7 @@ int srslte_pucch_proc_get_resources(const srslte_cell_t* cell, uint32_t* n_pucch_i) { if (!cfg || !cell || !uci_cfg || !n_pucch_i) { - ERROR("pucch_resource_selection(): Invalid parameters\n"); + ERROR("pucch_resource_selection(): Invalid parameters"); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -318,7 +318,7 @@ int srslte_pucch_proc_get_resources(const srslte_cell_t* cell, } // Otherwise an error shall be prompt - ERROR("Unhandled PUCCH format mode %s\n", srslte_ack_nack_feedback_mode_string(cfg->ack_nack_feedback_mode)); + ERROR("Unhandled PUCCH format mode %s", srslte_ack_nack_feedback_mode_string(cfg->ack_nack_feedback_mode)); return SRSLTE_ERROR; } @@ -421,7 +421,7 @@ static uint32_t get_npucch_cs(const srslte_pucch_cfg_t* cfg, } break; default: - ERROR("Too many (%d) ACK for this CS mode\n", srslte_uci_cfg_total_ack(uci_cfg)); + ERROR("Too many (%d) ACK for this CS mode", srslte_uci_cfg_total_ack(uci_cfg)); } return n_pucch; @@ -447,7 +447,7 @@ static void set_b01(uint8_t* b, uint8_t x) b[1] = 1; break; default: - ERROR("Unhandled case (%d)\n", x); + ERROR("Unhandled case (%d)", x); } } diff --git a/lib/src/phy/phch/pusch.c b/lib/src/phy/phch/pusch.c index a320477d3..ad8999eec 100644 --- a/lib/src/phy/phch/pusch.c +++ b/lib/src/phy/phch/pusch.c @@ -55,7 +55,7 @@ static int pusch_cp(srslte_pusch_t* q, if (is_shortened && slot == 1) { N_srs = 1; } - INFO("%s PUSCH %d PRB to index %d at slot %d\n", + INFO("%s PUSCH %d PRB to index %d at slot %d", advance_input ? "Allocating" : "Getting", grant->L_prb, grant->n_prb_tilde[slot], @@ -101,12 +101,11 @@ static int pusch_init(srslte_pusch_t* q, uint32_t max_prb, bool is_ue) int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - bzero(q, sizeof(srslte_pusch_t)); ret = SRSLTE_ERROR; q->max_re = max_prb * MAX_PUSCH_RE(SRSLTE_CP_NORM); - INFO("Init PUSCH: %d PRBs\n", max_prb); + INFO("Init PUSCH: %d PRBs", max_prb); for (srslte_mod_t i = 0; i < SRSLTE_MOD_NITEMS; i++) { if (srslte_modem_table_lte(&q->mod[i], i)) { @@ -130,7 +129,7 @@ static int pusch_init(srslte_pusch_t* q, uint32_t max_prb, bool is_ue) srslte_sch_init(&q->ul_sch); if (srslte_dft_precoding_init(&q->dft_precoding, max_prb, is_ue)) { - ERROR("Error initiating DFT transform precoding\n"); + ERROR("Error initiating DFT transform precoding"); goto clean; } @@ -159,7 +158,7 @@ static int pusch_init(srslte_pusch_t* q, uint32_t max_prb, bool is_ue) q->evm_buffer = srslte_evm_buffer_alloc(srslte_ra_tbs_from_idx(SRSLTE_RA_NOF_TBS_IDX - 1, 6)); if (!q->evm_buffer) { - ERROR("Allocating EVM buffer\n"); + ERROR("Allocating EVM buffer"); goto clean; } } @@ -237,7 +236,6 @@ int srslte_pusch_set_cell(srslte_pusch_t* q, srslte_cell_t cell) int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && srslte_cell_isvalid(&cell)) { - // Resize EVM buffer, only for eNb if (!q->is_ue && q->evm_buffer) { srslte_evm_buffer_resize(q->evm_buffer, srslte_ra_tbs_from_idx(SRSLTE_RA_NOF_TBS_IDX - 1, cell.nof_prb)); @@ -262,7 +260,7 @@ int srslte_pusch_set_rnti(srslte_pusch_t* q, uint16_t rnti) // If the sequence is not allocated generate q->users[rnti_idx] = calloc(1, sizeof(srslte_pdsch_user_t)); if (!q->users[rnti_idx]) { - ERROR("Alocating PDSCH user\n"); + ERROR("Alocating PDSCH user"); return SRSLTE_ERROR; } } else if (q->users[rnti_idx]->sequence_generated && q->users[rnti_idx]->cell_id == q->cell.id && !q->is_ue) { @@ -280,7 +278,7 @@ int srslte_pusch_set_rnti(srslte_pusch_t* q, uint16_t rnti) SRSLTE_NOF_SLOTS_PER_SF * sf_idx, q->cell.id, q->max_re * srslte_mod_bits_x_symbol(SRSLTE_MOD_64QAM))) { - ERROR("Error initializing PUSCH scrambling sequence\n"); + ERROR("Error initializing PUSCH scrambling sequence"); srslte_pusch_free_rnti(q, rnti); return SRSLTE_ERROR; } @@ -296,7 +294,6 @@ int srslte_pusch_set_rnti(srslte_pusch_t* q, uint16_t rnti) void srslte_pusch_free_rnti(srslte_pusch_t* q, uint16_t rnti) { - uint32_t rnti_idx = q->is_ue ? 0 : rnti; if (q->users[rnti_idx]) { @@ -320,13 +317,13 @@ static srslte_sequence_t* get_user_sequence(srslte_pusch_t* q, uint16_t rnti, ui return &q->users[rnti_idx]->seq[sf_idx]; } else { if (srslte_sequence_pusch(&q->tmp_seq, rnti, 2 * sf_idx, q->cell.id, len)) { - ERROR("Error generating temporal scrambling sequence\n"); + ERROR("Error generating temporal scrambling sequence"); return NULL; } return &q->tmp_seq; } } else { - ERROR("Invalid RNTI=0x%x\n", rnti); + ERROR("Invalid RNTI=0x%x", rnti); return NULL; } } @@ -362,7 +359,6 @@ int srslte_pusch_encode(srslte_pusch_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && cfg != NULL) { - /* Limit UL modulation if not supported by the UE or disabled by higher layers */ if (!cfg->enable_64qam) { if (cfg->grant.tb.mod >= SRSLTE_MOD_64QAM) { @@ -372,7 +368,7 @@ int srslte_pusch_encode(srslte_pusch_t* q, } if (cfg->grant.nof_re > q->max_re) { - ERROR("Error too many RE per subframe (%d). PUSCH configured for %d RE (%d PRB)\n", + ERROR("Error too many RE per subframe (%d). PUSCH configured for %d RE (%d PRB)", cfg->grant.nof_re, q->max_re, q->cell.nof_prb); @@ -384,7 +380,7 @@ int srslte_pusch_encode(srslte_pusch_t* q, return err; } - INFO("Encoding PUSCH SF: %d, Mod %s, RNTI: %d, TBS: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d\n", + INFO("Encoding PUSCH SF: %d, Mod %s, RNTI: %d, TBS: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d", sf->tti % 10, srslte_mod_string(cfg->grant.tb.mod), cfg->rnti, @@ -396,7 +392,7 @@ int srslte_pusch_encode(srslte_pusch_t* q, bzero(q->q, cfg->grant.tb.nof_bits); if ((ret = srslte_ulsch_encode(&q->ul_sch, cfg, data->ptr, &data->uci, q->g, q->q)) < 0) { - ERROR("Error encoding TB\n"); + ERROR("Error encoding TB"); return SRSLTE_ERROR; } @@ -405,7 +401,7 @@ int srslte_pusch_encode(srslte_pusch_t* q, // Generate scrambling sequence if not pre-generated srslte_sequence_t* seq = get_user_sequence(q, cfg->rnti, sf->tti % 10, cfg->grant.tb.nof_bits); if (!seq) { - ERROR("Error getting user sequence for rnti=0x%x\n", cfg->rnti); + ERROR("Error getting user sequence for rnti=0x%x", cfg->rnti); return -1; } @@ -439,7 +435,7 @@ int srslte_pusch_encode(srslte_pusch_t* q, // Mapping to resource elements uint32_t n = pusch_put(q, &cfg->grant, q->z, sf_symbols, sf->shortened); if (n != cfg->grant.nof_re) { - ERROR("Error trying to allocate %d symbols but %d were allocated (tti=%d, short=%d, L=%d)\n", + ERROR("Error trying to allocate %d symbols but %d were allocated (tti=%d, short=%d, L=%d)", cfg->grant.nof_re, n, sf->tti, @@ -466,7 +462,6 @@ int srslte_pusch_decode(srslte_pusch_t* q, uint32_t n; if (q != NULL && sf_symbols != NULL && out != NULL && cfg != NULL) { - struct timeval t[3]; if (cfg->meas_time_en) { gettimeofday(&t[1], NULL); @@ -480,7 +475,7 @@ int srslte_pusch_decode(srslte_pusch_t* q, } } - INFO("Decoding PUSCH SF: %d, Mod %s, NofBits: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d\n", + INFO("Decoding PUSCH SF: %d, Mod %s, NofBits: %d, NofRE: %d, NofSymbols=%d, NofBitsE: %d, rv_idx: %d", sf->tti % 10, srslte_mod_string(cfg->grant.tb.mod), cfg->grant.tb.tbs, @@ -492,7 +487,7 @@ int srslte_pusch_decode(srslte_pusch_t* q, /* extract symbols */ n = pusch_get(q, &cfg->grant, sf_symbols, q->d, sf->shortened); if (n != cfg->grant.nof_re) { - ERROR("Error expecting %d symbols but got %d\n", cfg->grant.nof_re, n); + ERROR("Error expecting %d symbols but got %d", cfg->grant.nof_re, n); return SRSLTE_ERROR; } @@ -506,7 +501,7 @@ int srslte_pusch_decode(srslte_pusch_t* q, /* extract channel estimates */ n = pusch_get(q, &cfg->grant, channel->ce, q->ce, sf->shortened); if (n != cfg->grant.nof_re) { - ERROR("Error expecting %d symbols but got %d\n", cfg->grant.nof_re, n); + ERROR("Error expecting %d symbols but got %d", cfg->grant.nof_re, n); return SRSLTE_ERROR; } @@ -536,7 +531,7 @@ int srslte_pusch_decode(srslte_pusch_t* q, // Generate scrambling sequence if not pre-generated srslte_sequence_t* seq = get_user_sequence(q, cfg->rnti, sf->tti % 10, cfg->grant.tb.nof_bits); if (!seq) { - ERROR("Error getting user sequence for rnti=0x%x\n", cfg->rnti); + ERROR("Error getting user sequence for rnti=0x%x", cfg->rnti); return -1; } @@ -577,7 +572,6 @@ uint32_t srslte_pusch_grant_tx_info(srslte_pusch_grant_t* grant, char* str, uint32_t str_len) { - uint32_t len = srslte_ra_ul_info(grant, str, str_len); if (uci_data) { @@ -589,7 +583,6 @@ uint32_t srslte_pusch_grant_tx_info(srslte_pusch_grant_t* grant, uint32_t srslte_pusch_tx_info(srslte_pusch_cfg_t* cfg, srslte_uci_value_t* uci_data, char* str, uint32_t str_len) { - uint32_t len = srslte_print_check(str, str_len, 0, "rnti=0x%x", cfg->rnti); len += srslte_pusch_grant_tx_info(&cfg->grant, &cfg->uci_cfg, uci_data, &str[len], str_len - len); @@ -606,7 +599,6 @@ uint32_t srslte_pusch_rx_info(srslte_pusch_cfg_t* cfg, char* str, uint32_t str_len) { - uint32_t len = srslte_print_check(str, str_len, 0, "rnti=0x%x", cfg->rnti); len += srslte_ra_ul_info(&cfg->grant, &str[len], str_len); diff --git a/lib/src/phy/phch/pusch_nr.c b/lib/src/phy/phch/pusch_nr.c index 36c579464..07f35fe53 100644 --- a/lib/src/phy/phch/pusch_nr.c +++ b/lib/src/phy/phch/pusch_nr.c @@ -20,7 +20,7 @@ int pusch_nr_init_common(srslte_pusch_nr_t* q, const srslte_pusch_nr_args_t* arg { for (srslte_mod_t mod = SRSLTE_MOD_BPSK; mod < SRSLTE_MOD_NITEMS; mod++) { if (srslte_modem_table_lte(&q->modem_tables[mod], mod) < SRSLTE_SUCCESS) { - ERROR("Error initialising modem table for %s\n", srslte_mod_string(mod)); + ERROR("Error initialising modem table for %s", srslte_mod_string(mod)); return SRSLTE_ERROR; } if (args->measure_evm) { @@ -42,7 +42,7 @@ int srslte_pusch_nr_init_ue(srslte_pusch_nr_t* q, const srslte_pusch_nr_args_t* } if (srslte_sch_nr_init_tx(&q->sch, &args->sch)) { - ERROR("Initialising SCH\n"); + ERROR("Initialising SCH"); return SRSLTE_ERROR; } @@ -60,14 +60,14 @@ int srslte_pusch_nr_init_gnb(srslte_pusch_nr_t* q, const srslte_pusch_nr_args_t* } if (srslte_sch_nr_init_rx(&q->sch, &args->sch)) { - ERROR("Initialising SCH\n"); + ERROR("Initialising SCH"); return SRSLTE_ERROR; } if (args->measure_evm) { q->evm_buffer = srslte_evm_buffer_alloc(8); if (q->evm_buffer == NULL) { - ERROR("Initialising EVM\n"); + ERROR("Initialising EVM"); return SRSLTE_ERROR; } } @@ -410,7 +410,7 @@ pusch_nr_cinit(const srslte_carrier_nr_t* carrier, const srslte_sch_cfg_nr_t* cf } uint32_t cinit = (((uint32_t)rnti) << 15U) + (cw_idx << 14U) + n_id; - INFO("PUSCH: RNTI=%d (0x%x); nid=%d; cinit=%d (0x%x);\n", rnti, rnti, n_id, cinit, cinit); + INFO("PUSCH: RNTI=%d (0x%x); nid=%d; cinit=%d (0x%x);", rnti, rnti, n_id, cinit, cinit); return cinit; } @@ -428,19 +428,19 @@ static inline int pusch_nr_encode_codeword(srslte_pusch_nr_t* q, // Check codeword index if (tb->cw_idx >= q->max_cw) { - ERROR("Unsupported codeword index %d\n", tb->cw_idx); + ERROR("Unsupported codeword index %d", tb->cw_idx); return SRSLTE_ERROR; } // Check modulation if (tb->mod >= SRSLTE_MOD_NITEMS) { - ERROR("Invalid modulation %s\n", srslte_mod_string(tb->mod)); + ERROR("Invalid modulation %s", srslte_mod_string(tb->mod)); return SRSLTE_ERROR_OUT_OF_BOUNDS; } // Encode SCH if (srslte_ulsch_nr_encode(&q->sch, &cfg->sch_cfg, tb, data, q->b[tb->cw_idx]) < SRSLTE_SUCCESS) { - ERROR("Error in DL-SCH encoding\n"); + ERROR("Error in DL-SCH encoding"); return SRSLTE_ERROR; } @@ -482,7 +482,7 @@ int srslte_pusch_nr_encode(srslte_pusch_nr_t* q, // Check number of layers if (q->max_layers < grant->nof_layers) { - ERROR("Error number of layers (%d) exceeds configured maximum (%d)\n", grant->nof_layers, q->max_layers); + ERROR("Error number of layers (%d) exceeds configured maximum (%d)", grant->nof_layers, q->max_layers); return SRSLTE_ERROR; } @@ -492,7 +492,7 @@ int srslte_pusch_nr_encode(srslte_pusch_nr_t* q, nof_cw += grant->tb[tb].enabled ? 1 : 0; if (pusch_nr_encode_codeword(q, cfg, &grant->tb[tb], data[tb], grant->rnti) < SRSLTE_SUCCESS) { - ERROR("Error encoding TB %d\n", tb); + ERROR("Error encoding TB %d", tb); return SRSLTE_ERROR; } } @@ -513,12 +513,12 @@ int srslte_pusch_nr_encode(srslte_pusch_nr_t* q, // 7.3.1.6 Mapping from virtual to physical resource blocks int n = srslte_pusch_nr_put(q, cfg, grant, x[0], sf_symbols[0]); if (n < SRSLTE_SUCCESS) { - ERROR("Putting NR PUSCH resources\n"); + ERROR("Putting NR PUSCH resources"); return SRSLTE_ERROR; } if (n != grant->tb[0].nof_re) { - ERROR("Unmatched number of RE (%d != %d)\n", n, grant->tb[0].nof_re); + ERROR("Unmatched number of RE (%d != %d)", n, grant->tb[0].nof_re); return SRSLTE_ERROR; } @@ -544,13 +544,13 @@ static inline int pusch_nr_decode_codeword(srslte_pusch_nr_t* q, // Check codeword index if (tb->cw_idx >= q->max_cw) { - ERROR("Unsupported codeword index %d\n", tb->cw_idx); + ERROR("Unsupported codeword index %d", tb->cw_idx); return SRSLTE_ERROR; } // Check modulation if (tb->mod >= SRSLTE_MOD_NITEMS) { - ERROR("Invalid modulation %s\n", srslte_mod_string(tb->mod)); + ERROR("Invalid modulation %s", srslte_mod_string(tb->mod)); return SRSLTE_ERROR_OUT_OF_BOUNDS; } @@ -585,7 +585,7 @@ static inline int pusch_nr_decode_codeword(srslte_pusch_nr_t* q, // Decode SCH if (srslte_ulsch_nr_decode(&q->sch, &cfg->sch_cfg, tb, llr, res->payload, &res->crc) < SRSLTE_SUCCESS) { - ERROR("Error in DL-SCH encoding\n"); + ERROR("Error in DL-SCH encoding"); return SRSLTE_ERROR; } @@ -617,14 +617,14 @@ int srslte_pusch_nr_decode(srslte_pusch_nr_t* q, uint32_t nof_re = srslte_ra_dl_nr_slot_nof_re(cfg, grant); if (channel->nof_re != nof_re) { - ERROR("Inconsistent number of RE (%d!=%d)\n", channel->nof_re, nof_re); + ERROR("Inconsistent number of RE (%d!=%d)", channel->nof_re, nof_re); return SRSLTE_ERROR; } // Demapping from virtual to physical resource blocks uint32_t nof_re_get = srslte_pusch_nr_get(q, cfg, grant, q->x[0], sf_symbols[0]); if (nof_re_get != nof_re) { - ERROR("Inconsistent number of RE (%d!=%d)\n", nof_re_get, nof_re); + ERROR("Inconsistent number of RE (%d!=%d)", nof_re_get, nof_re); return SRSLTE_ERROR; } @@ -653,7 +653,7 @@ int srslte_pusch_nr_decode(srslte_pusch_nr_t* q, nof_cw += grant->tb[tb].enabled ? 1 : 0; if (pusch_nr_decode_codeword(q, cfg, &grant->tb[tb], &data[tb], grant->rnti) < SRSLTE_SUCCESS) { - ERROR("Error encoding TB %d\n", tb); + ERROR("Error encoding TB %d", tb); return SRSLTE_ERROR; } } @@ -744,7 +744,7 @@ uint32_t srslte_pusch_nr_rx_info(const srslte_pusch_nr_t* q, } if (q->meas_time_en) { - len = srslte_print_check(str, str_len, len, ", t=%d us\n", q->meas_time_us); + len = srslte_print_check(str, str_len, len, ", t=%d us", q->meas_time_us); } return len; @@ -761,7 +761,7 @@ uint32_t srslte_pusch_nr_tx_info(const srslte_pusch_nr_t* q, len += srslte_pusch_nr_grant_info(cfg, grant, &str[len], str_len - len); if (q->meas_time_en) { - len = srslte_print_check(str, str_len, len, ", t=%d us\n", q->meas_time_us); + len = srslte_print_check(str, str_len, len, ", t=%d us", q->meas_time_us); } return len; diff --git a/lib/src/phy/phch/ra_dl.c b/lib/src/phy/phch/ra_dl.c index 6bcb98296..b3b8ff591 100644 --- a/lib/src/phy/phch/ra_dl.c +++ b/lib/src/phy/phch/ra_dl.c @@ -32,7 +32,6 @@ const int tbs_format1c_table[32] = {40, 56, 72, 120, 136, 144, 176, 208 /* Returns the number of RE in a PRB in a slot and subframe */ uint32_t ra_re_x_prb(const srslte_cell_t* cell, srslte_dl_sf_cfg_t* sf, uint32_t slot, uint32_t prb_idx) { - uint32_t subframe = sf->tti % 10; uint32_t nof_ctrl_symbols = SRSLTE_NOF_CTRL_SYMBOLS((*cell), sf->cfi); @@ -188,7 +187,7 @@ int srslte_ra_dl_grant_to_grant_prb_allocation(const srslte_dci_dl_t* dci, case SRSLTE_RA_ALLOC_TYPE1: // Make sure the rbg_subset is valid if (dci->type1_alloc.rbg_subset >= P) { - ERROR("Invalid RBG subset=%d for nof_prb=%d where P=%d\n", dci->type1_alloc.rbg_subset, nof_prb, P); + ERROR("Invalid RBG subset=%d for nof_prb=%d where P=%d", dci->type1_alloc.rbg_subset, nof_prb, P); return SRSLTE_ERROR; } n_rb_type1 = srslte_ra_type1_N_rb(nof_prb); @@ -209,7 +208,7 @@ int srslte_ra_dl_grant_to_grant_prb_allocation(const srslte_dci_dl_t* dci, grant->prb_idx[0][idx] = true; grant->nof_prb++; } else { - ERROR("Invalid idx=%d in Type1 RA, nof_prb=%d\n", idx, nof_prb); + ERROR("Invalid idx=%d in Type1 RA, nof_prb=%d", idx, nof_prb); return SRSLTE_ERROR; } } @@ -360,25 +359,25 @@ static int dl_dci_compute_tb(bool pdsch_use_tbs_index_alt, const srslte_dci_dl_t i_tbs = dci->tb[0].mcs_idx; tbs = srslte_ra_tbs_from_idx(i_tbs, n_prb); if (tbs < 0) { - ERROR("Invalid TBS_index=%d or n_prb=%d\n", i_tbs, n_prb); + ERROR("Invalid TBS_index=%d or n_prb=%d", i_tbs, n_prb); return SRSLTE_ERROR; } } else if (dci->format == SRSLTE_DCI_FORMAT1C) { if (dci->tb[0].mcs_idx < 32) { tbs = tbs_format1c_table[dci->tb[0].mcs_idx]; } else { - ERROR("Error decoding DCI: Invalid mcs_idx=%d in Format1C\n", dci->tb[0].mcs_idx); + ERROR("Error decoding DCI: Invalid mcs_idx=%d in Format1C", dci->tb[0].mcs_idx); return SRSLTE_ERROR; } } else { - ERROR("Error decoding DCI: P/SI/RA-RNTI supports Format1A/1C only\n"); + ERROR("Error decoding DCI: P/SI/RA-RNTI supports Format1A/1C only"); return SRSLTE_ERROR; } grant->tb[0].mod = SRSLTE_MOD_QPSK; if (tbs >= 0) { grant->tb[0].tbs = (uint32_t)tbs; } else { - ERROR("Invalid TBS=%d\n", tbs); + ERROR("Invalid TBS=%d", tbs); return SRSLTE_ERROR; } } else { @@ -393,7 +392,7 @@ static int dl_dci_compute_tb(bool pdsch_use_tbs_index_alt, const srslte_dci_dl_t if (grant->tb[i].tbs < 0) { char str[128]; srslte_dci_dl_info(dci, str, sizeof(str)); - INFO("Error computing TBS from %s\n", str); + INFO("Error computing TBS from %s", str); return SRSLTE_ERROR; } } else { @@ -448,7 +447,7 @@ config_mimo_type(const srslte_cell_t* cell, srslte_tm_t tm, const srslte_dci_dl_ grant->tx_scheme = SRSLTE_TXSCHEME_PORT0; } if (nof_tb != 1) { - ERROR("Wrong number of transport blocks (%d) for %s.\n", nof_tb, srslte_mimotype2str(grant->tx_scheme)); + ERROR("Wrong number of transport blocks (%d) for %s.", nof_tb, srslte_mimotype2str(grant->tx_scheme)); valid_config = false; } break; @@ -458,7 +457,7 @@ config_mimo_type(const srslte_cell_t* cell, srslte_tm_t tm, const srslte_dci_dl_ } else if (nof_tb == 2) { grant->tx_scheme = SRSLTE_TXSCHEME_CDD; } else { - ERROR("Invalid number of transport blocks (%d) for TM3\n", nof_tb); + ERROR("Invalid number of transport blocks (%d) for TM3", nof_tb); valid_config = false; } break; @@ -468,7 +467,7 @@ config_mimo_type(const srslte_cell_t* cell, srslte_tm_t tm, const srslte_dci_dl_ } else if (nof_tb == 2) { grant->tx_scheme = SRSLTE_TXSCHEME_SPATIALMUX; } else { - ERROR("Invalid number of transport blocks (%d) for TM4\n", nof_tb); + ERROR("Invalid number of transport blocks (%d) for TM4", nof_tb); valid_config = false; } break; @@ -478,12 +477,12 @@ config_mimo_type(const srslte_cell_t* cell, srslte_tm_t tm, const srslte_dci_dl_ case SRSLTE_TM6: case SRSLTE_TM7: case SRSLTE_TM8: - ERROR("Not implemented Tx mode (%d)\n", tm + 1); + ERROR("Not implemented Tx mode (%d)", tm + 1); break; /* Error cases */ default: - ERROR("Wrong Tx mode (%d)\n", tm + 1); + ERROR("Wrong Tx mode (%d)", tm + 1); } return valid_config ? SRSLTE_SUCCESS : SRSLTE_ERROR; } @@ -526,14 +525,14 @@ static int config_mimo_layers(const srslte_cell_t* cell, const srslte_dci_dl_t* switch (grant->tx_scheme) { case SRSLTE_TXSCHEME_PORT0: if (nof_tb != 1) { - ERROR("Wrong number of transport blocks (%d) for single antenna.\n", nof_tb); + ERROR("Wrong number of transport blocks (%d) for single antenna.", nof_tb); return SRSLTE_ERROR; } grant->nof_layers = 1; break; case SRSLTE_TXSCHEME_DIVERSITY: if (nof_tb != 1) { - ERROR("Wrong number of transport blocks (%d) for transmit diversity.\n", nof_tb); + ERROR("Wrong number of transport blocks (%d) for transmit diversity.", nof_tb); return SRSLTE_ERROR; } grant->nof_layers = cell->nof_ports; @@ -544,17 +543,17 @@ static int config_mimo_layers(const srslte_cell_t* cell, const srslte_dci_dl_t* } else if (nof_tb == 2) { grant->nof_layers = 2; } else { - ERROR("Wrong number of transport blocks (%d) for spatial multiplexing.\n", nof_tb); + ERROR("Wrong number of transport blocks (%d) for spatial multiplexing.", nof_tb); return SRSLTE_ERROR; } - INFO("PDSCH configured for Spatial Multiplex; nof_codewords=%d; nof_layers=%d; pmi=%d\n", + INFO("PDSCH configured for Spatial Multiplex; nof_codewords=%d; nof_layers=%d; pmi=%d", nof_tb, grant->nof_layers, grant->pmi); break; case SRSLTE_TXSCHEME_CDD: if (nof_tb != 2) { - ERROR("Wrong number of transport blocks (%d) for CDD.\n", nof_tb); + ERROR("Wrong number of transport blocks (%d) for CDD.", nof_tb); return SRSLTE_ERROR; } grant->nof_layers = 2; @@ -566,19 +565,18 @@ static int config_mimo_layers(const srslte_cell_t* cell, const srslte_dci_dl_t* static int config_mimo(const srslte_cell_t* cell, srslte_tm_t tm, const srslte_dci_dl_t* dci, srslte_pdsch_grant_t* grant) { - if (config_mimo_type(cell, tm, dci, grant)) { - ERROR("Configuring MIMO type\n"); + ERROR("Configuring MIMO type"); return -1; } if (config_mimo_pmi(cell, dci, grant)) { - ERROR("Configuring MIMO PMI\n"); + ERROR("Configuring MIMO PMI"); return -1; } if (config_mimo_layers(cell, dci, grant)) { - ERROR("Configuring MIMO layers\n"); + ERROR("Configuring MIMO layers"); return -1; } @@ -618,11 +616,11 @@ int srslte_ra_dl_dci_to_grant(const srslte_cell_t* cell, } } } else { - INFO("Configuring TB Info\n"); + INFO("Configuring TB Info"); return SRSLTE_ERROR; } } else { - ERROR("Configuring resource allocation\n"); + ERROR("Configuring resource allocation"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/ra_dl_nr.c b/lib/src/phy/phch/ra_dl_nr.c index 97a0fc443..9acee8cc6 100644 --- a/lib/src/phy/phch/ra_dl_nr.c +++ b/lib/src/phy/phch/ra_dl_nr.c @@ -18,23 +18,23 @@ static bool check_time_ra_typeA(uint32_t* S, uint32_t* L) { // Check values using Table 5.1.2.1-1 if (*S > 3) { - ERROR("S (%d) is out-of-range {0,1,2,3}\n", *S); + ERROR("S (%d) is out-of-range {0,1,2,3}", *S); return false; } if (*L < 3 || *L > 14) { - ERROR("L (%d) is out-of-range {3,...,14}\n", *L); + ERROR("L (%d) is out-of-range {3,...,14}", *L); return false; } uint32_t sum = *S + *L; if (sum < 3) { - ERROR("The sum of S (%d) and L (%d) is lower than 3\n", *S, *L); + ERROR("The sum of S (%d) and L (%d) is lower than 3", *S, *L); return false; } if (sum > 14) { - ERROR("The sum of S (%d) and L (%d) is greater than 14\n", *S, *L); + ERROR("The sum of S (%d) and L (%d) is greater than 14", *S, *L); return false; } @@ -43,7 +43,7 @@ static bool check_time_ra_typeA(uint32_t* S, uint32_t* L) static bool check_time_ra_typeB(uint32_t* S, uint32_t* L) { - ERROR("Not implemented\n"); + ERROR("Not implemented"); return false; } @@ -63,7 +63,7 @@ int srslte_ra_dl_nr_time_default_A(uint32_t m, srslte_dmrs_sch_typeA_pos_t dmrs_ } if (m >= SRSLTE_MAX_NOF_DL_ALLOCATION) { - ERROR("m (%d) is out-of-range\n", m); + ERROR("m (%d) is out-of-range", m); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -105,7 +105,7 @@ int srslte_ra_dl_nr_time_default_A(uint32_t m, srslte_dmrs_sch_typeA_pos_t dmrs_ grant->L = L_pos3[m]; break; default: - ERROR("Undefined case (%d)\n", dmrs_typeA_pos); + ERROR("Undefined case (%d)", dmrs_typeA_pos); return SRSLTE_ERROR; } @@ -133,7 +133,7 @@ int srslte_ra_dl_nr_time(const srslte_sch_hl_cfg_nr_t* cfg, } if (m >= SRSLTE_MAX_NOF_DL_ALLOCATION) { - ERROR("m (%d) is out-of-range\n", m); + ERROR("m (%d) is out-of-range", m); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -182,7 +182,7 @@ int srslte_ra_dl_nr_time(const srslte_sch_hl_cfg_nr_t* cfg, // Validate S and L parameters if (!srslte_ra_dl_nr_time_validate(grant)) { - ERROR("Invalid Time RA S=%d; L=%d; m=%d\n", grant->S, grant->L, m); + ERROR("Invalid Time RA S=%d; L=%d; m=%d", grant->S, grant->L, m); return SRSLTE_ERROR; } @@ -270,6 +270,6 @@ int srslte_ra_dl_nr_freq(const srslte_carrier_nr_t* carrier, } ra_freq_type0(carrier, cfg, dci_dl, grant); - ERROR("Only DCI Format 1_0 is supported\n"); + ERROR("Only DCI Format 1_0 is supported"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/ra_helper.h b/lib/src/phy/phch/ra_helper.h index 83f09cf3c..0e27b6216 100644 --- a/lib/src/phy/phch/ra_helper.h +++ b/lib/src/phy/phch/ra_helper.h @@ -36,7 +36,7 @@ static int ra_helper_freq_type1(uint32_t N_bwp_size, uint32_t riv, srslte_sch_gr ra_helper_compute_s_and_l(N_bwp_size, riv, &start, &len); if (start + len > N_bwp_size) { - ERROR("RIV 0x%x for BWP size %d resulted in freq=%d:%d\n", riv, N_bwp_size, start, len); + ERROR("RIV 0x%x for BWP size %d resulted in freq=%d:%d", riv, N_bwp_size, start, len); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/ra_nbiot.c b/lib/src/phy/phch/ra_nbiot.c index efdc6fbc7..395a6e6cb 100644 --- a/lib/src/phy/phch/ra_nbiot.c +++ b/lib/src/phy/phch/ra_nbiot.c @@ -142,7 +142,7 @@ static int nbiot_dl_dci_to_grant_mcs(srslte_ra_nbiot_dl_dci_t* dci, srslte_ra_nb } if (tbs <= 0) { - INFO("Unsupported resource allocation specified: i_tbs=%d [0,12], i_sf=%d [0,7]\n", i_tbs, i_sf); + INFO("Unsupported resource allocation specified: i_tbs=%d [0,12], i_sf=%d [0,7]", i_tbs, i_sf); return SRSLTE_ERROR; } else { grant->mcs[0].tbs = (uint32_t)tbs; @@ -471,7 +471,7 @@ int srslte_ra_nbiot_ul_dci_to_grant(srslte_ra_nbiot_ul_dci_t* dci, } else if (grant->nof_sc == 12) { grant->nof_slots = 2; } else { - DEBUG("Unsupported value for N_sc_RU=%d\n", grant->nof_sc); + DEBUG("Unsupported value for N_sc_RU=%d", grant->nof_sc); } break; case SRSLTE_NPUSCH_FORMAT2: diff --git a/lib/src/phy/phch/ra_nr.c b/lib/src/phy/phch/ra_nr.c index 16edc4f55..2afed56be 100644 --- a/lib/src/phy/phch/ra_nr.c +++ b/lib/src/phy/phch/ra_nr.c @@ -474,7 +474,7 @@ static int ra_dl_dmrs(const srslte_sch_hl_cfg_nr_t* pdsch_hl_cfg, if (pdsch_grant->dci_format == srslte_dci_format_nr_1_0) { if (srslte_ra_dl_nr_nof_dmrs_cdm_groups_without_data_format_1_0(dmrs_cfg, pdsch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading number of DMRS CDM groups\n"); + ERROR("Error loading number of DMRS CDM groups"); return SRSLTE_ERROR; } } else { @@ -576,11 +576,11 @@ ra_ul_dmrs(const srslte_sch_hl_cfg_nr_t* pusch_hl_cfg, srslte_sch_grant_nr_t* pu // Set number of DMRS CDM groups without data if (pusch_grant->dci_format == srslte_dci_format_nr_0_0) { if (srslte_ra_ul_nr_nof_dmrs_cdm_groups_without_data_format_0_0(cfg, pusch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading number of DMRS CDM groups\n"); + ERROR("Error loading number of DMRS CDM groups"); return SRSLTE_ERROR; } } else { - ERROR("Invalid case\n"); + ERROR("Invalid case"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/ra_ul.c b/lib/src/phy/phch/ra_ul.c index 2c7fd0724..2681fca90 100644 --- a/lib/src/phy/phch/ra_ul.c +++ b/lib/src/phy/phch/ra_ul.c @@ -71,14 +71,12 @@ static void compute_freq_hopping(srslte_ra_ul_pusch_hopping_t* q, srslte_pusch_hopping_cfg_t* hopping_cfg, srslte_pusch_grant_t* grant) { - if (q->cell.frame_type == SRSLTE_TDD) { - ERROR("Error frequency hopping for TDD not implemented (c_init for each subframe, see end of 5.3.4 36.211)\n"); + ERROR("Error frequency hopping for TDD not implemented (c_init for each subframe, see end of 5.3.4 36.211)"); } for (uint32_t slot = 0; slot < 2; slot++) { - - INFO("PUSCH Freq hopping: %d\n", grant->freq_hopping); + INFO("PUSCH Freq hopping: %d", grant->freq_hopping); uint32_t n_prb_tilde = grant->n_prb[slot]; if (grant->freq_hopping == 1) { @@ -108,7 +106,7 @@ static void compute_freq_hopping(srslte_ra_ul_pusch_hopping_t* q, 2 * (n_vrb_tilde % n_rb_sb) * f_m(q, hopping_cfg, i, hopping_cfg->current_tx_nb)) % (n_rb_sb * hopping_cfg->n_sb); - INFO("n_prb_tilde: %d, n_vrb_tilde: %d, n_rb_sb: %d, n_sb: %d\n", + INFO("n_prb_tilde: %d, n_vrb_tilde: %d, n_rb_sb: %d, n_sb: %d", n_prb_tilde, n_vrb_tilde, n_rb_sb, @@ -146,7 +144,7 @@ static int ra_ul_grant_to_grant_prb_allocation(srslte_dci_ul_t* dci, } else { grant->freq_hopping = 2; } - INFO("prb1: %d, prb2: %d, L: %d\n", grant->n_prb[0], grant->n_prb[1], grant->L_prb); + INFO("prb1: %d, prb2: %d, L: %d", grant->n_prb[0], grant->n_prb[1], grant->L_prb); } else { /* Type1 frequency hopping as defined in 8.4.1 of 36.213 * frequency offset between 1st and 2nd slot is fixed. @@ -156,7 +154,7 @@ static int ra_ul_grant_to_grant_prb_allocation(srslte_dci_ul_t* dci, // starting prb idx for slot 0 is as given by resource dci grant->n_prb[0] = n_prb_1; if (n_prb_1 < n_rb_ho / 2) { - INFO("Invalid Frequency Hopping parameters. Offset: %d, n_prb_1: %d\n", n_rb_ho, n_prb_1); + INFO("Invalid Frequency Hopping parameters. Offset: %d, n_prb_1: %d", n_rb_ho, n_prb_1); return SRSLTE_ERROR; } uint32_t n_prb_1_tilde = n_prb_1; @@ -179,7 +177,7 @@ static int ra_ul_grant_to_grant_prb_allocation(srslte_dci_ul_t* dci, default: break; } - INFO("n_rb_pusch: %d, prb1: %d, prb2: %d, L: %d\n", n_rb_pusch, grant->n_prb[0], grant->n_prb[1], grant->L_prb); + INFO("n_rb_pusch: %d, prb1: %d, prb2: %d, L: %d", n_rb_pusch, grant->n_prb[0], grant->n_prb[1], grant->L_prb); grant->freq_hopping = 1; } @@ -205,7 +203,7 @@ static void ul_fill_ra_mcs(srslte_ra_tb_t* tb, srslte_ra_tb_t* last_tb, uint32_t tb->mod = SRSLTE_MOD_64QAM; tb->tbs = srslte_ra_tbs_from_idx(tb->mcs_idx - 2, L_prb); } else { - ERROR("Invalid MCS index %d\n", tb->mcs_idx); + ERROR("Invalid MCS index %d", tb->mcs_idx); } } else if (tb->mcs_idx == 29 && cqi_request && L_prb <= 4) { // 8.6.1 and 8.6.2 36.213 second paragraph @@ -244,7 +242,7 @@ int srslte_ra_ul_pusch_hopping_init(srslte_ra_ul_pusch_hopping_t* q, srslte_cell q->initialized = true; /* Precompute sequence for type2 frequency hopping */ if (srslte_sequence_LTE_pr(&q->seq_type2_fo, 210, q->cell.id)) { - ERROR("Error initiating type2 frequency hopping sequence\n"); + ERROR("Error initiating type2 frequency hopping sequence"); return SRSLTE_ERROR; } ret = SRSLTE_SUCCESS; @@ -279,10 +277,8 @@ int srslte_ra_ul_dci_to_grant(srslte_cell_t* cell, srslte_dci_ul_t* dci, srslte_pusch_grant_t* grant) { - // Compute PRB allocation if (!ra_ul_grant_to_grant_prb_allocation(dci, grant, hopping_cfg->n_rb_ho, cell->nof_prb)) { - // copy default values from DCI. RV can be updated by ul_fill_ra_mcs() in case of Adaptive retx (mcs>28) grant->tb.mcs_idx = dci->tb.mcs_idx; grant->tb.rv = dci->tb.rv; @@ -290,18 +286,18 @@ int srslte_ra_ul_dci_to_grant(srslte_cell_t* cell, // Compute MCS ul_fill_ra_mcs(&grant->tb, &grant->last_tb, grant->L_prb, dci->cqi_request); - /* Compute RE assuming shortened is false*/ srslte_ra_ul_compute_nof_re(grant, cell->cp, 0); - // TODO: Need to compute hopping here before determining if there is collision with SRS, but only MAC knows if it's a + // TODO: Need to compute hopping here before determining if there is collision with SRS, but only MAC knows if it's + // a // new tx or a retx. Need to split MAC interface in 2 calls. For now, assume hopping is the same for (uint32_t i = 0; i < 2; i++) { grant->n_prb_tilde[i] = grant->n_prb[i]; } if (grant->nof_symb == 0 || grant->nof_re == 0) { - INFO("Error converting ul_dci to grant, nof_symb=%d, nof_re=%d\n", grant->nof_symb, grant->nof_re); + INFO("Error converting ul_dci to grant, nof_symb=%d, nof_re=%d", grant->nof_symb, grant->nof_re); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/regs.c b/lib/src/phy/phch/regs.c index a9b61a6c6..fa48e25bb 100644 --- a/lib/src/phy/phch/regs.c +++ b/lib/src/phy/phch/regs.c @@ -117,7 +117,7 @@ int regs_pdcch_init(srslte_regs_t* h) } } h->pdcch[cfi].nof_regs = (h->pdcch[cfi].nof_regs / 9) * 9; - INFO("Init PDCCH REG space CFI %d. %d useful REGs (%d CCEs)\n", + INFO("Init PDCCH REG space CFI %d. %d useful REGs (%d CCEs)", cfi + 1, h->pdcch[cfi].nof_regs, h->pdcch[cfi].nof_regs / 9); @@ -139,7 +139,7 @@ clean_and_exit: int srslte_regs_pdcch_nregs(srslte_regs_t* h, uint32_t cfi) { if (cfi < 1 || cfi > 3) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR; } else { return (int)h->pdcch[cfi - 1].nof_regs; @@ -168,7 +168,7 @@ int srslte_regs_pdcch_put_offset(srslte_regs_t* h, uint32_t nof_regs) { if (cfi < 1 || cfi > 3) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR; } if (start_reg + nof_regs <= h->pdcch[cfi - 1].nof_regs) { @@ -180,7 +180,7 @@ int srslte_regs_pdcch_put_offset(srslte_regs_t* h, } return k; } else { - ERROR("Out of range: start_reg + nof_reg must be lower than %d\n", h->pdcch[cfi - 1].nof_regs); + ERROR("Out of range: start_reg + nof_reg must be lower than %d", h->pdcch[cfi - 1].nof_regs); return SRSLTE_ERROR; } } @@ -188,7 +188,7 @@ int srslte_regs_pdcch_put_offset(srslte_regs_t* h, int srslte_regs_pdcch_put(srslte_regs_t* h, uint32_t cfi, cf_t* d, cf_t* slot_symbols) { if (cfi < 1 || cfi > 3) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR; } return srslte_regs_pdcch_put_offset(h, cfi, d, slot_symbols, 0, h->pdcch[cfi - 1].nof_regs); @@ -202,7 +202,7 @@ int srslte_regs_pdcch_get_offset(srslte_regs_t* h, uint32_t nof_regs) { if (cfi < 1 || cfi > 3) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR; } if (start_reg + nof_regs <= h->pdcch[cfi - 1].nof_regs) { @@ -214,7 +214,7 @@ int srslte_regs_pdcch_get_offset(srslte_regs_t* h, } return k; } else { - ERROR("Out of range: start_reg + nof_reg must be lower than %d\n", h->pdcch[cfi - 1].nof_regs); + ERROR("Out of range: start_reg + nof_reg must be lower than %d", h->pdcch[cfi - 1].nof_regs); return SRSLTE_ERROR; } } @@ -222,7 +222,7 @@ int srslte_regs_pdcch_get_offset(srslte_regs_t* h, int srslte_regs_pdcch_get(srslte_regs_t* h, uint32_t cfi, cf_t* slot_symbols, cf_t* d) { if (cfi < 1 || cfi > 3) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR; } return srslte_regs_pdcch_get_offset(h, cfi, slot_symbols, d, 0, h->pdcch[cfi - 1].nof_regs); @@ -272,7 +272,7 @@ int regs_phich_init(srslte_regs_t* h, uint32_t phich_mi, bool mbsfn_or_sf1_6_tdd perror("malloc"); return -1; } - INFO("Creating %d PHICH mapping units. %s length, Ng=%.2f\n", + INFO("Creating %d PHICH mapping units. %s length, Ng=%.2f", h->ngroups_phich, h->phich_len == SRSLTE_PHICH_EXT ? "Extended" : "Normal", ng); @@ -332,7 +332,7 @@ int regs_phich_init(srslte_regs_t* h, uint32_t phich_mi, bool mbsfn_or_sf1_6_tdd } h->phich[mi].regs[i] = regs_phich[li][ni]; h->phich[mi].regs[i]->assigned = true; - DEBUG("Assigned PHICH REG#%d (%d,%d)\n", nreg, h->phich[mi].regs[i]->k0, li); + DEBUG("Assigned PHICH REG#%d (%d,%d)", nreg, h->phich[mi].regs[i]->k0, li); nreg++; } } @@ -413,7 +413,7 @@ int srslte_regs_phich_add(srslte_regs_t* h, cf_t symbols[REGS_PHICH_NSYM], uint3 { uint32_t i; if (ngroup >= h->ngroups_phich) { - ERROR("Error invalid ngroup %d\n", ngroup); + ERROR("Error invalid ngroup %d", ngroup); return SRSLTE_ERROR_INVALID_INPUTS; } if (SRSLTE_CP_ISEXT(h->cell.cp)) { @@ -458,7 +458,7 @@ int srslte_regs_phich_get(srslte_regs_t* h, cf_t* slot_symbols, cf_t symbols[REG { uint32_t i; if (ngroup >= h->ngroups_phich) { - ERROR("Error invalid ngroup %d\n", ngroup); + ERROR("Error invalid ngroup %d", ngroup); return SRSLTE_ERROR_INVALID_INPUTS; } if (SRSLTE_CP_ISEXT(h->cell.cp)) { @@ -493,22 +493,21 @@ int regs_pcfich_init(srslte_regs_t* h) } ch->nof_regs = REGS_PCFICH_NREGS; - INFO("PCFICH allocating %d regs. CellID: %d, PRB: %d\n", ch->nof_regs, h->cell.id, h->cell.nof_prb); + INFO("PCFICH allocating %d regs. CellID: %d, PRB: %d", ch->nof_regs, h->cell.id, h->cell.nof_prb); k_hat = (SRSLTE_NRE / 2) * (h->cell.id % (2 * h->cell.nof_prb)); for (i = 0; i < REGS_PCFICH_NREGS; i++) { - k = (k_hat + (i * h->cell.nof_prb / 2) * (SRSLTE_NRE / 2)) % (h->cell.nof_prb * SRSLTE_NRE); ch->regs[i] = regs_find_reg(h, k, 0); if (!ch->regs[i]) { - ERROR("Error allocating PCFICH: REG (%d,0) not found\n", k); + ERROR("Error allocating PCFICH: REG (%d,0) not found", k); return SRSLTE_ERROR; } else if (ch->regs[i]->assigned) { - ERROR("Error allocating PCFICH: REG (%d,0) already allocated\n", k); + ERROR("Error allocating PCFICH: REG (%d,0) already allocated", k); return SRSLTE_ERROR; } else { ch->regs[i]->assigned = true; - DEBUG("Assigned PCFICH REG#%d (%d,0)\n", i, k); + DEBUG("Assigned PCFICH REG#%d (%d,0)", i, k); } } return SRSLTE_SUCCESS; @@ -581,7 +580,6 @@ srslte_regs_reg_t* regs_find_reg(srslte_regs_t* h, uint32_t k, uint32_t l) */ int regs_num_x_symbol(uint32_t symbol, uint32_t nof_port, srslte_cp_t cp) { - switch (symbol) { case 0: return 2; @@ -593,7 +591,7 @@ int regs_num_x_symbol(uint32_t symbol, uint32_t nof_port, srslte_cp_t cp) case 4: return 2; default: - ERROR("Invalid number of ports %d\n", nof_port); + ERROR("Invalid number of ports %d", nof_port); return SRSLTE_ERROR; } break; @@ -606,7 +604,7 @@ int regs_num_x_symbol(uint32_t symbol, uint32_t nof_port, srslte_cp_t cp) return 2; } default: - ERROR("Invalid symbol %d\n", symbol); + ERROR("Invalid symbol %d", symbol); return SRSLTE_ERROR; } } @@ -641,7 +639,7 @@ int regs_reg_init(srslte_regs_reg_t* reg, uint32_t symbol, uint32_t nreg, uint32 j++; } if (j != 4) { - ERROR("Something went wrong: expected 2 references\n"); + ERROR("Something went wrong: expected 2 references"); return SRSLTE_ERROR; } break; @@ -654,7 +652,7 @@ int regs_reg_init(srslte_regs_reg_t* reg, uint32_t symbol, uint32_t nreg, uint32 } break; default: - ERROR("Invalid number of REGs per PRB: %d\n", maxreg); + ERROR("Invalid number of REGs per PRB: %d", maxreg); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -709,7 +707,7 @@ int srslte_regs_init_opts(srslte_regs_t* h, srslte_cell_t cell, uint32_t phich_m } h->nof_regs += h->cell.nof_prb * n[i]; } - INFO("Indexing %d REGs. CellId: %d, %d PRB, CP: %s\n", + INFO("Indexing %d REGs. CellId: %d, %d PRB, CP: %s", h->nof_regs, h->cell.id, h->cell.nof_prb, @@ -726,10 +724,10 @@ int srslte_regs_init_opts(srslte_regs_t* h, srslte_cell_t cell, uint32_t phich_m while (k < h->nof_regs) { if (n[i] == 3 || (n[i] == 2 && jmax != 1)) { if (regs_reg_init(&h->regs[k], i, j[i], prb * SRSLTE_NRE, n[i], vo)) { - ERROR("Error initializing REGs\n"); + ERROR("Error initializing REGs"); goto clean_and_exit; } - /*DEBUG("Available REG #%3d: l=%d, prb=%d, nreg=%d (k0=%d)\n", k, i, prb, j[i], + /*DEBUG("Available REG #%3d: l=%d, prb=%d, nreg=%d (k0=%d)", k, i, prb, j[i], h->regs[k].k0); */ j[i]++; @@ -747,18 +745,18 @@ int srslte_regs_init_opts(srslte_regs_t* h, srslte_cell_t cell, uint32_t phich_m } } if (regs_pcfich_init(h)) { - ERROR("Error initializing PCFICH REGs\n"); + ERROR("Error initializing PCFICH REGs"); goto clean_and_exit; } h->phich_mi = phich_mi; if (phich_mi > 0) { if (regs_phich_init(h, phich_mi, mbsfn_or_sf1_6_tdd)) { - ERROR("Error initializing PHICH REGs\n"); + ERROR("Error initializing PHICH REGs"); goto clean_and_exit; } } if (regs_pdcch_init(h)) { - ERROR("Error initializing PDCCH REGs\n"); + ERROR("Error initializing PDCCH REGs"); goto clean_and_exit; } diff --git a/lib/src/phy/phch/sch.c b/lib/src/phy/phch/sch.c index 1fcd750b7..b75550b9e 100644 --- a/lib/src/phy/phch/sch.c +++ b/lib/src/phy/phch/sch.c @@ -39,7 +39,7 @@ static inline float get_beta_harq_offset(uint32_t idx) if (idx < 15) { ret = beta_harq_offset[idx]; } else { - ERROR("Invalid input %d (min: %d, max: %d)\n", idx, 0, 14); + ERROR("Invalid input %d (min: %d, max: %d)", idx, 0, 14); } return ret; @@ -55,7 +55,7 @@ static inline float get_beta_ri_offset(uint32_t idx) if (idx < 13) { ret = beta_ri_offset[idx]; } else { - ERROR("Invalid input %d (min: %d, max: %d)\n", idx, 0, 12); + ERROR("Invalid input %d (min: %d, max: %d)", idx, 0, 12); } return ret; @@ -71,7 +71,7 @@ static inline float get_beta_cqi_offset(uint32_t idx) if (idx > 1 && idx < 16) { ret = beta_cqi_offset[idx]; } else { - ERROR("Invalid input %d (min: %d, max: %d)\n", idx, 2, 15); + ERROR("Invalid input %d (min: %d, max: %d)", idx, 2, 15); } return ret; @@ -135,20 +135,20 @@ int srslte_sch_init(srslte_sch_t* q) bzero(q, sizeof(srslte_sch_t)); if (srslte_crc_init(&q->crc_tb, SRSLTE_LTE_CRC24A, 24)) { - ERROR("Error initiating CRC\n"); + ERROR("Error initiating CRC"); goto clean; } if (srslte_crc_init(&q->crc_cb, SRSLTE_LTE_CRC24B, 24)) { - ERROR("Error initiating CRC\n"); + ERROR("Error initiating CRC"); goto clean; } if (srslte_tcod_init(&q->encoder, SRSLTE_TCOD_MAX_LEN_CB)) { - ERROR("Error initiating Turbo Coder\n"); + ERROR("Error initiating Turbo Coder"); goto clean; } if (srslte_tdec_init(&q->decoder, SRSLTE_TCOD_MAX_LEN_CB)) { - ERROR("Error initiating Turbo Decoder\n"); + ERROR("Error initiating Turbo Decoder"); goto clean; } @@ -242,14 +242,13 @@ static int encode_tb_off(srslte_sch_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && e_bits != NULL && cb_segm != NULL && softbuffer != NULL) { - if (cb_segm->F) { - ERROR("Error filler bits are not supported. Use standard TBS\n"); + ERROR("Error filler bits are not supported. Use standard TBS"); return SRSLTE_ERROR; } if (cb_segm->C > softbuffer->max_cb) { - ERROR("Error number of CB to encode (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C, softbuffer->max_cb); + ERROR("Error number of CB to encode (%d) exceeds soft buffer size (%d CBs)", cb_segm->C, softbuffer->max_cb); return -1; } @@ -266,7 +265,6 @@ static int encode_tb_off(srslte_sch_t* q, wp = 0; rp = 0; for (i = 0; i < cb_segm->C; i++) { - uint32_t cblen_idx; /* Get read lengths */ if (i < cb_segm->C2) { @@ -287,7 +285,7 @@ static int encode_tb_off(srslte_sch_t* q, n_e = Qm * ((uint32_t)ceilf((float)Gp / cb_segm->C)); } - INFO("CB#%d: cb_len: %d, rlen: %d, wp: %d, rp: %d, E: %d\n", i, cb_len, rlen, wp, rp, n_e); + INFO("CB#%d: cb_len: %d, rlen: %d, wp: %d, rp: %d, E: %d", i, cb_len, rlen, wp, rp, n_e); if (data) { bool last_cb = false; @@ -297,7 +295,7 @@ static int encode_tb_off(srslte_sch_t* q, // Copy data memcpy(q->cb_in, &data[rp / 8], rlen * sizeof(uint8_t) / 8); } else { - INFO("Last CB, appending parity: %d from %d and 24 to %d\n", rlen - 24, rp, rlen - 24); + INFO("Last CB, appending parity: %d from %d and 24 to %d", rlen - 24, rp, rlen - 24); /* Append Transport Block parity bits to the last CB */ memcpy(q->cb_in, &data[rp / 8], (rlen - 24) * sizeof(uint8_t) / 8); @@ -315,7 +313,7 @@ static int encode_tb_off(srslte_sch_t* q, cblen_idx, last_cb); } - DEBUG("RM cblen_idx=%d, n_e=%d, wp=%d, nof_e_bits=%d\n", cblen_idx, n_e, wp, nof_e_bits); + DEBUG("RM cblen_idx=%d, n_e=%d, wp=%d, nof_e_bits=%d", cblen_idx, n_e, wp, nof_e_bits); /* Rate matching */ if (srslte_rm_turbo_tx_lut(softbuffer->buffer_b[i], @@ -326,7 +324,7 @@ static int encode_tb_off(srslte_sch_t* q, n_e, (wp + w_offset) % 8, rv)) { - ERROR("Error in rate matching\n"); + ERROR("Error in rate matching"); return SRSLTE_ERROR; } @@ -335,10 +333,10 @@ static int encode_tb_off(srslte_sch_t* q, wp += n_e; } - INFO("END CB#%d: wp: %d, rp: %d\n", i, wp, rp); + INFO("END CB#%d: wp: %d, rp: %d", i, wp, rp); ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters: e_bits=%d, cb_segm=%d, softbuffer=%d\n", e_bits != 0, cb_segm != 0, softbuffer != 0); + ERROR("Invalid parameters: e_bits=%d, cb_segm=%d, softbuffer=%d", e_bits != 0, cb_segm != 0, softbuffer != 0); } return ret; } @@ -364,12 +362,11 @@ bool decode_tb_cb(srslte_sch_t* q, void* e_bits, uint8_t* data) { - int8_t* e_bits_b = e_bits; int16_t* e_bits_s = e_bits; if (cb_segm->C > SRSLTE_MAX_CODEBLOCKS) { - ERROR("Error SRSLTE_MAX_CODEBLOCKS=%d\n", SRSLTE_MAX_CODEBLOCKS); + ERROR("Error SRSLTE_MAX_CODEBLOCKS=%d", SRSLTE_MAX_CODEBLOCKS); return false; } @@ -378,7 +375,6 @@ bool decode_tb_cb(srslte_sch_t* q, for (int cb_idx = 0; cb_idx < cb_segm->C; cb_idx++) { /* Do not process blocks with CRC Ok */ if (softbuffer->cb_crc[cb_idx] == false) { - uint32_t cb_len = cb_idx < cb_segm->C1 ? cb_segm->K1 : cb_segm->K2; uint32_t cb_len_idx = cb_idx < cb_segm->C1 ? cb_segm->K1_idx : cb_segm->K2_idx; @@ -397,12 +393,12 @@ bool decode_tb_cb(srslte_sch_t* q, if (q->llr_is_8bit) { if (srslte_rm_turbo_rx_lut_8bit(&e_bits_b[rp], (int8_t*)softbuffer->buffer_f[cb_idx], n_e2, cb_len_idx, rv)) { - ERROR("Error in rate matching\n"); + ERROR("Error in rate matching"); return SRSLTE_ERROR; } } else { if (srslte_rm_turbo_rx_lut(&e_bits_s[rp], softbuffer->buffer_f[cb_idx], n_e2, cb_len_idx, rv)) { - ERROR("Error in rate matching\n"); + ERROR("Error in rate matching"); return SRSLTE_ERROR; } } @@ -434,7 +430,6 @@ bool decode_tb_cb(srslte_sch_t* q, // CRC is OK if (!srslte_crc_checksum_byte(crc_ptr, &data[cb_idx * rlen / 8], len_crc)) { - softbuffer->cb_crc[cb_idx] = true; early_stop = true; @@ -444,7 +439,7 @@ bool decode_tb_cb(srslte_sch_t* q, } while (cb_noi < q->max_iterations && !early_stop); - INFO("CB %d: rp=%d, n_e=%d, cb_len=%d, CRC=%s, rlen=%d, iterations=%d/%d\n", + INFO("CB %d: rp=%d, n_e=%d, cb_len=%d, CRC=%s, rlen=%d, iterations=%d/%d", cb_idx, rp, n_e2, @@ -504,9 +499,7 @@ static int decode_tb(srslte_sch_t* q, int16_t* e_bits, uint8_t* data) { - if (q != NULL && data != NULL && softbuffer != NULL && e_bits != NULL && cb_segm != NULL) { - if (cb_segm->tbs == 0 || cb_segm->C == 0) { return SRSLTE_SUCCESS; } @@ -534,7 +527,6 @@ static int decode_tb(srslte_sch_t* q, crc_ok = decode_tb_cb(q, softbuffer, cb_segm, Qm, rv, nof_e_bits, e_bits, data); if (crc_ok) { - uint32_t par_rx = 0, par_tx = 0; // Compute transport block CRC @@ -545,17 +537,17 @@ static int decode_tb(srslte_sch_t* q, ((uint32_t)data[cb_segm->tbs / 8 + 2]); if (par_rx == par_tx && par_rx) { - INFO("TB decoded OK\n"); + INFO("TB decoded OK"); return SRSLTE_SUCCESS; } else { - INFO("Error in TB parity: par_tx=0x%x, par_rx=0x%x\n", par_tx, par_rx); + INFO("Error in TB parity: par_tx=0x%x, par_rx=0x%x", par_tx, par_rx); return SRSLTE_ERROR; } } else { return SRSLTE_ERROR; } } else { - ERROR("Missing inputs: data=%d, softbuffer=%d, e_bits=%d, cb_segm=%d\n", + ERROR("Missing inputs: data=%d, softbuffer=%d, e_bits=%d, cb_segm=%d", data != 0, softbuffer != 0, e_bits != 0, @@ -584,7 +576,7 @@ int srslte_dlsch_decode2(srslte_sch_t* q, // Prepare cbsegm srslte_cbsegm_t cb_segm; if (srslte_cbsegm(&cb_segm, (uint32_t)cfg->grant.tb[tb_idx].tbs)) { - ERROR("Error computing Codeword (%d) segmentation for TBS=%d\n", tb_idx, cfg->grant.tb[tb_idx].tbs); + ERROR("Error computing Codeword (%d) segmentation for TBS=%d", tb_idx, cfg->grant.tb[tb_idx].tbs); return SRSLTE_ERROR; } @@ -631,7 +623,7 @@ int srslte_dlsch_encode2(srslte_sch_t* q, // Prepare cbsegm srslte_cbsegm_t cb_segm; if (srslte_cbsegm(&cb_segm, (uint32_t)cfg->grant.tb[tb_idx].tbs)) { - ERROR("Error computing Codeword (%d) segmentation for TBS=%d\n", tb_idx, cfg->grant.tb[tb_idx].tbs); + ERROR("Error computing Codeword (%d) segmentation for TBS=%d", tb_idx, cfg->grant.tb[tb_idx].tbs); return SRSLTE_ERROR; } @@ -737,7 +729,6 @@ static void ulsch_interleave_qm4(uint8_t* g_bits, /* First bits are aligned to byte */ if (0 == (bit_read_idx & 0x3)) { for (; i < (cols - 3); i += 4) { - uint8_t w1 = *(_g_bits++); uint8_t w2 = *(_g_bits++); @@ -933,7 +924,7 @@ static void ulsch_interleave(uint8_t* g_bits, uint8_t* ri_present) { if (N_pusch_symbs == 0 || Qm == 0 || H_prime_total == 0 || H_prime_total < N_pusch_symbs) { - ERROR("Invalid input: N_pusch_symbs=%d, Qm=%d, H_prime_total=%d, N_pusch_symbs=%d\n", + ERROR("Invalid input: N_pusch_symbs=%d, Qm=%d, H_prime_total=%d, N_pusch_symbs=%d", N_pusch_symbs, Qm, H_prime_total, @@ -972,7 +963,7 @@ static void ulsch_interleave(uint8_t* g_bits, break; default: /* This line should never be reached */ - ERROR("Wrong Qm (%d)\n", Qm); + ERROR("Wrong Qm (%d)", Qm); } // Reset temp_buffer because will be reused next time @@ -1110,7 +1101,7 @@ int srslte_ulsch_decode(srslte_sch_t* q, // Prepare cbsegm srslte_cbsegm_t cb_segm; if (srslte_cbsegm(&cb_segm, (uint32_t)cfg->grant.tb.tbs)) { - ERROR("Error computing segmentation for TBS=%d\n", cfg->grant.tb.tbs); + ERROR("Error computing segmentation for TBS=%d", cfg->grant.tb.tbs); return SRSLTE_ERROR; } @@ -1121,7 +1112,7 @@ int srslte_ulsch_decode(srslte_sch_t* q, // Decode RI/HARQ values if ((ret = uci_decode_ri_ack(q, cfg, q_bits, c_seq, uci_data)) < 0) { - ERROR("Error decoding RI/HARQ bits\n"); + ERROR("Error decoding RI/HARQ bits"); return SRSLTE_ERROR; } @@ -1192,19 +1183,19 @@ int srslte_ulsch_encode(srslte_sch_t* q, uint32_t Qm = srslte_mod_bits_x_symbol(cfg->grant.tb.mod); if (Qm == 0) { - ERROR("Invalid input\n"); + ERROR("Invalid input"); return SRSLTE_ERROR_INVALID_INPUTS; } if (cfg->grant.nof_symb == 0) { - ERROR("Invalid input\n"); + ERROR("Invalid input"); return SRSLTE_ERROR_INVALID_INPUTS; } // Prepare cbsegm srslte_cbsegm_t cb_segm; if (srslte_cbsegm(&cb_segm, (uint32_t)cfg->grant.tb.tbs)) { - ERROR("Error computing segmentation for TBS=%d\n", cfg->grant.tb.tbs); + ERROR("Error computing segmentation for TBS=%d", cfg->grant.tb.tbs); return SRSLTE_ERROR; } @@ -1217,7 +1208,7 @@ int srslte_ulsch_encode(srslte_sch_t* q, if (cfg->uci_cfg.cqi.data_enable) { uci_cqi_len = (uint32_t)srslte_cqi_value_pack(&cfg->uci_cfg.cqi, &uci_data->cqi, cqi_buff); if (uci_cqi_len < 0) { - ERROR("Error encoding CQI bits\n"); + ERROR("Error encoding CQI bits"); return SRSLTE_ERROR; } } @@ -1315,11 +1306,11 @@ int srslte_ulsch_encode(srslte_sch_t* q, q_bits[p / 8] &= ~(1U << (7 - p % 8)); } } else { - ERROR("Invalid RI/ACK bit %d/%d, position %d. Max bits=%d, Qm=%d\n", i, nof_ri_ack_bits, p, nb_q, Qm); + ERROR("Invalid RI/ACK bit %d/%d, position %d. Max bits=%d, Qm=%d", i, nof_ri_ack_bits, p, nb_q, Qm); } } - INFO("Q_prime_ack=%d, Q_prime_cqi=%d, Q_prime_ri=%d\n", Q_prime_ack, Q_prime_cqi, Q_prime_ri); + INFO("Q_prime_ack=%d, Q_prime_cqi=%d, Q_prime_ri=%d", Q_prime_ack, Q_prime_cqi, Q_prime_ri); return nof_ri_ack_bits; } diff --git a/lib/src/phy/phch/sch_nr.c b/lib/src/phy/phch/sch_nr.c index 54b8f48b1..e07ee205e 100644 --- a/lib/src/phy/phch/sch_nr.c +++ b/lib/src/phy/phch/sch_nr.c @@ -81,18 +81,18 @@ int srslte_sch_nr_fill_cfg(srslte_sch_nr_t* q, srslte_cbsegm_t cbsegm = {}; if (bg == BG1) { if (srslte_cbsegm_ldpc_bg1(&cbsegm, tb->tbs) != SRSLTE_SUCCESS) { - ERROR("Error: calculating LDPC BG1 code block segmentation for tbs=%d\n", tb->tbs); + ERROR("Error: calculating LDPC BG1 code block segmentation for tbs=%d", tb->tbs); return SRSLTE_ERROR; } } else { if (srslte_cbsegm_ldpc_bg2(&cbsegm, tb->tbs) != SRSLTE_SUCCESS) { - ERROR("Error: calculating LDPC BG1 code block segmentation for tbs=%d\n", tb->tbs); + ERROR("Error: calculating LDPC BG1 code block segmentation for tbs=%d", tb->tbs); return SRSLTE_ERROR; } } if (cbsegm.Z > MAX_LIFTSIZE) { - ERROR("Error: lifting size Z=%d is out-of-range maximum is %d\n", cbsegm.Z, MAX_LIFTSIZE); + ERROR("Error: lifting size Z=%d is out-of-range maximum is %d", cbsegm.Z, MAX_LIFTSIZE); return SRSLTE_ERROR; } @@ -146,7 +146,7 @@ int srslte_sch_nr_fill_cfg(srslte_sch_nr_t* q, static inline uint32_t sch_nr_get_E(const srslte_sch_nr_common_cfg_t* cfg, uint32_t j) { if (cfg->Nl == 0 || cfg->Qm == 0 || cfg->Cp == 0) { - ERROR("Invalid Nl (%d), Qm (%d) or Cp (%d)\n", cfg->Nl, cfg->Qm, cfg->Cp); + ERROR("Invalid Nl (%d), Qm (%d) or Cp (%d)", cfg->Nl, cfg->Qm, cfg->Cp); return 0; } @@ -211,12 +211,12 @@ int srslte_sch_nr_init_tx(srslte_sch_nr_t* q, const srslte_sch_nr_args_t* args) q->encoder_bg1[ls] = calloc(1, sizeof(srslte_ldpc_encoder_t)); if (!q->encoder_bg1[ls]) { - ERROR("Error: calloc\n"); + ERROR("Error: calloc"); return SRSLTE_ERROR; } if (srslte_ldpc_encoder_init(q->encoder_bg1[ls], encoder_type, BG1, ls) < SRSLTE_SUCCESS) { - ERROR("Error: initialising BG1 LDPC encoder for ls=%d\n", ls); + ERROR("Error: initialising BG1 LDPC encoder for ls=%d", ls); return SRSLTE_ERROR; } @@ -226,13 +226,13 @@ int srslte_sch_nr_init_tx(srslte_sch_nr_t* q, const srslte_sch_nr_args_t* args) } if (srslte_ldpc_encoder_init(q->encoder_bg2[ls], encoder_type, BG2, ls) < SRSLTE_SUCCESS) { - ERROR("Error: initialising BG2 LDPC encoder for ls=%d\n", ls); + ERROR("Error: initialising BG2 LDPC encoder for ls=%d", ls); return SRSLTE_ERROR; } } if (srslte_ldpc_rm_tx_init(&q->tx_rm) < SRSLTE_SUCCESS) { - ERROR("Error: initialising Tx LDPC Rate matching\n"); + ERROR("Error: initialising Tx LDPC Rate matching"); return SRSLTE_ERROR; } @@ -282,29 +282,29 @@ int srslte_sch_nr_init_rx(srslte_sch_nr_t* q, const srslte_sch_nr_args_t* args) q->decoder_bg1[ls] = calloc(1, sizeof(srslte_ldpc_decoder_t)); if (!q->decoder_bg1[ls]) { - ERROR("Error: calloc\n"); + ERROR("Error: calloc"); return SRSLTE_ERROR; } if (srslte_ldpc_decoder_init(q->decoder_bg1[ls], decoder_type, BG1, ls, scaling_factor) < SRSLTE_SUCCESS) { - ERROR("Error: initialising BG1 LDPC decoder for ls=%d\n", ls); + ERROR("Error: initialising BG1 LDPC decoder for ls=%d", ls); return SRSLTE_ERROR; } q->decoder_bg2[ls] = calloc(1, sizeof(srslte_ldpc_decoder_t)); if (!q->decoder_bg2[ls]) { - ERROR("Error: calloc\n"); + ERROR("Error: calloc"); return SRSLTE_ERROR; } if (srslte_ldpc_decoder_init(q->decoder_bg2[ls], decoder_type, BG2, ls, scaling_factor) < SRSLTE_SUCCESS) { - ERROR("Error: initialising BG2 LDPC decoder for ls=%d\n", ls); + ERROR("Error: initialising BG2 LDPC decoder for ls=%d", ls); return SRSLTE_ERROR; } } if (srslte_ldpc_rm_rx_init_c(&q->rx_rm) < SRSLTE_SUCCESS) { - ERROR("Error: initialising Rx LDPC Rate matching\n"); + ERROR("Error: initialising Rx LDPC Rate matching"); return SRSLTE_ERROR; } @@ -368,7 +368,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, } if (!tb->softbuffer.tx) { - ERROR("Error: Missing Tx softbuffer\n"); + ERROR("Error: Missing Tx softbuffer"); return SRSLTE_ERROR; } @@ -382,19 +382,19 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, // Check encoder if (cfg.encoder == NULL) { - ERROR("Error: encoder for lifting size Z=%d not found (tbs=%d)\n", cfg.Z, tb->tbs); + ERROR("Error: encoder for lifting size Z=%d not found (tbs=%d)", cfg.Z, tb->tbs); return SRSLTE_ERROR; } // Check CRC for TB if (cfg.crc_tb == NULL) { - ERROR("Error: CRC for TB not found\n"); + ERROR("Error: CRC for TB not found"); return SRSLTE_ERROR; } // Soft-buffer number of code-block protection if (tb->softbuffer.tx->max_cb < cfg.C) { - ERROR("Soft-buffer does not have enough code-blocks (max_cb=%d) for a TBS=%d, C=%d.\n", + ERROR("Soft-buffer does not have enough code-blocks (max_cb=%d) for a TBS=%d, C=%d.", tb->softbuffer.tx->max_cb, tb->tbs, cfg.C); @@ -402,7 +402,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, } if (tb->softbuffer.tx->max_cb_size < (cfg.encoder->liftN - 2 * cfg.Z)) { - ERROR("Soft-buffer code-block maximum size insufficient (max_cb_size=%d) for a TBS=%d, requires %d.\n", + ERROR("Soft-buffer code-block maximum size insufficient (max_cb_size=%d) for a TBS=%d, requires %d.", tb->softbuffer.tx->max_cb_size, tb->tbs, (cfg.encoder->liftN - 2 * cfg.Z)); @@ -422,7 +422,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, // Select rate matching circular buffer uint8_t* rm_buffer = tb->softbuffer.tx->buffer_b[r]; if (rm_buffer == NULL) { - ERROR("Error: soft-buffer provided NULL buffer for cb_idx=%d\n", r); + ERROR("Error: soft-buffer provided NULL buffer for cb_idx=%d", r); return SRSLTE_ERROR; } @@ -440,7 +440,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, // Append TB CRC uint8_t* ptr = &q->temp_cb[cb_len]; srslte_bit_unpack(checksum_tb, &ptr, cfg.L_tb); - SCH_INFO_TX("CB %d: appending TB CRC=%06x\n", r, checksum_tb); + SCH_INFO_TX("CB %d: appending TB CRC=%06x", r, checksum_tb); } else { // Copy payload srslte_bit_unpack_vector(input_ptr, q->temp_cb, (int)cb_len); @@ -456,7 +456,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, // Attach code block CRC if required if (cfg.L_cb) { srslte_crc_attach(&q->crc_cb, q->temp_cb, (int)(cfg.Kp - cfg.L_cb)); - SCH_INFO_TX("CB %d: CRC=%06x\n", r, (uint32_t)srslte_crc_checksum_get(&q->crc_cb)); + SCH_INFO_TX("CB %d: CRC=%06x", r, (uint32_t)srslte_crc_checksum_get(&q->crc_cb)); } // Insert filler bits @@ -483,7 +483,7 @@ static inline int sch_nr_encode(srslte_sch_nr_t* q, j++; // LDPC Rate matching - SCH_INFO_TX("RM CB %d: E=%d; F=%d; BG=%d; Z=%d; RV=%d; Qm=%d; Nref=%d;\n", + SCH_INFO_TX("RM CB %d: E=%d; F=%d; BG=%d; Z=%d; RV=%d; Qm=%d; Nref=%d;", r, E, cfg.F, @@ -520,13 +520,13 @@ int sch_nr_decode(srslte_sch_nr_t* q, // Check decoder if (cfg.decoder == NULL) { - ERROR("Error: decoder for lifting size Z=%d not found\n", cfg.Z); + ERROR("Error: decoder for lifting size Z=%d not found", cfg.Z); return SRSLTE_ERROR; } // Check CRC for TB if (cfg.crc_tb == NULL) { - ERROR("Error: CRC for TB not found\n"); + ERROR("Error: CRC for TB not found"); return SRSLTE_ERROR; } @@ -544,7 +544,7 @@ int sch_nr_decode(srslte_sch_nr_t* q, bool decoded = tb->softbuffer.rx->cb_crc[r]; int8_t* rm_buffer = (int8_t*)tb->softbuffer.tx->buffer_b[r]; if (!rm_buffer) { - ERROR("Error: soft-buffer provided NULL buffer for cb_idx=%d\n", r); + ERROR("Error: soft-buffer provided NULL buffer for cb_idx=%d", r); return SRSLTE_ERROR; } @@ -553,7 +553,7 @@ int sch_nr_decode(srslte_sch_nr_t* q, if (decoded) { cb_ok++; } - SCH_INFO_RX("RM CB %d: Disabled, CRC %s ... Skipping\n", r, decoded ? "OK" : "KO"); + SCH_INFO_RX("RM CB %d: Disabled, CRC %s ... Skipping", r, decoded ? "OK" : "KO"); continue; } @@ -563,13 +563,13 @@ int sch_nr_decode(srslte_sch_nr_t* q, // Skip CB if it has a matched CRC if (decoded) { - SCH_INFO_RX("RM CB %d: CRC OK ... Skipping\n", r); + SCH_INFO_RX("RM CB %d: CRC OK ... Skipping", r); cb_ok++; continue; } // LDPC Rate matching - SCH_INFO_RX("RM CB %d: E=%d; F=%d; BG=%d; Z=%d; RV=%d; Qm=%d; Nref=%d;\n", + SCH_INFO_RX("RM CB %d: E=%d; F=%d; BG=%d; Z=%d; RV=%d; Qm=%d; Nref=%d;", r, E, cfg.F, @@ -591,7 +591,7 @@ int sch_nr_decode(srslte_sch_nr_t* q, uint32_t checksum2 = srslte_bit_pack(&ptr, cfg.L_cb); tb->softbuffer.rx->cb_crc[r] = (checksum1 == checksum2); - SCH_INFO_RX("CB %d/%d: CRC={%06x, %06x} ... %s\n", + SCH_INFO_RX("CB %d/%d: CRC={%06x, %06x} ... %s", r, cfg.C, checksum1, @@ -648,7 +648,7 @@ int sch_nr_decode(srslte_sch_nr_t* q, uint32_t checksum1 = srslte_crc_checksum_byte(cfg.crc_tb, data, tb->tbs); *crc_ok = (checksum1 == checksum2 && !all_zeros); - SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}\n", tb->tbs, checksum1, checksum2); + SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}", tb->tbs, checksum1, checksum2); if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_DEBUG && !handler_registered) { DEBUG("Decode: "); srslte_vec_fprint_byte(stdout, data, tb->tbs / 8); diff --git a/lib/src/phy/phch/sci.c b/lib/src/phy/phch/sci.c index 831f68773..0befc3082 100644 --- a/lib/src/phy/phch/sci.c +++ b/lib/src/phy/phch/sci.c @@ -167,7 +167,7 @@ void srslte_sci_info(const srslte_sci_t* q, char* str, uint32_t len) n = srslte_print_check(str, SRSLTE_SCI_MSG_MAX_LEN, n, - ", trp_idx=%i, t_adv=%i, n_sa_id=%i, freqhoppflg=%s\n", + ", trp_idx=%i, t_adv=%i, n_sa_id=%i, freqhoppflg=%s", q->trp_idx, q->timing_advance, q->N_sa_id, @@ -176,7 +176,7 @@ void srslte_sci_info(const srslte_sci_t* q, char* str, uint32_t len) n = srslte_print_check(str, SRSLTE_SCI_MSG_MAX_LEN, n, - ", priority=%i, res_rsrv=%i, t_gap=%i, rtx=%i, txformat=%d\n", + ", priority=%i, res_rsrv=%i, t_gap=%i, rtx=%i, txformat=%d", q->priority, q->resource_reserv, q->time_gap, diff --git a/lib/src/phy/phch/test/npbch_file_test.c b/lib/src/phy/phch/test/npbch_file_test.c index c210d167c..cb14be046 100644 --- a/lib/src/phy/phch/test/npbch_file_test.c +++ b/lib/src/phy/phch/test/npbch_file_test.c @@ -165,7 +165,7 @@ int base_init() return -1; } - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } @@ -216,7 +216,7 @@ int main(int argc, char** argv) if (nread == SFLEN) { // do IFFT and channel estimation only on subframes that are known to contain NRS if (sf_idx == 0 || sf_idx == 4) { - INFO("%d.%d: Estimating channel.\n", frame_cnt, sf_idx); + INFO("%d.%d: Estimating channel.", frame_cnt, sf_idx); srslte_ofdm_rx_sf(&fft); // srslte_ofdm_set_normalize(&fft, true); @@ -229,10 +229,10 @@ int main(int argc, char** argv) if (sf_idx == 0) { float noise_est = (do_chest) ? srslte_chest_dl_nbiot_get_noise_estimate(&chest) : 0.0; if (frame_cnt % 8 == 0) { - DEBUG("Reseting NPBCH decoder.\n"); + DEBUG("Reseting NPBCH decoder."); srslte_npbch_decode_reset(&npbch); } - INFO("%d.0: Calling NPBCH decoder (noise_est=%.2f)\n", frame_cnt, noise_est); + INFO("%d.0: Calling NPBCH decoder (noise_est=%.2f)", frame_cnt, noise_est); ret = srslte_npbch_decode_nf(&npbch, fft_buffer, ce, noise_est, bch_payload, &nof_tx_ports, NULL, nf); if (ret == SRSLTE_SUCCESS) { @@ -246,10 +246,10 @@ int main(int argc, char** argv) if (SRSLTE_VERBOSE_ISDEBUG()) { if (do_chest) { - DEBUG("SAVED FILE npbch_rx_chest_on.bin: NPBCH with chest\n"); + DEBUG("SAVED FILE npbch_rx_chest_on.bin: NPBCH with chest"); srslte_vec_save_file("npbch_rx_chest_on.bin", npbch.d, npbch.nof_symbols * sizeof(cf_t)); } else { - DEBUG("SAVED FILE npbch_rx_chest_off.bin: NPBCH without chest\n"); + DEBUG("SAVED FILE npbch_rx_chest_off.bin: NPBCH without chest"); srslte_vec_save_file("npbch_rx_chest_off.bin", npbch.d, npbch.nof_symbols * sizeof(cf_t)); } } diff --git a/lib/src/phy/phch/test/npdcch_file_test.c b/lib/src/phy/phch/test/npdcch_file_test.c index 4185819eb..1f1fddc7b 100644 --- a/lib/src/phy/phch/test/npdcch_file_test.c +++ b/lib/src/phy/phch/test/npdcch_file_test.c @@ -75,7 +75,7 @@ void parse_args(int argc, char** argv) case 'o': dci_format = srslte_dci_format_from_string(argv[optind]); if (dci_format == SRSLTE_DCI_NOF_FORMATS) { - ERROR("Error unsupported format %s\n", argv[optind]); + ERROR("Error unsupported format %s", argv[optind]); exit(-1); } break; @@ -177,7 +177,7 @@ int main(int argc, char** argv) // Run FFT and estimate channel srslte_ofdm_rx_sf(&fft); - INFO("%d.%d: Estimating channel.\n", frame_cnt, tti % 10); + INFO("%d.%d: Estimating channel.", frame_cnt, tti % 10); srslte_chest_dl_nbiot_estimate(&chest, fft_buffer, ce, tti % 10); // Extract LLR diff --git a/lib/src/phy/phch/test/npdcch_test.c b/lib/src/phy/phch/test/npdcch_test.c index c69c6cc60..eb78d0da0 100644 --- a/lib/src/phy/phch/test/npdcch_test.c +++ b/lib/src/phy/phch/test/npdcch_test.c @@ -60,7 +60,7 @@ void parse_args(int argc, char** argv) case 'o': dci_format = srslte_dci_format_from_string(argv[optind]); if (dci_format == SRSLTE_DCI_NOF_FORMATS) { - ERROR("Error unsupported format %s\n", argv[optind]); + ERROR("Error unsupported format %s", argv[optind]); exit(-1); } 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 64ccae756..39d4ada8a 100644 --- a/lib/src/phy/phch/test/npdsch_npdcch_file_test.c +++ b/lib/src/phy/phch/test/npdsch_npdcch_file_test.c @@ -159,7 +159,7 @@ int base_init() srslte_nbiot_ue_dl_set_rnti(&ue_dl, rnti); // srslte_mib_nb_printf(stdout, 0, &mib); - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } @@ -209,7 +209,7 @@ int main(int argc, char** argv) do { nread = srslte_filesource_read(&fsrc, buff_ptrs[0], flen); if (nread > 0) { - DEBUG("%d.%d: Reading %d samples.\n", sfn, sf_idx, nread); + DEBUG("%d.%d: Reading %d samples.", sfn, sf_idx, nread); // add some noise to the signal if (snr != -1.0) { @@ -224,7 +224,7 @@ int main(int argc, char** argv) // attempt to decode NPDSCH n = srslte_nbiot_ue_dl_decode_npdsch(&ue_dl, buff_ptrs[0], data, sfn, sf_idx, rnti); if (n == SRSLTE_SUCCESS) { - INFO("NPDSCH decoded ok.\n"); + INFO("NPDSCH decoded ok."); if (decode_sib1) { srslte_nbiot_ue_dl_decode_sib1(&ue_dl, sfn); @@ -238,7 +238,7 @@ int main(int argc, char** argv) srslte_dci_msg_t dci_msg; n = srslte_nbiot_ue_dl_decode_npdcch(&ue_dl, buff_ptrs[0], sfn, sf_idx, rnti, &dci_msg); if (n == SRSLTE_NBIOT_UE_DL_FOUND_DCI) { - INFO("Found %s DCI for RNTI=0x%x\n", srslte_dci_format_string(dci_msg.format), rnti); + INFO("Found %s DCI for RNTI=0x%x", srslte_dci_format_string(dci_msg.format), rnti); last_dci_format = dci_msg.format; if (dci_msg.format == SRSLTE_DCI_FORMATN0) { diff --git a/lib/src/phy/phch/test/npdsch_test.c b/lib/src/phy/phch/test/npdsch_test.c index 69daaf5c7..d1e4b31ff 100644 --- a/lib/src/phy/phch/test/npdsch_test.c +++ b/lib/src/phy/phch/test/npdsch_test.c @@ -120,17 +120,17 @@ int get_ref_res(srslte_nbiot_cell_t cell, int32_t* re_with_refs) // add all RE that contain NRS for (int p = 0; p < cell.nof_ports; p++) { - DEBUG("Adding NRS for port=%d n_id_ncell=%d\n", p, cell.n_id_ncell); + DEBUG("Adding NRS for port=%d n_id_ncell=%d", p, cell.n_id_ncell); uint32_t nof_syms = srslte_refsignal_dl_nbiot_nof_symbols(p); for (int l = 0; l < nof_syms; l++) { uint32_t nsymbol = srslte_refsignal_nrs_nsymbol(l); - DEBUG(" - adding NRS for symbol=%d\n", nsymbol); + DEBUG(" - adding NRS for symbol=%d", nsymbol); // two references per symbol for (int m = 0; m < SRSLTE_NBIOT_NUM_NRS_X_SYM_X_PORT; m++) { uint32_t fidx = srslte_refsignal_dl_nbiot_fidx(cell, l, p, m); uint32_t re_idx = SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx); - DEBUG(" - adding NRS at re_idx=%d with fidx=%d\n", re_idx, fidx); + DEBUG(" - adding NRS at re_idx=%d with fidx=%d", re_idx, fidx); re_with_refs[num_ref] = re_idx; num_ref++; } @@ -139,17 +139,17 @@ int get_ref_res(srslte_nbiot_cell_t cell, int32_t* re_with_refs) // add all RE that contain CRS for (int p = 0; p < cell.base.nof_ports; p++) { - DEBUG("Adding CRS for port=%d cell_id=%d\n", p, cell.base.id); + DEBUG("Adding CRS for port=%d cell_id=%d", p, cell.base.id); uint32_t nof_syms = srslte_refsignal_cs_nof_symbols(NULL, NULL, p); for (int l = 0; l < nof_syms; l++) { uint32_t nsymbol = srslte_refsignal_cs_nsymbol(l, cell.base.cp, p); - DEBUG(" - adding CRS for symbol=%d\n", nsymbol); + DEBUG(" - adding CRS for symbol=%d", nsymbol); // two references per symbol for (int m = 0; m < 2; m++) { uint32_t fidx = ((srslte_refsignal_cs_v(p, l) + (cell.base.id % 6)) % 6) + m * 6; uint32_t re_idx = SRSLTE_RE_IDX(cell.base.nof_prb, nsymbol, fidx); - DEBUG(" - adding CRS at re_idx=%d with fidx=%d\n", re_idx, fidx); + DEBUG(" - adding CRS at re_idx=%d with fidx=%d", re_idx, fidx); re_with_refs[num_ref] = re_idx; num_ref++; } @@ -254,8 +254,8 @@ int coding_test(int argc, char** argv) srslte_ra_nbiot_dl_grant_t grant; srslte_npdsch_cfg_t npdsch_cfg; srslte_npdsch_t npdsch; - uint8_t* data = NULL; - uint8_t* rx_data = NULL; + uint8_t* data = NULL; + uint8_t* rx_data = NULL; cf_t* ce[SRSLTE_MAX_PORTS] = {NULL}; cf_t* sf_symbols = NULL; cf_t* slot_symbols[SRSLTE_MAX_PORTS] = {NULL}; @@ -265,12 +265,12 @@ int coding_test(int argc, char** argv) // setup cell config for this test srslte_nbiot_cell_t cell = {}; - cell.base.nof_prb = 1; - cell.base.cp = SRSLTE_CP_NORM; - cell.base.nof_ports = 1; - cell.nof_ports = 1; - cell.mode = SRSLTE_NBIOT_MODE_STANDALONE; - cell.n_id_ncell = n_id_ncell; + cell.base.nof_prb = 1; + cell.base.cp = SRSLTE_CP_NORM; + cell.base.nof_ports = 1; + cell.nof_ports = 1; + cell.mode = SRSLTE_NBIOT_MODE_STANDALONE; + cell.n_id_ncell = n_id_ncell; if (!srslte_nbiot_cell_isvalid(&cell)) { printf("Cell is not properly configured\n"); @@ -397,7 +397,7 @@ int coding_test(int argc, char** argv) #endif if (SRSLTE_VERBOSE_ISDEBUG()) { - DEBUG("SAVED FILE npdsch_tx_sf.bin: transmitted subframe symbols\n"); + DEBUG("SAVED FILE npdsch_tx_sf.bin: transmitted subframe symbols"); srslte_vec_save_file("npdsch_tx_sf.bin", sf_symbols, SRSLTE_NBIOT_SFLEN * sizeof(cf_t)); } diff --git a/lib/src/phy/phch/test/pbch_file_test.c b/lib/src/phy/phch/test/pbch_file_test.c index c2a95776c..f83ebebed 100644 --- a/lib/src/phy/phch/test/pbch_file_test.c +++ b/lib/src/phy/phch/test/pbch_file_test.c @@ -92,9 +92,8 @@ void parse_args(int argc, char** argv) int base_init() { - if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -111,38 +110,38 @@ int base_init() } if (!srslte_cell_isvalid(&cell)) { - ERROR("Invalid cell properties\n"); + ERROR("Invalid cell properties"); return -1; } if (srslte_chest_dl_init(&chest, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_res_init(&chest_res, cell.nof_prb)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_set_cell(&chest, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_ofdm_rx_init(&fft, cell.cp, input_buffer, fft_buffer[0], cell.nof_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); return -1; } if (srslte_pbch_init(&pbch)) { - ERROR("Error initiating PBCH\n"); + ERROR("Error initiating PBCH"); return -1; } if (srslte_pbch_set_cell(&pbch, cell)) { - ERROR("Error initiating PBCH\n"); + ERROR("Error initiating PBCH"); return -1; } - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } @@ -176,7 +175,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (base_init()) { - ERROR("Error initializing receiver\n"); + ERROR("Error initializing receiver"); exit(-1); } @@ -196,7 +195,7 @@ int main(int argc, char** argv) /* Get channel estimates for each port */ srslte_chest_dl_estimate(&chest, &dl_sf, fft_buffer, &chest_res); - INFO("Decoding PBCH\n"); + INFO("Decoding PBCH"); srslte_pbch_decode_reset(&pbch); n = srslte_pbch_decode(&pbch, &chest_res, fft_buffer, bch_payload, &nof_tx_ports, &sfn_offset); @@ -204,12 +203,12 @@ int main(int argc, char** argv) if (n == 1) { nof_decoded_mibs++; } else if (n < 0) { - ERROR("Error decoding PBCH\n"); + ERROR("Error decoding PBCH"); exit(-1); } frame_cnt++; } else if (nread < 0) { - ERROR("Error reading from file\n"); + ERROR("Error reading from file"); exit(-1); } } while (nread > 0 && frame_cnt < nof_frames); diff --git a/lib/src/phy/phch/test/pbch_test.c b/lib/src/phy/phch/test/pbch_test.c index ea582e7a8..546ef3866 100644 --- a/lib/src/phy/phch/test/pbch_test.c +++ b/lib/src/phy/phch/test/pbch_test.c @@ -92,11 +92,11 @@ int main(int argc, char** argv) } } if (srslte_pbch_init(&pbch)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } if (srslte_pbch_set_cell(&pbch, cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } diff --git a/lib/src/phy/phch/test/pcfich_file_test.c b/lib/src/phy/phch/test/pcfich_file_test.c index b85ad9b59..f8e7ca0cb 100644 --- a/lib/src/phy/phch/test/pcfich_file_test.c +++ b/lib/src/phy/phch/test/pcfich_file_test.c @@ -98,7 +98,7 @@ int base_init() srslte_use_standard_symbol_size(use_standard_lte_rates); if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -127,44 +127,43 @@ int base_init() } if (srslte_chest_dl_init(&chest, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_res_init(&chest_res, cell.nof_prb)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_set_cell(&chest, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_ofdm_rx_init(&fft, cell.cp, input_buffer, fft_buffer[0], cell.nof_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); return -1; } if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating REGs\n"); + ERROR("Error initiating REGs"); return -1; } if (srslte_pcfich_init(&pcfich, 1)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); return -1; } if (srslte_pcfich_set_cell(&pcfich, ®s, cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); return -1; } - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } void base_free() { - srslte_filesource_free(&fsrc); if (fmatlab) { fclose(fmatlab); @@ -196,7 +195,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (base_init()) { - ERROR("Error initializing receiver\n"); + ERROR("Error initializing receiver"); exit(-1); } @@ -222,7 +221,7 @@ int main(int argc, char** argv) /* Get channel estimates for each port */ srslte_chest_dl_estimate(&chest, &dl_sf, fft_buffer, &chest_res); - INFO("Decoding PCFICH\n"); + INFO("Decoding PCFICH"); n = srslte_pcfich_decode(&pcfich, &dl_sf, &chest_res, fft_buffer, &cfi_corr); printf("cfi: %d, distance: %f\n", dl_sf.cfi, cfi_corr); @@ -235,7 +234,7 @@ int main(int argc, char** argv) base_free(); if (n < 0) { - ERROR("Error decoding PCFICH\n"); + ERROR("Error decoding PCFICH"); exit(-1); } else if (n == 0) { printf("Could not decode PCFICH\n"); diff --git a/lib/src/phy/phch/test/pcfich_test.c b/lib/src/phy/phch/test/pcfich_test.c index 88554fbb2..bbbfd55e2 100644 --- a/lib/src/phy/phch/test/pcfich_test.c +++ b/lib/src/phy/phch/test/pcfich_test.c @@ -108,16 +108,16 @@ int main(int argc, char** argv) printf("Testing CellID=%d...\n", cid); if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating regs\n"); + ERROR("Error initiating regs"); exit(-1); } if (srslte_pcfich_init(&pcfich, 1)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } if (srslte_pcfich_set_cell(&pcfich, ®s, cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } @@ -137,7 +137,7 @@ int main(int argc, char** argv) if (srslte_pcfich_decode(&pcfich, &dl_sf, &chest_res, slot_symbols, &corr_res) < 0) { exit(-1); } - INFO("cfi_tx: %d, cfi_rx: %d, ns: %d, distance: %f\n", cfi, dl_sf.cfi, nsf, corr_res); + INFO("cfi_tx: %d, cfi_rx: %d, ns: %d, distance: %f", cfi, dl_sf.cfi, nsf, corr_res); } } srslte_pcfich_free(&pcfich); diff --git a/lib/src/phy/phch/test/pdcch_file_test.c b/lib/src/phy/phch/test/pdcch_file_test.c index 75249a688..9a9bc072b 100644 --- a/lib/src/phy/phch/test/pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdcch_file_test.c @@ -88,7 +88,7 @@ void parse_args(int argc, char** argv) case 'o': dci_format = srslte_dci_format_from_string(argv[optind]); if (dci_format == SRSLTE_DCI_NOF_FORMATS) { - ERROR("Error unsupported format %s\n", argv[optind]); + ERROR("Error unsupported format %s", argv[optind]); exit(-1); } break; @@ -111,9 +111,8 @@ void parse_args(int argc, char** argv) int base_init() { - if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -132,44 +131,43 @@ int base_init() } if (srslte_chest_dl_init(&chest, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_res_init(&chest_res, cell.nof_prb)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_set_cell(&chest, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_ofdm_rx_init(&fft, cell.cp, input_buffer, fft_buffer[0], cell.nof_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); return -1; } if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating regs\n"); + ERROR("Error initiating regs"); return -1; } if (srslte_pdcch_init_ue(&pdcch, cell.nof_prb, 1)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); exit(-1); } if (srslte_pdcch_set_cell(&pdcch, ®s, cell)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); exit(-1); } - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } void base_free() { - srslte_filesource_free(&fsrc); free(input_buffer); @@ -202,7 +200,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (base_init()) { - ERROR("Error initializing memory\n"); + ERROR("Error initializing memory"); exit(-1); } @@ -211,7 +209,7 @@ int main(int argc, char** argv) do { srslte_filesource_read(&fsrc, input_buffer, flen); - INFO("Reading %d samples sub-frame %d\n", flen, frame_cnt); + INFO("Reading %d samples sub-frame %d", flen, frame_cnt); srslte_ofdm_rx_sf(&fft); @@ -224,14 +222,14 @@ int main(int argc, char** argv) srslte_chest_dl_estimate(&chest, &dl_sf, fft_buffer, &chest_res); if (srslte_pdcch_extract_llr(&pdcch, &dl_sf, &chest_res, fft_buffer)) { - ERROR("Error extracting LLRs\n"); + ERROR("Error extracting LLRs"); return -1; } if (rnti == SRSLTE_SIRNTI) { - INFO("Initializing common search space for SI-RNTI\n"); + INFO("Initializing common search space for SI-RNTI"); nof_locations = srslte_pdcch_common_locations(&pdcch, locations, SRSLTE_MAX_CANDIDATES, cfi); } else { - INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti); + INFO("Initializing user-specific search space for RNTI: 0x%x", rnti); nof_locations = srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations, SRSLTE_MAX_CANDIDATES, rnti); } @@ -244,17 +242,16 @@ int main(int argc, char** argv) dci_msg.location = locations[i]; dci_msg.format = dci_format; if (srslte_pdcch_decode_msg(&pdcch, &dl_sf, &dci_cfg, &dci_msg)) { - ERROR("Error decoding DCI msg\n"); + ERROR("Error decoding DCI msg"); return -1; } } if (dci_msg.rnti == rnti) { - srslte_dci_dl_t dci; bzero(&dci, sizeof(srslte_dci_dl_t)); if (srslte_dci_msg_unpack_pdsch(&cell, &dl_sf, &dci_cfg, &dci_msg, &dci)) { - ERROR("Can't unpack DCI message\n"); + ERROR("Can't unpack DCI message"); } else { if (dci.alloc_type == SRSLTE_RA_ALLOC_TYPE2 && dci.type2_alloc.mode == SRSLTE_RA_TYPE2_LOC && dci.type2_alloc.riv == 11 && dci.tb[0].rv == 0 && dci.pid == 0 && dci.tb[0].mcs_idx == 2) { diff --git a/lib/src/phy/phch/test/pdcch_nr_test.c b/lib/src/phy/phch/test/pdcch_nr_test.c index 3223fa3ad..5bf83c40f 100644 --- a/lib/src/phy/phch/test/pdcch_nr_test.c +++ b/lib/src/phy/phch/test/pdcch_nr_test.c @@ -116,19 +116,19 @@ int main(int argc, char** argv) srslte_dmrs_pdcch_ce_t* ce = SRSLTE_MEM_ALLOC(srslte_dmrs_pdcch_ce_t, 1); cf_t* buffer = srslte_vec_cf_malloc(grid_sz); if (rand_gen == NULL || ce == NULL || buffer == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } SRSLTE_MEM_ZERO(ce, srslte_dmrs_pdcch_ce_t, 1); if (srslte_pdcch_nr_init_tx(&pdcch_tx, &args) < SRSLTE_SUCCESS) { - ERROR("Error init\n"); + ERROR("Error init"); goto clean_exit; } if (srslte_pdcch_nr_init_rx(&pdcch_rx, &args) < SRSLTE_SUCCESS) { - ERROR("Error init\n"); + ERROR("Error init"); goto clean_exit; } @@ -142,17 +142,16 @@ int main(int argc, char** argv) } for (coreset.duration = SRSLTE_CORESET_DURATION_MIN; coreset.duration <= SRSLTE_CORESET_DURATION_MAX; coreset.duration++) { - srslte_search_space_t search_space = {}; search_space.type = srslte_search_space_type_ue; if (srslte_pdcch_nr_set_carrier(&pdcch_tx, &carrier, &coreset) < SRSLTE_SUCCESS) { - ERROR("Error setting carrier\n"); + ERROR("Error setting carrier"); goto clean_exit; } if (srslte_pdcch_nr_set_carrier(&pdcch_rx, &carrier, &coreset) < SRSLTE_SUCCESS) { - ERROR("Error setting carrier\n"); + ERROR("Error setting carrier"); goto clean_exit; } @@ -174,7 +173,7 @@ int main(int argc, char** argv) int n = srslte_pdcch_nr_locations_coreset( &coreset, &search_space, rnti, aggregation_level, slot_idx, dci_locations); if (n < SRSLTE_SUCCESS) { - ERROR("Error calculating locations in CORESET\n"); + ERROR("Error calculating locations in CORESET"); goto clean_exit; } @@ -184,7 +183,6 @@ int main(int argc, char** argv) } for (uint32_t ncce_idx = 0; ncce_idx < n; ncce_idx++) { - // Init MSG srslte_dci_msg_nr_t dci_msg = {}; dci_msg.format = srslte_dci_format_nr_1_0; @@ -206,7 +204,7 @@ int main(int argc, char** argv) ce->noise_var = 0.0f; if (test(&pdcch_tx, &pdcch_rx, buffer, ce, &dci_msg) < SRSLTE_SUCCESS) { - ERROR("test failed\n"); + ERROR("test failed"); goto clean_exit; } } diff --git a/lib/src/phy/phch/test/pdcch_test.c b/lib/src/phy/phch/test/pdcch_test.c index 7ab483b60..8561e80a6 100644 --- a/lib/src/phy/phch/test/pdcch_test.c +++ b/lib/src/phy/phch/test/pdcch_test.c @@ -110,7 +110,7 @@ int test_dci_payload_size() for (j = 0; j < 5; j++) { x[j] = srslte_dci_format_sizeof(&cell_test, &dl_sf, &dci_cfg, formats[j]); if (x[j] != dci_sz[i][j]) { - ERROR("Invalid DCI payload size for %s and %d PRB. Is %d and should be %d\n", + ERROR("Invalid DCI payload size for %s and %d PRB. Is %d and should be %d", srslte_dci_format_string(formats[j]), n, x[j], @@ -154,7 +154,6 @@ typedef struct { int main(int argc, char** argv) { - srslte_chest_dl_res_t chest_dl_res; srslte_pdcch_t pdcch_tx, pdcch_rx; testcase_dci_t testcases[10]; @@ -191,25 +190,25 @@ int main(int argc, char** argv) } if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating regs\n"); + ERROR("Error initiating regs"); exit(-1); } if (srslte_pdcch_init_enb(&pdcch_tx, cell.nof_prb)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); exit(-1); } if (srslte_pdcch_set_cell(&pdcch_tx, ®s, cell)) { - ERROR("Error setting cell in PDCCH object\n"); + ERROR("Error setting cell in PDCCH object"); exit(-1); } if (srslte_pdcch_init_ue(&pdcch_rx, cell.nof_prb, nof_rx_ant)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); exit(-1); } if (srslte_pdcch_set_cell(&pdcch_rx, ®s, cell)) { - ERROR("Error setting cell in PDCCH object\n"); + ERROR("Error setting cell in PDCCH object"); exit(-1); } @@ -302,14 +301,14 @@ int main(int argc, char** argv) } if (srslte_pdcch_encode(&pdcch_tx, &dl_sf, &testcases[i].dci_tx, slot_symbols)) { - ERROR("Error encoding DCI message\n"); + ERROR("Error encoding DCI message"); goto quit; } } /* Execute 'Rx' */ if (srslte_pdcch_extract_llr(&pdcch_rx, &dl_sf, &chest_dl_res, slot_symbols)) { - ERROR("Error extracting LLRs\n"); + ERROR("Error extracting LLRs"); goto quit; } @@ -318,11 +317,11 @@ int main(int argc, char** argv) testcases[i].dci_rx.format = testcases[i].dci_format; testcases[i].dci_rx.location = testcases[i].dci_location; if (srslte_pdcch_decode_msg(&pdcch_rx, &dl_sf, &dci_cfg, &testcases[i].dci_rx)) { - ERROR("Error decoding DCI message\n"); + ERROR("Error decoding DCI message"); goto quit; } if (srslte_dci_msg_unpack_pdsch(&cell, &dl_sf, &dci_cfg, &testcases[i].dci_rx, &testcases[i].ra_dl_rx)) { - ERROR("Error unpacking DCI message\n"); + ERROR("Error unpacking DCI message"); goto quit; } if (testcases[i].dci_rx.rnti >= 1234 && testcases[i].dci_rx.rnti < 1234 + nof_dcis) { diff --git a/lib/src/phy/phch/test/pdsch_nr_test.c b/lib/src/phy/phch/test/pdsch_nr_test.c index 8d8ab2bbf..6e26a2508 100644 --- a/lib/src/phy/phch/test/pdsch_nr_test.c +++ b/lib/src/phy/phch/test/pdsch_nr_test.c @@ -99,29 +99,29 @@ int main(int argc, char** argv) pdsch_args.measure_evm = true; if (srslte_pdsch_nr_init_enb(&pdsch_tx, &pdsch_args) < SRSLTE_SUCCESS) { - ERROR("Error initiating PDSCH for Tx\n"); + ERROR("Error initiating PDSCH for Tx"); goto clean_exit; } if (srslte_pdsch_nr_init_ue(&pdsch_rx, &pdsch_args) < SRSLTE_SUCCESS) { - ERROR("Error initiating SCH NR for Rx\n"); + ERROR("Error initiating SCH NR for Rx"); goto clean_exit; } if (srslte_pdsch_nr_set_carrier(&pdsch_tx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } if (srslte_pdsch_nr_set_carrier(&pdsch_rx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } for (uint32_t i = 0; i < carrier.max_mimo_layers; i++) { sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(carrier.nof_prb)); if (sf_symbols[i] == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } } @@ -130,7 +130,7 @@ int main(int argc, char** argv) data_tx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); data_rx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); if (data_tx[i] == NULL || data_rx[i] == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } @@ -142,25 +142,25 @@ int main(int argc, char** argv) if (srslte_softbuffer_tx_init_guru(&softbuffer_tx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } if (srslte_softbuffer_rx_init_guru(&softbuffer_rx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } // Use grant default A time resources with m=0 if (srslte_ra_dl_nr_time_default_A(0, pdsch_cfg.dmrs.typeA_pos, &pdsch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading default grant\n"); + ERROR("Error loading default grant"); goto clean_exit; } // Load number of DMRS CDM groups without data if (srslte_ra_dl_nr_nof_dmrs_cdm_groups_without_data_format_1_0(&pdsch_cfg.dmrs, &pdsch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading number of DMRS CDM groups without data\n"); + ERROR("Error loading number of DMRS CDM groups without data"); goto clean_exit; } @@ -183,19 +183,18 @@ int main(int argc, char** argv) } if (srslte_chest_dl_res_init(&chest, carrier.nof_prb) < SRSLTE_SUCCESS) { - ERROR("Initiating chest\n"); + ERROR("Initiating chest"); goto clean_exit; } for (n_prb = n_prb_start; n_prb < n_prb_end; n_prb++) { for (mcs = mcs_start; mcs < mcs_end; mcs++) { - for (uint32_t n = 0; n < SRSLTE_MAX_PRB_NR; n++) { pdsch_grant.prb_idx[n] = (n < n_prb); } if (srslte_ra_nr_fill_tb(&pdsch_cfg, &pdsch_grant, mcs, &pdsch_grant.tb[0]) < SRSLTE_SUCCESS) { - ERROR("Error filing tb\n"); + ERROR("Error filing tb"); goto clean_exit; } @@ -212,7 +211,7 @@ int main(int argc, char** argv) } if (srslte_pdsch_nr_encode(&pdsch_tx, &pdsch_cfg, &pdsch_grant, data_tx, sf_symbols) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } @@ -227,12 +226,12 @@ int main(int argc, char** argv) chest.nof_re = pdsch_grant.tb->nof_re; if (srslte_pdsch_nr_decode(&pdsch_rx, &pdsch_cfg, &pdsch_grant, &chest, sf_symbols, pdsch_res) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } if (pdsch_res->evm > 0.001f) { - ERROR("Error PDSCH EVM is too high %f\n", pdsch_res->evm); + ERROR("Error PDSCH EVM is too high %f", pdsch_res->evm); goto clean_exit; } @@ -247,7 +246,7 @@ int main(int argc, char** argv) mse = mse / (nof_re * pdsch_grant.nof_layers); } if (mse > 0.001) { - ERROR("MSE error (%f) is too high\n", mse); + ERROR("MSE error (%f) is too high", mse); for (uint32_t i = 0; i < pdsch_grant.nof_layers; i++) { printf("d_tx[%d]=", i); srslte_vec_fprint_c(stdout, pdsch_tx.d[i], nof_re); @@ -258,12 +257,12 @@ int main(int argc, char** argv) } if (!pdsch_res[0].crc) { - ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pdsch_grant.tb[0].tbs); + ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pdsch_grant.tb[0].tbs); goto clean_exit; } if (memcmp(data_tx[0], data_rx[0], pdsch_grant.tb[0].tbs / 8) != 0) { - ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pdsch_grant.tb[0].tbs); + ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pdsch_grant.tb[0].tbs); printf("Tx data: "); srslte_vec_fprint_byte(stdout, data_tx[0], pdsch_grant.tb[0].tbs / 8); printf("Rx data: "); 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 df2a5cb70..5f0ac7e4b 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -91,7 +91,7 @@ void parse_args(int argc, char** argv) case 'o': dci_format = srslte_dci_format_from_string(argv[optind]); if (dci_format == SRSLTE_DCI_NOF_FORMATS) { - ERROR("Error unsupported format %s\n", argv[optind]); + ERROR("Error unsupported format %s", argv[optind]); exit(-1); } break; @@ -114,9 +114,8 @@ void parse_args(int argc, char** argv) int base_init() { - if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -129,17 +128,17 @@ int base_init() } if (srslte_ue_dl_init(&ue_dl, input_buffer, cell.nof_prb, 1)) { - ERROR("Error initializing UE DL\n"); + ERROR("Error initializing UE DL"); return -1; } if (srslte_ue_dl_set_cell(&ue_dl, cell)) { - ERROR("Error initializing UE DL\n"); + ERROR("Error initializing UE DL"); return -1; } srslte_ue_dl_set_rnti(&ue_dl, rnti); - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } @@ -164,7 +163,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (base_init()) { - ERROR("Error initializing memory\n"); + ERROR("Error initializing memory"); exit(-1); } @@ -192,7 +191,7 @@ int main(int argc, char** argv) nof_frames = 0; do { srslte_filesource_read(&fsrc, input_buffer[0], flen); - INFO("Reading %d samples sub-frame %d\n", flen, sf_idx); + INFO("Reading %d samples sub-frame %d", flen, sf_idx); dl_sf.tti = sf_idx; ret = srslte_ue_dl_find_and_decode(&ue_dl, &dl_sf, &ue_dl_cfg, &pdsch_cfg, data, acks); diff --git a/lib/src/phy/phch/test/pdsch_test.c b/lib/src/phy/phch/test/pdsch_test.c index d593cb7a7..5a66b55ab 100644 --- a/lib/src/phy/phch/test/pdsch_test.c +++ b/lib/src/phy/phch/test/pdsch_test.c @@ -149,7 +149,6 @@ static int check_softbits(srslte_pdsch_t* pdsch_enb, int ret = SRSLTE_SUCCESS; if (!pdsch_ue->llr_is_8bit && !tb_cw_swap) { - // Generate sequence srslte_sequence_pdsch(&pdsch_ue->tmp_seq, rnti, @@ -271,7 +270,7 @@ int main(int argc, char** argv) /* Generate dci from DCI */ if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, tm, enable_256qam, &dci, &pdsch_cfg.grant)) { - ERROR("Error computing resource allocation\n"); + ERROR("Error computing resource allocation"); return ret; } @@ -318,11 +317,11 @@ int main(int argc, char** argv) } if (srslte_pdsch_init_ue(&pdsch_rx, cell.nof_prb, nof_rx_antennas)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto quit; } if (srslte_pdsch_set_cell(&pdsch_rx, cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto quit; } @@ -334,12 +333,12 @@ int main(int argc, char** argv) for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { softbuffers_rx[i] = calloc(sizeof(srslte_softbuffer_rx_t), 1); if (!softbuffers_rx[i]) { - ERROR("Error allocating RX soft buffer\n"); + ERROR("Error allocating RX soft buffer"); goto quit; } if (srslte_softbuffer_rx_init(softbuffers_rx[i], cell.nof_prb)) { - ERROR("Error initiating RX soft buffer\n"); + ERROR("Error initiating RX soft buffer"); goto quit; } @@ -349,12 +348,12 @@ int main(int argc, char** argv) if (input_file) { srslte_filesource_t fsrc; if (srslte_filesource_init(&fsrc, input_file, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file); + ERROR("Error opening file %s", input_file); goto quit; } if (srslte_chest_dl_init(&chest, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); exit(-1); } if (srslte_chest_dl_set_cell(&chest, cell)) { @@ -367,13 +366,12 @@ int main(int argc, char** argv) srslte_filesource_free(&fsrc); } else { - if (srslte_pdsch_init_enb(&pdsch_tx, cell.nof_prb)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto quit; } if (srslte_pdsch_set_cell(&pdsch_tx, cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto quit; } @@ -382,11 +380,11 @@ int main(int argc, char** argv) for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { softbuffers_tx[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1); if (!softbuffers_tx[i]) { - ERROR("Error allocating TX soft buffer\n"); + ERROR("Error allocating TX soft buffer"); } if (srslte_softbuffer_tx_init(softbuffers_tx[i], cell.nof_prb)) { - ERROR("Error initiating TX soft buffer\n"); + ERROR("Error initiating TX soft buffer"); goto quit; } } @@ -412,7 +410,7 @@ int main(int argc, char** argv) } /* Do 1st transmission for rv_idx!=0 */ if (srslte_pdsch_encode(&pdsch_tx, &dl_sf, &pdsch_cfg, data_tx, tx_slot_symbols)) { - ERROR("Error encoding PDSCH\n"); + ERROR("Error encoding PDSCH"); goto quit; } } @@ -444,25 +442,25 @@ int main(int argc, char** argv) } } - INFO(" Global:\n"); - INFO(" nof_prb=%d\n", cell.nof_prb); - INFO(" nof_ports=%d\n", cell.nof_ports); - INFO(" id=%d\n", cell.id); - INFO(" cp=%s\n", srslte_cp_string(cell.cp)); - INFO(" phich_length=%d\n", (int)cell.phich_length); - INFO(" phich_resources=%d\n", (int)cell.phich_resources); - INFO(" nof_prb=%d\n", pdsch_cfg.grant.nof_prb); - INFO(" sf_idx=%d\n", dl_sf.tti); - INFO(" nof_tb=%d\n", pdsch_cfg.grant.nof_tb); + INFO(" Global:"); + INFO(" nof_prb=%d", cell.nof_prb); + INFO(" nof_ports=%d", cell.nof_ports); + INFO(" id=%d", cell.id); + INFO(" cp=%s", srslte_cp_string(cell.cp)); + INFO(" phich_length=%d", (int)cell.phich_length); + INFO(" phich_resources=%d", (int)cell.phich_resources); + INFO(" nof_prb=%d", pdsch_cfg.grant.nof_prb); + INFO(" sf_idx=%d", dl_sf.tti); + INFO(" nof_tb=%d", pdsch_cfg.grant.nof_tb); for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { - INFO(" Tranport block index %d:\n", i); - INFO(" enabled=%d\n", pdsch_cfg.grant.tb[i].enabled); - INFO(" mcs.idx=%d\n", pdsch_cfg.grant.tb[i].mcs_idx); - INFO(" mcs.tbs=%d\n", pdsch_cfg.grant.tb[i].tbs); - INFO(" mcs.mod=%s\n", srslte_mod_string(pdsch_cfg.grant.tb[i].mod)); - INFO(" rv=%d\n", pdsch_cfg.grant.tb[i].rv); - INFO(" nof_bits=%d\n", pdsch_cfg.grant.tb[i].nof_bits); - INFO(" nof_re=%d\n", pdsch_cfg.grant.nof_re); + INFO(" Tranport block index %d:", i); + INFO(" enabled=%d", pdsch_cfg.grant.tb[i].enabled); + INFO(" mcs.idx=%d", pdsch_cfg.grant.tb[i].mcs_idx); + INFO(" mcs.tbs=%d", pdsch_cfg.grant.tb[i].tbs); + INFO(" mcs.mod=%s", srslte_mod_string(pdsch_cfg.grant.tb[i].mod)); + INFO(" rv=%d", pdsch_cfg.grant.tb[i].rv); + INFO(" nof_bits=%d", pdsch_cfg.grant.tb[i].nof_bits); + INFO(" nof_re=%d", pdsch_cfg.grant.nof_re); } int r = 0; diff --git a/lib/src/phy/phch/test/phich_file_test.c b/lib/src/phy/phch/test/phich_file_test.c index dd4205afe..d31c5f9db 100644 --- a/lib/src/phy/phch/test/phich_file_test.c +++ b/lib/src/phy/phch/test/phich_file_test.c @@ -87,7 +87,7 @@ void parse_args(int argc, char** argv) } else if (!strcmp(argv[optind], "2")) { cell.phich_resources = SRSLTE_PHICH_R_2; } else { - ERROR("Invalid phich ng factor %s. Setting to default.\n", argv[optind]); + ERROR("Invalid phich ng factor %s. Setting to default.", argv[optind]); } break; case 'e': @@ -118,9 +118,8 @@ void parse_args(int argc, char** argv) int base_init() { - if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -149,44 +148,43 @@ int base_init() } if (srslte_chest_dl_init(&chest, cell.nof_prb, 1)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_res_init(&chest_res, cell.nof_prb)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_chest_dl_set_cell(&chest, cell)) { - ERROR("Error initializing equalizer\n"); + ERROR("Error initializing equalizer"); return -1; } if (srslte_ofdm_rx_init(&fft, cell.cp, input_buffer, fft_buffer[0], cell.nof_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); return -1; } if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating regs\n"); + ERROR("Error initiating regs"); return -1; } if (srslte_phich_init(&phich, 1)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); return -1; } if (srslte_phich_set_cell(&phich, ®s, cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); return -1; } - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } void base_free() { - srslte_filesource_free(&fsrc); if (fmatlab) { fclose(fmatlab); @@ -220,7 +218,7 @@ int main(int argc, char** argv) max_nseq = SRSLTE_CP_ISNORM(cell.cp) ? SRSLTE_PHICH_NORM_NSEQUENCES : SRSLTE_PHICH_EXT_NSEQUENCES; if (base_init()) { - ERROR("Error initializing memory\n"); + ERROR("Error initializing memory"); exit(-1); } @@ -245,12 +243,11 @@ int main(int argc, char** argv) /* Get channel estimates for each port */ srslte_chest_dl_estimate(&chest, &dl_sf, fft_buffer, &chest_res); - INFO("Decoding PHICH\n"); + INFO("Decoding PHICH"); /* Receive all PHICH groups and sequence numbers */ for (ngroup = 0; ngroup < srslte_phich_ngroups(&phich); ngroup++) { for (nseq = 0; nseq < max_nseq; nseq++) { - srslte_phich_resource_t resource; resource.ngroup = ngroup; resource.nseq = nseq; @@ -262,14 +259,14 @@ int main(int argc, char** argv) exit(-1); } - INFO("%d/%d, ack_rx: %d, ns: %d, distance: %f\n", ngroup, nseq, res.ack_value, numsubframe, res.distance); + INFO("%d/%d, ack_rx: %d, ns: %d, distance: %f", ngroup, nseq, res.ack_value, numsubframe, res.distance); } } base_free(); if (n < 0) { - ERROR("Error decoding phich\n"); + ERROR("Error decoding phich"); exit(-1); } else if (n == 0) { printf("Could not decode phich\n"); diff --git a/lib/src/phy/phch/test/phich_test.c b/lib/src/phy/phch/test/phich_test.c index 5d844ce85..46a9dc47a 100644 --- a/lib/src/phy/phch/test/phich_test.c +++ b/lib/src/phy/phch/test/phich_test.c @@ -68,7 +68,7 @@ void parse_args(int argc, char** argv) } else if (!strcmp(argv[optind], "2")) { phich_res = SRSLTE_PHICH_R_2; } else { - ERROR("Invalid phich ng factor %s. Setting to default.\n", argv[optind]); + ERROR("Invalid phich ng factor %s. Setting to default.", argv[optind]); } break; case 'e': @@ -127,7 +127,7 @@ int main(int argc, char** argv) max_cid = cell.id; } if (srslte_phich_init(&phich, 1)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } while (cid <= max_cid) { @@ -136,12 +136,12 @@ int main(int argc, char** argv) printf("Testing CellID=%d...\n", cid); if (srslte_regs_init(®s, cell)) { - ERROR("Error initiating regs\n"); + ERROR("Error initiating regs"); exit(-1); } if (srslte_phich_set_cell(&phich, ®s, cell)) { - ERROR("Error creating PBCH object\n"); + ERROR("Error creating PBCH object"); exit(-1); } @@ -149,7 +149,6 @@ int main(int argc, char** argv) ZERO_OBJECT(dl_sf); for (nsf = 0; nsf < 10; nsf++) { - dl_sf.tti = nsf; srslte_phich_reset(&phich, slot_symbols); @@ -159,7 +158,6 @@ int main(int argc, char** argv) /* Transmit all PHICH groups and sequence numbers */ for (ngroup = 0; ngroup < srslte_phich_ngroups(&phich); ngroup++) { for (nseq = 0; nseq < max_nseq; nseq++) { - resource.ngroup = ngroup; resource.nseq = nseq; @@ -178,7 +176,6 @@ int main(int argc, char** argv) /* Receive all PHICH groups and sequence numbers */ for (ngroup = 0; ngroup < srslte_phich_ngroups(&phich); ngroup++) { for (nseq = 0; nseq < max_nseq; nseq++) { - resource.ngroup = ngroup; resource.nseq = nseq; @@ -188,7 +185,7 @@ int main(int argc, char** argv) printf("Error decoding ACK\n"); exit(-1); } - INFO("%d/%d, ack_tx: %d, ack_rx: %d, ns: %d, distance: %f\n", + INFO("%d/%d, ack_tx: %d, ack_rx: %d, ns: %d, distance: %f", ngroup, nseq, ack[ngroup][nseq], diff --git a/lib/src/phy/phch/test/pmch_file_test.c b/lib/src/phy/phch/test/pmch_file_test.c index 30574e3a9..028ebff58 100644 --- a/lib/src/phy/phch/test/pmch_file_test.c +++ b/lib/src/phy/phch/test/pmch_file_test.c @@ -104,9 +104,8 @@ void parse_args(int argc, char** argv) int base_init() { - if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } @@ -119,12 +118,12 @@ int base_init() } if (srslte_ue_dl_init(&ue_dl, input_buffer, cell.nof_prb, 1)) { - ERROR("Error initializing UE DL\n"); + ERROR("Error initializing UE DL"); return -1; } if (srslte_ue_dl_set_cell(&ue_dl, cell)) { - ERROR("Error initializing UE DL\n"); + ERROR("Error initializing UE DL"); return -1; } @@ -134,7 +133,7 @@ int base_init() srslte_softbuffer_rx_init(&softbuffer_rx, cell.nof_prb); srslte_softbuffer_rx_reset(&softbuffer_rx); - DEBUG("Memory init OK\n"); + DEBUG("Memory init OK"); return 0; } @@ -157,7 +156,7 @@ int main(int argc, char** argv) parse_args(argc, argv); srslte_use_standard_symbol_size(false); if (base_init()) { - ERROR("Error initializing memory\n"); + ERROR("Error initializing memory"); exit(-1); } @@ -170,7 +169,7 @@ int main(int argc, char** argv) ret = -1; srslte_filesource_read(&fsrc, input_buffer[0], flen); - INFO("Reading %d samples sub-frame %d\n", flen, sf_idx); + INFO("Reading %d samples sub-frame %d", flen, sf_idx); srslte_dl_sf_cfg_t dl_sf; ZERO_OBJECT(dl_sf); @@ -184,10 +183,10 @@ int main(int argc, char** argv) ue_dl_cfg.chest_cfg.mbsfn_area_id = mbsfn_area_id; // Special configuration for MBSFN channel estimation - ue_dl_cfg.chest_cfg.filter_type = SRSLTE_CHEST_FILTER_TRIANGLE; - ue_dl_cfg.chest_cfg.filter_coef[0] = 0.1; - ue_dl_cfg.chest_cfg.estimator_alg = SRSLTE_ESTIMATOR_ALG_INTERPOLATE; - ue_dl_cfg.chest_cfg.noise_alg = SRSLTE_NOISE_ALG_PSS; + ue_dl_cfg.chest_cfg.filter_type = SRSLTE_CHEST_FILTER_TRIANGLE; + ue_dl_cfg.chest_cfg.filter_coef[0] = 0.1; + ue_dl_cfg.chest_cfg.estimator_alg = SRSLTE_ESTIMATOR_ALG_INTERPOLATE; + ue_dl_cfg.chest_cfg.noise_alg = SRSLTE_NOISE_ALG_PSS; if ((ret = srslte_ue_dl_decode_fft_estimate(&ue_dl, &dl_sf, &ue_dl_cfg)) < 0) { return ret; diff --git a/lib/src/phy/phch/test/pmch_test.c b/lib/src/phy/phch/test/pmch_test.c index 02bd7fb20..d7c80c48d 100644 --- a/lib/src/phy/phch/test/pmch_test.c +++ b/lib/src/phy/phch/test/pmch_test.c @@ -160,11 +160,11 @@ int main(int argc, char** argv) for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { softbuffers_tx[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1); if (!softbuffers_tx[i]) { - ERROR("Error allocating TX soft buffer\n"); + ERROR("Error allocating TX soft buffer"); } if (srslte_softbuffer_tx_init(softbuffers_tx[i], cell.nof_prb)) { - ERROR("Error initiating TX soft buffer\n"); + ERROR("Error initiating TX soft buffer"); goto quit; } } @@ -180,12 +180,12 @@ int main(int argc, char** argv) for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { softbuffers_rx[i] = calloc(sizeof(srslte_softbuffer_rx_t), 1); if (!softbuffers_rx[i]) { - ERROR("Error allocating RX soft buffer\n"); + ERROR("Error allocating RX soft buffer"); goto quit; } if (srslte_softbuffer_rx_init(softbuffers_rx[i], cell.nof_prb)) { - ERROR("Error initiating RX soft buffer\n"); + ERROR("Error initiating RX soft buffer"); goto quit; } } @@ -196,7 +196,7 @@ int main(int argc, char** argv) tx_sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(cell.nof_prb)); srslte_vec_cf_zero(tx_sf_symbols[i], SRSLTE_SF_LEN_PRB(cell.nof_prb)); if (srslte_ofdm_tx_init_mbsfn(&ifft_mbsfn[i], SRSLTE_CP_EXT, tx_slot_symbols[i], tx_sf_symbols[i], cell.nof_prb)) { - ERROR("Error creating iFFT object\n"); + ERROR("Error creating iFFT object"); exit(-1); } @@ -208,7 +208,7 @@ int main(int argc, char** argv) rx_sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(cell.nof_prb)); srslte_vec_cf_zero(rx_sf_symbols[i], SRSLTE_SF_LEN_PRB(cell.nof_prb)); if (srslte_ofdm_rx_init_mbsfn(&fft_mbsfn[i], SRSLTE_CP_EXT, rx_sf_symbols[i], rx_slot_symbols[i], cell.nof_prb)) { - ERROR("Error creating iFFT object\n"); + ERROR("Error creating iFFT object"); exit(-1); } @@ -259,26 +259,26 @@ int main(int argc, char** argv) } } - INFO(" Global:\n"); - INFO(" nof_prb=%d\n", cell.nof_prb); - INFO(" nof_ports=%d\n", cell.nof_ports); - INFO(" id=%d\n", cell.id); - INFO(" cp=%s\n", srslte_cp_string(cell.cp)); - INFO(" phich_length=%d\n", (int)cell.phich_length); - INFO(" phich_resources=%d\n", (int)cell.phich_resources); - INFO(" nof_prb=%d\n", pmch_cfg.pdsch_cfg.grant.nof_prb); - INFO(" sf_idx=%d\n", subframe); - INFO(" nof_tb=%d\n", pmch_cfg.pdsch_cfg.grant.nof_tb); - - INFO(" mcs.idx=0x%X\n", pmch_cfg.pdsch_cfg.grant.tb[0].mcs_idx); - INFO(" mcs.tbs=%d\n", pmch_cfg.pdsch_cfg.grant.tb[0].tbs); - INFO(" mcs.mod=%s\n", srslte_mod_string(pmch_cfg.pdsch_cfg.grant.tb[0].mod)); - INFO(" rv=%d\n", pmch_cfg.pdsch_cfg.grant.tb[0].rv); - INFO(" nof_bits=%d\n", pmch_cfg.pdsch_cfg.grant.tb[0].nof_bits); - INFO(" nof_re=%d\n", pmch_cfg.pdsch_cfg.grant.nof_re); + INFO(" Global:"); + INFO(" nof_prb=%d", cell.nof_prb); + INFO(" nof_ports=%d", cell.nof_ports); + INFO(" id=%d", cell.id); + INFO(" cp=%s", srslte_cp_string(cell.cp)); + INFO(" phich_length=%d", (int)cell.phich_length); + INFO(" phich_resources=%d", (int)cell.phich_resources); + INFO(" nof_prb=%d", pmch_cfg.pdsch_cfg.grant.nof_prb); + INFO(" sf_idx=%d", subframe); + INFO(" nof_tb=%d", pmch_cfg.pdsch_cfg.grant.nof_tb); + + INFO(" mcs.idx=0x%X", pmch_cfg.pdsch_cfg.grant.tb[0].mcs_idx); + INFO(" mcs.tbs=%d", pmch_cfg.pdsch_cfg.grant.tb[0].tbs); + INFO(" mcs.mod=%s", srslte_mod_string(pmch_cfg.pdsch_cfg.grant.tb[0].mod)); + INFO(" rv=%d", pmch_cfg.pdsch_cfg.grant.tb[0].rv); + INFO(" nof_bits=%d", pmch_cfg.pdsch_cfg.grant.tb[0].nof_bits); + INFO(" nof_re=%d", pmch_cfg.pdsch_cfg.grant.nof_re); if (srslte_pmch_init(&pmch, cell.nof_prb, 1)) { - ERROR("Error creating PMCH object\n"); + ERROR("Error creating PMCH object"); } srslte_pmch_set_area_id(&pmch, mbsfn_area_id); @@ -291,7 +291,7 @@ int main(int argc, char** argv) } if (srslte_pmch_encode(&pmch, &dl_sf, &pmch_cfg, data_tx[0], tx_slot_symbols)) { - ERROR("Error encoding PDSCH\n"); + ERROR("Error encoding PDSCH"); exit(-1); } gettimeofday(&t[2], NULL); @@ -429,6 +429,5 @@ quit: printf("Ok\n"); } - exit(ret); } diff --git a/lib/src/phy/phch/test/prach_test.c b/lib/src/phy/phch/test/prach_test.c index 90fdee8ce..707648215 100644 --- a/lib/src/phy/phch/test/prach_test.c +++ b/lib/src/phy/phch/test/prach_test.c @@ -84,7 +84,7 @@ int main(int argc, char** argv) return -1; } if (srslte_prach_set_cfg(&prach, &prach_cfg, nof_prb)) { - ERROR("Error initiating PRACH object\n"); + ERROR("Error initiating PRACH object"); return -1; } diff --git a/lib/src/phy/phch/test/prach_test_multi.c b/lib/src/phy/phch/test/prach_test_multi.c index 8988bc4aa..f882d3318 100644 --- a/lib/src/phy/phch/test/prach_test_multi.c +++ b/lib/src/phy/phch/test/prach_test_multi.c @@ -18,16 +18,16 @@ #include #include -#include -#include "srslte/srslte.h" -#include #include "srslte/phy/phch/prach.h" #include "srslte/phy/utils/debug.h" +#include "srslte/srslte.h" +#include +#include char* input_file_name = NULL; #define PRACH_SRATE 1048750 #define MAX_LEN 70176 -int offset = -1; +int offset = -1; uint32_t nof_prb = 6; uint32_t preamble_format = 0; uint32_t root_seq_idx = 0; @@ -40,7 +40,7 @@ bool test_successive_cancellation = false; bool test_offset_calculation = false; bool stagger_prach_power_and_phase = false; // this will work best with one or two simultaenous prach -srslte_filesource_t fsrc; +srslte_filesource_t fsrc; void usage(char* prog) { @@ -80,7 +80,7 @@ void parse_args(int argc, char** argv) input_file_name = argv[optind]; break; case 'o': - offset = (uint32_t)strtol(argv[optind], NULL, 10); + offset = (uint32_t)strtol(argv[optind], NULL, 10); break; case 's': test_successive_cancellation = true; @@ -101,8 +101,13 @@ void parse_args(int argc, char** argv) } } // this function staggers power and phase of the different PRACH signals for more realisitc testing -void stagger_prach_powers(srslte_prach_t *prach, cf_t *preamble, cf_t* preamble_sum, int freq_offset, int n_seqs, int *offsets) { - +void stagger_prach_powers(srslte_prach_t* prach, + cf_t* preamble, + cf_t* preamble_sum, + int freq_offset, + int n_seqs, + int* offsets) +{ for (int seq_index = 0; seq_index < n_seqs; seq_index++) { srslte_prach_gen(prach, seq_index, freq_offset, preamble); if (seq_index == 0) { @@ -148,12 +153,12 @@ int main(int argc, char** argv) memset(preamble_sum, 0, sizeof(cf_t) * MAX_LEN); int offsets[64]; memset(offsets, 0, sizeof(int) * 64); - float t_offsets[64]; + float t_offsets[64]; srslte_prach_cfg_t prach_cfg; ZERO_OBJECT(prach_cfg); - if(input_file_name) { + if (input_file_name) { if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } } @@ -166,14 +171,14 @@ int main(int argc, char** argv) prach_cfg.enable_successive_cancellation = test_successive_cancellation; prach_cfg.enable_freq_domain_offset_calc = freq_domain_offset_calc; - int srate = srslte_sampling_freq_hz(nof_prb); - int divisor = srate / PRACH_SRATE; + int srate = srslte_sampling_freq_hz(nof_prb); + int divisor = srate / PRACH_SRATE; if (test_offset_calculation || test_successive_cancellation || stagger_prach_power_and_phase) { if (n_seqs > 6) { n_seqs = 6; } - prach_cfg.zero_corr_zone = 0; - prach_cfg.num_ra_preambles = 8; + prach_cfg.zero_corr_zone = 0; + prach_cfg.num_ra_preambles = 8; printf("limiting number of preambles to 6\n"); if (test_offset_calculation) { for (int i = 0; i < 6; i++) { @@ -187,11 +192,11 @@ int main(int argc, char** argv) } if (srslte_prach_set_cfg(&prach, &prach_cfg, nof_prb)) { - ERROR("Error initiating PRACH object\n"); + ERROR("Error initiating PRACH object"); return -1; } - uint32_t seq_index = 0; + uint32_t seq_index = 0; uint32_t indices[64]; uint32_t n_indices = 0; @@ -212,7 +217,7 @@ int main(int argc, char** argv) } if (input_file_name) { - srslte_filesource_read(&fsrc, &preamble_sum[prach.N_cp], prach.N_seq); + srslte_filesource_read(&fsrc, &preamble_sum[prach.N_cp], prach.N_seq); } uint32_t prach_len = prach.N_seq; @@ -221,7 +226,7 @@ int main(int argc, char** argv) } struct timeval t[3]; gettimeofday(&t[1], NULL); - srslte_prach_detect_offset(&prach, 0, &preamble_sum[prach.N_cp], prach_len, indices, t_offsets , NULL, &n_indices); + srslte_prach_detect_offset(&prach, 0, &preamble_sum[prach.N_cp], prach_len, indices, t_offsets, NULL, &n_indices); gettimeofday(&t[2], NULL); get_time_interval(t); printf("texec=%ld us\n", t[0].tv_usec); @@ -232,7 +237,7 @@ int main(int argc, char** argv) } for (int i = 0; i < n_indices; i++) { if (test_offset_calculation) { - int error = (int)(t_offsets[i] * srate) - offsets[i]; + int error = (int)(t_offsets[i] * srate) - offsets[i]; if (abs(error) > divisor) { printf("preamble %d has incorrect offset calculated as %d, should be %d\n", indices[i], @@ -242,7 +247,7 @@ int main(int argc, char** argv) } } } - if (err){ + if (err) { return -1; } diff --git a/lib/src/phy/phch/test/prach_test_usrp.c b/lib/src/phy/phch/test/prach_test_usrp.c index dcd8f775f..ca3068c23 100644 --- a/lib/src/phy/phch/test/prach_test_usrp.c +++ b/lib/src/phy/phch/test/prach_test_usrp.c @@ -44,7 +44,7 @@ static const uint32_t tx_delay_ms = 4; // RF parameters static float uhd_rx_gain = 40, uhd_tx_gain = 60, uhd_freq = 2.4e9; -static char* uhd_args = ""; +static char* uhd_args = ""; static char* device_name = ""; // SRSLTE Verbose @@ -119,7 +119,7 @@ void parse_args(int argc, char** argv) case 'p': nof_prb = (int)strtol(argv[optind], NULL, 10); if (!srslte_nofprb_isvalid(nof_prb)) { - ERROR("Invalid number of UL RB %d\n", nof_prb); + ERROR("Invalid number of UL RB %d", nof_prb); exit(-1); } break; @@ -151,7 +151,6 @@ void parse_args(int argc, char** argv) void rf_msg_callback(void* arg, srslte_rf_error_t error) { switch (error.type) { - case SRSLTE_RF_ERROR_LATE: printf("L"); break; @@ -204,7 +203,7 @@ int main(int argc, char** argv) } if (srslte_prach_set_cfg(&prach, &prach_cfg, nof_prb)) { - ERROR("Error initiating PRACH object\n"); + ERROR("Error initiating PRACH object"); return SRSLTE_ERROR; } @@ -215,7 +214,7 @@ int main(int argc, char** argv) srslte_rf_t rf; printf("Opening RF device...\n"); if (srslte_rf_open_devname(&rf, device_name, uhd_args, 1)) { - ERROR("Error opening &uhd\n"); + ERROR("Error opening &uhd"); exit(-1); } printf("Test summary:\n"); @@ -236,7 +235,7 @@ int main(int argc, char** argv) printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000); int srate_rf = (int)srslte_rf_set_rx_srate(&rf, (double)srate); if (srate_rf != srate) { - ERROR("Could not set sampling rate\n"); + ERROR("Could not set sampling rate"); exit(-1); } srslte_rf_set_tx_srate(&rf, (double)srate); @@ -271,16 +270,16 @@ int main(int argc, char** argv) // For a the number of frames for (uint32_t nframe = 0; nframe < nof_frames; nframe++) { - INFO("Rep %d. Receiving frame %d\n", rep, nframe); + INFO("Rep %d. Receiving frame %d", rep, nframe); srslte_rf_recv_with_time(&rf, &buffer[flen * nframe], flen, true, &tstamp.full_secs, &tstamp.frac_secs); srslte_timestamp_add(&tstamp, 0, tx_delay_ms * 1e-3 - timeadv * 1e-6); if (nframe == 10 - tx_delay_ms) { srslte_rf_send_timed2(&rf, preamble, flen, tstamp.full_secs, tstamp.frac_secs, false, !continous_tx); - INFO("Rep %d. Transmitting PRACH\n", rep); + INFO("Rep %d. Transmitting PRACH", rep); } else if (nframe == 10 - tx_delay_ms - 1 || continous_tx) { srslte_rf_send_timed2(&rf, zeros, flen, tstamp.full_secs, tstamp.frac_secs, is_start_of_burst, false); - INFO("Rep %d. Transmitting Zeros\n", rep); + INFO("Rep %d. Transmitting Zeros", rep); is_start_of_burst = false; } } @@ -302,9 +301,9 @@ int main(int argc, char** argv) } // Prompt detected PRACH - INFO("Rep %d. Nof detected PRACHs: %d\n", rep, nof_detected); + INFO("Rep %d. Nof detected PRACHs: %d", rep, nof_detected); for (int i = 0; i < nof_detected; i++) { - INFO("%d/%d index=%d, offset=%.2f us (%d samples)\n", + INFO("%d/%d index=%d, offset=%.2f us (%d samples)", i, nof_detected, indices[i], diff --git a/lib/src/phy/phch/test/psbch_file_test.c b/lib/src/phy/phch/test/psbch_file_test.c index 007637b5f..785b120f3 100644 --- a/lib/src/phy/phch/test/psbch_file_test.c +++ b/lib/src/phy/phch/test/psbch_file_test.c @@ -126,7 +126,7 @@ int main(int argc, char** argv) // TX srslte_ofdm_t ifft; if (srslte_ofdm_tx_init(&ifft, cell.cp, sf_buffer, output_buffer, cell.nof_prb)) { - ERROR("Error creating IFFT object\n"); + ERROR("Error creating IFFT object"); return SRSLTE_ERROR; } srslte_ofdm_set_normalize(&ifft, true); @@ -144,20 +144,20 @@ int main(int argc, char** argv) // PSBCH srslte_psbch_t psbch; if (srslte_psbch_init(&psbch, cell.nof_prb, cell.N_sl_id, cell.tm, cell.cp) != SRSLTE_SUCCESS) { - ERROR("Error in psbch init\n"); + ERROR("Error in psbch init"); return SRSLTE_ERROR; } // PSCBH DMRS srslte_sl_comm_resource_pool_t sl_comm_resource_pool; if (srslte_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell) != SRSLTE_SUCCESS) { - ERROR("Error initializing sl_comm_resource_pool\n"); + ERROR("Error initializing sl_comm_resource_pool"); return SRSLTE_ERROR; } - srslte_chest_sl_t psbch_chest; + srslte_chest_sl_t psbch_chest; if (srslte_chest_sl_init(&psbch_chest, SRSLTE_SIDELINK_PSBCH, cell, sl_comm_resource_pool) != SRSLTE_SUCCESS) { - ERROR("Error in chest PSBCH init\n"); + ERROR("Error in chest PSBCH init"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/test/psbch_test.c b/lib/src/phy/phch/test/psbch_test.c index 3d49a9a1d..df8de24da 100644 --- a/lib/src/phy/phch/test/psbch_test.c +++ b/lib/src/phy/phch/test/psbch_test.c @@ -98,7 +98,7 @@ int main(int argc, char** argv) // PSBCH srslte_psbch_t psbch; if (srslte_psbch_init(&psbch, cell.nof_prb, cell.N_sl_id, cell.tm, cell.cp) != SRSLTE_SUCCESS) { - ERROR("Error in psbch init\n"); + ERROR("Error in psbch init"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/test/pscch_test.c b/lib/src/phy/phch/test/pscch_test.c index f8b95e770..8e997d6a3 100644 --- a/lib/src/phy/phch/test/pscch_test.c +++ b/lib/src/phy/phch/test/pscch_test.c @@ -87,7 +87,7 @@ int main(int argc, char** argv) srslte_sl_comm_resource_pool_t sl_comm_resource_pool; if (srslte_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell) != SRSLTE_SUCCESS) { - ERROR("Error initializing sl_comm_resource_pool\n"); + ERROR("Error initializing sl_comm_resource_pool"); return SRSLTE_ERROR; } @@ -104,12 +104,12 @@ int main(int argc, char** argv) // PSCCH srslte_pscch_t pscch; if (srslte_pscch_init(&pscch, SRSLTE_MAX_PRB) != SRSLTE_SUCCESS) { - ERROR("Error in PSCCH init\n"); + ERROR("Error in PSCCH init"); return SRSLTE_ERROR; } if (srslte_pscch_set_cell(&pscch, cell) != SRSLTE_SUCCESS) { - ERROR("Error in PSCCH init\n"); + ERROR("Error in PSCCH init"); return SRSLTE_ERROR; } 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 1595efda5..6279d5c80 100644 --- a/lib/src/phy/phch/test/pssch_pscch_file_test.c +++ b/lib/src/phy/phch/test/pssch_pscch_file_test.c @@ -124,7 +124,7 @@ int base_init() sf_n_re = SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp); if (srslte_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell) != SRSLTE_SUCCESS) { - ERROR("Error initializing sl_comm_resource_pool\n"); + ERROR("Error initializing sl_comm_resource_pool"); return SRSLTE_ERROR; } sl_comm_resource_pool.num_sub_channel = num_sub_channel; @@ -132,21 +132,21 @@ int base_init() sf_buffer = srslte_vec_cf_malloc(sf_n_re); if (!sf_buffer) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(sf_buffer, sf_n_re); equalized_sf_buffer = srslte_vec_cf_malloc(sf_n_re); if (!equalized_sf_buffer) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(equalized_sf_buffer, sf_n_re); input_buffer = srslte_vec_cf_malloc(sf_n_samples); if (!input_buffer) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(input_buffer, sf_n_samples); @@ -154,37 +154,37 @@ int base_init() srslte_sci_init(&sci, cell, sl_comm_resource_pool); if (srslte_pscch_init(&pscch, SRSLTE_MAX_PRB) != SRSLTE_SUCCESS) { - ERROR("Error in PSCCH init\n"); + ERROR("Error in PSCCH init"); return SRSLTE_ERROR; } if (srslte_pscch_set_cell(&pscch, cell) != SRSLTE_SUCCESS) { - ERROR("Error in PSCCH set cell\n"); + ERROR("Error in PSCCH set cell"); return SRSLTE_ERROR; } if (srslte_chest_sl_init(&pscch_chest, SRSLTE_SIDELINK_PSCCH, cell, sl_comm_resource_pool) != SRSLTE_SUCCESS) { - ERROR("Error in PSCCH DMRS init\n"); + ERROR("Error in PSCCH DMRS init"); return SRSLTE_ERROR; } if (srslte_pssch_init(&pssch, cell, sl_comm_resource_pool) != SRSLTE_SUCCESS) { - ERROR("Error initializing PSSCH\n"); + ERROR("Error initializing PSSCH"); return SRSLTE_ERROR; } if (srslte_chest_sl_init(&pssch_chest, SRSLTE_SIDELINK_PSSCH, cell, sl_comm_resource_pool) != SRSLTE_SUCCESS) { - ERROR("Error in chest PSSCH init\n"); + ERROR("Error in chest PSSCH init"); return SRSLTE_ERROR; } if (input_file_name) { if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - printf("Error opening file %s\n", input_file_name); + printf("Error opening file %s", input_file_name); return SRSLTE_ERROR; } } else { - ERROR("Invalid input file name\n"); + ERROR("Invalid input file name"); return SRSLTE_ERROR; } @@ -230,7 +230,7 @@ int main(int argc, char** argv) srslte_use_standard_symbol_size(use_standard_lte_rates); if (base_init()) { - ERROR("Error initializing\n"); + ERROR("Error initializing"); base_free(); return SRSLTE_ERROR; } @@ -270,15 +270,12 @@ int main(int argc, char** argv) srslte_ofdm_rx_sf(&fft); if (cell.tm == SRSLTE_SIDELINK_TM1 || cell.tm == SRSLTE_SIDELINK_TM2) { - // 3GPP TS 36.213 Section 14.2.1.2 UE procedure for determining subframes // and resource blocks for transmitting PSCCH for sidelink transmission mode 2 if (sl_comm_resource_pool.pscch_sf_bitmap[period_sf_idx] == 1) { - for (uint32_t pscch_prb_start_idx = sl_comm_resource_pool.prb_start; pscch_prb_start_idx <= sl_comm_resource_pool.prb_end; pscch_prb_start_idx++) { - // PSCCH Channel estimation pscch_chest_sl_cfg.prb_start_idx = pscch_prb_start_idx; srslte_chest_sl_set_cfg(&pscch_chest, pscch_chest_sl_cfg); @@ -286,7 +283,6 @@ int main(int argc, char** argv) if (srslte_pscch_decode(&pscch, equalized_sf_buffer, sci_rx, pscch_prb_start_idx) == SRSLTE_SUCCESS) { if (srslte_sci_format0_unpack(&sci, sci_rx) == SRSLTE_SUCCESS) { - srslte_sci_info(&sci, sci_msg, sizeof(sci_msg)); fprintf(stdout, "%s", sci_msg); @@ -306,7 +302,6 @@ int main(int argc, char** argv) if ((sl_comm_resource_pool.pssch_sf_bitmap[period_sf_idx] == 1) && (sci_decoded == true)) { if (srslte_ra_sl_pssch_allowed_sf(current_sf_idx, sci.trp_idx, SRSLTE_SL_DUPLEX_MODE_FDD, 0)) { - // Redundancy version uint32_t rv_idx = allowed_pssch_sf_idx % 4; diff --git a/lib/src/phy/phch/test/pssch_test.c b/lib/src/phy/phch/test/pssch_test.c index 8512dee02..03ad9105e 100644 --- a/lib/src/phy/phch/test/pssch_test.c +++ b/lib/src/phy/phch/test/pssch_test.c @@ -78,22 +78,22 @@ int main(int argc, char** argv) srslte_sl_comm_resource_pool_t sl_comm_resource_pool; if (srslte_sl_comm_resource_pool_get_default_config(&sl_comm_resource_pool, cell) != SRSLTE_SUCCESS) { - ERROR("Error initializing sl_comm_resource_pool\n"); + ERROR("Error initializing sl_comm_resource_pool"); return SRSLTE_ERROR; } srslte_pssch_t pssch = {}; if (srslte_pssch_init(&pssch, cell, sl_comm_resource_pool) != SRSLTE_SUCCESS) { - ERROR("Error initializing PSSCH\n"); + ERROR("Error initializing PSSCH"); return SRSLTE_ERROR; } uint32_t nof_prb_pssch = srslte_dft_precoding_get_valid_prb(cell.nof_prb); - uint32_t N_x_id = 255; - uint32_t sf_n_re = SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp); - cf_t* sf_buffer = srslte_vec_cf_malloc(sf_n_re); + uint32_t N_x_id = 255; + uint32_t sf_n_re = SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp); + cf_t* sf_buffer = srslte_vec_cf_malloc(sf_n_re); if (!sf_buffer) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); return SRSLTE_ERROR; } srslte_vec_cf_zero(sf_buffer, sf_n_re); @@ -106,7 +106,7 @@ int main(int argc, char** argv) srslte_pssch_cfg_t pssch_cfg = {prb_start_idx, nof_prb_pssch, N_x_id, mcs_idx, 0, 0}; if (srslte_pssch_set_cfg(&pssch, pssch_cfg) != SRSLTE_SUCCESS) { - ERROR("Error configuring PSSCH\n"); + ERROR("Error configuring PSSCH"); goto clean_exit; } @@ -120,13 +120,13 @@ int main(int argc, char** argv) // PSSCH encoding if (srslte_pssch_encode(&pssch, tb, pssch.sl_sch_tb_len, sf_buffer) != SRSLTE_SUCCESS) { - ERROR("Error encoding PSSCH\n"); + ERROR("Error encoding PSSCH"); goto clean_exit; } // PSSCH decoding if (srslte_pssch_decode(&pssch, sf_buffer, tb_rx, pssch.sl_sch_tb_len) != SRSLTE_SUCCESS) { - ERROR("Error decoding PSSCH\n"); + ERROR("Error decoding PSSCH"); goto clean_exit; } diff --git a/lib/src/phy/phch/test/pucch_nr_test.c b/lib/src/phy/phch/test/pucch_nr_test.c index 3eb3c3991..c3d026f10 100644 --- a/lib/src/phy/phch/test/pucch_nr_test.c +++ b/lib/src/phy/phch/test/pucch_nr_test.c @@ -216,7 +216,7 @@ static int test_pucch_format2(srslte_pucch_nr_t* pucch, // Estimate channel TESTASSERT(srslte_dmrs_pucch_format2_estimate( pucch, &carrier, cfg, &slot, &resource, slot_symbols, chest_res) == SRSLTE_SUCCESS); - INFO("RSRP=%+.2f; EPRE=%+.2f; SNR=%+.2f;\n", + INFO("RSRP=%+.2f; EPRE=%+.2f; SNR=%+.2f;", chest_res->rsrp_dBfs, chest_res->epre_dBfs, chest_res->snr_db); @@ -296,33 +296,33 @@ int main(int argc, char** argv) random_gen = srslte_random_init(0x1234); if (random_gen == NULL) { - ERROR("Random init\n"); + ERROR("Random init"); goto clean_exit; } if (slot_symb == NULL) { - ERROR("Alloc\n"); + ERROR("Alloc"); goto clean_exit; } srslte_pucch_nr_args_t pucch_args = {}; if (srslte_pucch_nr_init(&pucch, &pucch_args) < SRSLTE_SUCCESS) { - ERROR("PUCCH init\n"); + ERROR("PUCCH init"); goto clean_exit; } if (srslte_chest_ul_res_init(&chest_res, carrier.nof_prb)) { - ERROR("Chest UL\n"); + ERROR("Chest UL"); goto clean_exit; } if (srslte_channel_awgn_init(&awgn, 1234) < SRSLTE_SUCCESS) { - ERROR("AWGN init\n"); + ERROR("AWGN init"); goto clean_exit; } if (srslte_channel_awgn_set_n0(&awgn, -snr_db) < SRSLTE_SUCCESS) { - ERROR("AWGN set N0\n"); + ERROR("AWGN set N0"); goto clean_exit; } @@ -331,7 +331,7 @@ int main(int argc, char** argv) // Test Format 0 if (format < 0 || format == 0) { if (test_pucch_format0(&pucch, &common_cfg, slot_symb) < SRSLTE_SUCCESS) { - ERROR("Failed PUCCH format 0\n"); + ERROR("Failed PUCCH format 0"); goto clean_exit; } } @@ -339,7 +339,7 @@ int main(int argc, char** argv) // Test Format 1 if (format < 0 || format == 1) { if (test_pucch_format1(&pucch, &common_cfg, &chest_res, slot_symb) < SRSLTE_SUCCESS) { - ERROR("Failed PUCCH format 1\n"); + ERROR("Failed PUCCH format 1"); goto clean_exit; } } @@ -347,7 +347,7 @@ int main(int argc, char** argv) // Test Format 2 if (format < 0 || format == 2) { if (test_pucch_format2(&pucch, &common_cfg, &chest_res, slot_symb) < SRSLTE_SUCCESS) { - ERROR("Failed PUCCH format 2\n"); + ERROR("Failed PUCCH format 2"); goto clean_exit; } } diff --git a/lib/src/phy/phch/test/pucch_test.c b/lib/src/phy/phch/test/pucch_test.c index 1de6152c5..32b0f16d8 100644 --- a/lib/src/phy/phch/test/pucch_test.c +++ b/lib/src/phy/phch/test/pucch_test.c @@ -149,55 +149,55 @@ int main(int argc, char** argv) } if (srslte_pucch_init_ue(&pucch_ue)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); exit(-1); } if (srslte_pucch_set_cell(&pucch_ue, cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); exit(-1); } if (srslte_pucch_set_rnti(&pucch_ue, 11)) { - ERROR("Error setting C-RNTI\n"); + ERROR("Error setting C-RNTI"); goto quit; } if (srslte_pucch_init_enb(&pucch_enb)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); exit(-1); } if (srslte_pucch_set_cell(&pucch_enb, cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); exit(-1); } if (srslte_pucch_set_rnti(&pucch_enb, 11)) { - ERROR("Error setting C-RNTI\n"); + ERROR("Error setting C-RNTI"); goto quit; } if (srslte_refsignal_ul_set_cell(&dmrs, cell)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); exit(-1); } if (srslte_chest_ul_init(&chest, cell.nof_prb) < SRSLTE_SUCCESS) { - ERROR("Error initiating channel estimator\n"); + ERROR("Error initiating channel estimator"); goto quit; } if (srslte_chest_ul_res_init(&chest_res, cell.nof_prb) < SRSLTE_SUCCESS) { - ERROR("Error initiating channel estimator result\n"); + ERROR("Error initiating channel estimator result"); goto quit; } if (srslte_chest_ul_set_cell(&chest, cell) < SRSLTE_SUCCESS) { - ERROR("Error setting channel estimator cell\n"); + ERROR("Error setting channel estimator cell"); goto quit; } if (srslte_channel_awgn_init(&awgn, 0x1234) < SRSLTE_SUCCESS) { - ERROR("Error initiating AWGN\n"); + ERROR("Error initiating AWGN"); goto quit; } if (srslte_channel_awgn_set_n0(&awgn, -snr_db) < SRSLTE_SUCCESS) { - ERROR("Error setting AWGN\n"); + ERROR("Error setting AWGN"); goto quit; } @@ -255,16 +255,16 @@ int main(int argc, char** argv) // Encode PUCCH signals gettimeofday(&t[1], NULL); if (srslte_pucch_encode(&pucch_ue, &ul_sf, &pucch_cfg, &uci_data.value, sf_symbols)) { - ERROR("Error encoding PUCCH\n"); + ERROR("Error encoding PUCCH"); goto quit; } if (srslte_refsignal_dmrs_pucch_gen(&dmrs, &ul_sf, &pucch_cfg, pucch_dmrs)) { - ERROR("Error encoding PUCCH\n"); + ERROR("Error encoding PUCCH"); goto quit; } if (srslte_refsignal_dmrs_pucch_put(&dmrs, &pucch_cfg, pucch_dmrs, sf_symbols)) { - ERROR("Error encoding PUCCH\n"); + ERROR("Error encoding PUCCH"); goto quit; } gettimeofday(&t[2], NULL); @@ -277,13 +277,13 @@ int main(int argc, char** argv) // Decode PUCCH signals gettimeofday(&t[1], NULL); if (srslte_chest_ul_estimate_pucch(&chest, &ul_sf, &pucch_cfg, sf_symbols, &chest_res) < SRSLTE_SUCCESS) { - ERROR("Error estimating PUCCH channel\n"); + ERROR("Error estimating PUCCH channel"); goto quit; } srslte_pucch_res_t res = {}; if (srslte_pucch_decode(&pucch_enb, &ul_sf, &pucch_cfg, &chest_res, sf_symbols, &res) < SRSLTE_SUCCESS) { - ERROR("Error decoding PUCCH\n"); + ERROR("Error decoding PUCCH"); goto quit; } gettimeofday(&t[2], NULL); @@ -293,7 +293,7 @@ int main(int argc, char** argv) // Check EPRE and RSRP are +/- 1 dB and SNR measurements are +/- 3dB if (fabsf(chest_res.epre_dBfs) > 1.0 || fabsf(chest_res.rsrp_dBfs) > 1.0 || fabsf(chest_res.snr_db - snr_db) > 3.0) { - ERROR("Invalid EPRE (%+.2f), RSRP (%+.2f) or SNR (%+.2f)\n", + ERROR("Invalid EPRE (%+.2f), RSRP (%+.2f) or SNR (%+.2f)", chest_res.epre_dBfs, chest_res.rsrp_dBfs, chest_res.snr_db); @@ -301,7 +301,7 @@ int main(int argc, char** argv) } INFO("format %d, n_pucch: %d, ncs: %d, d: %d, t_encode=%ld us, t_decode=%ld us, EPRE=%+.1f dBfs, RSRP=%+.1f " - "dBfs, SNR=%+.1f dBfs\n", + "dBfs, SNR=%+.1f dBfs", format, n_pucch, ncs, diff --git a/lib/src/phy/phch/test/pusch_nr_test.c b/lib/src/phy/phch/test/pusch_nr_test.c index 82436f329..8edbed4dc 100644 --- a/lib/src/phy/phch/test/pusch_nr_test.c +++ b/lib/src/phy/phch/test/pusch_nr_test.c @@ -98,29 +98,29 @@ int main(int argc, char** argv) pusch_args.measure_evm = true; if (srslte_pusch_nr_init_ue(&pusch_tx, &pusch_args) < SRSLTE_SUCCESS) { - ERROR("Error initiating PUSCH for Tx\n"); + ERROR("Error initiating PUSCH for Tx"); goto clean_exit; } if (srslte_pusch_nr_init_gnb(&pusch_rx, &pusch_args) < SRSLTE_SUCCESS) { - ERROR("Error initiating SCH NR for Rx\n"); + ERROR("Error initiating SCH NR for Rx"); goto clean_exit; } if (srslte_pusch_nr_set_carrier(&pusch_tx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } if (srslte_pusch_nr_set_carrier(&pusch_rx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } for (uint32_t i = 0; i < carrier.max_mimo_layers; i++) { sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(carrier.nof_prb)); if (sf_symbols[i] == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } } @@ -129,7 +129,7 @@ int main(int argc, char** argv) data_tx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); data_rx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); if (data_tx[i] == NULL || data_rx[i] == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } @@ -141,25 +141,25 @@ int main(int argc, char** argv) if (srslte_softbuffer_tx_init_guru(&softbuffer_tx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } if (srslte_softbuffer_rx_init_guru(&softbuffer_rx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } // Use grant default A time resources with m=0 if (srslte_ra_ul_nr_pdsch_time_resource_default_A(carrier.numerology, 0, &pusch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading default grant\n"); + ERROR("Error loading default grant"); goto clean_exit; } // Load number of DMRS CDM groups without data if (srslte_ra_ul_nr_nof_dmrs_cdm_groups_without_data_format_0_0(&pusch_cfg, &pusch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading number of DMRS CDM groups without data\n"); + ERROR("Error loading number of DMRS CDM groups without data"); goto clean_exit; } @@ -182,7 +182,7 @@ int main(int argc, char** argv) } if (srslte_chest_dl_res_init(&chest, carrier.nof_prb) < SRSLTE_SUCCESS) { - ERROR("Initiating chest\n"); + ERROR("Initiating chest"); goto clean_exit; } @@ -194,7 +194,7 @@ int main(int argc, char** argv) pusch_grant.dci_format = srslte_dci_format_nr_0_0; if (srslte_ra_nr_fill_tb(&pusch_cfg, &pusch_grant, mcs, &pusch_grant.tb[0]) < SRSLTE_SUCCESS) { - ERROR("Error filing tb\n"); + ERROR("Error filing tb"); goto clean_exit; } @@ -211,7 +211,7 @@ int main(int argc, char** argv) } if (srslte_pusch_nr_encode(&pusch_tx, &pusch_cfg, &pusch_grant, data_tx, sf_symbols) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } @@ -226,12 +226,12 @@ int main(int argc, char** argv) chest.nof_re = pusch_grant.tb->nof_re; if (srslte_pusch_nr_decode(&pusch_rx, &pusch_cfg, &pusch_grant, &chest, sf_symbols, pusch_res) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } if (pusch_res->evm > 0.001f) { - ERROR("Error PUSCH EVM is too high %f\n", pusch_res->evm); + ERROR("Error PUSCH EVM is too high %f", pusch_res->evm); goto clean_exit; } @@ -246,7 +246,7 @@ int main(int argc, char** argv) mse = mse / (nof_re * pusch_grant.nof_layers); } if (mse > 0.001) { - ERROR("MSE error (%f) is too high\n", mse); + ERROR("MSE error (%f) is too high", mse); for (uint32_t i = 0; i < pusch_grant.nof_layers; i++) { printf("d_tx[%d]=", i); srslte_vec_fprint_c(stdout, pusch_tx.d[i], nof_re); @@ -257,12 +257,12 @@ int main(int argc, char** argv) } if (!pusch_res[0].crc) { - ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pusch_grant.tb[0].tbs); + ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pusch_grant.tb[0].tbs); goto clean_exit; } if (memcmp(data_tx[0], data_rx[0], pusch_grant.tb[0].tbs / 8) != 0) { - ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pusch_grant.tb[0].tbs); + ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pusch_grant.tb[0].tbs); printf("Tx data: "); srslte_vec_fprint_byte(stdout, data_tx[0], pusch_grant.tb[0].tbs / 8); printf("Rx data: "); diff --git a/lib/src/phy/phch/test/pusch_test.c b/lib/src/phy/phch/test/pusch_test.c index a414028b0..40d9990cf 100644 --- a/lib/src/phy/phch/test/pusch_test.c +++ b/lib/src/phy/phch/test/pusch_test.c @@ -122,7 +122,7 @@ void parse_extensive_param(char* param, char* arg) } if (ext_code) { - ERROR("Error parsing parameter '%s' and argument '%s'\n", param, arg); + ERROR("Error parsing parameter '%s' and argument '%s'", param, arg); exit(ext_code); } } @@ -209,7 +209,7 @@ int main(int argc, char** argv) srslte_pusch_hopping_cfg_t ul_hopping = {.n_sb = 1, .hopping_offset = 0, .hop_mode = 1}; if (srslte_ra_ul_dci_to_grant(&cell, &ul_sf, &ul_hopping, &dci, &cfg.grant)) { - ERROR("Error computing resource allocation\n"); + ERROR("Error computing resource allocation"); return ret; } @@ -217,19 +217,19 @@ int main(int argc, char** argv) cfg.grant.n_prb_tilde[1] = cfg.grant.n_prb[1]; if (srslte_pusch_init_ue(&pusch_tx, cell.nof_prb)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto quit; } if (srslte_pusch_set_cell(&pusch_tx, cell)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto quit; } if (srslte_pusch_init_enb(&pusch_rx, cell.nof_prb)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto quit; } if (srslte_pusch_set_cell(&pusch_rx, cell)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto quit; } @@ -259,12 +259,12 @@ int main(int argc, char** argv) } if (srslte_softbuffer_tx_init(&softbuffer_tx, 100)) { - ERROR("Error initiating soft buffer\n"); + ERROR("Error initiating soft buffer"); goto quit; } if (srslte_softbuffer_rx_init(&softbuffer_rx, 100)) { - ERROR("Error initiating soft buffer\n"); + ERROR("Error initiating soft buffer"); goto quit; } @@ -300,14 +300,13 @@ int main(int argc, char** argv) cfg.softbuffers.tx = &softbuffer_tx; if (srslte_pusch_encode(&pusch_tx, &ul_sf, &cfg, &pdata, sf_symbols)) { - ERROR("Error encoding TB\n"); + ERROR("Error encoding TB"); exit(-1); } if (rv_idx > 0) { - cfg.grant.tb.rv = rv_idx; if (srslte_pusch_encode(&pusch_tx, &ul_sf, &cfg, &pdata, sf_symbols)) { - ERROR("Error encoding TB\n"); + ERROR("Error encoding TB"); exit(-1); } } @@ -329,7 +328,7 @@ int main(int argc, char** argv) printf("Unmatched data detected\n"); ret = SRSLTE_ERROR; } else { - INFO("Rx Data is Ok\n"); + INFO("Rx Data is Ok"); } if (uci_data_tx.cfg.ack[0].nof_acks) { @@ -358,7 +357,7 @@ int main(int argc, char** argv) printf("UCI RI bit error: %d != %d\n", uci_data_tx.value.ri, pusch_res.uci.ri); ret = SRSLTE_ERROR; } else { - INFO("Rx RI is Ok\n"); + INFO("Rx RI is Ok"); } } @@ -368,7 +367,7 @@ int main(int argc, char** argv) printf("CQI Decode failed at subframe %d\n", n); ret = SRSLTE_ERROR; } else { - INFO("Rx CQI is Ok (crc=%d, wb_cqi=%d)\n", pusch_res.uci.cqi.data_crc, pusch_res.uci.cqi.wideband.wideband_cqi); + INFO("Rx CQI is Ok (crc=%d, wb_cqi=%d)", pusch_res.uci.cqi.data_crc, pusch_res.uci.cqi.wideband.wideband_cqi); } } diff --git a/lib/src/phy/phch/test/sch_nr_test.c b/lib/src/phy/phch/test/sch_nr_test.c index ff0029eaf..bfa7e125e 100644 --- a/lib/src/phy/phch/test/sch_nr_test.c +++ b/lib/src/phy/phch/test/sch_nr_test.c @@ -97,22 +97,22 @@ int main(int argc, char** argv) srslte_sch_nr_args_t args = {}; args.disable_simd = false; if (srslte_sch_nr_init_tx(&sch_nr_tx, &args) < SRSLTE_SUCCESS) { - ERROR("Error initiating SCH NR for Tx\n"); + ERROR("Error initiating SCH NR for Tx"); goto clean_exit; } if (srslte_sch_nr_init_rx(&sch_nr_rx, &args) < SRSLTE_SUCCESS) { - ERROR("Error initiating SCH NR for Rx\n"); + ERROR("Error initiating SCH NR for Rx"); goto clean_exit; } if (srslte_sch_nr_set_carrier(&sch_nr_tx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } if (srslte_sch_nr_set_carrier(&sch_nr_rx, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } @@ -121,19 +121,19 @@ int main(int argc, char** argv) if (srslte_softbuffer_tx_init_guru(&softbuffer_tx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } if (srslte_softbuffer_rx_init_guru(&softbuffer_rx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } // Use grant default A time resources with m=0 if (srslte_ra_dl_nr_time_default_A(0, pdsch_cfg.dmrs.typeA_pos, &pdsch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading default grant\n"); + ERROR("Error loading default grant"); goto clean_exit; } pdsch_grant.nof_layers = carrier.max_mimo_layers; @@ -155,14 +155,13 @@ int main(int argc, char** argv) for (n_prb = n_prb_start; n_prb < n_prb_end; n_prb++) { for (mcs = mcs_start; mcs < mcs_end; mcs++) { - for (uint32_t n = 0; n < SRSLTE_MAX_PRB_NR; n++) { pdsch_grant.prb_idx[n] = (n < n_prb); } srslte_sch_tb_t tb = {}; if (srslte_ra_nr_fill_tb(&pdsch_cfg, &pdsch_grant, mcs, &tb) < SRSLTE_SUCCESS) { - ERROR("Error filing tb\n"); + ERROR("Error filing tb"); goto clean_exit; } @@ -173,7 +172,7 @@ int main(int argc, char** argv) tb.softbuffer.tx = &softbuffer_tx; if (srslte_dlsch_nr_encode(&sch_nr_tx, &pdsch_cfg.sch_cfg, &tb, data_tx, encoded) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } @@ -186,17 +185,17 @@ int main(int argc, char** argv) bool crc = false; if (srslte_dlsch_nr_decode(&sch_nr_rx, &pdsch_cfg.sch_cfg, &tb, llr, data_rx, &crc) < SRSLTE_SUCCESS) { - ERROR("Error encoding\n"); + ERROR("Error encoding"); goto clean_exit; } if (!crc) { - ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, tb.tbs); + ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, tb.tbs); goto clean_exit; } if (memcmp(data_tx, data_rx, tb.tbs / 8) != 0) { - ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, tb.tbs); + ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, tb.tbs); printf("Tx data: "); srslte_vec_fprint_byte(stdout, data_tx, tb.tbs / 8); printf("Rx data: "); diff --git a/lib/src/phy/phch/uci.c b/lib/src/phy/phch/uci.c index 2757ab4e7..d6c3abea7 100644 --- a/lib/src/phy/phch/uci.c +++ b/lib/src/phy/phch/uci.c @@ -125,7 +125,6 @@ int16_t srslte_uci_decode_cqi_pucch(srslte_uci_cqi_pucch_t* q, int32_t max_corr = INT32_MIN; uint32_t nwords = 1 << SRSLTE_UCI_MAX_CQI_LEN_PUCCH; for (uint32_t w = 0; w < nwords; w += 1 << (SRSLTE_UCI_MAX_CQI_LEN_PUCCH - cqi_len)) { - // Calculate correlation with pregenerated word and select maximum int32_t corr = srslte_vec_dot_prod_sss(q->cqi_table_s[w], b_bits, SRSLTE_UCI_CQI_CODED_PUCCH_B); if (corr > max_corr) { @@ -137,7 +136,7 @@ int16_t srslte_uci_decode_cqi_pucch(srslte_uci_cqi_pucch_t* q, uint8_t* ptr = cqi_data; srslte_bit_unpack(max_w, &ptr, SRSLTE_UCI_MAX_CQI_LEN_PUCCH); - INFO("Decoded CQI: w=%d, corr=%d\n", max_w, max_corr); + INFO("Decoded CQI: w=%d, corr=%d", max_w, max_corr); return max_corr; } else { return SRSLTE_ERROR_INVALID_INPUTS; @@ -164,7 +163,6 @@ void srslte_uci_cqi_free(srslte_uci_cqi_pusch_t* q) static uint32_t Q_prime_cqi(srslte_pusch_cfg_t* cfg, uint32_t O, float beta, uint32_t Q_prime_ri) { - uint32_t K = cfg->K_segm; uint32_t Q_prime = 0; @@ -206,7 +204,7 @@ int decode_cqi_short(srslte_uci_cqi_pusch_t* q, int16_t* q_bits, uint32_t Q, uin { if (nof_bits <= SRSLTE_FEC_BLOCK_MAX_NOF_BITS && nof_bits > 0 && q != NULL && data != NULL && q_bits != NULL) { int32_t max_corr = srslte_block_decode_i16(q_bits, Q, data, nof_bits); - INFO("Decoded CQI: corr=%d\n", max_corr); + INFO("Decoded CQI: corr=%d", max_corr); return SRSLTE_SUCCESS; } else { return SRSLTE_ERROR_INVALID_INPUTS; @@ -253,7 +251,6 @@ int decode_cqi_long(srslte_uci_cqi_pusch_t* q, int16_t* q_bits, uint32_t Q, uint { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (nof_bits + 8 < SRSLTE_UCI_MAX_CQI_LEN_PUSCH && q != NULL && data != NULL && q_bits != NULL) { - srslte_rm_conv_rx_s(q_bits, Q, q->encoded_cqi_s, 3 * (nof_bits + 8)); DEBUG("cconv_rx="); @@ -291,7 +288,7 @@ int srslte_uci_decode_cqi_pusch(srslte_uci_cqi_pusch_t* q, bool* cqi_ack) { if (beta < 0) { - ERROR("Error beta is reserved\n"); + ERROR("Error beta is reserved"); return -1; } uint32_t Q_prime = Q_prime_cqi(cfg, cqi_len, beta, Q_prime_ri); @@ -334,7 +331,7 @@ int srslte_uci_encode_cqi_pusch(srslte_uci_cqi_pusch_t* q, uint8_t* q_bits) { if (beta < 0) { - ERROR("Error beta is reserved\n"); + ERROR("Error beta is reserved"); return -1; } @@ -361,7 +358,6 @@ static int uci_ulsch_interleave_ack_gen(uint32_t ack_q_bit_idx, uint32_t N_pusch_symbs, srslte_uci_bit_t* ack_bits) { - const uint32_t ack_column_set_norm[4] = {2, 3, 8, 9}; const uint32_t ack_column_set_ext[4] = {1, 2, 6, 7}; @@ -374,7 +370,7 @@ static int uci_ulsch_interleave_ack_gen(uint32_t ack_q_bit_idx, } return SRSLTE_SUCCESS; } else { - ERROR("Error interleaving UCI-ACK bit idx %d for H_prime_total=%d and N_pusch_symbs=%d\n", + ERROR("Error interleaving UCI-ACK bit idx %d for H_prime_total=%d and N_pusch_symbs=%d", ack_q_bit_idx, H_prime_total, N_pusch_symbs); @@ -389,7 +385,6 @@ static int uci_ulsch_interleave_ri_gen(uint32_t ri_q_bit_idx, uint32_t N_pusch_symbs, srslte_uci_bit_t* ri_bits) { - static uint32_t ri_column_set_norm[4] = {1, 4, 7, 10}; static uint32_t ri_column_set_ext[4] = {0, 3, 5, 8}; @@ -403,7 +398,7 @@ static int uci_ulsch_interleave_ri_gen(uint32_t ri_q_bit_idx, } return SRSLTE_SUCCESS; } else { - ERROR("Error interleaving UCI-RI bit idx %d for H_prime_total=%d and N_pusch_symbs=%d\n", + ERROR("Error interleaving UCI-RI bit idx %d for H_prime_total=%d and N_pusch_symbs=%d", ri_q_bit_idx, H_prime_total, N_pusch_symbs); @@ -413,9 +408,8 @@ static int uci_ulsch_interleave_ri_gen(uint32_t ri_q_bit_idx, static uint32_t Q_prime_ri_ack(srslte_pusch_cfg_t* cfg, uint32_t O, uint32_t O_cqi, float beta) { - if (beta < 0) { - ERROR("Error beta is reserved\n"); + ERROR("Error beta is reserved"); return -1; } @@ -483,7 +477,7 @@ encode_ack_long(const uint8_t* data, uint32_t O_ack, uint8_t Q_m, uint32_t Q_pri uint32_t Q_ack = Q_m * Q_prime; if (O_ack > SRSLTE_UCI_MAX_ACK_BITS) { - ERROR("Error encoding long ACK bits: O_ack can't be higher than %d\n", SRSLTE_UCI_MAX_ACK_BITS); + ERROR("Error encoding long ACK bits: O_ack can't be higher than %d", SRSLTE_UCI_MAX_ACK_BITS); return 0; } @@ -584,7 +578,7 @@ int srslte_uci_encode_ack_ri(srslte_pusch_cfg_t* cfg, srslte_uci_bit_t* bits) { if (beta < 0) { - ERROR("Error beta is reserved\n"); + ERROR("Error beta is reserved"); return -1; } uint32_t Q_prime = Q_prime_ri_ack(cfg, O_ack, O_cqi, beta); @@ -639,7 +633,7 @@ int srslte_uci_decode_ack_ri(srslte_pusch_cfg_t* cfg, bool is_ri) { if (beta < 0) { - ERROR("Error beta (%f) is reserved\n", beta); + ERROR("Error beta (%f) is reserved", beta); return SRSLTE_ERROR; } @@ -733,7 +727,6 @@ int srslte_uci_data_info(srslte_uci_cfg_t* uci_cfg, srslte_uci_value_t* uci_data if (nof_acks) { n = srslte_print_check(str, str_len, n, ", ack="); if (uci_data->ack.valid) { - for (uint32_t i = 0; i < nof_acks; i++) { n = srslte_print_check(str, str_len, n, "%d", uci_data->ack.ack_value[i]); } diff --git a/lib/src/phy/phch/uci_nr.c b/lib/src/phy/phch/uci_nr.c index cd72c71e1..dfaae96dc 100644 --- a/lib/src/phy/phch/uci_nr.c +++ b/lib/src/phy/phch/uci_nr.c @@ -49,63 +49,63 @@ int srslte_uci_nr_init(srslte_uci_nr_t* q, const srslte_uci_nr_args_t* args) #endif // LV_HAVE_AVX2 if (srslte_polar_code_init(&q->code)) { - ERROR("Initialising polar code\n"); + ERROR("Initialising polar code"); return SRSLTE_ERROR; } if (srslte_polar_encoder_init(&q->encoder, polar_encoder_type, NMAX_LOG) < SRSLTE_SUCCESS) { - ERROR("Initialising polar encoder\n"); + ERROR("Initialising polar encoder"); return SRSLTE_ERROR; } if (srslte_polar_decoder_init(&q->decoder, polar_decoder_type, NMAX_LOG) < SRSLTE_SUCCESS) { - ERROR("Initialising polar encoder\n"); + ERROR("Initialising polar encoder"); return SRSLTE_ERROR; } if (srslte_polar_rm_tx_init(&q->rm_tx) < SRSLTE_SUCCESS) { - ERROR("Initialising polar RM\n"); + ERROR("Initialising polar RM"); return SRSLTE_ERROR; } if (srslte_polar_rm_rx_init_c(&q->rm_rx) < SRSLTE_SUCCESS) { - ERROR("Initialising polar RM\n"); + ERROR("Initialising polar RM"); return SRSLTE_ERROR; } if (srslte_crc_init(&q->crc6, SRSLTE_LTE_CRC6, 6) < SRSLTE_SUCCESS) { - ERROR("Initialising CRC\n"); + ERROR("Initialising CRC"); return SRSLTE_ERROR; } if (srslte_crc_init(&q->crc11, SRSLTE_LTE_CRC11, 11) < SRSLTE_SUCCESS) { - ERROR("Initialising CRC\n"); + ERROR("Initialising CRC"); return SRSLTE_ERROR; } // Allocate bit sequence with space for the CRC q->bit_sequence = srslte_vec_u8_malloc(UCI_NR_MAX_A); if (q->bit_sequence == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); return SRSLTE_ERROR; } // Allocate c with space for a and the CRC q->c = srslte_vec_u8_malloc(UCI_NR_MAX_A + UCI_NR_MAX_L); if (q->c == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); return SRSLTE_ERROR; } q->allocated = srslte_vec_u8_malloc(UCI_NR_POLAR_MAX); if (q->allocated == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); return SRSLTE_ERROR; } q->d = srslte_vec_u8_malloc(UCI_NR_POLAR_MAX); if (q->d == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); return SRSLTE_ERROR; } @@ -195,12 +195,12 @@ static int uci_nr_A(const srslte_uci_cfg_nr_t* cfg) // 6.3.1.1.2 CSI only if (cfg->o_ack == 0 && cfg->o_sr == 0) { - ERROR("CSI only are not implemented\n"); + ERROR("CSI only are not implemented"); return SRSLTE_ERROR; } // 6.3.1.1.3 HARQ-ACK/SR and CSI - ERROR("HARQ-ACK/SR and CSI encoding are not implemented\n"); + ERROR("HARQ-ACK/SR and CSI encoding are not implemented"); return SRSLTE_ERROR; } @@ -213,12 +213,12 @@ static int uci_nr_packing(const srslte_uci_cfg_nr_t* cfg, const srslte_uci_value // 6.3.1.1.2 CSI only if (cfg->o_ack == 0 && cfg->o_sr == 0) { - ERROR("CSI only are not implemented\n"); + ERROR("CSI only are not implemented"); return SRSLTE_ERROR; } // 6.3.1.1.3 HARQ-ACK/SR and CSI - ERROR("HARQ-ACK/SR and CSI encoding are not implemented\n"); + ERROR("HARQ-ACK/SR and CSI encoding are not implemented"); return SRSLTE_ERROR; } @@ -231,12 +231,12 @@ static int uci_nr_unpacking(const srslte_uci_cfg_nr_t* cfg, const uint8_t* seque // 6.3.1.1.2 CSI only if (cfg->o_ack == 0 && cfg->o_sr == 0) { - ERROR("CSI only are not implemented\n"); + ERROR("CSI only are not implemented"); return SRSLTE_ERROR; } // 6.3.1.1.3 HARQ-ACK/SR and CSI - ERROR("HARQ-ACK/SR and CSI encoding are not implemented\n"); + ERROR("HARQ-ACK/SR and CSI encoding are not implemented"); return SRSLTE_ERROR; } @@ -291,7 +291,7 @@ static int uci_nr_encode_1bit(srslte_uci_nr_t* q, const srslte_uci_cfg_nr_t* cfg break; case SRSLTE_MOD_NITEMS: default: - ERROR("Invalid modulation\n"); + ERROR("Invalid modulation"); return SRSLTE_ERROR; } @@ -306,7 +306,6 @@ static int uci_nr_encode_2bit(srslte_uci_nr_t* q, const srslte_uci_cfg_nr_t* cfg srslte_uci_bit_type_t c2 = ((q->bit_sequence[0] ^ q->bit_sequence[1]) == 0) ? UCI_BIT_0 : UCI_BIT_1; switch (cfg->modulation) { - case SRSLTE_MOD_BPSK: case SRSLTE_MOD_QPSK: while (i < E) { @@ -384,7 +383,7 @@ static int uci_nr_encode_2bit(srslte_uci_nr_t* q, const srslte_uci_cfg_nr_t* cfg break; case SRSLTE_MOD_NITEMS: default: - ERROR("Invalid modulation\n"); + ERROR("Invalid modulation"); return SRSLTE_ERROR; } @@ -417,7 +416,7 @@ static int uci_nr_decode_3_11_bit(srslte_uci_nr_t* q, } if (A == 11 && E <= 16) { - ERROR("NR-UCI Impossible to decode A=%d; E=%d\n", A, E); + ERROR("NR-UCI Impossible to decode A=%d; E=%d", A, E); return SRSLTE_ERROR; } @@ -439,7 +438,7 @@ static int uci_nr_decode_3_11_bit(srslte_uci_nr_t* q, if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { UCI_NR_INFO_RX("Block decoding NR-UCI llr="); srslte_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\n", + UCI_NR_INFO_RX("Block decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s", A, E, pwr, @@ -499,7 +498,7 @@ uci_nr_encode_11_1706_bit(srslte_uci_nr_t* q, const srslte_uci_cfg_nr_t* cfg, ui // Attach CRC srslte_crc_attach(crc, q->c, A_prime / C); - UCI_NR_INFO_TX("Attaching %d/%d CRC%d=%02lx\n", r, C, L, srslte_crc_checksum_get(crc)); + UCI_NR_INFO_TX("Attaching %d/%d CRC%d=%02lx", r, C, L, srslte_crc_checksum_get(crc)); if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { UCI_NR_INFO_TX("Polar cb %d/%d c=", r, C); @@ -606,7 +605,7 @@ static int uci_nr_decode_11_1706_bit(srslte_uci_nr_t* q, uint32_t checksum1 = srslte_crc_checksum(crc, q->c, A_prime / C); uint32_t checksum2 = srslte_bit_pack(&ptr, L); (*decoded_ok) = ((*decoded_ok) && (checksum1 == checksum2)); - UCI_NR_INFO_RX("Checking %d/%d CRC%d={%02x,%02x}\n", r, C, L, checksum1, checksum2); + UCI_NR_INFO_RX("Checking %d/%d CRC%d={%02x,%02x}", r, C, L, checksum1, checksum2); // Prefix (A_prime - A) zeros for the first CB only if (r == 0) { @@ -677,15 +676,15 @@ static int uci_nr_decode(srslte_uci_nr_t* q, // 6.3.1.1 UCI bit sequence generation int A = uci_nr_A(uci_cfg); if (A < SRSLTE_SUCCESS) { - ERROR("Error getting number of bits\n"); + ERROR("Error getting number of bits"); return SRSLTE_ERROR; } // Decode LLR if (A == 1) { - ERROR("Not implemented\n"); + ERROR("Not implemented"); } else if (A == 2) { - ERROR("Not implemented\n"); + ERROR("Not implemented"); } else if (A <= 11) { if (uci_nr_decode_3_11_bit(q, uci_cfg, A, llr, E_uci, &uci_value->valid) < SRSLTE_SUCCESS) { return SRSLTE_ERROR; @@ -695,7 +694,7 @@ static int uci_nr_decode(srslte_uci_nr_t* q, return SRSLTE_ERROR; } } else { - ERROR("Invalid number of bits (A=%d)\n", A); + ERROR("Invalid number of bits (A=%d)", A); } // Unpack bits @@ -722,7 +721,7 @@ int srslte_uci_nr_pucch_format_2_3_4_E(const srslte_pucch_nr_resource_t* resourc return (int)(12 * resource->nof_symbols * resource->nof_prb); case SRSLTE_PUCCH_NR_FORMAT_4: if (resource->occ_lenth != 1 && resource->occ_lenth != 2) { - ERROR("Invalid spreading factor (%d)\n", resource->occ_lenth); + ERROR("Invalid spreading factor (%d)", resource->occ_lenth); return SRSLTE_ERROR; } if (!resource->enable_pi_bpsk) { @@ -730,7 +729,7 @@ int srslte_uci_nr_pucch_format_2_3_4_E(const srslte_pucch_nr_resource_t* resourc } return (int)(12 * resource->nof_symbols / resource->occ_lenth); default: - ERROR("Invalid case\n"); + ERROR("Invalid case"); } return SRSLTE_ERROR; } @@ -740,7 +739,7 @@ static int uci_nr_pucch_E_uci(const srslte_pucch_nr_resource_t* pucch_cfg, const srslte_uci_cfg_nr_t* uci_cfg, uint32_t E_tot) { if (uci_cfg->o_csi1 != 0 && uci_cfg->o_csi2) { - ERROR("Simultaneous CSI part 1 and CSI part 2 is not implemented\n"); + ERROR("Simultaneous CSI part 1 and CSI part 2 is not implemented"); return SRSLTE_ERROR; } @@ -755,13 +754,13 @@ int srslte_uci_nr_encode_pucch(srslte_uci_nr_t* q, { int E_tot = srslte_uci_nr_pucch_format_2_3_4_E(pucch_resource_cfg); if (E_tot < SRSLTE_SUCCESS) { - ERROR("Error calculating number of bits\n"); + ERROR("Error calculating number of bits"); return SRSLTE_ERROR; } int E_uci = uci_nr_pucch_E_uci(pucch_resource_cfg, uci_cfg, E_tot); if (E_uci < SRSLTE_SUCCESS) { - ERROR("Error calculating number of bits\n"); + ERROR("Error calculating number of bits"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/resampling/interp.c b/lib/src/phy/resampling/interp.c index 7af32045c..c7fa6750c 100644 --- a/lib/src/phy/resampling/interp.c +++ b/lib/src/phy/resampling/interp.c @@ -111,7 +111,7 @@ int srslte_interp_linear_vector_resize(srslte_interp_linsrslte_vec_t* q, uint32_ q->vector_len = vector_len; return SRSLTE_SUCCESS; } else { - ERROR("Error resizing interp_linear: vector_len must be lower or equal than initialized\n"); + ERROR("Error resizing interp_linear: vector_len must be lower or equal than initialized"); return SRSLTE_ERROR; } } @@ -233,7 +233,6 @@ void srslte_interp_linear_free(srslte_interp_lin_t* q) int srslte_interp_linear_resize(srslte_interp_lin_t* q, uint32_t vector_len, uint32_t M) { if (vector_len <= q->max_vector_len && M <= q->max_M) { - for (int i = 0; i < M; i++) { q->ramp[i] = (float)i; } @@ -242,7 +241,7 @@ int srslte_interp_linear_resize(srslte_interp_lin_t* q, uint32_t vector_len, uin q->M = M; return SRSLTE_SUCCESS; } else { - ERROR("Error resizing interp_linear: vector_len and M must be lower or equal than initialized\n"); + ERROR("Error resizing interp_linear: vector_len and M must be lower or equal than initialized"); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/resampling/resampler.c b/lib/src/phy/resampling/resampler.c index 669749912..b1ddf3955 100644 --- a/lib/src/phy/resampling/resampler.c +++ b/lib/src/phy/resampling/resampler.c @@ -90,14 +90,14 @@ int srslte_resampler_fft_init(srslte_resampler_fft_t* q, srslte_resampler_mode_t int err = srslte_dft_plan_guru_c(&q->fft, input_fft_size, SRSLTE_DFT_FORWARD, q->in_buffer, q->out_buffer, 1, 1, 1, 1, 1); if (err != SRSLTE_SUCCESS) { - ERROR("Initialising DFT\n"); + ERROR("Initialising DFT"); return err; } err = srslte_dft_plan_guru_c( &q->ifft, output_fft_size, SRSLTE_DFT_BACKWARD, q->in_buffer, q->out_buffer, 1, 1, 1, 1, 1); if (err != SRSLTE_SUCCESS) { - ERROR("Initialising DFT\n"); + ERROR("Initialising DFT"); return err; } diff --git a/lib/src/phy/rf/rf_blade_imp.c b/lib/src/phy/rf/rf_blade_imp.c index 41aaf585b..b55870f87 100644 --- a/lib/src/phy/rf/rf_blade_imp.c +++ b/lib/src/phy/rf/rf_blade_imp.c @@ -69,12 +69,12 @@ int rf_blade_start_tx_stream(void* h) num_transfers, timeout_ms); if (status != 0) { - ERROR("Failed to configure TX sync interface: %s\n", bladerf_strerror(status)); + ERROR("Failed to configure TX sync interface: %s", bladerf_strerror(status)); return status; } status = bladerf_enable_module(handler->dev, BLADERF_TX_X1, true); if (status != 0) { - ERROR("Failed to enable TX module: %s\n", bladerf_strerror(status)); + ERROR("Failed to enable TX module: %s", bladerf_strerror(status)); return status; } handler->tx_stream_enabled = true; @@ -98,7 +98,7 @@ int rf_blade_start_rx_stream(void* h, UNUSED bool now) num_transfers, timeout_ms); if (status != 0) { - ERROR("Failed to configure RX sync interface: %s\n", bladerf_strerror(status)); + ERROR("Failed to configure RX sync interface: %s", bladerf_strerror(status)); return status; } status = bladerf_sync_config(handler->dev, @@ -109,17 +109,17 @@ int rf_blade_start_rx_stream(void* h, UNUSED bool now) num_transfers, timeout_ms); if (status != 0) { - ERROR("Failed to configure TX sync interface: %s\n", bladerf_strerror(status)); + ERROR("Failed to configure TX sync interface: %s", bladerf_strerror(status)); return status; } status = bladerf_enable_module(handler->dev, BLADERF_RX_X1, true); if (status != 0) { - ERROR("Failed to enable RX module: %s\n", bladerf_strerror(status)); + ERROR("Failed to enable RX module: %s", bladerf_strerror(status)); return status; } status = bladerf_enable_module(handler->dev, BLADERF_TX_X1, true); if (status != 0) { - ERROR("Failed to enable TX module: %s\n", bladerf_strerror(status)); + ERROR("Failed to enable TX module: %s", bladerf_strerror(status)); return status; } handler->rx_stream_enabled = true; @@ -131,12 +131,12 @@ int rf_blade_stop_rx_stream(void* h) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; int status = bladerf_enable_module(handler->dev, BLADERF_RX_X1, false); if (status != 0) { - ERROR("Failed to enable RX module: %s\n", bladerf_strerror(status)); + ERROR("Failed to enable RX module: %s", bladerf_strerror(status)); return status; } status = bladerf_enable_module(handler->dev, BLADERF_TX_X1, false); if (status != 0) { - ERROR("Failed to enable TX module: %s\n", bladerf_strerror(status)); + ERROR("Failed to enable TX module: %s", bladerf_strerror(status)); return status; } handler->rx_stream_enabled = false; @@ -177,13 +177,13 @@ int rf_blade_open(char* args, void** h) printf("Opening bladeRF...\n"); int status = bladerf_open(&handler->dev, args); if (status) { - ERROR("Unable to open device: %s\n", bladerf_strerror(status)); + ERROR("Unable to open device: %s", bladerf_strerror(status)); goto clean_exit; } status = bladerf_set_gain_mode(handler->dev, BLADERF_RX_X1, BLADERF_GAIN_MGC); if (status) { - ERROR("Unable to open device: %s\n", bladerf_strerror(status)); + ERROR("Unable to open device: %s", bladerf_strerror(status)); goto clean_exit; } @@ -192,19 +192,19 @@ int rf_blade_open(char* args, void** h) /* Get Gain ranges and set Rx to maximum */ status = bladerf_get_gain_range(handler->dev, BLADERF_RX_X1, &range_rx); if ((status != 0) || (range_rx == NULL)) { - ERROR("Failed to get RX gain range: %s\n", bladerf_strerror(status)); + ERROR("Failed to get RX gain range: %s", bladerf_strerror(status)); goto clean_exit; } status = bladerf_get_gain_range(handler->dev, BLADERF_TX_X1, &range_tx); if ((status != 0) || (range_tx == NULL)) { - ERROR("Failed to get TX gain range: %s\n", bladerf_strerror(status)); + ERROR("Failed to get TX gain range: %s", bladerf_strerror(status)); goto clean_exit; } status = bladerf_set_gain(handler->dev, BLADERF_RX_X1, (bladerf_gain)range_rx->max); if (status != 0) { - ERROR("Failed to set RX LNA gain: %s\n", bladerf_strerror(status)); + ERROR("Failed to set RX LNA gain: %s", bladerf_strerror(status)); goto clean_exit; } handler->rx_stream_enabled = false; @@ -240,19 +240,19 @@ double rf_blade_set_rx_srate(void* h, double freq) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; int status = bladerf_set_sample_rate(handler->dev, BLADERF_RX_X1, (uint32_t)freq, &handler->rx_rate); if (status != 0) { - ERROR("Failed to set samplerate = %u: %s\n", (uint32_t)freq, bladerf_strerror(status)); + ERROR("Failed to set samplerate = %u: %s", (uint32_t)freq, bladerf_strerror(status)); return -1; } if (handler->rx_rate < 2000000) { status = bladerf_set_bandwidth(handler->dev, BLADERF_RX_X1, handler->rx_rate, &bw); if (status != 0) { - ERROR("Failed to set bandwidth = %u: %s\n", handler->rx_rate, bladerf_strerror(status)); + ERROR("Failed to set bandwidth = %u: %s", handler->rx_rate, bladerf_strerror(status)); return -1; } } else { status = bladerf_set_bandwidth(handler->dev, BLADERF_RX_X1, (bladerf_bandwidth)(handler->rx_rate * 0.8), &bw); if (status != 0) { - ERROR("Failed to set bandwidth = %u: %s\n", handler->rx_rate, bladerf_strerror(status)); + ERROR("Failed to set bandwidth = %u: %s", handler->rx_rate, bladerf_strerror(status)); return -1; } } @@ -266,12 +266,12 @@ double rf_blade_set_tx_srate(void* h, double freq) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; int status = bladerf_set_sample_rate(handler->dev, BLADERF_TX_X1, (uint32_t)freq, &handler->tx_rate); if (status != 0) { - ERROR("Failed to set samplerate = %u: %s\n", (uint32_t)freq, bladerf_strerror(status)); + ERROR("Failed to set samplerate = %u: %s", (uint32_t)freq, bladerf_strerror(status)); return -1; } status = bladerf_set_bandwidth(handler->dev, BLADERF_TX_X1, handler->tx_rate, &bw); if (status != 0) { - ERROR("Failed to set bandwidth = %u: %s\n", handler->tx_rate, bladerf_strerror(status)); + ERROR("Failed to set bandwidth = %u: %s", handler->tx_rate, bladerf_strerror(status)); return -1; } return (double)handler->tx_rate; @@ -283,7 +283,7 @@ int rf_blade_set_rx_gain(void* h, double gain) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; status = bladerf_set_gain(handler->dev, BLADERF_RX_X1, (bladerf_gain)gain); if (status != 0) { - ERROR("Failed to set RX gain: %s\n", bladerf_strerror(status)); + ERROR("Failed to set RX gain: %s", bladerf_strerror(status)); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -300,7 +300,7 @@ int rf_blade_set_tx_gain(void* h, double gain) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; status = bladerf_set_gain(handler->dev, BLADERF_TX_X1, (bladerf_gain)gain); if (status != 0) { - ERROR("Failed to set TX gain: %s\n", bladerf_strerror(status)); + ERROR("Failed to set TX gain: %s", bladerf_strerror(status)); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -318,7 +318,7 @@ double rf_blade_get_rx_gain(void* h) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; status = bladerf_get_gain(handler->dev, BLADERF_RX_X1, &gain); if (status != 0) { - ERROR("Failed to get RX gain: %s\n", bladerf_strerror(status)); + ERROR("Failed to get RX gain: %s", bladerf_strerror(status)); return -1; } return gain; @@ -331,7 +331,7 @@ double rf_blade_get_tx_gain(void* h) rf_blade_handler_t* handler = (rf_blade_handler_t*)h; status = bladerf_get_gain(handler->dev, BLADERF_TX_X1, &gain); if (status != 0) { - ERROR("Failed to get TX gain: %s\n", bladerf_strerror(status)); + ERROR("Failed to get TX gain: %s", bladerf_strerror(status)); return -1; } return gain; @@ -339,7 +339,6 @@ double rf_blade_get_tx_gain(void* h) srslte_rf_info_t* rf_blade_get_info(void* h) { - srslte_rf_info_t* info = NULL; if (h) { @@ -356,7 +355,7 @@ double rf_blade_set_rx_freq(void* h, UNUSED uint32_t ch, double freq) bladerf_frequency f_int = (uint32_t)round(freq); int status = bladerf_set_frequency(handler->dev, BLADERF_RX_X1, f_int); if (status != 0) { - ERROR("Failed to set samplerate = %u: %s\n", (uint32_t)freq, bladerf_strerror(status)); + ERROR("Failed to set samplerate = %u: %s", (uint32_t)freq, bladerf_strerror(status)); return -1; } f_int = 0; @@ -372,7 +371,7 @@ double rf_blade_set_tx_freq(void* h, UNUSED uint32_t ch, double freq) bladerf_frequency f_int = (uint32_t)round(freq); int status = bladerf_set_frequency(handler->dev, BLADERF_TX_X1, f_int); if (status != 0) { - ERROR("Failed to set samplerate = %u: %s\n", (uint32_t)freq, bladerf_strerror(status)); + ERROR("Failed to set samplerate = %u: %s", (uint32_t)freq, bladerf_strerror(status)); return -1; } @@ -401,7 +400,7 @@ void rf_blade_get_time(void* h, time_t* secs, double* frac_secs) int status = bladerf_get_timestamp(handler->dev, BLADERF_RX, &meta.timestamp); if (status != 0) { - ERROR("Failed to get current RX timestamp: %s\n", bladerf_strerror(status)); + ERROR("Failed to get current RX timestamp: %s", bladerf_strerror(status)); } timestamp_to_secs(handler->rx_rate, meta.timestamp, secs, frac_secs); } @@ -431,12 +430,12 @@ int rf_blade_recv_with_time(void* h, meta.flags = BLADERF_META_FLAG_RX_NOW; if (2 * nsamples > CONVERT_BUFFER_SIZE) { - ERROR("RX failed: nsamples exceeds buffer size (%d>%d)\n", nsamples, CONVERT_BUFFER_SIZE); + ERROR("RX failed: nsamples exceeds buffer size (%d>%d)", nsamples, CONVERT_BUFFER_SIZE); return -1; } status = bladerf_sync_rx(handler->dev, handler->rx_buffer, nsamples, &meta, 2000); if (status) { - ERROR("RX failed: %s; nsamples=%d;\n", bladerf_strerror(status), nsamples); + ERROR("RX failed: %s; nsamples=%d;", bladerf_strerror(status), nsamples); return -1; } else if (meta.status & BLADERF_META_STATUS_OVERRUN) { if (blade_error_handler) { @@ -446,7 +445,7 @@ int rf_blade_recv_with_time(void* h, blade_error_handler(blade_error_handler_arg, error); } else { /*ERROR("Overrun detected in scheduled RX. " - "%u valid samples were read.\n\n", meta.actual_count);*/ + "%u valid samples were read.", meta.actual_count);*/ } } @@ -489,7 +488,7 @@ int rf_blade_send_timed(void* h, } if (2 * nsamples > CONVERT_BUFFER_SIZE) { - ERROR("TX failed: nsamples exceeds buffer size (%d>%d)\n", nsamples, CONVERT_BUFFER_SIZE); + ERROR("TX failed: nsamples exceeds buffer size (%d>%d)", nsamples, CONVERT_BUFFER_SIZE); return -1; } @@ -518,17 +517,17 @@ int rf_blade_send_timed(void* h, error.type = SRSLTE_RF_ERROR_LATE; blade_error_handler(blade_error_handler_arg, error); } else { - ERROR("TX failed: %s\n", bladerf_strerror(status)); + ERROR("TX failed: %s", bladerf_strerror(status)); } } else if (status) { - ERROR("TX failed: %s\n", bladerf_strerror(status)); + ERROR("TX failed: %s", bladerf_strerror(status)); return status; } else if (meta.status == BLADERF_META_STATUS_UNDERRUN) { if (blade_error_handler) { error.type = SRSLTE_RF_ERROR_UNDERFLOW; blade_error_handler(blade_error_handler_arg, error); } else { - ERROR("TX warning: underflow detected.\n"); + ERROR("TX warning: underflow detected."); } } diff --git a/lib/src/phy/rf/rf_imp.c b/lib/src/phy/rf/rf_imp.c index a7138f834..f24c4bf1f 100644 --- a/lib/src/phy/rf/rf_imp.c +++ b/lib/src/phy/rf/rf_imp.c @@ -117,7 +117,7 @@ int srslte_rf_open_devname(srslte_rf_t* rf, const char* devname, char* args, uin } i++; } - ERROR("No compatible RF frontend found\n"); + ERROR("No compatible RF frontend found"); return -1; } @@ -300,7 +300,6 @@ int srslte_rf_send_timed3(srslte_rf_t* rf, bool is_start_of_burst, bool is_end_of_burst) { - return ((rf_dev_t*)rf->dev) ->srslte_rf_send_timed( rf->handler, data, nsamples, secs, frac_secs, has_time_spec, blocking, is_start_of_burst, is_end_of_burst); @@ -315,7 +314,6 @@ int srslte_rf_send_timed_multi(srslte_rf_t* rf, bool is_start_of_burst, bool is_end_of_burst) { - return ((rf_dev_t*)rf->dev) ->srslte_rf_send_timed_multi( rf->handler, data, nsamples, secs, frac_secs, true, blocking, is_start_of_burst, is_end_of_burst); @@ -328,7 +326,6 @@ int srslte_rf_send_multi(srslte_rf_t* rf, bool is_start_of_burst, bool is_end_of_burst) { - return ((rf_dev_t*)rf->dev) ->srslte_rf_send_timed_multi( rf->handler, data, nsamples, 0, 0, false, blocking, is_start_of_burst, is_end_of_burst); diff --git a/lib/src/phy/rf/rf_soapy_imp.c b/lib/src/phy/rf/rf_soapy_imp.c index a9facf4f5..206ba0010 100644 --- a/lib/src/phy/rf/rf_soapy_imp.c +++ b/lib/src/phy/rf/rf_soapy_imp.c @@ -127,10 +127,10 @@ static void* async_thread(void* h) // this is a timeout of the readStreamStatus call, ignoring it .. } else if (ret == SOAPY_SDR_NOT_SUPPORTED) { // stopping async thread - ERROR("Receiving async metadata not supported by device. Exiting thread.\n"); + ERROR("Receiving async metadata not supported by device. Exiting thread."); handler->async_thread_running = false; } else { - ERROR("Error while receiving aync metadata: %s (%d), flags=%d, channel=%zu, timeNs=%lld\n", + ERROR("Error while receiving aync metadata: %s (%d), flags=%d, channel=%zu, timeNs=%lld", SoapySDR_errToStr(ret), ret, flags, @@ -276,7 +276,7 @@ float rf_soapy_get_rssi(void* h) int rf_soapy_open_multi(char* args, void** h, uint32_t num_requested_channels) { - size_t length; + size_t length; // Let Soapy pick the device if no arguments are passed SoapySDRKwargs* soapy_args = @@ -317,7 +317,7 @@ int rf_soapy_open_multi(char* args, void** h, uint32_t num_requested_channels) copy_subdev_string(dev_str, dev_ptr + strnlen(dev_arg, 64)); dev_id = strtol(dev_str, NULL, 0); if (dev_id < 0 || dev_id > 10) { - ERROR("Failed to set device. Using 0 as default.\n"); + ERROR("Failed to set device. Using 0 as default."); dev_id = 0; } remove_substring(args, dev_arg); @@ -460,7 +460,7 @@ int rf_soapy_open_multi(char* args, void** h, uint32_t num_requested_channels) for (int i = 0; i < handler->num_rx_channels; i++) { printf("Setting Rx channel %d antenna to %s\n", i, rx_ant_str); if (SoapySDRDevice_setAntenna(handler->device, SOAPY_SDR_RX, i, rx_ant_str) != 0) { - ERROR("Failed to set Rx antenna for channel %d.\n", i); + ERROR("Failed to set Rx antenna for channel %d.", i); } } remove_substring(args, rx_ant_arg); @@ -476,7 +476,7 @@ int rf_soapy_open_multi(char* args, void** h, uint32_t num_requested_channels) for (int i = 0; i < handler->num_rx_channels; i++) { printf("Setting Tx channel %d antenna to %s\n", i, tx_ant_str); if (SoapySDRDevice_setAntenna(handler->device, SOAPY_SDR_TX, i, tx_ant_str) != 0) { - ERROR("Failed to set Tx antenna for channel %d.\n", i); + ERROR("Failed to set Tx antenna for channel %d.", i); } } remove_substring(args, tx_ant_arg); @@ -974,7 +974,7 @@ int rf_soapy_send_timed_multi(void* h, printf("U"); break; default: - ERROR("Error during writeStream\n"); + ERROR("Error during writeStream"); exit(-1); return SRSLTE_ERROR; } @@ -983,7 +983,7 @@ int rf_soapy_send_timed_multi(void* h, } while (n < nsamples && trials < 100); if (n != nsamples) { - ERROR("Couldn't write all samples after %d trials.\n", trials); + ERROR("Couldn't write all samples after %d trials.", trials); } return n; diff --git a/lib/src/phy/rf/rf_uhd_imp.cc b/lib/src/phy/rf/rf_uhd_imp.cc index df20fd1c4..2565a49ed 100644 --- a/lib/src/phy/rf/rf_uhd_imp.cc +++ b/lib/src/phy/rf/rf_uhd_imp.cc @@ -170,7 +170,7 @@ static cf_t zero_mem[64 * 1024] = {}; #define print_usrp_error(h) \ do { \ - ERROR("USRP reported the following error: %s\n", h->uhd->last_error.c_str()); \ + ERROR("USRP reported the following error: %s", h->uhd->last_error.c_str()); \ } while (false) static void log_overflow(rf_uhd_handler_t* h) @@ -221,7 +221,7 @@ static void log_underflow(rf_uhd_handler_t* h) static void log_rx_error(rf_uhd_handler_t* h) { if (h->uhd_error_handler) { - ERROR("USRP reported the following error: %s\n", h->uhd->last_error.c_str()); + ERROR("USRP reported the following error: %s", h->uhd->last_error.c_str()); srslte_rf_error_t error; bzero(&error, sizeof(srslte_rf_error_t)); @@ -265,7 +265,7 @@ static void* async_thread(void* h) handler->tx_state = RF_UHD_IMP_TX_STATE_START_BURST; } } else { - ERROR("UHD unhandled event code %d\n", event_code); + ERROR("UHD unhandled event code %d", event_code); } } else { std::this_thread::sleep_for(RF_UHD_IMP_ASYNCH_MSG_SLEEP_MS); @@ -357,7 +357,7 @@ static int set_time_to_gps_time(rf_uhd_handler_t* handler) // No sensor found if (not found) { - ERROR("Sensor '%s` not found.\n", sensor_name.c_str()); + ERROR("Sensor '%s` not found.", sensor_name.c_str()); return UHD_ERROR_NONE; } @@ -418,7 +418,7 @@ static int wait_sensor_locked(rf_uhd_handler_t* handler, // No sensor found if (not found) { - ERROR("Sensor '%s` not found.\n", sensor_name.c_str()); + ERROR("Sensor '%s` not found.", sensor_name.c_str()); return UHD_ERROR_NONE; } @@ -462,7 +462,7 @@ bool rf_uhd_rx_wait_lo_locked(void* h) int error = wait_sensor_locked(handler, sensor_name, false, 300, is_locked); if (not is_locked and error == SRSLTE_SUCCESS) { - ERROR("Could not lock reference clock source. Sensor: %s=%s\n", sensor_name.c_str(), is_locked ? "true" : "false"); + ERROR("Could not lock reference clock source. Sensor: %s=%s", sensor_name.c_str(), is_locked ? "true" : "false"); } return is_locked; @@ -568,7 +568,7 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels) } if (nof_channels > SRSLTE_MAX_CHANNELS) { - ERROR("Error opening UHD: maximum number of channels exceeded (%d>%d)\n", nof_channels, SRSLTE_MAX_CHANNELS); + ERROR("Error opening UHD: maximum number of channels exceeded (%d>%d)", nof_channels, SRSLTE_MAX_CHANNELS); return SRSLTE_ERROR; } @@ -1212,7 +1212,7 @@ int rf_uhd_recv_with_time_multi(void* h, } else if (error_code == uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND) { log_late(handler, true); } else if (error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) { - ERROR("Error timed out while receiving samples from UHD.\n"); + ERROR("Error timed out while receiving samples from UHD."); if (RF_UHD_IMP_PROHIBITED_STOP_START.count(handler->devname) == 0) { // Stop Rx stream @@ -1221,8 +1221,8 @@ int rf_uhd_recv_with_time_multi(void* h, return -1; } else if (error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) { - ERROR("Error %s was returned during streaming. Aborting.\n", md.to_pp_string(true).c_str()); - INFO("Error %s was returned during streaming. Aborting.\n", md.to_pp_string(true).c_str()); + ERROR("Error %s was returned during streaming. Aborting.", md.to_pp_string(true).c_str()); + INFO("Error %s was returned during streaming. Aborting.", md.to_pp_string(true).c_str()); } } diff --git a/lib/src/phy/rf/rf_utils.c b/lib/src/phy/rf/rf_utils.c index 346191444..152561910 100644 --- a/lib/src/phy/rf/rf_utils.c +++ b/lib/src/phy/rf/rf_utils.c @@ -72,7 +72,7 @@ free_and_exit: int srslte_rf_recv_wrapper_cs(void* h, cf_t* data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) { - DEBUG(" ---- Receive %d samples ---- \n", nsamples); + DEBUG(" ---- Receive %d samples ----", nsamples); void* ptr[SRSLTE_MAX_CHANNELS] = {}; for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { ptr[i] = data[i]; @@ -104,15 +104,15 @@ int rf_mib_decoder(srslte_rf_t* rf, } if (srslte_ue_mib_sync_set_cell(&ue_mib, *cell)) { - ERROR("Error initiating srslte_ue_mib_sync\n"); + ERROR("Error initiating srslte_ue_mib_sync"); goto clean_exit; } int srate = srslte_sampling_freq_hz(SRSLTE_UE_MIB_NOF_PRB); - INFO("Setting sampling frequency %.2f MHz for PSS search\n", (float)srate / 1000000); + INFO("Setting sampling frequency %.2f MHz for PSS search", (float)srate / 1000000); srslte_rf_set_rx_srate(rf, (float)srate); - INFO("Starting receiver...\n"); + INFO("Starting receiver..."); srslte_rf_start_rx_stream(rf, false); // Copy CFO estimate if provided and disable CP estimation during find @@ -126,7 +126,7 @@ int rf_mib_decoder(srslte_rf_t* rf, /* Find and decode MIB */ ret = srslte_ue_mib_sync_decode(&ue_mib, config->max_frames_pbch, bch_payload, &cell->nof_ports, NULL); if (ret < 0) { - ERROR("Error decoding MIB\n"); + ERROR("Error decoding MIB"); goto clean_exit; } if (ret == 1) { @@ -170,10 +170,10 @@ int rf_cell_search(srslte_rf_t* rf, srslte_ue_cellsearch_set_nof_valid_frames(&cs, config->nof_valid_pss_frames); } - INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ / 1000000); + INFO("Setting sampling frequency %.2f MHz for PSS search", SRSLTE_CS_SAMP_FREQ / 1000000); srslte_rf_set_rx_srate(rf, SRSLTE_CS_SAMP_FREQ); - INFO("Starting receiver...\n"); + INFO("Starting receiver..."); srslte_rf_start_rx_stream(rf, false); if (config->force_tdd) { @@ -192,10 +192,10 @@ int rf_cell_search(srslte_rf_t* rf, srslte_rf_stop_rx_stream(rf); if (ret < 0) { - ERROR("Error searching cell\n"); + ERROR("Error searching cell"); return SRSLTE_ERROR; } else if (ret == 0) { - ERROR("Could not find any cell in this frequency\n"); + ERROR("Could not find any cell in this frequency"); return SRSLTE_SUCCESS; } @@ -251,7 +251,7 @@ int rf_search_and_decode_mib(srslte_rf_t* rf, printf("Decoding PBCH for cell %d (N_id_2=%d)\n", cell->id, cell->id % 3); ret = rf_mib_decoder(rf, nof_rx_channels, config, cell, cfo); if (ret < 0) { - ERROR("Could not decode PBCH from CELL ID %d\n", cell->id); + ERROR("Could not decode PBCH from CELL ID %d", cell->id); return SRSLTE_ERROR; } } @@ -276,10 +276,10 @@ int rf_cell_search_nbiot(srslte_rf_t* rf, cell_search_cfg_t* config, srslte_nbio srslte_ue_sync_nbiot_start_agc(&cs.ue_sync, srslte_rf_set_rx_gain_wrapper, config->init_agc); } - DEBUG("Setting sampling frequency %.2f MHz for NPSS search\n", SRSLTE_CS_SAMP_FREQ / 1000000); + DEBUG("Setting sampling frequency %.2f MHz for NPSS search", SRSLTE_CS_SAMP_FREQ / 1000000); srslte_rf_set_rx_srate(rf, SRSLTE_CS_SAMP_FREQ); - INFO("Starting receiver...\n"); + INFO("Starting receiver..."); srslte_rf_start_rx_stream(rf, false); ret = srslte_ue_cellsearch_nbiot_scan(&cs); @@ -288,11 +288,11 @@ int rf_cell_search_nbiot(srslte_rf_t* rf, cell_search_cfg_t* config, srslte_nbio goto clean_exit; } - INFO("Stopping receiver...\n"); + INFO("Stopping receiver..."); srslte_rf_stop_rx_stream(rf); // Find a cell - INFO("Running N_id_ncell detection\n"); + INFO("Running N_id_ncell detection"); uint32_t max_peak_cell = 0; ret = srslte_ue_cellsearch_nbiot_detect(&cs, found_cells); diff --git a/lib/src/phy/scrambling/test/scrambling_test.c b/lib/src/phy/scrambling/test/scrambling_test.c index 053c7b6ee..12d909830 100644 --- a/lib/src/phy/scrambling/test/scrambling_test.c +++ b/lib/src/phy/scrambling/test/scrambling_test.c @@ -79,7 +79,7 @@ int init_sequence(srslte_sequence_t* seq, char* name) bzero(seq, sizeof(srslte_sequence_t)); return srslte_sequence_pdsch(seq, 1234, 0, 0, cell_id, nof_bits); } else { - ERROR("Unsupported sequence name %s\n", name); + ERROR("Unsupported sequence name %s", name); return -1; } } @@ -95,7 +95,7 @@ int main(int argc, char** argv) parse_args(argc, argv); if (init_sequence(&seq, srslte_sequence_name) == -1) { - ERROR("Error initiating sequence %s\n", srslte_sequence_name); + ERROR("Error initiating sequence %s", srslte_sequence_name); exit(-1); } diff --git a/lib/src/phy/sync/cfo.c b/lib/src/phy/sync/cfo.c index 550cc80fa..4eb26fb0e 100644 --- a/lib/src/phy/sync/cfo.c +++ b/lib/src/phy/sync/cfo.c @@ -77,7 +77,7 @@ int srslte_cfo_resize(srslte_cfo_t* h, uint32_t samples) srslte_cexptab_gen(&h->tab, h->cur_cexp, h->last_freq, samples); h->nsamples = samples; } else { - ERROR("Error in cfo_resize(): nof_samples must be lower than initialized\n"); + ERROR("Error in cfo_resize(): nof_samples must be lower than initialized"); return SRSLTE_ERROR; } #endif /* SRSLTE_CFO_USE_EXP_TABLE */ @@ -90,7 +90,7 @@ void srslte_cfo_correct(srslte_cfo_t* h, const cf_t* input, cf_t* output, float if (fabs(h->last_freq - freq) > h->tol) { h->last_freq = freq; srslte_cexptab_gen(&h->tab, h->cur_cexp, h->last_freq, h->nsamples); - DEBUG("CFO generating new table for frequency %.4fe-6\n", freq * 1e6); + DEBUG("CFO generating new table for frequency %.4fe-6", freq * 1e6); } srslte_vec_prod_ccc(h->cur_cexp, input, output, h->nsamples); #else /* SRSLTE_CFO_USE_EXP_TABLE */ @@ -113,7 +113,7 @@ void srslte_cfo_correct_offset(srslte_cfo_t* h, if (fabs(h->last_freq - freq) > h->tol) { h->last_freq = freq; srslte_cexptab_gen(&h->tab, h->cur_cexp, h->last_freq, h->nsamples); - DEBUG("CFO generating new table for frequency %.4fe-6\n", freq * 1e6); + DEBUG("CFO generating new table for frequency %.4fe-6", freq * 1e6); } srslte_vec_prod_ccc(&h->cur_cexp[cexp_offset], input, output, nsamples); } diff --git a/lib/src/phy/sync/cp.c b/lib/src/phy/sync/cp.c index fae9529a7..24241bcd6 100644 --- a/lib/src/phy/sync/cp.c +++ b/lib/src/phy/sync/cp.c @@ -40,7 +40,7 @@ void srslte_cp_synch_free(srslte_cp_synch_t* q) int srslte_cp_synch_resize(srslte_cp_synch_t* q, uint32_t symbol_sz) { if (symbol_sz > q->max_symbol_sz) { - ERROR("Error in cp_synch_resize(): symbol_sz must be lower than initialized\n"); + ERROR("Error in cp_synch_resize(): symbol_sz must be lower than initialized"); return SRSLTE_ERROR; } q->symbol_sz = symbol_sz; diff --git a/lib/src/phy/sync/npss.c b/lib/src/phy/sync/npss.c index 38959725e..8aa03b89b 100644 --- a/lib/src/phy/sync/npss.c +++ b/lib/src/phy/sync/npss.c @@ -321,7 +321,7 @@ int srslte_npss_sync_find(srslte_npss_synch_t* q, cf_t* input, float* corr_peak_ *corr_peak_value = q->conv_output_avg[corr_peak_pos] / side_lobe_value; if (*corr_peak_value < 10) { - DEBUG("peak_pos=%2d, pl_ub=%2d, pl_lb=%2d, sl_right: %2d, sl_left: %2d, PSR: %.2f/%.2f=%.2f\n", + DEBUG("peak_pos=%2d, pl_ub=%2d, pl_lb=%2d, sl_right: %2d, sl_left: %2d, PSR: %.2f/%.2f=%.2f", corr_peak_pos, pl_ub, pl_lb, diff --git a/lib/src/phy/sync/nsss.c b/lib/src/phy/sync/nsss.c index 31fb270a7..7cf3dc2c3 100644 --- a/lib/src/phy/sync/nsss.c +++ b/lib/src/phy/sync/nsss.c @@ -38,7 +38,7 @@ int srslte_nsss_synch_init(srslte_nsss_synch_t* q, uint32_t input_size, uint32_t q->corr_peak_threshold = 2.0; uint32_t buffer_size = SRSLTE_NSSS_CORR_FILTER_LEN + q->input_size + 1; - DEBUG("NSSS buffer size is %d samples.\n", buffer_size); + DEBUG("NSSS buffer size is %d samples.", buffer_size); q->tmp_input = srslte_vec_cf_malloc(buffer_size); if (!q->tmp_input) { fprintf(stderr, "Error allocating memory\n"); @@ -135,7 +135,7 @@ int srslte_nsss_synch_resize(srslte_nsss_synch_t* q, uint32_t fft_size) int srslte_nsss_corr_init(srslte_nsss_synch_t* q) { srslte_dft_plan_t plan; - float complex nsss_signal_pad[q->fft_size]; + float complex nsss_signal_pad[q->fft_size]; // construct dft plan if (srslte_dft_plan(&plan, q->fft_size, SRSLTE_DFT_BACKWARD, SRSLTE_DFT_COMPLEX)) { @@ -161,7 +161,7 @@ int srslte_nsss_corr_init(srslte_nsss_synch_t* q) #endif // generate correlation sequences - DEBUG("Generating NSSS sequences\n"); + DEBUG("Generating NSSS sequences"); for (int i = 0; i < SRSLTE_NUM_PCI; i++) { float complex nsss_signal[SRSLTE_NSSS_TOT_LEN] = {}; srslte_nsss_generate(nsss_signal, i); @@ -234,7 +234,7 @@ int srslte_nsss_sync_find(srslte_nsss_synch_t* q, memcpy(q->tmp_input, input, q->input_size * sizeof(cf_t)); if (*cell_id == SRSLTE_CELL_ID_UNKNOWN) { - DEBUG("N_id_ncell is not set. Perform exhaustive search on input.\n"); + DEBUG("N_id_ncell is not set. Perform exhaustive search on input."); // brute-force: correlate with all possible sequences until cell is found for (int i = 0; i < SRSLTE_NUM_PCI; i++) { @@ -251,7 +251,7 @@ int srslte_nsss_sync_find(srslte_nsss_synch_t* q, peak_value = q->peak_values[max_id]; } else { - DEBUG("Current N_id_ncell is %d.\n", *cell_id); + DEBUG("Current N_id_ncell is %d.", *cell_id); // run correlation only for given id srslte_nsss_sync_find_pci(q, q->tmp_input, *cell_id); @@ -319,7 +319,7 @@ void srslte_nsss_sync_find_pci(srslte_nsss_synch_t* q, cf_t* input, uint32_t cel int sl_left = srslte_vec_max_fi(q->conv_output_abs, sl_distance_left); float side_lobe_value = SRSLTE_MAX(q->conv_output_abs[sl_right], q->conv_output_abs[sl_left]); q->peak_values[cell_id] = q->conv_output_abs[corr_peak_pos] / side_lobe_value; - DEBUG("NSSS n_id_ncell=%d at peak_pos=%2d, pl_ub=%2d, pl_lb=%2d, sl_right: %2d, sl_left: %2d, PSR: %.2f/%.2f=%.2f\n", + DEBUG("NSSS n_id_ncell=%d at peak_pos=%2d, pl_ub=%2d, pl_lb=%2d, sl_right: %2d, sl_left: %2d, PSR: %.2f/%.2f=%.2f", cell_id, corr_peak_pos, pl_ub, @@ -332,7 +332,7 @@ void srslte_nsss_sync_find_pci(srslte_nsss_synch_t* q, cf_t* input, uint32_t cel #else // save max. absolute value q->peak_values[cell_id] = q->conv_output_abs[corr_peak_pos]; - DEBUG("NSSS n_id_ncell=%d with peak=%f found at: %d\n", cell_id, q->peak_values[cell_id], corr_peak_pos); + DEBUG("NSSS n_id_ncell=%d with peak=%f found at: %d", cell_id, q->peak_values[cell_id], corr_peak_pos); #endif } @@ -351,7 +351,7 @@ void srslte_nsss_generate(cf_t* signal, uint32_t cell_id) int n_prime = n % 131; int m = n % 128; - float arg = (float)sign * 2.0 * M_PI * ((float)theta_f) * ((float)n); + float arg = (float)sign * 2.0 * M_PI * ((float)theta_f) * ((float)n); float complex tmp1; __real__ tmp1 = cosf(arg); __imag__ tmp1 = sinf(arg); @@ -365,7 +365,7 @@ void srslte_nsss_generate(cf_t* signal, uint32_t cell_id) } } } else { - DEBUG("Invalid n_id_ncell %d\n", cell_id); + DEBUG("Invalid n_id_ncell %d", cell_id); } } @@ -381,7 +381,7 @@ void srslte_nsss_put_subframe(srslte_nsss_synch_t* q, // skip first 3 OFDM symbols over all PRBs completely int k = 3 * nof_prb * SRSLTE_NRE + nbiot_prb_offset * SRSLTE_NRE; - DEBUG("%d.9: Putting NSSS with theta_f=%d\n", nf, theta_f); + DEBUG("%d.9: Putting NSSS with theta_f=%d", nf, theta_f); for (int l = 0; l < SRSLTE_CP_NORM_SF_NSYMB - 3; l++) { memcpy(&subframe[k + SRSLTE_NSSS_NSC * l], &nsss[(theta_f * SRSLTE_NSSS_LEN) + (l * SRSLTE_NSSS_NSC)], diff --git a/lib/src/phy/sync/pss.c b/lib/src/phy/sync/pss.c index ea1920a43..6d88cd99c 100644 --- a/lib/src/phy/sync/pss.c +++ b/lib/src/phy/sync/pss.c @@ -26,7 +26,6 @@ int srslte_pss_init_N_id_2(cf_t* pss_signal_freq, cf_t* pss_signal_time, uint32_ int ret = SRSLTE_ERROR_INVALID_INPUTS; if (srslte_N_id_2_isvalid(N_id_2) && fft_size <= 2048) { - srslte_pss_generate(pss_signal_freq, N_id_2); srslte_vec_cf_zero(pss_signal_pad, fft_size); @@ -81,10 +80,8 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, int offset, int decimate) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - ret = SRSLTE_ERROR; uint32_t N_id_2; @@ -118,7 +115,7 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, } if (srslte_dft_plan(&q->dftp_input, fft_size, SRSLTE_DFT_FORWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error creating DFT plan \n"); + ERROR("Error creating DFT plan "); goto clean_and_exit; } srslte_dft_plan_set_mirror(&q->dftp_input, true); @@ -126,7 +123,7 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, srslte_dft_plan_set_norm(&q->dftp_input, false); if (srslte_dft_plan(&q->idftp_input, fft_size, SRSLTE_DFT_BACKWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error creating DFT plan \n"); + ERROR("Error creating DFT plan "); goto clean_and_exit; } srslte_dft_plan_set_mirror(&q->idftp_input, true); @@ -137,7 +134,7 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, q->tmp_input = srslte_vec_cf_malloc(buffer_size + frame_size * (q->decimate - 1)); if (!q->tmp_input) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); goto clean_and_exit; } @@ -145,20 +142,20 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, q->conv_output = srslte_vec_cf_malloc(buffer_size); if (!q->conv_output) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); goto clean_and_exit; } srslte_vec_cf_zero(q->conv_output, buffer_size); q->conv_output_avg = srslte_vec_f_malloc(buffer_size); if (!q->conv_output_avg) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); goto clean_and_exit; } srslte_vec_f_zero(q->conv_output_avg, buffer_size); #ifdef SRSLTE_PSS_ACCUMULATE_ABS q->conv_output_abs = srslte_vec_f_malloc(buffer_size); if (!q->conv_output_abs) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); goto clean_and_exit; } srslte_vec_f_zero(q->conv_output_abs, buffer_size); @@ -167,12 +164,12 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { q->pss_signal_time[N_id_2] = srslte_vec_cf_malloc(buffer_size); if (!q->pss_signal_time[N_id_2]) { - ERROR("Error allocating memory\n"); + ERROR("Error allocating memory"); goto clean_and_exit; } /* The PSS is translated into the time domain for each N_id_2 */ if (srslte_pss_init_N_id_2(q->pss_signal_freq[N_id_2], q->pss_signal_time[N_id_2], N_id_2, fft_size, offset)) { - ERROR("Error initiating PSS detector for N_id_2=%d fft_size=%d\n", N_id_2, fft_size); + ERROR("Error initiating PSS detector for N_id_2=%d fft_size=%d", N_id_2, fft_size); goto clean_and_exit; } srslte_vec_cf_zero(&q->pss_signal_time[N_id_2][q->fft_size], q->frame_size); @@ -180,7 +177,7 @@ int srslte_pss_init_fft_offset_decim(srslte_pss_t* q, #ifdef CONVOLUTION_FFT if (srslte_conv_fft_cc_init(&q->conv_fft, frame_size, fft_size)) { - ERROR("Error initiating convolution FFT\n"); + ERROR("Error initiating convolution FFT"); goto clean_and_exit; } for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { @@ -209,14 +206,12 @@ clean_and_exit: */ int srslte_pss_resize(srslte_pss_t* q, uint32_t frame_size, uint32_t fft_size, int offset) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - ret = SRSLTE_ERROR; if (fft_size > q->max_fft_size || frame_size > q->max_frame_size) { - ERROR("Error in pss_config(): fft_size and frame_size must be lower than initialized\n"); + ERROR("Error in pss_config(): fft_size and frame_size must be lower than initialized"); return SRSLTE_ERROR; } @@ -235,12 +230,12 @@ int srslte_pss_resize(srslte_pss_t* q, uint32_t frame_size, uint32_t fft_size, i buffer_size = fft_size + frame_size + 1; if (srslte_dft_replan(&q->dftp_input, fft_size)) { - ERROR("Error creating DFT plan \n"); + ERROR("Error creating DFT plan "); return SRSLTE_ERROR; } if (srslte_dft_replan(&q->idftp_input, fft_size)) { - ERROR("Error creating DFT plan \n"); + ERROR("Error creating DFT plan "); return SRSLTE_ERROR; } @@ -257,7 +252,7 @@ int srslte_pss_resize(srslte_pss_t* q, uint32_t frame_size, uint32_t fft_size, i // Generate PSS sequences for this FFT size for (N_id_2 = 0; N_id_2 < 3; N_id_2++) { if (srslte_pss_init_N_id_2(q->pss_signal_freq[N_id_2], q->pss_signal_time[N_id_2], N_id_2, fft_size, offset)) { - ERROR("Error initiating PSS detector for N_id_2=%d fft_size=%d\n", N_id_2, fft_size); + ERROR("Error initiating PSS detector for N_id_2=%d fft_size=%d", N_id_2, fft_size); return SRSLTE_ERROR; } srslte_vec_cf_zero(&q->pss_signal_time[N_id_2][q->fft_size], q->frame_size); @@ -265,7 +260,7 @@ int srslte_pss_resize(srslte_pss_t* q, uint32_t frame_size, uint32_t fft_size, i #ifdef CONVOLUTION_FFT if (srslte_conv_fft_cc_replan(&q->conv_fft, frame_size, fft_size)) { - ERROR("Error initiating convolution FFT\n"); + ERROR("Error initiating convolution FFT"); return SRSLTE_ERROR; } for (int i = 0; i < 3; i++) { @@ -344,7 +339,7 @@ int srslte_pss_generate(cf_t* signal, uint32_t N_id_2) int sign = -1; if (N_id_2 > 2) { - ERROR("Invalid N_id_2 %d\n", N_id_2); + ERROR("Invalid N_id_2 %d", N_id_2); return -1; } @@ -386,7 +381,7 @@ void srslte_pss_get_slot(cf_t* slot, cf_t* pss_signal, uint32_t nof_prb, srslte_ int srslte_pss_set_N_id_2(srslte_pss_t* q, uint32_t N_id_2) { if (!srslte_N_id_2_isvalid((N_id_2))) { - ERROR("Invalid N_id_2 %d\n", N_id_2); + ERROR("Invalid N_id_2 %d", N_id_2); return -1; } else { q->N_id_2 = N_id_2; @@ -444,12 +439,11 @@ int srslte_pss_find_pss(srslte_pss_t* q, const cf_t* input, float* corr_peak_val int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && input != NULL) { - uint32_t corr_peak_pos; uint32_t conv_output_len; if (!srslte_N_id_2_isvalid(q->N_id_2)) { - ERROR("Error finding PSS peak, Must set N_id_2 first\n"); + ERROR("Error finding PSS peak, Must set N_id_2 first"); return SRSLTE_ERROR; } @@ -539,9 +533,8 @@ int srslte_pss_chest(srslte_pss_t* q, const cf_t* input, cf_t ce[SRSLTE_PSS_LEN] int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && input != NULL) { - if (!srslte_N_id_2_isvalid(q->N_id_2)) { - ERROR("Error finding PSS peak, Must set N_id_2 first\n"); + ERROR("Error finding PSS peak, Must set N_id_2 first"); return SRSLTE_ERROR; } @@ -563,7 +556,6 @@ int srslte_pss_chest(srslte_pss_t* q, const cf_t* input, cf_t ce[SRSLTE_PSS_LEN] void srslte_pss_sic(srslte_pss_t* q, cf_t* input) { if (q->chest_on_filter) { - srslte_vec_cf_zero(q->tmp_fft, q->fft_size); // Pass transmitted PSS sequence through the channel @@ -578,7 +570,7 @@ void srslte_pss_sic(srslte_pss_t* q, cf_t* input) srslte_vec_sub_ccc(input, q->tmp_fft2, input, q->fft_size); } else { - ERROR("Error calling srslte_pss_sic(): need to enable channel estimation on filtering\n"); + ERROR("Error calling srslte_pss_sic(): need to enable channel estimation on filtering"); } } diff --git a/lib/src/phy/sync/psss.c b/lib/src/phy/sync/psss.c index b9d1020fe..b58ac3d31 100644 --- a/lib/src/phy/sync/psss.c +++ b/lib/src/phy/sync/psss.c @@ -28,11 +28,10 @@ int srslte_psss_init(srslte_psss_t* q, uint32_t nof_prb, srslte_cp_t cp) int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - // Generate the 2 PSSS sequences for (uint32_t i = 0; i < 2; i++) { if (srslte_psss_generate(q->psss_signal[i], i) != SRSLTE_SUCCESS) { - ERROR("Error srslte_psss_generate\n"); + ERROR("Error srslte_psss_generate"); return SRSLTE_ERROR; } } @@ -142,7 +141,7 @@ int srslte_psss_generate(cf_t* psss_signal, uint32_t N_id_2) const float root_value[] = {26.0, 37.0}; if (N_id_2 > 1) { - ERROR("Invalid N_id_2 %d\n", N_id_2); + ERROR("Invalid N_id_2 %d", N_id_2); return SRSLTE_ERROR; } @@ -216,7 +215,7 @@ int srslte_psss_find(srslte_psss_t* q, cf_t* input, uint32_t nof_prb, srslte_cp_ // Experimental Validation uint32_t symbol_sz = (uint32_t)srslte_symbol_sz(nof_prb); - int cp_len = SRSLTE_CP_SZ(symbol_sz, cp); + int cp_len = SRSLTE_CP_SZ(symbol_sz, cp); // Correlation output peaks: // diff --git a/lib/src/phy/sync/refsignal_dl_sync.c b/lib/src/phy/sync/refsignal_dl_sync.c index 24b35f3e7..a9b9b0851 100644 --- a/lib/src/phy/sync/refsignal_dl_sync.c +++ b/lib/src/phy/sync/refsignal_dl_sync.c @@ -343,7 +343,7 @@ int srslte_refsignal_dl_sync_find_peak(srslte_refsignal_dl_sync_t* q, cf_t* buff } } - INFO("pci=%03d; sf_len=%d; imax=%d; peak=%.3f; rms=%.3f; peak/rms=%.3f\n", + INFO("pci=%03d; sf_len=%d; imax=%d; peak=%.3f; rms=%.3f; peak/rms=%.3f", q->refsignal.cell.id, sf_len, peak_idx, @@ -466,7 +466,7 @@ void srslte_refsignal_dl_sync_run(srslte_refsignal_dl_sync_t* q, cf_t* buffer, u } INFO("-- pci=%03d; rsrp_dB=(%+.1f|%+.1f|%+.1f); rsrp_max-min=%.1f; rsrp_false_ratio=%.1f; " - "cfo=(%.1f|%.1f|%.1f); cfo_max-min=%.1f; sss_ratio=%f; false_count=%d;\n", + "cfo=(%.1f|%.1f|%.1f); cfo_max-min=%.1f; sss_ratio=%f; false_count=%d;", q->refsignal.cell.id, rsrp_dB_min, rsrp_dB, @@ -481,7 +481,6 @@ void srslte_refsignal_dl_sync_run(srslte_refsignal_dl_sync_t* q, cf_t* buffer, u false_count); if (!false_alarm) { - // Calculate in dBm q->rsrp_dBfs = rsrp_dB; @@ -555,7 +554,6 @@ void srslte_refsignal_dl_sync_measure_sf(srslte_refsignal_dl_sync_t* q, } if (cfo) { - // Distances between symbols float distance_1 = (cp_len1 + symbol_sz) * 4.0f; // Number of samples between first and second symbol float distance_2 = diff --git a/lib/src/phy/sync/sss.c b/lib/src/phy/sync/sss.c index 2b5691552..2db73cdff 100644 --- a/lib/src/phy/sync/sss.c +++ b/lib/src/phy/sync/sss.c @@ -28,7 +28,6 @@ void generate_N_id_1_table(uint32_t table[30][30]); int srslte_sss_init(srslte_sss_t* q, uint32_t fft_size) { - if (q != NULL && fft_size <= 2048) { uint32_t N_id_2; srslte_sss_tables_t sss_tables; @@ -61,7 +60,7 @@ int srslte_sss_resize(srslte_sss_t* q, uint32_t fft_size) { if (q != NULL && fft_size <= 2048) { if (fft_size > q->max_fft_size) { - ERROR("Error in sss_synch_resize(): fft_size must be lower than initialized\n"); + ERROR("Error in sss_synch_resize(): fft_size must be lower than initialized"); return SRSLTE_ERROR; } if (srslte_dft_replan(&q->dftp_input, fft_size)) { @@ -84,7 +83,7 @@ void srslte_sss_free(srslte_sss_t* q) int srslte_sss_set_N_id_2(srslte_sss_t* q, uint32_t N_id_2) { if (!srslte_N_id_2_isvalid(N_id_2)) { - ERROR("Invalid N_id_2 %d\n", N_id_2); + ERROR("Invalid N_id_2 %d", N_id_2); return SRSLTE_ERROR; } else { q->N_id_2 = N_id_2; diff --git a/lib/src/phy/sync/sync.c b/lib/src/phy/sync/sync.c index 234170932..90f10039d 100644 --- a/lib/src/phy/sync/sync.c +++ b/lib/src/phy/sync/sync.c @@ -73,12 +73,12 @@ int srslte_sync_init_decim(srslte_sync_t* q, uint32_t frame_size, uint32_t max_o srslte_sync_cfo_reset(q, 0.0f); if (srslte_cfo_init(&q->cfo_corr_frame, q->frame_size)) { - ERROR("Error initiating CFO\n"); + ERROR("Error initiating CFO"); goto clean_exit; } if (srslte_cfo_init(&q->cfo_corr_symbol, q->fft_size)) { - ERROR("Error initiating CFO\n"); + ERROR("Error initiating CFO"); goto clean_exit; } @@ -106,7 +106,7 @@ int srslte_sync_init_decim(srslte_sync_t* q, uint32_t frame_size, uint32_t max_o } if (srslte_dft_plan(&q->idftp_sss, fft_size, SRSLTE_DFT_BACKWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error creating DFT plan \n"); + ERROR("Error creating DFT plan "); goto clean_exit; } srslte_dft_plan_set_mirror(&q->idftp_sss, true); @@ -114,24 +114,24 @@ int srslte_sync_init_decim(srslte_sync_t* q, uint32_t frame_size, uint32_t max_o srslte_dft_plan_set_norm(&q->idftp_sss, false); if (srslte_pss_init_fft_offset_decim(&q->pss, max_offset, fft_size, 0, decimate)) { - ERROR("Error initializing PSS object\n"); + ERROR("Error initializing PSS object"); goto clean_exit; } if (srslte_sss_init(&q->sss, fft_size)) { - ERROR("Error initializing SSS object\n"); + ERROR("Error initializing SSS object"); goto clean_exit; } if (srslte_cp_synch_init(&q->cp_synch, fft_size)) { - ERROR("Error initiating CFO\n"); + ERROR("Error initiating CFO"); goto clean_exit; } - DEBUG("SYNC init with frame_size=%d, max_offset=%d and fft_size=%d\n", frame_size, max_offset, fft_size); + DEBUG("SYNC init with frame_size=%d, max_offset=%d and fft_size=%d", frame_size, max_offset, fft_size); ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters frame_size: %d, fft_size: %d\n", frame_size, fft_size); + ERROR("Invalid parameters frame_size: %d, fft_size: %d", frame_size, fft_size); } clean_exit: @@ -167,12 +167,11 @@ void srslte_sync_free(srslte_sync_t* q) int srslte_sync_resize(srslte_sync_t* q, uint32_t frame_size, uint32_t max_offset, uint32_t fft_size) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && fft_size_isvalid(fft_size)) { if (frame_size > q->max_frame_size) { - ERROR("Error in sync_resize(): frame_size must be lower than initialized\n"); + ERROR("Error in sync_resize(): frame_size must be lower than initialized"); return SRSLTE_ERROR; } @@ -181,31 +180,31 @@ int srslte_sync_resize(srslte_sync_t* q, uint32_t frame_size, uint32_t max_offse q->max_offset = max_offset; if (srslte_pss_resize(&q->pss, q->max_offset, q->fft_size, 0)) { - ERROR("Error resizing PSS object\n"); + ERROR("Error resizing PSS object"); return SRSLTE_ERROR; } if (srslte_sss_resize(&q->sss, q->fft_size)) { - ERROR("Error resizing SSS object\n"); + ERROR("Error resizing SSS object"); return SRSLTE_ERROR; } if (srslte_dft_replan(&q->idftp_sss, fft_size)) { - ERROR("Error resizing DFT plan \n"); + ERROR("Error resizing DFT plan "); return SRSLTE_ERROR; } if (srslte_cp_synch_resize(&q->cp_synch, q->fft_size)) { - ERROR("Error resizing CFO\n"); + ERROR("Error resizing CFO"); return SRSLTE_ERROR; } if (srslte_cfo_resize(&q->cfo_corr_frame, q->frame_size)) { - ERROR("Error resizing CFO\n"); + ERROR("Error resizing CFO"); return SRSLTE_ERROR; } if (srslte_cfo_resize(&q->cfo_corr_symbol, q->fft_size)) { - ERROR("Error resizing CFO\n"); + ERROR("Error resizing CFO"); return SRSLTE_ERROR; } @@ -213,7 +212,7 @@ int srslte_sync_resize(srslte_sync_t* q, uint32_t frame_size, uint32_t max_offse for (int i = 0; i < 2; i++) { int offset = (i == 0) ? -1 : 1; if (srslte_pss_resize(&q->pss_i[i], q->max_offset, q->fft_size, offset)) { - ERROR("Error initializing PSS object\n"); + ERROR("Error initializing PSS object"); } for (int t = 0; t < q->frame_size; t++) { q->cfo_i_corr[i][t] = cexpf(-2 * _Complex_I * M_PI * offset * (float)t / q->fft_size); @@ -224,11 +223,11 @@ int srslte_sync_resize(srslte_sync_t* q, uint32_t frame_size, uint32_t max_offse // Update CFO tolerance srslte_sync_set_cfo_tol(q, q->current_cfo_tol); - DEBUG("SYNC init with frame_size=%d, max_offset=%d and fft_size=%d\n", frame_size, max_offset, fft_size); + DEBUG("SYNC init with frame_size=%d, max_offset=%d and fft_size=%d", frame_size, max_offset, fft_size); ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters frame_size: %d, fft_size: %d\n", frame_size, fft_size); + ERROR("Invalid parameters frame_size: %d, fft_size: %d", frame_size, fft_size); } return ret; @@ -287,7 +286,7 @@ int srslte_sync_set_N_id_2(srslte_sync_t* q, uint32_t N_id_2) q->N_id_2 = N_id_2; return SRSLTE_SUCCESS; } else { - ERROR("Invalid N_id_2=%d\n", N_id_2); + ERROR("Invalid N_id_2=%d", N_id_2); return SRSLTE_ERROR_INVALID_INPUTS; } } @@ -313,7 +312,7 @@ static void generate_freq_sss(srslte_sync_t* q, uint32_t N_id_1) srslte_dft_run_c(&q->idftp_sss, symbol, q->sss_signal[n]); } q->sss_generated = true; - DEBUG("Generated SSS for N_id_1=%d, cell_id=%d\n", N_id_1, cell_id); + DEBUG("Generated SSS for N_id_1=%d, cell_id=%d", N_id_1, cell_id); } int srslte_sync_set_N_id_1(srslte_sync_t* q, uint32_t N_id_1) @@ -322,7 +321,7 @@ int srslte_sync_set_N_id_1(srslte_sync_t* q, uint32_t N_id_1) generate_freq_sss(q, N_id_1); return SRSLTE_SUCCESS; } else { - ERROR("Invalid N_id_2=%d\n", N_id_1); + ERROR("Invalid N_id_2=%d", N_id_1); return SRSLTE_ERROR_INVALID_INPUTS; } } @@ -361,7 +360,7 @@ void srslte_sync_set_cfo_i_enable(srslte_sync_t* q, bool enable) for (int i = 0; i < 2; i++) { int offset = (i == 0) ? -1 : 1; if (srslte_pss_init_fft_offset(&q->pss_i[i], q->max_offset, q->fft_size, offset)) { - ERROR("Error initializing PSS object\n"); + ERROR("Error initializing PSS object"); } for (int t = 0; t < q->frame_size; t++) { q->cfo_i_corr[i][t] = cexpf(-2 * _Complex_I * M_PI * offset * (float)t / q->fft_size); @@ -455,7 +454,6 @@ srslte_cp_t srslte_sync_detect_cp(srslte_sync_t* q, const cf_t* input, uint32_t } if (nof_symbols > 0) { - const cf_t* input_cp_norm = &input[peak_pos - nof_symbols * (q->fft_size + cp_norm_len)]; const cf_t* input_cp_ext = &input[peak_pos - nof_symbols * (q->fft_size + cp_ext_len)]; @@ -526,7 +524,7 @@ static bool sync_sss_symbol(srslte_sync_t* q, const cf_t* input, uint32_t* sf_id } *N_id_1 = q->N_id_1; *corr = ratio; - DEBUG("SSS correlation with N_id_1=%d, sf0=%.2f, sf5=%.2f, sf_idx=%d, ratio=%.1f\n", + DEBUG("SSS correlation with N_id_1=%d, sf0=%.2f, sf5=%.2f, sf_idx=%d, ratio=%.1f", q->N_id_1, res[0], res[1], @@ -555,7 +553,7 @@ static bool sync_sss_symbol(srslte_sync_t* q, const cf_t* input, uint32_t* sf_id ret = srslte_sss_N_id_1(&q->sss, q->m0, q->m1, *corr); if (ret >= 0) { *N_id_1 = (uint32_t)ret; - INFO("SSS detected N_id_1=%d (corr=%7.1f), sf_idx=%d, %s CP\n", + INFO("SSS detected N_id_1=%d (corr=%7.1f), sf_idx=%d, %s CP", *N_id_1, *corr, *sf_idx, @@ -630,7 +628,6 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint } if (input != NULL && srslte_N_id_2_isvalid(q->N_id_2) && fft_size_isvalid(q->fft_size)) { - q->sss_detected = false; if (peak_position) { @@ -645,13 +642,13 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint */ if (q->cfo_i_enable) { if (cfo_i_estimate(q, input_ptr, find_offset, &peak_pos, &q->cfo_i_value) < 0) { - ERROR("Error calling finding PSS sequence at : %d \n", peak_pos); + ERROR("Error calling finding PSS sequence at : %d ", peak_pos); return SRSLTE_ERROR; } // Correct it using precomputed signal and store in buffer (don't modify input signal) if (q->cfo_i_value != 0) { srslte_vec_prod_ccc((cf_t*)input_ptr, q->cfo_i_corr[q->cfo_i_value < 0 ? 0 : 1], q->temp, q->frame_size); - INFO("Compensating cfo_i=%d\n", q->cfo_i_value); + INFO("Compensating cfo_i=%d", q->cfo_i_value); input_ptr = q->temp; } } @@ -670,7 +667,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint q->cfo_cp_mean = SRSLTE_VEC_EMA(cfo_cp, q->cfo_cp_mean, q->cfo_ema_alpha); } - DEBUG("CP-CFO: estimated=%f, mean=%f\n", cfo_cp, q->cfo_cp_mean); + DEBUG("CP-CFO: estimated=%f, mean=%f", cfo_cp, q->cfo_cp_mean); /* Correct CFO with the averaged CFO estimation */ srslte_cfo_correct(&q->cfo_corr_frame, input_ptr, q->temp, -q->cfo_cp_mean / q->fft_size); @@ -683,12 +680,12 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint srslte_pss_set_N_id_2(&q->pss, q->N_id_2); peak_pos = srslte_pss_find_pss(&q->pss, &input_ptr[find_offset], q->threshold > 0 ? &q->peak_value : NULL); if (peak_pos < 0) { - ERROR("Error calling finding PSS sequence at : %d \n", peak_pos); + ERROR("Error calling finding PSS sequence at : %d ", peak_pos); return SRSLTE_ERROR; } } - DEBUG("PSS: id=%d, peak_pos=%d, peak_value=%f\n", q->N_id_2, peak_pos, q->peak_value); + DEBUG("PSS: id=%d, peak_pos=%d, peak_value=%f", q->N_id_2, peak_pos, q->peak_value); // Save peak position if (peak_position) { @@ -702,9 +699,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint /* If peak is over threshold, compute CFO and SSS */ if (q->peak_value >= q->threshold || q->threshold == 0) { - if (q->cfo_pss_enable && peak_pos >= q->fft_size) { - // Filter central bands before PSS-based CFO estimation const cf_t* pss_ptr = &input_ptr[find_offset + peak_pos - q->fft_size]; if (q->pss_filtering_enabled) { @@ -721,7 +716,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint q->cfo_pss_mean = SRSLTE_VEC_EMA(q->cfo_pss, q->cfo_pss_mean, q->cfo_ema_alpha); } - DEBUG("PSS-CFO: filter=%s, estimated=%f, mean=%f\n", + DEBUG("PSS-CFO: filter=%s, estimated=%f, mean=%f", q->pss_filtering_enabled ? "yes" : "no", q->cfo_pss, q->cfo_pss_mean); @@ -729,10 +724,8 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint // If there is enough space for CP and SSS estimation if (peak_pos + find_offset >= 2 * (q->fft_size + SRSLTE_CP_LEN_EXT(q->fft_size))) { - // If SSS search is enabled, correlate SSS sequence if (q->sss_en) { - int sss_idx; uint32_t nof_frame_type_trials; srslte_frame_type_t frame_type_trials[2]; @@ -795,7 +788,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint q->N_id_1 = N_id_1[1]; q->sss_corr = sss_corr[1]; } - DEBUG("SYNC: Detected SSS %s, corr=%.2f/%.2f\n", + DEBUG("SYNC: Detected SSS %s, corr=%.2f/%.2f", q->frame_type == SRSLTE_FDD ? "FDD" : "TDD", sss_corr[0], sss_corr[1]); @@ -823,7 +816,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint ret = SRSLTE_SYNC_NOFOUND; } - DEBUG("SYNC ret=%d N_id_2=%d find_offset=%d frame_len=%d, pos=%d peak=%.2f threshold=%.2f CFO=%.3f kHz\n", + DEBUG("SYNC ret=%d N_id_2=%d find_offset=%d frame_len=%d, pos=%d peak=%.2f threshold=%.2f CFO=%.3f kHz", ret, q->N_id_2, find_offset, @@ -834,7 +827,7 @@ srslte_sync_find(srslte_sync_t* q, const cf_t* input, uint32_t find_offset, uint 15 * (srslte_sync_get_cfo(q))); } else if (!srslte_N_id_2_isvalid(q->N_id_2)) { - ERROR("Must call srslte_sync_set_N_id_2() first!\n"); + ERROR("Must call srslte_sync_set_N_id_2() first!"); } return ret; diff --git a/lib/src/phy/sync/sync_nbiot.c b/lib/src/phy/sync/sync_nbiot.c index 78774cfd7..9a04c7cad 100644 --- a/lib/src/phy/sync/sync_nbiot.c +++ b/lib/src/phy/sync/sync_nbiot.c @@ -161,7 +161,7 @@ int srslte_sync_nbiot_resize(srslte_sync_nbiot_t* q, uint32_t frame_size, uint32 // Update CFO tolerance srslte_sync_nbiot_set_cfo_tol(q, q->current_cfo_tol); - DEBUG("NBIOT SYNC init with frame_size=%d, max_offset=%d and fft_size=%d\n", frame_size, max_offset, fft_size); + DEBUG("NBIOT SYNC init with frame_size=%d, max_offset=%d and fft_size=%d", frame_size, max_offset, fft_size); ret = SRSLTE_SUCCESS; } else { @@ -226,13 +226,13 @@ srslte_sync_nbiot_find(srslte_sync_nbiot_t* q, cf_t* input, uint32_t find_offset // compute exponential moving average CFO q->mean_cfo = SRSLTE_VEC_EMA(cfo, q->mean_cfo, q->cfo_ema_alpha); - DEBUG("CFO=%.4f, mean=%.4f (%.2f Hz), ema=%.2f\n", cfo, q->mean_cfo, q->mean_cfo * 15000, q->cfo_ema_alpha); + DEBUG("CFO=%.4f, mean=%.4f (%.2f Hz), ema=%.2f", cfo, q->mean_cfo, q->mean_cfo * 15000, q->cfo_ema_alpha); } else { - DEBUG("Not enough samples for CFO estimation. Skipping.\n"); + DEBUG("Not enough samples for CFO estimation. Skipping."); } } - DEBUG("sync_nbiot ret=%d find_offset=%d frame_len=%d, pos=%d peak=%.2f threshold=%.2f, CFO=%.3f kHz\n", + DEBUG("sync_nbiot ret=%d find_offset=%d frame_len=%d, pos=%d peak=%.2f threshold=%.2f, CFO=%.3f kHz", ret, find_offset, q->frame_size, diff --git a/lib/src/phy/sync/test/cfo_test.c b/lib/src/phy/sync/test/cfo_test.c index 70f10be51..f8348d36a 100644 --- a/lib/src/phy/sync/test/cfo_test.c +++ b/lib/src/phy/sync/test/cfo_test.c @@ -80,7 +80,7 @@ int main(int argc, char** argv) } if (srslte_cfo_init(&cfocorr, num_samples)) { - ERROR("Error initiating CFO\n"); + ERROR("Error initiating CFO"); return -1; } diff --git a/lib/src/phy/sync/test/pss_file.c b/lib/src/phy/sync/test/pss_file.c index 8682a2fe5..d17dff5f6 100644 --- a/lib/src/phy/sync/test/pss_file.c +++ b/lib/src/phy/sync/test/pss_file.c @@ -140,12 +140,12 @@ int main(int argc, char** argv) } if (srslte_pss_init_fft(&pss, flen, fft_size)) { - ERROR("Error initiating PSS\n"); + ERROR("Error initiating PSS"); exit(-1); } if (srslte_pss_set_N_id_2(&pss, N_id_2_sync)) { - ERROR("Error setting N_id_2=%d\n", N_id_2_sync); + ERROR("Error setting N_id_2=%d", N_id_2_sync); exit(-1); } @@ -153,7 +153,7 @@ int main(int argc, char** argv) srslte_cfo_init(&cfocorr64, flen); if (srslte_sss_init(&sss, fft_size)) { - ERROR("Error initializing SSS object\n"); + ERROR("Error initializing SSS object"); return SRSLTE_ERROR; } @@ -161,7 +161,7 @@ int main(int argc, char** argv) printf("Opening file...\n"); if (srslte_filesource_init(&fsrc, input_file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", input_file_name); + ERROR("Error opening file %s", input_file_name); exit(-1); } printf("N_id_2: %d\n", N_id_2); @@ -189,7 +189,7 @@ int main(int argc, char** argv) while (frame_cnt < nof_frames || nof_frames == -1) { n = srslte_filesource_read(&fsrc, buffer, flen - peak_offset); if (n < 0) { - ERROR("Error reading samples\n"); + ERROR("Error reading samples"); exit(-1); } if (n < flen - peak_offset) { @@ -199,7 +199,7 @@ int main(int argc, char** argv) peak_idx = srslte_pss_find_pss(&pss, buffer, &peak_value); if (peak_idx < 0) { - ERROR("Error finding PSS peak\n"); + ERROR("Error finding PSS peak"); exit(-1); } @@ -209,7 +209,6 @@ int main(int argc, char** argv) nof_det++; if (peak_idx >= fft_size) { - // Estimate CFO cfo = srslte_pss_cfo_compute(&pss, &buffer[peak_idx - fft_size]); mean_cfo = SRSLTE_VEC_CMA(cfo, mean_cfo, frame_cnt); @@ -219,7 +218,7 @@ int main(int argc, char** argv) // Estimate channel if (srslte_pss_chest(&pss, &buffer[peak_idx - fft_size], ce)) { - ERROR("Error computing channel estimation\n"); + ERROR("Error computing channel estimation"); exit(-1); } @@ -232,18 +231,18 @@ int main(int argc, char** argv) if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { sss_error2++; } - INFO("sf_idx = %d\n", srslte_sss_subframe(m0, m1)); - INFO("Partial N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("sf_idx = %d", srslte_sss_subframe(m0, m1)); + INFO("Partial N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); srslte_sss_m0m1_diff(&sss, &buffer[sss_idx], &m0, &m0_value, &m1, &m1_value); if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { sss_error3++; } - INFO("Diff N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("Diff N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); srslte_sss_m0m1_partial(&sss, &buffer[sss_idx], 1, NULL, &m0, &m0_value, &m1, &m1_value); if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { sss_error1++; } - INFO("Full N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("Full N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); } // Estimate CP @@ -255,7 +254,7 @@ int main(int argc, char** argv) } } else { - INFO("No space for CFO computation. Frame starts at \n"); + INFO("No space for CFO computation. Frame starts at "); } if (srslte_sss_subframe(m0, m1) == 0) { diff --git a/lib/src/phy/sync/test/pss_usrp.c b/lib/src/phy/sync/test/pss_usrp.c index 281699fff..d0f0f33e8 100644 --- a/lib/src/phy/sync/test/pss_usrp.c +++ b/lib/src/phy/sync/test/pss_usrp.c @@ -147,7 +147,7 @@ int main(int argc, char** argv) printf("Opening RF device...\n"); if (srslte_rf_open(&rf, rf_args)) { - ERROR("Error opening rf\n"); + ERROR("Error opening rf"); exit(-1); } srslte_rf_set_rx_gain(&rf, rf_gain); @@ -162,12 +162,12 @@ int main(int argc, char** argv) } if (srslte_pss_init_fft(&pss, flen, fft_size)) { - ERROR("Error initiating PSS\n"); + ERROR("Error initiating PSS"); exit(-1); } if (srslte_pss_set_N_id_2(&pss, N_id_2_sync)) { - ERROR("Error setting N_id_2=%d\n", N_id_2_sync); + ERROR("Error setting N_id_2=%d", N_id_2_sync); exit(-1); } @@ -175,7 +175,7 @@ int main(int argc, char** argv) srslte_cfo_init(&cfocorr64, flen); if (srslte_sss_init(&sss, fft_size)) { - ERROR("Error initializing SSS object\n"); + ERROR("Error initializing SSS object"); exit(-1); } @@ -213,13 +213,13 @@ int main(int argc, char** argv) while (frame_cnt < nof_frames || nof_frames == -1) { n = srslte_rf_recv(&rf, buffer, flen - peak_offset, 1); if (n < 0) { - ERROR("Error receiving samples\n"); + ERROR("Error receiving samples"); exit(-1); } peak_idx = srslte_pss_find_pss(&pss, buffer, &peak_value); if (peak_idx < 0) { - ERROR("Error finding PSS peak\n"); + ERROR("Error finding PSS peak"); exit(-1); } @@ -229,7 +229,6 @@ int main(int argc, char** argv) nof_det++; if (peak_idx >= fft_size) { - // Estimate CFO cfo = srslte_pss_cfo_compute(&pss, &buffer[peak_idx - fft_size]); mean_cfo = SRSLTE_VEC_CMA(cfo, mean_cfo, frame_cnt); @@ -239,7 +238,7 @@ int main(int argc, char** argv) // Estimate channel if (srslte_pss_chest(&pss, &buffer[peak_idx - fft_size], ce)) { - ERROR("Error computing channel estimation\n"); + ERROR("Error computing channel estimation"); exit(-1); } @@ -255,21 +254,20 @@ int main(int argc, char** argv) : SRSLTE_CP_LEN(fft_size, SRSLTE_CP_EXT_LEN)); } if (sss_idx >= 0 && sss_idx < flen - fft_size) { - // Filter SSS srslte_pss_filter(&pss, &buffer[sss_idx], &buffer[sss_idx]); - INFO("Full N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("Full N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); srslte_sss_m0m1_partial(&sss, &buffer[sss_idx], 1, ce, &m0, &m0_value, &m1, &m1_value); if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { sss_error2++; } - INFO("Partial N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("Partial N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); srslte_sss_m0m1_diff_coh(&sss, &buffer[sss_idx], ce, &m0, &m0_value, &m1, &m1_value); if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { sss_error3++; } - INFO("Diff N_id_1: %d\n", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); + INFO("Diff N_id_1: %d", srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value)); } srslte_sss_m0m1_partial(&sss, &buffer[sss_idx], 1, NULL, &m0, &m0_value, &m1, &m1_value); if (srslte_sss_N_id_1(&sss, m0, m1, m1_value + m0_value) != N_id_1) { @@ -285,7 +283,7 @@ int main(int argc, char** argv) } } else { - INFO("No space for CFO computation. Frame starts at \n"); + INFO("No space for CFO computation. Frame starts at "); } if (srslte_sss_subframe(m0, m1) == 0) { diff --git a/lib/src/phy/sync/test/sync_sl_test.c b/lib/src/phy/sync/test/sync_sl_test.c index 36909d334..5cac32b6a 100644 --- a/lib/src/phy/sync/test/sync_sl_test.c +++ b/lib/src/phy/sync/test/sync_sl_test.c @@ -112,7 +112,6 @@ void parse_args(int argc, char** argv) int main(int argc, char** argv) { - parse_args(argc, argv); srslte_use_standard_symbol_size(use_standard_lte_rates); @@ -133,7 +132,7 @@ int main(int argc, char** argv) srslte_ofdm_t ifft; if (srslte_ofdm_tx_init(&ifft, cp, sf_buffer, output_buffer, nof_prb)) { - ERROR("Error creating IFFT object\n"); + ERROR("Error creating IFFT object"); return SRSLTE_ERROR; } srslte_ofdm_set_normalize(&ifft, true); @@ -192,7 +191,6 @@ int main(int argc, char** argv) bool sync = false; while (sync == false) { - samples_to_read = sf_n_samples - offset_pos; if (offset < samples_to_read) { @@ -230,7 +228,6 @@ int main(int argc, char** argv) // Find sync signals if (srslte_psss_find(&psss, input_buffer, nof_prb, cp) == SRSLTE_SUCCESS) { - printf("PSSS correlation peak pos: %d value: %f N_id_2: %d\n", psss.corr_peak_pos, psss.corr_peak_value, @@ -239,7 +236,6 @@ int main(int argc, char** argv) if (psss.corr_peak_pos - sf_n_samples == 0) { // Find SSSS if (srslte_ssss_find(&ssss, input_buffer, nof_prb, psss.N_id_2, cp) == SRSLTE_SUCCESS) { - printf("SSSS correlation peak pos: %d value: %f N_sl_id: %d \n", ssss.corr_peak_pos, ssss.corr_peak_value, diff --git a/lib/src/phy/sync/test/sync_test.c b/lib/src/phy/sync/test/sync_test.c index ca5f50edb..8b5ab9f3c 100644 --- a/lib/src/phy/sync/test/sync_test.c +++ b/lib/src/phy/sync/test/sync_test.c @@ -82,7 +82,7 @@ int main(int argc, char** argv) fft_size = srslte_symbol_sz(nof_prb); if (fft_size < 0) { - ERROR("Invalid nof_prb=%d\n", nof_prb); + ERROR("Invalid nof_prb=%d", nof_prb); exit(-1); } @@ -99,12 +99,12 @@ int main(int argc, char** argv) } if (srslte_ofdm_tx_init(&ifft, cp, buffer, fft_buffer, nof_prb)) { - ERROR("Error creating iFFT object\n"); + ERROR("Error creating iFFT object"); exit(-1); } if (srslte_sync_init(&syncobj, FLEN, FLEN, fft_size)) { - ERROR("Error initiating PSS/SSS\n"); + ERROR("Error initiating PSS/SSS"); return -1; } @@ -147,7 +147,7 @@ int main(int argc, char** argv) srslte_vec_cf_zero(fft_buffer, offset); if (srslte_sync_find(&syncobj, fft_buffer, 0, &find_idx) < 0) { - ERROR("Error running srslte_sync_find\n"); + ERROR("Error running srslte_sync_find"); exit(-1); } find_sf = srslte_sync_get_sf_idx(&syncobj); 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 8e51b6444..4e95d4038 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 @@ -101,7 +101,7 @@ void sig_int_handler(int signo) int srslte_rf_recv_wrapper(void* h, cf_t* data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t* t) { - DEBUG(" ---- Receive %d samples ---- \n", nsamples); + DEBUG(" ---- Receive %d samples ---- ", nsamples); void* ptr[SRSLTE_MAX_PORTS]; for (int i = 0; i < SRSLTE_MAX_PORTS; i++) { ptr[i] = data[i]; 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 fc1bd3e0f..9556bc587 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 @@ -120,7 +120,7 @@ void sig_int_handler(int signo) int srslte_rf_recv_wrapper_cs(void* h, void* data, uint32_t nsamples, srslte_timestamp_t* t) { - DEBUG(" ---- Receive %d samples ---- \n", nsamples); + DEBUG(" ---- Receive %d samples ---- ", nsamples); return srslte_rf_recv(h, data, nsamples, 1); } diff --git a/lib/src/phy/ue/ue_cell_search.c b/lib/src/phy/ue/ue_cell_search.c index 2403ec10d..35f25fbb6 100644 --- a/lib/src/phy/ue/ue_cell_search.c +++ b/lib/src/phy/ue/ue_cell_search.c @@ -42,12 +42,12 @@ int srslte_ue_cellsearch_init(srslte_ue_cellsearch_t* q, cell.nof_prb = SRSLTE_CS_NOF_PRB; if (srslte_ue_sync_init(&q->ue_sync, cell.nof_prb, true, recv_callback, stream_handler)) { - ERROR("Error initiating ue_sync\n"); + ERROR("Error initiating ue_sync"); goto clean_exit; } if (srslte_ue_sync_set_cell(&q->ue_sync, cell)) { - ERROR("Error initiating ue_sync\n"); + ERROR("Error initiating ue_sync"); goto clean_exit; } @@ -110,7 +110,7 @@ int srslte_ue_cellsearch_init_multi( goto clean_exit; } if (srslte_ue_sync_set_cell(&q->ue_sync, cell)) { - ERROR("Error setting cell in ue_sync\n"); + ERROR("Error setting cell in ue_sync"); goto clean_exit; } @@ -257,10 +257,10 @@ int srslte_ue_cellsearch_scan(srslte_ue_cellsearch_t* q, uint32_t nof_detected_cells = 0; for (uint32_t N_id_2 = 0; N_id_2 < 3; N_id_2++) { - INFO("CELL SEARCH: Starting scan for N_id_2=%d\n", N_id_2); + INFO("CELL SEARCH: Starting scan for N_id_2=%d", N_id_2); ret = srslte_ue_cellsearch_scan_N_id_2(q, N_id_2, &found_cells[N_id_2]); if (ret < 0) { - ERROR("Error searching cell\n"); + ERROR("Error searching cell"); return ret; } nof_detected_cells += ret; @@ -300,7 +300,7 @@ int srslte_ue_cellsearch_scan_N_id_2(srslte_ue_cellsearch_t* q, do { ret = srslte_ue_sync_zerocopy(&q->ue_sync, q->sf_buffer, CELL_SEARCH_BUFFER_MAX_SAMPLES); if (ret < 0) { - ERROR("Error calling srslte_ue_sync_work()\n"); + ERROR("Error calling srslte_ue_sync_work()"); return -1; } else if (ret == 1) { /* This means a peak was found in find state */ @@ -313,7 +313,7 @@ int srslte_ue_cellsearch_scan_N_id_2(srslte_ue_cellsearch_t* q, q->candidates[nof_detected_frames].psr = srslte_sync_get_peak_value(&q->ue_sync.sfind); q->candidates[nof_detected_frames].cfo = 15000 * srslte_sync_get_cfo(&q->ue_sync.sfind); q->candidates[nof_detected_frames].frame_type = srslte_ue_sync_get_frame_type(&q->ue_sync); - INFO("CELL SEARCH: [%d/%d/%d]: Found peak PSR=%.3f, Cell_id: %d CP: %s, CFO=%.1f KHz\n", + INFO("CELL SEARCH: [%d/%d/%d]: Found peak PSR=%.3f, Cell_id: %d CP: %s, CFO=%.1f KHz", nof_detected_frames, nof_scanned_frames, q->nof_valid_frames, diff --git a/lib/src/phy/ue/ue_cell_search_nbiot.c b/lib/src/phy/ue/ue_cell_search_nbiot.c index ba34a0629..832e897eb 100644 --- a/lib/src/phy/ue/ue_cell_search_nbiot.c +++ b/lib/src/phy/ue/ue_cell_search_nbiot.c @@ -23,7 +23,7 @@ int srslte_ue_cellsearch_nbiot_init(srslte_ue_cellsearch_nbiot_t* q, uint32_t max_frames_total, - int(recv_callback)(void*, cf_t * [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), + int(recv_callback)(void*, cf_t* [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), void* stream_handler) { int ret = SRSLTE_ERROR_INVALID_INPUTS; @@ -114,13 +114,13 @@ int srslte_ue_cellsearch_nbiot_scan(srslte_ue_cellsearch_nbiot_t* q) break; } else if (ret == 1) { // we are in sync, wait until we have received two full frames, store subframe 9 for both - DEBUG("In tracking state sf_idx=%d\n", srslte_ue_sync_nbiot_get_sfidx(&q->ue_sync)); + DEBUG("In tracking state sf_idx=%d", srslte_ue_sync_nbiot_get_sfidx(&q->ue_sync)); if (srslte_ue_sync_nbiot_get_sfidx(&q->ue_sync) == 9) { // accumulate NSSS subframes for cell id detection srslte_vec_cf_copy(&q->nsss_buffer[q->nsss_sf_counter * q->sf_len], q->rx_buffer[0], q->sf_len); q->nsss_sf_counter++; if (q->nsss_sf_counter == SRSLTE_NSSS_NUM_SF_DETECT) { - DEBUG("Captured %d subframes for NSSS detection.\n", q->nsss_sf_counter); + DEBUG("Captured %d subframes for NSSS detection.", q->nsss_sf_counter); return SRSLTE_SUCCESS; } } @@ -145,7 +145,7 @@ int srslte_ue_cellsearch_nbiot_detect(srslte_ue_cellsearch_nbiot_t* q, srslte_nb found_cells[0].peak = q->ue_sync.strack.npss.peak_value; found_cells[0].psr = srslte_sync_nbiot_get_peak_value(&q->ue_sync.strack); found_cells[0].cfo = srslte_ue_sync_nbiot_get_cfo(&q->ue_sync); - INFO("CELL SEARCH: Found peak PSR=%.3f, Cell_id: %d\n", found_cells[0].psr, found_cells[0].n_id_ncell); + INFO("CELL SEARCH: Found peak PSR=%.3f, Cell_id: %d", found_cells[0].psr, found_cells[0].n_id_ncell); } } return ret; diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index a36ca2f41..3abe791c3 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -88,7 +88,7 @@ int srslte_ue_dl_init(srslte_ue_dl_t* q, cf_t* in_buffer[SRSLTE_MAX_PORTS], uint ofdm_cfg.sf_type = SRSLTE_SF_NORM; if (srslte_ofdm_rx_init_cfg(&q->fft[i], &ofdm_cfg)) { - ERROR("Error initiating FFT\n"); + ERROR("Error initiating FFT"); goto clean_exit; } } @@ -97,46 +97,46 @@ int srslte_ue_dl_init(srslte_ue_dl_t* q, cf_t* in_buffer[SRSLTE_MAX_PORTS], uint ofdm_cfg.out_buffer = q->sf_symbols[0]; ofdm_cfg.sf_type = SRSLTE_SF_MBSFN; if (srslte_ofdm_rx_init_cfg(&q->fft_mbsfn, &ofdm_cfg)) { - ERROR("Error initiating FFT for MBSFN subframes \n"); + ERROR("Error initiating FFT for MBSFN subframes "); goto clean_exit; } srslte_ofdm_set_non_mbsfn_region(&q->fft_mbsfn, 2); // Set a default to init if (srslte_chest_dl_init(&q->chest, max_prb, nof_rx_antennas)) { - ERROR("Error initiating channel estimator\n"); + ERROR("Error initiating channel estimator"); goto clean_exit; } if (srslte_chest_dl_res_init(&q->chest_res, max_prb)) { - ERROR("Error initiating channel estimator\n"); + ERROR("Error initiating channel estimator"); goto clean_exit; } if (srslte_pcfich_init(&q->pcfich, nof_rx_antennas)) { - ERROR("Error creating PCFICH object\n"); + ERROR("Error creating PCFICH object"); goto clean_exit; } if (srslte_phich_init(&q->phich, nof_rx_antennas)) { - ERROR("Error creating PHICH object\n"); + ERROR("Error creating PHICH object"); goto clean_exit; } if (srslte_pdcch_init_ue(&q->pdcch, max_prb, nof_rx_antennas)) { - ERROR("Error creating PDCCH object\n"); + ERROR("Error creating PDCCH object"); goto clean_exit; } if (srslte_pdsch_init_ue(&q->pdsch, max_prb, nof_rx_antennas)) { - ERROR("Error creating PDSCH object\n"); + ERROR("Error creating PDSCH object"); goto clean_exit; } if (srslte_pmch_init(&q->pmch, max_prb, nof_rx_antennas)) { - ERROR("Error creating PMCH object\n"); + ERROR("Error creating PMCH object"); goto clean_exit; } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters\n"); + ERROR("Invalid parameters"); } clean_exit: @@ -188,13 +188,13 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t* q, srslte_cell_t cell) q->cell = cell; for (int i = 0; i < SRSLTE_MI_NOF_REGS; i++) { if (srslte_regs_init_opts(&q->regs[i], q->cell, mi_reg_idx[i % 3], i > 2)) { - ERROR("Error resizing REGs\n"); + ERROR("Error resizing REGs"); return SRSLTE_ERROR; } } for (int port = 0; port < q->nof_rx_antennas; port++) { if (srslte_ofdm_rx_set_prb(&q->fft[port], q->cell.cp, q->cell.nof_prb)) { - ERROR("Error resizing FFT\n"); + ERROR("Error resizing FFT"); return SRSLTE_ERROR; } } @@ -208,35 +208,35 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t* q, srslte_cell_t cell) } if (srslte_ofdm_rx_set_prb(&q->fft_mbsfn, SRSLTE_CP_EXT, q->cell.nof_prb)) { - ERROR("Error resizing MBSFN FFT\n"); + ERROR("Error resizing MBSFN FFT"); return SRSLTE_ERROR; } if (srslte_chest_dl_set_cell(&q->chest, q->cell)) { - ERROR("Error resizing channel estimator\n"); + ERROR("Error resizing channel estimator"); return SRSLTE_ERROR; } if (srslte_pcfich_set_cell(&q->pcfich, &q->regs[0], q->cell)) { - ERROR("Error resizing PCFICH object\n"); + ERROR("Error resizing PCFICH object"); return SRSLTE_ERROR; } if (srslte_phich_set_cell(&q->phich, &q->regs[phich_init_reg], q->cell)) { - ERROR("Error resizing PHICH object\n"); + ERROR("Error resizing PHICH object"); return SRSLTE_ERROR; } if (srslte_pdcch_set_cell(&q->pdcch, &q->regs[pdcch_init_reg], q->cell)) { - ERROR("Error resizing PDCCH object\n"); + ERROR("Error resizing PDCCH object"); return SRSLTE_ERROR; } if (srslte_pdsch_set_cell(&q->pdsch, q->cell)) { - ERROR("Error resizing PDSCH object\n"); + ERROR("Error resizing PDSCH object"); return SRSLTE_ERROR; } if (srslte_pmch_set_cell(&q->pmch, q->cell)) { - ERROR("Error resizing PMCH object\n"); + ERROR("Error resizing PMCH object"); return SRSLTE_ERROR; } } @@ -245,7 +245,7 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t* q, srslte_cell_t cell) } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid cell properties ue_dl: Id=%d, Ports=%d, PRBs=%d\n", cell.id, cell.nof_ports, cell.nof_prb); + ERROR("Invalid cell properties ue_dl: Id=%d, Ports=%d, PRBs=%d", cell.id, cell.nof_ports, cell.nof_prb); } return ret; } @@ -272,7 +272,6 @@ void srslte_ue_dl_set_mi_manual(srslte_ue_dl_t* q, uint32_t mi_idx) */ void srslte_ue_dl_set_rnti(srslte_ue_dl_t* q, uint16_t rnti) { - srslte_pdsch_set_rnti(&q->pdsch, rnti); srslte_dl_sf_cfg_t sf_cfg; @@ -284,7 +283,7 @@ void srslte_ue_dl_set_rnti(srslte_ue_dl_t* q, uint16_t rnti) for (int cfi = 1; cfi <= SRSLTE_NOF_CFI; cfi++) { sf_cfg.cfi = cfi; for (int sf_idx = 0; sf_idx < SRSLTE_NOF_SF_X_FRAME; sf_idx++) { - sf_cfg.tti = sf_idx; + sf_cfg.tti = sf_idx; q->current_ss_ue[i][SRSLTE_CFI_IDX(cfi)][sf_idx].nof_locations = srslte_pdcch_ue_locations( &q->pdcch, &sf_cfg, q->current_ss_ue[i][SRSLTE_CFI_IDX(cfi)][sf_idx].loc, SRSLTE_MAX_CANDIDATES_UE, rnti); } @@ -304,11 +303,11 @@ int srslte_ue_dl_set_mbsfn_area_id(srslte_ue_dl_t* q, uint16_t mbsfn_area_id) if (q != NULL) { ret = SRSLTE_ERROR; if (srslte_chest_dl_set_mbsfn_area_id(&q->chest, mbsfn_area_id)) { - ERROR("Error setting MBSFN area ID \n"); + ERROR("Error setting MBSFN area ID "); return ret; } if (srslte_pmch_set_area_id(&q->pmch, mbsfn_area_id)) { - ERROR("Error setting MBSFN area ID \n"); + ERROR("Error setting MBSFN area ID "); return ret; } q->current_mbsfn_area_id = mbsfn_area_id; @@ -322,12 +321,12 @@ static void set_mi_value(srslte_ue_dl_t* q, srslte_dl_sf_cfg_t* sf, srslte_ue_dl uint32_t sf_idx = sf->tti % 10; // Set mi value in pdcch region if (q->mi_auto) { - INFO("Setting PHICH mi value auto. sf_idx=%d, mi=%d, idx=%d\n", sf_idx, MI_VALUE(sf_idx), MI_IDX(sf_idx)); + INFO("Setting PHICH mi value auto. sf_idx=%d, mi=%d, idx=%d", sf_idx, MI_VALUE(sf_idx), MI_IDX(sf_idx)); srslte_phich_set_regs(&q->phich, &q->regs[MI_IDX(sf_idx)]); srslte_pdcch_set_regs(&q->pdcch, &q->regs[MI_IDX(sf_idx)]); } else { // No subframe 1 or 6 so no need to consider it - INFO("Setting PHICH mi value manual. sf_idx=%d, mi=%d, idx=%d\n", + INFO("Setting PHICH mi value manual. sf_idx=%d, mi=%d, idx=%d", sf_idx, q->mi_manual_index, mi_reg_idx_inv[q->mi_manual_index]); @@ -339,7 +338,6 @@ static void set_mi_value(srslte_ue_dl_t* q, srslte_dl_sf_cfg_t* sf, srslte_ue_dl static int estimate_pdcch_pcfich(srslte_ue_dl_t* q, srslte_dl_sf_cfg_t* sf, srslte_ue_dl_cfg_t* cfg) { if (q) { - float cfi_corr = 0; set_mi_value(q, sf, cfg); @@ -349,21 +347,21 @@ static int estimate_pdcch_pcfich(srslte_ue_dl_t* q, srslte_dl_sf_cfg_t* sf, srsl /* First decode PCFICH and obtain CFI */ if (srslte_pcfich_decode(&q->pcfich, sf, &q->chest_res, q->sf_symbols, &cfi_corr) < 0) { - ERROR("Error decoding PCFICH\n"); + ERROR("Error decoding PCFICH"); return SRSLTE_ERROR; } if (q->cell.frame_type == SRSLTE_TDD && ((sf->tti % 10) == 1 || (sf->tti % 10) == 6) && sf->cfi == 3) { sf->cfi = 2; - INFO("Received CFI=3 in subframe 1 or 6 and TDD. Setting to 2\n"); + INFO("Received CFI=3 in subframe 1 or 6 and TDD. Setting to 2"); } if (srslte_pdcch_extract_llr(&q->pdcch, sf, &q->chest_res, q->sf_symbols)) { - ERROR("Extracting PDCCH LLR\n"); + ERROR("Extracting PDCCH LLR"); return false; } - INFO("Decoded CFI=%d with correlation %.2f, sf_idx=%d\n", sf->cfi, cfi_corr, sf->tti % 10); + INFO("Decoded CFI=%d with correlation %.2f, sf_idx=%d", sf->cfi, cfi_corr, sf->tti % 10); return SRSLTE_SUCCESS; } else { @@ -450,15 +448,15 @@ static int dci_blind_search(srslte_ue_dl_t* q, if (rnti) { for (int l = 0; l < search_space->nof_locations; l++) { if (nof_dci >= SRSLTE_MAX_DCI_MSG) { - ERROR("Can't store more DCIs in buffer\n"); + ERROR("Can't store more DCIs in buffer"); return nof_dci; } if (dci_location_is_allocated(q, search_space->loc[l])) { - INFO("Skipping location L=%d, ncce=%d. Already allocated\n", search_space->loc[l].L, search_space->loc[l].ncce); + INFO("Skipping location L=%d, ncce=%d. Already allocated", search_space->loc[l].L, search_space->loc[l].ncce); continue; } for (uint32_t f = 0; f < search_space->nof_formats; f++) { - INFO("Searching format %s in %d,%d (%d/%d)\n", + INFO("Searching format %s in %d,%d (%d/%d)", srslte_dci_format_string(search_space->formats[f]), search_space->loc[l].ncce, search_space->loc[l].L, @@ -470,7 +468,7 @@ static int dci_blind_search(srslte_ue_dl_t* q, dci_msg[nof_dci].format = search_space->formats[f]; dci_msg[nof_dci].rnti = 0; if (srslte_pdcch_decode_msg(&q->pdcch, sf, dci_cfg, &dci_msg[nof_dci])) { - ERROR("Error decoding DCI msg\n"); + ERROR("Error decoding DCI msg"); return SRSLTE_ERROR; } @@ -500,7 +498,7 @@ static int dci_blind_search(srslte_ue_dl_t* q, dci_msg[nof_dci].format = dci_msg[nof_dci].payload[0] ? SRSLTE_DCI_FORMAT1A : SRSLTE_DCI_FORMAT0; // Format0/1A bit indicator is the MSB - INFO("DCI msg found in location L=%d, ncce=%d, size=%d belongs to the common SS and is format %s\n", + INFO("DCI msg found in location L=%d, ncce=%d, size=%d belongs to the common SS and is format %s", dci_msg[nof_dci].location.L, dci_msg[nof_dci].location.ncce, dci_msg[nof_dci].nof_bits, @@ -529,13 +527,13 @@ static int dci_blind_search(srslte_ue_dl_t* q, nof_dci++; break; } else { - INFO("Ignoring message with size %d, already decoded\n", dci_msg[nof_dci].nof_bits); + INFO("Ignoring message with size %d, already decoded", dci_msg[nof_dci].nof_bits); } } } } } else { - ERROR("RNTI not specified\n"); + ERROR("RNTI not specified"); } return nof_dci; } @@ -557,7 +555,7 @@ static int find_dci_ss(srslte_ue_dl_t* q, srslte_dci_cfg_t dci_cfg = cfg->cfg.dci; if (!SRSLTE_CFI_ISVALID(cfi)) { - ERROR("Invalid CFI=%d\n", cfi); + ERROR("Invalid CFI=%d", cfi); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -587,7 +585,7 @@ static int find_dci_ss(srslte_ue_dl_t* q, current_ss->nof_formats = nof_formats; memcpy(current_ss->formats, formats, nof_formats * sizeof(srslte_dci_format_t)); - INFO("Searching %d formats in %d locations in %s SS, csi=%d\n", + INFO("Searching %d formats in %d locations in %s SS, csi=%d", nof_formats, current_ss->nof_locations, is_ue ? "ue" : "common", @@ -619,7 +617,7 @@ int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t* q, // Unpack DCI messages for (uint32_t i = 0; i < nof_msg; i++) { if (srslte_dci_msg_unpack_pusch(&q->cell, sf, &dl_cfg->cfg.dci, &dci_msg[i], &dci_ul[i])) { - ERROR("Unpacking UL DCI\n"); + ERROR("Unpacking UL DCI"); return SRSLTE_ERROR; } } @@ -651,7 +649,7 @@ static int find_dl_ul_dci_type_crnti(srslte_ue_dl_t* q, int ret = SRSLTE_SUCCESS; if (dl_cfg->cfg.tm > SRSLTE_TM8) { - ERROR("Searching DL CRNTI: Invalid TM=%d\n", dl_cfg->cfg.tm + 1); + ERROR("Searching DL CRNTI: Invalid TM=%d", dl_cfg->cfg.tm + 1); return SRSLTE_ERROR; } @@ -670,7 +668,6 @@ static int find_dl_ul_dci_type_crnti(srslte_ue_dl_t* q, // Search common SS if (dl_cfg->cfg.dci_common_ss) { - // Search only for SRSLTE_DCI_FORMAT1A (1st in common_formats) when looking for C-RNTI ret = 0; if ((ret = find_dci_ss(q, sf, dl_cfg, rnti, &dci_msg[nof_dci_msg], common_formats, 1, false)) < 0) { @@ -706,14 +703,14 @@ int srslte_ue_dl_find_dl_dci(srslte_ue_dl_t* q, } if (nof_msg < 0) { - ERROR("Invalid number of DCI messages\n"); + ERROR("Invalid number of DCI messages"); return SRSLTE_ERROR; } // Unpack DCI messages for (uint32_t i = 0; i < nof_msg; i++) { if (srslte_dci_msg_unpack_pdsch(&q->cell, sf, &dl_cfg->cfg.dci, &dci_msg[i], &dci_dl[i])) { - ERROR("Unpacking DL DCI\n"); + ERROR("Unpacking DL DCI"); return SRSLTE_ERROR; } } @@ -758,7 +755,7 @@ int srslte_ue_dl_decode_phich(srslte_ue_dl_t* q, set_mi_value(q, sf, cfg); srslte_phich_calc(&q->phich, grant, &n_phich); - INFO("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, I_phich=%d, n_group=%d, n_seq=%d, Ngroups=%d, Nsf=%d\n", + INFO("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, I_phich=%d, n_group=%d, n_seq=%d, Ngroups=%d, Nsf=%d", sf_idx, grant->n_prb_lowest, grant->n_dmrs, @@ -769,10 +766,10 @@ int srslte_ue_dl_decode_phich(srslte_ue_dl_t* q, srslte_phich_nsf(&q->phich)); if (!srslte_phich_decode(&q->phich, sf, &q->chest_res, n_phich, q->sf_symbols, result)) { - INFO("Decoded PHICH %d with distance %f\n", result->ack_value, result->distance); + INFO("Decoded PHICH %d with distance %f", result->ack_value, result->distance); return 0; } else { - ERROR("Error decoding PHICH\n"); + ERROR("Error decoding PHICH"); return -1; } } @@ -894,7 +891,6 @@ void srslte_ue_dl_gen_cqi_periodic(srslte_ue_dl_t* q, uci_data->cfg.cqi.ri_len = 1; uci_data->value.ri = cfg->last_ri; } else if (srslte_cqi_periodic_send(&cfg->cfg.cqi_report, tti, q->cell.frame_type)) { - if (cfg->cfg.cqi_report.format_is_subband) { // TODO: Implement subband periodic reports uci_data->cfg.cqi.type = SRSLTE_CQI_TYPE_SUBBAND; @@ -1000,7 +996,7 @@ void srslte_ue_dl_gen_cqi_aperiodic(srslte_ue_dl_t* q, break; default: - ERROR("CQI mode %d not supported\n", cfg->cfg.cqi_report.aperiodic_mode); + ERROR("CQI mode %d not supported", cfg->cfg.cqi_report.aperiodic_mode); break; } } @@ -1040,7 +1036,6 @@ ue_dl_gen_ack_fdd_pcell_skip_drx(const srslte_pdsch_ack_t* ack_info, srslte_uci_ static void ue_dl_gen_ack_fdd_all_keep_drx(const srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_data, uint32_t nof_tb) { - for (uint32_t cc_idx = 0; cc_idx < ack_info->nof_cc; cc_idx++) { // Find ACK/NACK if (ack_info->cc[cc_idx].m[0].present) { @@ -1154,7 +1149,6 @@ static void gen_ack_fdd(const srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* u // For each HARQ ACK/NACK feedback mode switch (ack_info->ack_nack_feedback_mode) { - case SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL: // Get ACK from PCell only, skipping DRX ue_dl_gen_ack_fdd_pcell_skip_drx(ack_info, uci_data, nof_tb); @@ -1242,7 +1236,6 @@ static void gen_ack_tdd(bool is_tdd_mode16, const srslte_pdsch_ack_t* ack_info, uint32_t min_k = 10; if (ack_value->M > 0) { - ack_cfg->tdd_ack_M = ack_value->M; // ACK/NACK bundling or multiplexing and M=1 @@ -1322,7 +1315,6 @@ static void gen_ack_tdd(bool is_tdd_mode16, const srslte_pdsch_ack_t* ack_info, // For TDD PUSCH if (is_tdd_mode16) { - uint32_t V_dai_ul = ack_info->V_dai_ul + 1; // Table 7.3-x ack_cfg->tdd_is_multiplex = ack_info->tdd_ack_multiplex; @@ -1467,7 +1459,6 @@ int srslte_ue_dl_find_and_decode(srslte_ue_dl_t* q, // Blind search PHICH mi value ret = 0; for (uint32_t i = 0; i < mi_set_len && !ret; i++) { - if (mi_set_len == 1) { srslte_ue_dl_set_mi_auto(q); } else { @@ -1486,7 +1477,7 @@ int srslte_ue_dl_find_and_decode(srslte_ue_dl_t* q, if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO) { char str[512]; srslte_dci_dl_info(&dci_dl[0], str, 512); - INFO("PDCCH: %s, snr=%.1f dB\n", str, q->chest_res.snr_db); + INFO("PDCCH: %s, snr=%.1f dB", str, q->chest_res.snr_db); } // Force known MBSFN grant @@ -1501,7 +1492,7 @@ int srslte_ue_dl_find_and_decode(srslte_ue_dl_t* q, // Convert DCI message to DL grant if (srslte_ue_dl_dci_to_pdsch_grant(q, sf, cfg, &dci_dl[0], &pdsch_cfg->grant)) { - ERROR("Error unpacking DCI\n"); + ERROR("Error unpacking DCI"); return SRSLTE_ERROR; } @@ -1529,13 +1520,13 @@ int srslte_ue_dl_find_and_decode(srslte_ue_dl_t* q, if (decode_enable) { if (sf->sf_type == SRSLTE_SF_NORM) { if (srslte_ue_dl_decode_pdsch(q, sf, pdsch_cfg, pdsch_res)) { - ERROR("ERROR: Decoding PDSCH\n"); + ERROR("ERROR: Decoding PDSCH"); ret = -1; } } else { pmch_cfg.pdsch_cfg = *pdsch_cfg; if (srslte_ue_dl_decode_pmch(q, sf, &pmch_cfg, pdsch_res)) { - ERROR("Decoding PMCH\n"); + ERROR("Decoding PMCH"); ret = -1; } } diff --git a/lib/src/phy/ue/ue_dl_nbiot.c b/lib/src/phy/ue/ue_dl_nbiot.c index 0577c7897..8b47b3821 100644 --- a/lib/src/phy/ue/ue_dl_nbiot.c +++ b/lib/src/phy/ue/ue_dl_nbiot.c @@ -172,13 +172,11 @@ int srslte_nbiot_ue_dl_set_cell(srslte_nbiot_ue_dl_t* q, srslte_nbiot_cell_t cel int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && srslte_nbiot_cell_isvalid(&cell)) { - q->pkt_errors = 0; q->pkts_total = 0; q->sample_offset = 0; if (q->cell.n_id_ncell != cell.n_id_ncell || q->cell.base.nof_prb == 0) { - q->cell = cell; if (srslte_chest_dl_nbiot_set_cell(&q->chest, q->cell)) { @@ -249,7 +247,6 @@ void srslte_nbiot_ue_dl_set_si_params(srslte_nbiot_ue_dl_t* q, srslte_nbiot_si_params_t params) { if (type < SRSLTE_NBIOT_SI_TYPE_NITEMS) { - if (params.n != 0) { // calculate TTIs for this SI int x = (params.n - 1) * params.si_window_length; @@ -261,7 +258,7 @@ void srslte_nbiot_ue_dl_set_si_params(srslte_nbiot_ue_dl_t* q, // SI is always transmitted in subframe 1 int si_start_tti = 10 * sfn + 1; - INFO("Start SI tx in TTI=%d\n", si_start_tti); + INFO("Start SI tx in TTI=%d", si_start_tti); do { // TBS 56 and 120 are sent over 2 sub-frames, all other over 8 @@ -338,13 +335,8 @@ void srslte_nbiot_ue_dl_get_sib1_grant(srslte_nbiot_ue_dl_t* q, uint32_t sfn, sr bzero(&ra_dl_sib1, sizeof(srslte_ra_nbiot_dl_dci_t)); ra_dl_sib1.alloc.has_sib1 = true; ra_dl_sib1.alloc.sched_info_sib1 = q->mib.sched_info_sib1; - srslte_ra_nbiot_dl_dci_to_grant(&ra_dl_sib1, - grant, - srslte_nbiot_ue_dl_get_next_sib1_start(q, sfn), - 4, - DUMMY_R_MAX, - true, - q->cell.mode); + srslte_ra_nbiot_dl_dci_to_grant( + &ra_dl_sib1, grant, srslte_nbiot_ue_dl_get_next_sib1_start(q, sfn), 4, DUMMY_R_MAX, true, q->cell.mode); grant->has_sib1 = true; } @@ -411,7 +403,7 @@ void srslte_nbiot_ue_dl_decode_sib(srslte_nbiot_ue_dl_t* q, srslte_nbiot_si_params_t params) { if (q->has_dl_grant) { - INFO("Already processing grant, skipping this.\n"); + INFO("Already processing grant, skipping this."); return; } @@ -421,12 +413,12 @@ void srslte_nbiot_ue_dl_decode_sib(srslte_nbiot_ue_dl_t* q, srslte_ra_nbiot_dl_grant_t grant; srslte_nbiot_ue_dl_get_sib_grant(q, hfn, sfn, params, &grant); srslte_nbiot_ue_dl_set_grant(q, &grant); - INFO("%d.x: Activated SIB2 reception in hfn=%d, sfn=%d\n", + INFO("%d.x: Activated SIB2 reception in hfn=%d, sfn=%d", sfn, q->npdsch_cfg.grant.start_hfn, q->npdsch_cfg.grant.start_sfn); } else { - INFO("Not handling this SI type.\n"); + INFO("Not handling this SI type."); } } @@ -493,7 +485,6 @@ int srslte_nbiot_ue_dl_decode_fft_estimate(srslte_nbiot_ue_dl_t* q, uint32_t sf_ int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && sf_idx < SRSLTE_NOF_SF_X_FRAME) { - ret = SRSLTE_ERROR; // Run FFT for all subframe data @@ -599,7 +590,7 @@ dci_blind_search(srslte_nbiot_ue_dl_t* q, dci_blind_search_t* search_space, uint ret = 0; int i = 0; while (!ret && i < search_space->nof_locations) { - DEBUG("Searching format %s in %d,%d\n", + DEBUG("Searching format %s in %d,%d", srslte_dci_format_string(search_space->format), search_space->loc[i].ncce, search_space->loc[i].L); @@ -638,8 +629,7 @@ int srslte_nbiot_ue_dl_find_dl_dci_type_siprarnti(srslte_nbiot_ue_dl_t* q, uint1 dci_blind_search_t search_space; search_space.nof_locations = srslte_npdcch_common_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_COM); - DEBUG( - "Searching SI/P/RA-RNTI in %d common locations, %d formats\n", search_space.nof_locations, nb_nof_common_formats); + DEBUG("Searching SI/P/RA-RNTI in %d common locations, %d formats", search_space.nof_locations, nb_nof_common_formats); // Search for RNTI only if there is room for the common search space if (search_space.nof_locations > 0) { for (int f = 0; f < nb_nof_common_formats; f++) { @@ -663,7 +653,7 @@ int srslte_nbiot_ue_dl_find_dl_dci_type_crnti(srslte_nbiot_ue_dl_t* q, // Search UE-specific search space dci_blind_search_t search_space; search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_UE); - DEBUG("x.%d: Searching DL C-RNTI=0x%x in %d locations, %d formats\n", + DEBUG("x.%d: Searching DL C-RNTI=0x%x in %d locations, %d formats", sf_idx, rnti, search_space.nof_locations, @@ -691,12 +681,12 @@ int srslte_nbiot_ue_dl_decode_npdsch(srslte_nbiot_ue_dl_t* q, // skip subframe without grant and if it's not a valid downlink subframe if (q->has_dl_grant == false || srslte_ra_nbiot_is_valid_dl_sf(sfn * 10 + sf_idx) == false) { - DEBUG("%d.%d: Skipping NPDSCH processing.\n", sfn, sf_idx); + DEBUG("%d.%d: Skipping NPDSCH processing.", sfn, sf_idx); return SRSLTE_NBIOT_UE_DL_SKIP_SF; } // run FFT and estimate channel - DEBUG("%d.%d: Estimating channel.\n", sfn, sf_idx); + DEBUG("%d.%d: Estimating channel.", sfn, sf_idx); if ((srslte_nbiot_ue_dl_decode_fft_estimate(q, sf_idx, true)) < 0) { return ret; } @@ -705,7 +695,7 @@ int srslte_nbiot_ue_dl_decode_npdsch(srslte_nbiot_ue_dl_t* q, if (srslte_nbiot_ue_dl_is_sib1_sf(q, sfn, sf_idx) && q->has_dl_grant) { if (q->npdsch_cfg.grant.has_sib1 == false) { // skip SIB1 decoding if grant is being processed - DEBUG("%d.%d: Skipping SIB1 due to ongoing DL reception.\n", sfn, sf_idx); + DEBUG("%d.%d: Skipping SIB1 due to ongoing DL reception.", sfn, sf_idx); return SRSLTE_NBIOT_EXPECT_MORE_SF; } } @@ -724,7 +714,7 @@ int srslte_nbiot_ue_dl_decode_npdsch(srslte_nbiot_ue_dl_t* q, ret = srslte_nbiot_ue_dl_decode_npdsch_no_bcch(q, data, sfn * 10 + sf_idx, rnti); } } else { - DEBUG("%d.%d: WARNING: DL grant still active. Possibly needs to be deactivated.\n", sfn, sf_idx); + DEBUG("%d.%d: WARNING: DL grant still active. Possibly needs to be deactivated.", sfn, sf_idx); ret = SRSLTE_NBIOT_UE_DL_SKIP_SF; } @@ -739,11 +729,11 @@ int srslte_nbiot_ue_dl_decode_npdsch_no_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* d int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q->npdsch_cfg.sf_idx >= SRSLTE_NPDSCH_MAX_NOF_SF) { - ERROR("Invalid npdsch_cfg.sf_idx=%d\n", q->npdsch_cfg.sf_idx); + ERROR("Invalid npdsch_cfg.sf_idx=%d", q->npdsch_cfg.sf_idx); return ret; } - INFO("%d.%d: NPDSCH processing sf_idx=%d/%d rep=%d/%d tot=%d/%d\n", + INFO("%d.%d: NPDSCH processing sf_idx=%d/%d rep=%d/%d tot=%d/%d", tti / 10, tti % 10, q->npdsch_cfg.sf_idx + 1, @@ -800,7 +790,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_no_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* d if (q->npdsch_cfg.num_sf == q->npdsch_cfg.grant.nof_sf * q->npdsch_cfg.grant.nof_rep) { // try to decode NPDSCH - INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s).\n", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf); + INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s).", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf); if (srslte_nbiot_ue_dl_decode_rnti_packet(q, &q->npdsch_cfg.grant, data, @@ -811,7 +801,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_no_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* d q->ce_buffer, q->npdsch_cfg.rep_idx) != SRSLTE_SUCCESS) { // decoding failed - INFO("%d.%d: Error decoding NPDSCH with %d repetitions.\n", tti / 10, tti % 10, q->npdsch_cfg.rep_idx); + INFO("%d.%d: Error decoding NPDSCH with %d repetitions.", tti / 10, tti % 10, q->npdsch_cfg.rep_idx); q->pkt_errors++; q->has_dl_grant = false; ret = SRSLTE_ERROR; @@ -820,7 +810,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_no_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* d ret = SRSLTE_SUCCESS; } } else { - DEBUG("%d.%d: Waiting for %d more subframes.\n", + DEBUG("%d.%d: Waiting for %d more subframes.", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf * q->npdsch_cfg.grant.nof_rep - q->npdsch_cfg.num_sf); @@ -842,7 +832,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* data // make sure we also look on odd SFNs (if n_rep=16 and n_id_ncell%2=1) uint32_t valid_si_sfn = tti / 10 + srslte_ra_nbiot_sib1_start(q->cell.n_id_ncell, &q->mib); if (valid_si_sfn % 2 == 0 && tti % 10 == 4) { - INFO("%d.%d: NPDSCH processing sf_idx=%d/%d rep=%d/%d tot=%d/%d\n", + INFO("%d.%d: NPDSCH processing sf_idx=%d/%d rep=%d/%d tot=%d/%d", tti / 10, tti % 10, q->npdsch_cfg.sf_idx + 1, @@ -863,7 +853,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* data // check if we already have received the entire transmission if (q->npdsch_cfg.num_sf % q->npdsch_cfg.grant.nof_sf == 0) { // try to decode NPDSCH - INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s).\n", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf); + INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s).", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf); if (srslte_nbiot_ue_dl_decode_rnti_packet(q, &q->npdsch_cfg.grant, data, @@ -878,11 +868,11 @@ int srslte_nbiot_ue_dl_decode_npdsch_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* data // store soft-bits of first repetition srslte_vec_f_copy(q->llr, q->npdsch.llr, q->npdsch_cfg.grant.nof_sf * q->npdsch_cfg.nbits.nof_bits); } else { - INFO("Soft-combining NPDSCH repetition %d\n", q->npdsch_cfg.rep_idx); + INFO("Soft-combining NPDSCH repetition %d", q->npdsch_cfg.rep_idx); srslte_vec_sum_fff(q->llr, q->npdsch.llr, q->llr, q->npdsch_cfg.grant.nof_sf * q->npdsch_cfg.nbits.nof_bits); // try to decode combined soft-bits - INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s) after %d repetitions.\n", + INFO("%d.%d: Trying to decode NPDSCH with %d subframe(s) after %d repetitions.", tti / 10, tti % 10, q->npdsch_cfg.grant.nof_sf, @@ -903,11 +893,10 @@ int srslte_nbiot_ue_dl_decode_npdsch_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* data q->npdsch_cfg.rep_idx++; if (q->npdsch_cfg.rep_idx < q->npdsch_cfg.grant.nof_rep) { - DEBUG("%d.%d: Couldn't decode NPDSCH, waiting for next repetition\n", tti / 10, tti % 10); + DEBUG("%d.%d: Couldn't decode NPDSCH, waiting for next repetition", tti / 10, tti % 10); ret = SRSLTE_NBIOT_EXPECT_MORE_SF; } else { - - INFO("%d.%d: Error decoding NPDSCH with %d repetitions.\n", tti / 10, tti % 10, q->npdsch_cfg.rep_idx); + INFO("%d.%d: Error decoding NPDSCH with %d repetitions.", tti / 10, tti % 10, q->npdsch_cfg.rep_idx); ret = SRSLTE_ERROR; q->pkt_errors++; // count as error after all repetitons failed q->has_dl_grant = false; @@ -918,7 +907,7 @@ int srslte_nbiot_ue_dl_decode_npdsch_bcch(srslte_nbiot_ue_dl_t* q, uint8_t* data return SRSLTE_SUCCESS; } } else { - DEBUG("%d.%d: Waiting for more subframes.\n", tti / 10, tti % 10); + DEBUG("%d.%d: Waiting for more subframes.", tti / 10, tti % 10); ret = SRSLTE_NBIOT_EXPECT_MORE_SF; } } @@ -941,12 +930,12 @@ int srslte_nbiot_ue_dl_decode_npdcch(srslte_nbiot_ue_dl_t* q, // skip subframe with grant and if it's not a valid downlink subframe if (q->has_dl_grant || srslte_ra_nbiot_is_valid_dl_sf(sfn * 10 + sf_idx) == false) { - DEBUG("%d.%d: Skipping NPDCCH processing.\n", sfn, sf_idx); + DEBUG("%d.%d: Skipping NPDCCH processing.", sfn, sf_idx); return ret; } // run FFT and estimate channel - DEBUG("%d.%d: Estimating channel.\n", sfn, sf_idx); + DEBUG("%d.%d: Estimating channel.", sfn, sf_idx); if ((srslte_nbiot_ue_dl_decode_fft_estimate(q, sf_idx, true)) < 0) { return ret; } @@ -955,7 +944,7 @@ int srslte_nbiot_ue_dl_decode_npdcch(srslte_nbiot_ue_dl_t* q, if (srslte_nbiot_ue_dl_is_si_tti(q, sfn, sf_idx) && q->has_dl_grant) { if (q->npdsch_cfg.grant.has_sib1 == false) { // skip SI decoding if grant is being processed - DEBUG("%d.%d: Skipping SI SF due to ongoing DL reception.\n", sfn, sf_idx); + DEBUG("%d.%d: Skipping SI SF due to ongoing DL reception.", sfn, sf_idx); return SRSLTE_NBIOT_EXPECT_MORE_SF; } } @@ -967,10 +956,10 @@ int srslte_nbiot_ue_dl_decode_npdcch(srslte_nbiot_ue_dl_t* q, return SRSLTE_ERROR; } - DEBUG("%d.%d: Looking for DCI for RNTI=0x%x.\n", sfn, sf_idx, rnti); + DEBUG("%d.%d: Looking for DCI for RNTI=0x%x.", sfn, sf_idx, rnti); if (srslte_nbiot_ue_dl_find_dl_dci(q, sf_idx, rnti, dci_msg) == 1) { // a DCI was found - INFO("%d.%d: Found DCI for RNTI=0x%x.\n", sfn, sf_idx, rnti); + INFO("%d.%d: Found DCI for RNTI=0x%x.", sfn, sf_idx, rnti); q->nof_detected++; ret = SRSLTE_NBIOT_UE_DL_FOUND_DCI; } @@ -986,12 +975,12 @@ int srslte_nbiot_ue_dl_decode_npdcch(srslte_nbiot_ue_dl_t* q, // i.e. srslte_nbiot_ue_dl_decode_npdcch() needs to be called before int srslte_nbiot_ue_dl_find_ul_dci(srslte_nbiot_ue_dl_t* q, uint32_t tti, uint32_t rnti, srslte_dci_msg_t* dci_msg) { - DEBUG("%d.%d: Looking for UL DCI for RNTI=0x%x.\n", tti / 10, tti % 10, rnti); + DEBUG("%d.%d: Looking for UL DCI for RNTI=0x%x.", tti / 10, tti % 10, rnti); // Search UE-specific search space dci_blind_search_t search_space; search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_UE); - DEBUG("x.%d: Searching UL C-RNTI=0x%x in %d locations, %d formats\n", + DEBUG("x.%d: Searching UL C-RNTI=0x%x in %d locations, %d formats", tti % 10, rnti, search_space.nof_locations, @@ -1014,37 +1003,37 @@ void srslte_nbiot_ue_dl_save_signal(srslte_nbiot_ue_dl_t* q, cf_t* input, uint32 // RAW samples snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_raw_samples.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: rx'ed samples\n", fname); + DEBUG("SAVED FILE %s: rx'ed samples", fname); srslte_vec_save_file(fname, input, num_symbols * sizeof(cf_t)); // NPDCCH num_symbols = q->npdcch.num_decoded_symbols; snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_npdcch_symbols.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: rx'ed downlink symbols\n", fname); + DEBUG("SAVED FILE %s: rx'ed downlink symbols", fname); srslte_vec_save_file(fname, q->npdcch.symbols[0], num_symbols * sizeof(cf_t)); snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_npdcch_symbols_eq.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: eq rx'ed downlink symbols\n", fname); + DEBUG("SAVED FILE %s: eq rx'ed downlink symbols", fname); srslte_vec_save_file(fname, q->npdcch.d, num_symbols * sizeof(cf_t)); // NPDSCH num_symbols = q->npdsch_cfg.nbits.nof_re * q->npdsch_cfg.grant.nof_sf; snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_npdsch_symbols.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: rx'ed downlink symbols\n", fname); + DEBUG("SAVED FILE %s: rx'ed downlink symbols", fname); srslte_vec_save_file(fname, q->npdsch.symbols[0], num_symbols * sizeof(cf_t)); snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_npdsch_symbols_eq.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: eq rx'ed downlink symbols\n", fname); + DEBUG("SAVED FILE %s: eq rx'ed downlink symbols", fname); srslte_vec_save_file(fname, q->npdsch.d, num_symbols * sizeof(cf_t)); // CE snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_ce0.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: downlink channel estimates port 0\n", fname); + DEBUG("SAVED FILE %s: downlink channel estimates port 0", fname); srslte_vec_save_file(fname, q->ce_buffer[0], num_symbols * sizeof(cf_t)); if (q->cell.nof_ports > 1) { snprintf(fname, MAX_FNAME_LEN, "nb_ue_dl_sfn%d_sf%d_ce1.bin", sfn, sf_idx); - DEBUG("SAVED FILE %s: downlink channel estimates port 1\n", fname); + DEBUG("SAVED FILE %s: downlink channel estimates port 1", fname); srslte_vec_save_file(fname, q->ce_buffer[1], num_symbols * sizeof(cf_t)); } } diff --git a/lib/src/phy/ue/ue_dl_nr.c b/lib/src/phy/ue/ue_dl_nr.c index e8409439d..f13fcf6e5 100644 --- a/lib/src/phy/ue/ue_dl_nr.c +++ b/lib/src/phy/ue/ue_dl_nr.c @@ -33,7 +33,7 @@ static int ue_dl_nr_alloc_prb(srslte_ue_dl_nr_t* q, uint32_t new_nof_prb) q->sf_symbols[i] = srslte_vec_cf_malloc(SRSLTE_SLOT_LEN_RE_NR(q->max_prb)); if (q->sf_symbols[i] == NULL) { - ERROR("Malloc\n"); + ERROR("Malloc"); return SRSLTE_ERROR; } } @@ -49,7 +49,7 @@ int srslte_ue_dl_nr_init(srslte_ue_dl_nr_t* q, cf_t* input[SRSLTE_MAX_PORTS], co } if (args->nof_rx_antennas == 0) { - ERROR("Error invalid number of antennas (%d)\n", args->nof_rx_antennas); + ERROR("Error invalid number of antennas (%d)", args->nof_rx_antennas); return SRSLTE_ERROR; } @@ -74,7 +74,7 @@ int srslte_ue_dl_nr_init(srslte_ue_dl_nr_t* q, cf_t* input[SRSLTE_MAX_PORTS], co } if (ue_dl_nr_alloc_prb(q, args->nof_max_prb)) { - ERROR("Error allocating\n"); + ERROR("Error allocating"); return SRSLTE_ERROR; } @@ -90,13 +90,13 @@ int srslte_ue_dl_nr_init(srslte_ue_dl_nr_t* q, cf_t* input[SRSLTE_MAX_PORTS], co } if (srslte_dmrs_sch_init(&q->dmrs_pdsch, true) < SRSLTE_SUCCESS) { - ERROR("Error DMRS\n"); + ERROR("Error DMRS"); return SRSLTE_ERROR; } q->pdcch_ce = SRSLTE_MEM_ALLOC(srslte_dmrs_pdcch_ce_t, 1); if (q->pdcch_ce == NULL) { - ERROR("Error alloc\n"); + ERROR("Error alloc"); return SRSLTE_ERROR; } @@ -140,12 +140,12 @@ int srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t* } if (srslte_dmrs_sch_set_carrier(&q->dmrs_pdsch, carrier) < SRSLTE_SUCCESS) { - ERROR("Error DMRS\n"); + ERROR("Error DMRS"); return SRSLTE_ERROR; } if (ue_dl_nr_alloc_prb(q, carrier->nof_prb)) { - ERROR("Error allocating\n"); + ERROR("Error allocating"); return SRSLTE_ERROR; } @@ -225,19 +225,19 @@ static int ue_dl_nr_find_dci_ncce(srslte_ue_dl_nr_t* q, // Measures the PDCCH transmission DMRS if (srslte_dmrs_pdcch_get_measure(&q->dmrs_pdcch[coreset_id], &dci_msg->location, &m) < SRSLTE_SUCCESS) { - ERROR("Error getting measure location L=%d, ncce=%d\n", dci_msg->location.L, dci_msg->location.ncce); + ERROR("Error getting measure location L=%d, ncce=%d", dci_msg->location.L, dci_msg->location.ncce); return SRSLTE_ERROR; } // If measured correlation is invalid, early return if (!isnormal(m.norm_corr)) { - INFO("Discarded PDCCH candidate L=%d;ncce=%d; Invalid measurement;\n", dci_msg->location.L, dci_msg->location.ncce); + INFO("Discarded PDCCH candidate L=%d;ncce=%d; Invalid measurement;", dci_msg->location.L, dci_msg->location.ncce); return SRSLTE_SUCCESS; } // Compare EPRE with threshold if (m.epre_dBfs < q->pdcch_dmrs_epre_thr) { - INFO("Discarded PDCCH candidate L=%d;ncce=%d; EPRE is too weak (%.1f<%.1f);\n", + INFO("Discarded PDCCH candidate L=%d;ncce=%d; EPRE is too weak (%.1f<%.1f);", dci_msg->location.L, dci_msg->location.ncce, m.epre_dBfs, @@ -247,7 +247,7 @@ static int ue_dl_nr_find_dci_ncce(srslte_ue_dl_nr_t* q, // Compare DMRS correlation with threshold if (m.norm_corr < q->pdcch_dmrs_corr_thr) { - INFO("Discarded PDCCH candidate L=%d;ncce=%d; Correlation is too low (%.1f<%.1f); EPRE=%+.2f; RSRP=%+.2f;\n", + INFO("Discarded PDCCH candidate L=%d;ncce=%d; Correlation is too low (%.1f<%.1f); EPRE=%+.2f; RSRP=%+.2f;", dci_msg->location.L, dci_msg->location.ncce, m.norm_corr, @@ -259,13 +259,13 @@ static int ue_dl_nr_find_dci_ncce(srslte_ue_dl_nr_t* q, // Extract PDCCH channel estimates if (srslte_dmrs_pdcch_get_ce(&q->dmrs_pdcch[coreset_id], &dci_msg->location, q->pdcch_ce) < SRSLTE_SUCCESS) { - ERROR("Error extracting PDCCH DMRS\n"); + ERROR("Error extracting PDCCH DMRS"); return SRSLTE_ERROR; } // Decode PDCCH if (srslte_pdcch_nr_decode(&q->pdcch, q->sf_symbols[0], q->pdcch_ce, dci_msg, pdcch_res) < SRSLTE_SUCCESS) { - ERROR("Error decoding PDCCH\n"); + ERROR("Error decoding PDCCH"); return SRSLTE_ERROR; } @@ -304,7 +304,7 @@ static int ue_dl_nr_find_dl_dci_ss(srslte_ue_dl_nr_t* q, // Select CORESET uint32_t coreset_id = search_space->coreset_id; if (coreset_id >= SRSLTE_UE_DL_NR_MAX_NOF_CORESET || !q->cfg.coreset_present[coreset_id]) { - ERROR("CORESET %d is not present in search space %d\n", search_space->coreset_id, search_space->id); + ERROR("CORESET %d is not present in search space %d", search_space->coreset_id, search_space->id); return SRSLTE_ERROR; } srslte_coreset_t* coreset = &q->cfg.coreset[search_space->coreset_id]; @@ -323,7 +323,7 @@ static int ue_dl_nr_find_dl_dci_ss(srslte_ue_dl_nr_t* q, // Calculate number of DCI bits int dci_nof_bits = srslte_dci_nr_format_1_0_sizeof(&q->carrier, coreset, rnti_type); if (dci_nof_bits <= SRSLTE_SUCCESS) { - ERROR("Error DCI size\n"); + ERROR("Error DCI size"); return SRSLTE_ERROR; } @@ -333,7 +333,7 @@ static int ue_dl_nr_find_dl_dci_ss(srslte_ue_dl_nr_t* q, uint32_t candidates[SRSLTE_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR] = {}; int nof_candidates = srslte_pdcch_nr_locations_coreset(coreset, search_space, rnti, L, slot_cfg->idx, candidates); if (nof_candidates < SRSLTE_SUCCESS) { - ERROR("Error calculating DCI candidate location\n"); + ERROR("Error calculating DCI candidate location"); return SRSLTE_ERROR; } @@ -386,7 +386,7 @@ static int ue_dl_nr_find_dl_dci_ss(srslte_ue_dl_nr_t* q, continue; } - INFO("Found DCI in L=%d,ncce=%d\n", dci_msg.location.L, dci_msg.location.ncce); + INFO("Found DCI in L=%d,ncce=%d", dci_msg.location.L, dci_msg.location.ncce); // Append DCI message into the list dci_msg_list[count] = dci_msg; count++; @@ -498,7 +498,7 @@ int srslte_ue_dl_nr_decode_pdsch(srslte_ue_dl_nr_t* q, if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) { char str[512]; srslte_ue_dl_nr_pdsch_info(q, cfg, res, str, sizeof(str)); - INFO("PDSCH: %s\n", str); + INFO("PDSCH: %s", str); } return SRSLTE_SUCCESS; diff --git a/lib/src/phy/ue/ue_mib.c b/lib/src/phy/ue/ue_mib.c index 0e563b9a5..9a0fb451d 100644 --- a/lib/src/phy/ue/ue_mib.c +++ b/lib/src/phy/ue/ue_mib.c @@ -29,12 +29,11 @@ int srslte_ue_mib_init(srslte_ue_mib_t* q, cf_t* in_buffer, uint32_t max_prb) int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - ret = SRSLTE_ERROR; bzero(q, sizeof(srslte_ue_mib_t)); if (srslte_pbch_init(&q->pbch)) { - ERROR("Error initiating PBCH\n"); + ERROR("Error initiating PBCH"); goto clean_exit; } @@ -45,15 +44,15 @@ int srslte_ue_mib_init(srslte_ue_mib_t* q, cf_t* in_buffer, uint32_t max_prb) } if (srslte_ofdm_rx_init(&q->fft, SRSLTE_CP_NORM, in_buffer, q->sf_symbols, max_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); goto clean_exit; } if (srslte_chest_dl_init(&q->chest, max_prb, 1)) { - ERROR("Error initializing reference signal\n"); + ERROR("Error initializing reference signal"); goto clean_exit; } if (srslte_chest_dl_res_init(&q->chest_res, max_prb)) { - ERROR("Error initializing reference signal\n"); + ERROR("Error initializing reference signal"); goto clean_exit; } srslte_ue_mib_reset(q); @@ -88,11 +87,11 @@ int srslte_ue_mib_set_cell(srslte_ue_mib_t* q, srslte_cell_t cell) if (q != NULL && cell.nof_ports <= SRSLTE_MAX_PORTS) { if (srslte_pbch_set_cell(&q->pbch, cell)) { - ERROR("Error initiating PBCH\n"); + ERROR("Error initiating PBCH"); return SRSLTE_ERROR; } if (srslte_ofdm_rx_set_prb(&q->fft, cell.cp, cell.nof_prb)) { - ERROR("Error initializing FFT\n"); + ERROR("Error initializing FFT"); return SRSLTE_ERROR; } @@ -101,7 +100,7 @@ int srslte_ue_mib_set_cell(srslte_ue_mib_t* q, srslte_cell_t cell) } if (srslte_chest_dl_set_cell(&q->chest, cell)) { - ERROR("Error initializing reference signal\n"); + ERROR("Error initializing reference signal"); return SRSLTE_ERROR; } srslte_ue_mib_reset(q); @@ -142,21 +141,21 @@ int srslte_ue_mib_decode(srslte_ue_mib_t* q, } /* Reset decoder if we missed a frame */ if (q->frame_cnt > 8) { - INFO("Resetting PBCH decoder after %d frames\n", q->frame_cnt); + INFO("Resetting PBCH decoder after %d frames", q->frame_cnt); srslte_ue_mib_reset(q); } /* Decode PBCH */ ret = srslte_pbch_decode(&q->pbch, &q->chest_res, sf_buffer, bch_payload, nof_tx_ports, sfn_offset); if (ret < 0) { - ERROR("Error decoding PBCH (%d)\n", ret); + ERROR("Error decoding PBCH (%d)", ret); } else if (ret == 1) { - INFO("MIB decoded: %u, snr=%.1f dB\n", q->frame_cnt, q->chest_res.snr_db); + INFO("MIB decoded: %u, snr=%.1f dB", q->frame_cnt, q->chest_res.snr_db); srslte_ue_mib_reset(q); ret = SRSLTE_UE_MIB_FOUND; } else { ret = SRSLTE_UE_MIB_NOTFOUND; - INFO("MIB not decoded: %u, snr=%.1f dB\n", q->frame_cnt, q->chest_res.snr_db); + INFO("MIB not decoded: %u, snr=%.1f dB", q->frame_cnt, q->chest_res.snr_db); q->frame_cnt++; } @@ -175,7 +174,7 @@ int srslte_ue_mib_sync_init_multi(srslte_ue_mib_sync_t* q, // Use 1st RF channel only to receive MIB if (srslte_ue_mib_init(&q->ue_mib, q->sf_buffer[0], SRSLTE_UE_MIB_NOF_PRB)) { - ERROR("Error initiating ue_mib\n"); + ERROR("Error initiating ue_mib"); return SRSLTE_ERROR; } // Configure ue_sync to receive all channels @@ -197,11 +196,11 @@ int srslte_ue_mib_sync_set_cell(srslte_ue_mib_sync_t* q, srslte_cell_t cell) cell.nof_prb = SRSLTE_UE_MIB_NOF_PRB; if (srslte_ue_mib_set_cell(&q->ue_mib, cell)) { - ERROR("Error initiating ue_mib\n"); + ERROR("Error initiating ue_mib"); return SRSLTE_ERROR; } if (srslte_ue_sync_set_cell(&q->ue_sync, cell)) { - ERROR("Error initiating ue_sync\n"); + ERROR("Error initiating ue_sync"); srslte_ue_mib_free(&q->ue_mib); return SRSLTE_ERROR; } @@ -231,7 +230,6 @@ int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t* q, uint32_t* nof_tx_ports, int* sfn_offset) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; uint32_t nof_frames = 0; int mib_ret = SRSLTE_UE_MIB_NOTFOUND; @@ -246,7 +244,7 @@ int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t* q, mib_ret = SRSLTE_UE_MIB_NOTFOUND; ret = srslte_ue_sync_zerocopy(&q->ue_sync, q->sf_buffer, MIB_BUFFER_MAX_SAMPLES); if (ret < 0) { - ERROR("Error calling srslte_ue_sync_work()\n"); + ERROR("Error calling srslte_ue_sync_work()"); return -1; } @@ -254,7 +252,7 @@ int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t* q, if (ret == 1) { mib_ret = srslte_ue_mib_decode(&q->ue_mib, bch_payload, nof_tx_ports, sfn_offset); } else { - DEBUG("Resetting PBCH decoder after %d frames\n", q->ue_mib.frame_cnt); + DEBUG("Resetting PBCH decoder after %d frames", q->ue_mib.frame_cnt); srslte_ue_mib_reset(&q->ue_mib); } nof_frames++; diff --git a/lib/src/phy/ue/ue_mib_nbiot.c b/lib/src/phy/ue/ue_mib_nbiot.c index 2efcf9bee..2756c40ea 100644 --- a/lib/src/phy/ue/ue_mib_nbiot.c +++ b/lib/src/phy/ue/ue_mib_nbiot.c @@ -138,7 +138,7 @@ int srslte_ue_mib_nbiot_decode(srslte_ue_mib_nbiot_t* q, // Reset decoder if we missed a NPBCH TTI if (q->frame_cnt > SRSLTE_NPBCH_NUM_FRAMES) { - INFO("Resetting NPBCH decoder after %d frames\n", q->frame_cnt); + INFO("Resetting NPBCH decoder after %d frames", q->frame_cnt); srslte_ue_mib_nbiot_reset(q); return SRSLTE_UE_MIB_NBIOT_NOTFOUND; } @@ -152,13 +152,13 @@ int srslte_ue_mib_nbiot_decode(srslte_ue_mib_nbiot_t* q, nof_tx_ports, sfn_offset, 0)) { - DEBUG("BCH decoded ok with offset %d\n", *sfn_offset); + DEBUG("BCH decoded ok with offset %d", *sfn_offset); if (memcmp(bch_payload, q->last_bch_payload, SRSLTE_MIB_NB_LEN) == 0) { - DEBUG("BCH content equals last BCH, new counter %d\n", q->frame_cnt); + DEBUG("BCH content equals last BCH, new counter %d", q->frame_cnt); } else { // new BCH transmitted if (q->frame_cnt != 0) { - INFO("MIB-NB decoded: %u with offset %d\n", q->frame_cnt, *sfn_offset); + INFO("MIB-NB decoded: %u with offset %d", q->frame_cnt, *sfn_offset); if (*sfn_offset != 0) { INFO("New BCH was decoded at block offset %d. SFN may be corrupted.", *sfn_offset); } @@ -166,7 +166,7 @@ int srslte_ue_mib_nbiot_decode(srslte_ue_mib_nbiot_t* q, return SRSLTE_UE_MIB_NBIOT_FOUND; } else { // store new BCH - DEBUG("New BCH transmitted after %d frames\n", q->frame_cnt); + DEBUG("New BCH transmitted after %d frames", q->frame_cnt); memcpy(q->last_bch_payload, bch_payload, SRSLTE_MIB_NB_LEN); } } @@ -177,7 +177,7 @@ int srslte_ue_mib_nbiot_decode(srslte_ue_mib_nbiot_t* q, int srslte_ue_mib_sync_nbiot_init_multi( srslte_ue_mib_sync_nbiot_t* q, - int(recv_callback)(void*, cf_t * [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), + int(recv_callback)(void*, cf_t* [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), uint32_t nof_rx_antennas, void* stream_handler) { @@ -240,7 +240,7 @@ int srslte_ue_mib_sync_nbiot_decode(srslte_ue_mib_sync_nbiot_t* q, int mib_ret = SRSLTE_UE_MIB_NBIOT_NOTFOUND; if (q == NULL) { - return ret; + return ret; } do { @@ -254,7 +254,7 @@ int srslte_ue_mib_sync_nbiot_decode(srslte_ue_mib_sync_nbiot_t* q, if (srslte_ue_sync_nbiot_get_sfidx(&q->ue_sync) == 0) { mib_ret = srslte_ue_mib_nbiot_decode(&q->ue_mib, NULL, bch_payload, nof_tx_ports, sfn_offset); if (mib_ret < 0) { - DEBUG("Resetting NPBCH decoder after %d frames\n", q->ue_mib.frame_cnt); + DEBUG("Resetting NPBCH decoder after %d frames", q->ue_mib.frame_cnt); srslte_ue_mib_nbiot_reset(&q->ue_mib); } nof_frames++; diff --git a/lib/src/phy/ue/ue_sync.c b/lib/src/phy/ue/ue_sync.c index 1254a9210..43d2543d1 100644 --- a/lib/src/phy/ue/ue_sync.c +++ b/lib/src/phy/ue/ue_sync.c @@ -73,16 +73,16 @@ int srslte_ue_sync_init_file_multi(srslte_ue_sync_t* q, q->cfo_correct_enable_track = true; if (srslte_cfo_init(&q->file_cfo_correct, 2 * q->sf_len)) { - ERROR("Error initiating CFO\n"); + ERROR("Error initiating CFO"); goto clean_exit; } if (srslte_filesource_init(&q->file_source, file_name, SRSLTE_COMPLEX_FLOAT_BIN)) { - ERROR("Error opening file %s\n", file_name); + ERROR("Error opening file %s", file_name); goto clean_exit; } - INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq / 1000); + INFO("Offseting input file by %d samples and %.1f kHz", offset_time, offset_freq / 1000); if (offset_time) { cf_t* file_offset_buffer = srslte_vec_cf_malloc(offset_time * nof_rx_ant); @@ -233,12 +233,10 @@ int srslte_ue_sync_init_multi_decim_mode( q->pss_stable_timeout = DEFAULT_PSS_STABLE_TIMEOUT; if (search_cell) { - /* If the cell is unkown, we search PSS/SSS in 5 ms */ q->nof_recv_sf = 5; } else { - /* If the cell is known, we work on a 1ms basis */ q->nof_recv_sf = 1; } @@ -251,12 +249,12 @@ int srslte_ue_sync_init_multi_decim_mode( if (q->mode == SYNC_MODE_PSS) { if (srslte_sync_init_decim(&q->sfind, q->frame_len, q->frame_len, q->fft_size, q->decimate)) { - ERROR("Error initiating sync find\n"); + ERROR("Error initiating sync find"); goto clean_exit; } if (search_cell) { if (srslte_sync_init(&q->strack, q->frame_len, TRACK_FRAME_SIZE, q->fft_size)) { - ERROR("Error initiating sync track\n"); + ERROR("Error initiating sync track"); goto clean_exit; } } else { @@ -264,7 +262,7 @@ int srslte_ue_sync_init_multi_decim_mode( q->frame_len, SRSLTE_MAX(TRACK_FRAME_SIZE, SRSLTE_CP_LEN_NORM(1, q->fft_size)), q->fft_size)) { - ERROR("Error initiating sync track\n"); + ERROR("Error initiating sync track"); goto clean_exit; } } @@ -325,7 +323,7 @@ int srslte_ue_sync_set_cell(srslte_ue_sync_t* q, srslte_cell_t cell) if (q != NULL && srslte_nofprb_isvalid(cell.nof_prb)) { if (cell.nof_prb > q->max_prb) { - ERROR("Error in ue_sync_set_cell(): cell.nof_prb must be lower than initialized\n"); + ERROR("Error in ue_sync_set_cell(): cell.nof_prb must be lower than initialized"); return SRSLTE_ERROR; } @@ -334,11 +332,9 @@ int srslte_ue_sync_set_cell(srslte_ue_sync_t* q, srslte_cell_t cell) q->sf_len = SRSLTE_SF_LEN(q->fft_size); if (cell.id == 1000) { - /* If the cell is unkown, we search PSS/SSS in 5 ms */ q->nof_recv_sf = 5; } else { - /* If the cell is known, we work on a 1ms basis */ q->nof_recv_sf = 1; } @@ -352,12 +348,12 @@ int srslte_ue_sync_set_cell(srslte_ue_sync_t* q, srslte_cell_t cell) } if (srslte_sync_resize(&q->sfind, q->frame_len, q->frame_len, q->fft_size)) { - ERROR("Error setting cell sync find\n"); + ERROR("Error setting cell sync find"); return SRSLTE_ERROR; } if (cell.id == 1000) { if (srslte_sync_resize(&q->strack, q->frame_len, TRACK_FRAME_SIZE, q->fft_size)) { - ERROR("Error setting cell sync track\n"); + ERROR("Error setting cell sync track"); return SRSLTE_ERROR; } } else { @@ -365,7 +361,7 @@ int srslte_ue_sync_set_cell(srslte_ue_sync_t* q, srslte_cell_t cell) q->frame_len, SRSLTE_MAX(TRACK_FRAME_SIZE, SRSLTE_CP_LEN_NORM(1, q->fft_size)), q->fft_size)) { - ERROR("Error setting cell sync track\n"); + ERROR("Error setting cell sync track"); return SRSLTE_ERROR; } } @@ -554,15 +550,14 @@ void srslte_ue_sync_set_agc_period(srslte_ue_sync_t* q, uint32_t period) static int find_peak_ok(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANNELS]) { - if (srslte_sync_sss_detected(&q->sfind)) { /* Get the subframe index (0 or 5) */ q->sf_idx = (srslte_sync_get_sf_idx(&q->sfind) + q->nof_recv_sf) % 10; } else if (srslte_sync_sss_available(&q->sfind)) { - INFO("Found peak at %d, SSS not detected\n", q->peak_idx); + INFO("Found peak at %d, SSS not detected", q->peak_idx); return 0; } else { - INFO("Found peak at %d, No space for SSS. Realigning frame, reading %d samples\n", q->peak_idx, q->peak_idx); + INFO("Found peak at %d, No space for SSS. Realigning frame, reading %d samples", q->peak_idx, q->peak_idx); if (q->recv_callback(q->stream, input_buffer, q->peak_idx, &q->last_timestamp) < 0) { return SRSLTE_ERROR; } @@ -570,7 +565,7 @@ static int find_peak_ok(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANN } q->frame_find_cnt++; - DEBUG("Found peak %d at %d, value %.3f, Cell_id: %d CP: %s\n", + DEBUG("Found peak %d at %d, value %.3f, Cell_id: %d CP: %s", q->frame_find_cnt, q->peak_idx, srslte_sync_get_peak_value(&q->sfind), @@ -580,7 +575,7 @@ static int find_peak_ok(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANN if (q->frame_find_cnt >= q->nof_avg_find_frames || q->peak_idx < 2 * q->fft_size) { // Receive read_len samples until the start of the next subframe (different for FDD and TDD) uint32_t read_len = q->peak_idx + PSS_OFFSET; - INFO("Realigning frame, reading %d samples\n", read_len); + INFO("Realigning frame, reading %d samples", read_len); if (q->recv_callback(q->stream, input_buffer, read_len, &q->last_timestamp) < 0) { return SRSLTE_ERROR; } @@ -613,7 +608,6 @@ static int find_peak_ok(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANN static int track_peak_ok(srslte_ue_sync_t* q, uint32_t track_idx) { - // Get sampling time offset q->last_sample_offset = ((int)track_idx - (int)q->strack.max_offset / 2 - (int)q->strack.fft_size); @@ -629,8 +623,7 @@ static int track_peak_ok(srslte_ue_sync_t* q, uint32_t track_idx) /* Adjust current CFO estimation with PSS * Since sync track has enabled only PSS-based correlation, get_cfo() returns that value only, already filtered. */ - DEBUG( - "TRACK: cfo_current=%f, cfo_strack=%f\n", 15000 * q->cfo_current_value, 15000 * srslte_sync_get_cfo(&q->strack)); + DEBUG("TRACK: cfo_current=%f, cfo_strack=%f", 15000 * q->cfo_current_value, 15000 * srslte_sync_get_cfo(&q->strack)); if (15000 * fabsf(srslte_sync_get_cfo(&q->strack)) > q->cfo_pss_min) { q->cfo_current_value += srslte_sync_get_cfo(&q->strack) * q->cfo_loop_bw_pss; q->pss_stable_cnt = 0; @@ -650,7 +643,7 @@ static int track_peak_ok(srslte_ue_sync_t* q, uint32_t track_idx) q->next_rf_sample_offset = (int)round(q->mean_sample_offset); if (q->next_rf_sample_offset) { - INFO("Time offset adjustment: %d samples (%.2f), mean SFO: %.2f Hz, ema=%f, length=%d\n", + INFO("Time offset adjustment: %d samples (%.2f), mean SFO: %.2f Hz, ema=%f, length=%d", q->next_rf_sample_offset, q->mean_sample_offset, srslte_ue_sync_get_sfo(q), @@ -663,9 +656,9 @@ static int track_peak_ok(srslte_ue_sync_t* q, uint32_t track_idx) /* If the PSS peak is beyond the frame (we sample too slowly), discard the offseted samples to align next frame */ if (q->next_rf_sample_offset > 0 && q->next_rf_sample_offset < MAX_TIME_OFFSET) { - DEBUG("Positive time offset %d samples.\n", q->next_rf_sample_offset); + DEBUG("Positive time offset %d samples.", q->next_rf_sample_offset); if (q->recv_callback(q->stream, dummy_offset_buffer, (uint32_t)q->next_rf_sample_offset, NULL) < 0) { - ERROR("Error receiving from USRP\n"); + ERROR("Error receiving from USRP"); return SRSLTE_ERROR; } q->next_rf_sample_offset = 0; @@ -680,15 +673,14 @@ static int track_peak_ok(srslte_ue_sync_t* q, uint32_t track_idx) static int track_peak_no(srslte_ue_sync_t* q) { - /* if we missed too many PSS go back to FIND and consider this frame unsynchronized */ q->frame_no_cnt++; if (q->frame_no_cnt >= TRACK_MAX_LOST) { - INFO("\n%d frames lost. Going back to FIND\n", (int)q->frame_no_cnt); + INFO("%d frames lost. Going back to FIND", (int)q->frame_no_cnt); q->state = SF_FIND; return 0; } else { - INFO("Tracking peak not found. Peak %.3f, %d lost\n", srslte_sync_get_peak_value(&q->strack), (int)q->frame_no_cnt); + INFO("Tracking peak not found. Peak %.3f, %d lost", srslte_sync_get_peak_value(&q->strack), (int)q->frame_no_cnt); return 1; } } @@ -729,11 +721,10 @@ int srslte_ue_sync_zerocopy(srslte_ue_sync_t* q, int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL && input_buffer != NULL) { - if (q->file_mode) { int n = srslte_filesource_read_multi(&q->file_source, (void**)input_buffer, q->sf_len, q->nof_rx_antennas); if (n < 0) { - ERROR("Error reading input file\n"); + ERROR("Error reading input file"); return SRSLTE_ERROR; } if (n == 0) { @@ -742,7 +733,7 @@ int srslte_ue_sync_zerocopy(srslte_ue_sync_t* q, q->sf_idx = 9; n = srslte_filesource_read_multi(&q->file_source, (void**)input_buffer, q->sf_len, q->nof_rx_antennas); if (n < 0) { - ERROR("Error reading input file\n"); + ERROR("Error reading input file"); return SRSLTE_ERROR; } } else { @@ -758,12 +749,11 @@ int srslte_ue_sync_zerocopy(srslte_ue_sync_t* q, if (q->sf_idx == 10) { q->sf_idx = 0; } - INFO("Reading %d samples. sf_idx = %d\n", q->sf_len, q->sf_idx); + INFO("Reading %d samples. sf_idx = %d", q->sf_len, q->sf_idx); ret = 1; } else { - if (receive_samples(q, input_buffer, max_num_samples)) { - ERROR("Error receiving samples\n"); + ERROR("Error receiving samples"); return SRSLTE_ERROR; } @@ -818,7 +808,7 @@ int srslte_ue_sync_zerocopy(srslte_ue_sync_t* q, } break; default: - ERROR("Unknown sync state %d\n", q->state); + ERROR("Unknown sync state %d", q->state); } } } @@ -832,14 +822,14 @@ int srslte_ue_sync_run_find_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SRS switch (n) { case SRSLTE_SYNC_ERROR: - ERROR("Error finding correlation peak (%d)\n", ret); + ERROR("Error finding correlation peak (%d)", ret); return ret; case SRSLTE_SYNC_FOUND: ret = find_peak_ok(q, input_buffer); break; case SRSLTE_SYNC_FOUND_NOSPACE: /* If a peak was found but there is not enough space for SSS/CP detection, discard a few samples */ - INFO("No space for SSS/CP detection. Realigning frame...\n"); + INFO("No space for SSS/CP detection. Realigning frame..."); q->recv_callback(q->stream, dummy_offset_buffer, q->frame_len / 2, NULL); srslte_sync_reset(&q->sfind); ret = SRSLTE_SUCCESS; @@ -850,7 +840,7 @@ int srslte_ue_sync_run_find_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SRS } INFO("SYNC FIND: sf_idx=%d, ret=%d, peak_pos=%d, peak_value=%.2f, mean_cp_cfo=%.2f, mean_pss_cfo=%.2f, " - "total_cfo_khz=%.1f\n", + "total_cfo_khz=%.1f", q->sf_idx, ret, q->peak_idx, @@ -884,7 +874,7 @@ int srslte_ue_sync_run_track_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SR int n = srslte_sync_find(&q->strack, input_buffer[0], pss_idx, &track_idx); switch (n) { case SRSLTE_SYNC_ERROR: - ERROR("Error tracking correlation peak\n"); + ERROR("Error tracking correlation peak"); return SRSLTE_ERROR; case SRSLTE_SYNC_FOUND: ret = track_peak_ok(q, track_idx); @@ -893,7 +883,7 @@ int srslte_ue_sync_run_track_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SR // It's very very unlikely that we fall here because this event should happen at FIND phase only ret = 0; q->state = SF_FIND; - INFO("Warning: No space for SSS/CP while in tracking phase\n"); + INFO("Warning: No space for SSS/CP while in tracking phase"); break; case SRSLTE_SYNC_NOFOUND: ret = track_peak_no(q); @@ -901,7 +891,7 @@ int srslte_ue_sync_run_track_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SR } if (ret == SRSLTE_ERROR) { - ERROR("Error processing tracking peak\n"); + ERROR("Error processing tracking peak"); q->state = SF_FIND; return SRSLTE_SUCCESS; } @@ -909,7 +899,7 @@ int srslte_ue_sync_run_track_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SR q->frame_total_cnt++; INFO("SYNC TRACK: sf_idx=%d, ret=%d, peak_pos=%d, peak_value=%.2f, mean_cp_cfo=%.2f, mean_pss_cfo=%.2f, " - "total_cfo_khz=%.1f\n", + "total_cfo_khz=%.1f", q->sf_idx, ret, track_idx, @@ -918,7 +908,7 @@ int srslte_ue_sync_run_track_pss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SR q->strack.cfo_pss_mean, 15 * srslte_sync_get_cfo(&q->strack)); } else { - INFO("SYNC TRACK: sf_idx=%d, ret=%d, next_state=%d\n", q->sf_idx, ret, q->state); + INFO("SYNC TRACK: sf_idx=%d, ret=%d, next_state=%d", q->sf_idx, ret, q->state); } return 1; ///< 1 means subframe in sync @@ -928,7 +918,7 @@ int srslte_ue_sync_run_find_gnss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANNELS], const uint32_t max_num_samples) { - INFO("Calibration samples received start at %ld + %f\n", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); + INFO("Calibration samples received start at %ld + %f", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); // round to nearest second srslte_timestamp_t ts_next_rx; @@ -936,7 +926,7 @@ int srslte_ue_sync_run_find_gnss_mode(srslte_ue_sync_t* q, ts_next_rx.full_secs++; ts_next_rx.frac_secs = 0.0; - INFO("Next desired recv at %ld + %f\n", ts_next_rx.full_secs, ts_next_rx.frac_secs); + INFO("Next desired recv at %ld + %f", ts_next_rx.full_secs, ts_next_rx.frac_secs); // get difference in time between second rx and now srslte_timestamp_sub(&ts_next_rx, q->last_timestamp.full_secs, q->last_timestamp.frac_secs); @@ -944,7 +934,7 @@ int srslte_ue_sync_run_find_gnss_mode(srslte_ue_sync_t* q, uint64_t align_len = srslte_timestamp_uint64(&ts_next_rx, q->sf_len * 1000); - DEBUG("Difference between first recv is %ld + %f, realigning %" PRIu64 " samples\n", + DEBUG("Difference between first recv is %ld + %f, realigning %" PRIu64 " samples", ts_next_rx.full_secs, ts_next_rx.frac_secs, align_len); @@ -958,26 +948,26 @@ int srslte_ue_sync_run_find_gnss_mode(srslte_ue_sync_t* q, sample_count += actual_rx_len; } - DEBUG("Received %d samples during alignment\n", sample_count); + DEBUG("Received %d samples during alignment", sample_count); // do one normal receive, the first time-aligned subframe if (receive_samples(q, input_buffer, max_num_samples)) { - ERROR("Error receiving samples\n"); + ERROR("Error receiving samples"); return SRSLTE_ERROR; } - INFO("First aligned samples received start at %ld + %f\n", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); + INFO("First aligned samples received start at %ld + %f", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); // switch to track state, from here on, samples should be ms aligned q->state = SF_TRACK; // calculate system timing if (srslte_ue_sync_set_tti_from_timestamp(q, &q->last_timestamp)) { - ERROR("Error deriving timing from received samples\n"); + ERROR("Error deriving timing from received samples"); return SRSLTE_ERROR; } - INFO("SYNC FIND: sfn=%d, sf_idx=%d next_state=%d\n", q->frame_number, q->sf_idx, q->state); + INFO("SYNC FIND: sfn=%d, sf_idx=%d next_state=%d", q->frame_number, q->sf_idx, q->state); return 1; ///< 1 means subframe in sync } @@ -985,25 +975,25 @@ int srslte_ue_sync_run_find_gnss_mode(srslte_ue_sync_t* q, ///< The track function in GNSS mode only needs to increment the system frame number int srslte_ue_sync_run_track_gnss_mode(srslte_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX_CHANNELS]) { - INFO("TRACK samples received at %ld + %.4f\n", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); + INFO("TRACK samples received at %ld + %.4f", q->last_timestamp.full_secs, q->last_timestamp.frac_secs); // make sure the fractional receive time is ms-aligned uint32_t rx_full_ms = floor(q->last_timestamp.frac_secs * 1e3); double rx_frac_ms = q->last_timestamp.frac_secs - (rx_full_ms / 1e3); int32_t offset_samp = round(rx_frac_ms / (1.0 / (q->sf_len * 1000))); - INFO("rx_full_ms=%d, rx_frac_ms=%f, offset_samp=%d\n", rx_full_ms, rx_frac_ms, offset_samp); + INFO("rx_full_ms=%d, rx_frac_ms=%f, offset_samp=%d", rx_full_ms, rx_frac_ms, offset_samp); if (offset_samp != q->sf_len) { q->next_rf_sample_offset = offset_samp; } if (q->next_rf_sample_offset) { - INFO("Time offset adjustment: %d samples\n", q->next_rf_sample_offset); + INFO("Time offset adjustment: %d samples", q->next_rf_sample_offset); } // update SF index q->sf_idx = ((int)round(q->last_timestamp.frac_secs * 1e3)) % SRSLTE_NOF_SF_X_FRAME; - INFO("SYNC TRACK: sfn=%d, sf_idx=%d, next_state=%d\n", q->frame_number, q->sf_idx, q->state); + INFO("SYNC TRACK: sfn=%d, sf_idx=%d, next_state=%d", q->frame_number, q->sf_idx, q->state); return 1; ///< 1 means subframe in sync } @@ -1018,7 +1008,7 @@ int srslte_ue_sync_set_tti_from_timestamp(srslte_ue_sync_t* q, srslte_timestamp_ { // calculate time_t of Rx time time_t t_cur = rx_timestamp->full_secs; - DEBUG("t_cur=%ld\n", t_cur); + DEBUG("t_cur=%ld", t_cur); // time_t of reference UTC time on 1. Jan 1900 at 0:00 // If we put this date in https://www.epochconverter.com it returns a negative number @@ -1031,11 +1021,11 @@ int srslte_ue_sync_set_tti_from_timestamp(srslte_ue_sync_t* q, srslte_timestamp_ t_ref = mktime(&t); #endif - DEBUG("t_ref=%ld\n", t_ref); + DEBUG("t_ref=%ld", t_ref); static const uint32_t MSECS_PER_SEC = 1000; - DEBUG("diff=%f\n", difftime(t_cur, t_ref)); + DEBUG("diff=%f", difftime(t_cur, t_ref)); double time_diff_secs = difftime(t_cur, t_ref); @@ -1044,11 +1034,11 @@ int srslte_ue_sync_set_tti_from_timestamp(srslte_ue_sync_t* q, srslte_timestamp_ return SRSLTE_ERROR; } - DEBUG("time diff in s %f\n", time_diff_secs); + DEBUG("time diff in s %f", time_diff_secs); // convert to ms and add fractional part double time_diff_msecs = time_diff_secs * MSECS_PER_SEC + rx_timestamp->frac_secs; - DEBUG("time diff in ms %f\n", time_diff_msecs); + DEBUG("time diff in ms %f", time_diff_msecs); // calculate SFN and SF index according to TS 36.331 Sec. 5.10.14 q->frame_number = ((uint32_t)floor(0.1 * (time_diff_msecs - q->sfn_offset))) % 1024; diff --git a/lib/src/phy/ue/ue_sync_nbiot.c b/lib/src/phy/ue/ue_sync_nbiot.c index d15bf0da7..55b0f1ef5 100644 --- a/lib/src/phy/ue/ue_sync_nbiot.c +++ b/lib/src/phy/ue/ue_sync_nbiot.c @@ -103,7 +103,7 @@ int srslte_ue_sync_nbiot_init_file_multi(srslte_nbiot_ue_sync_t* q, srslte_sync_nbiot_free(&q->sfind); #endif - INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq / 1000); + INFO("Offseting input file by %d samples and %.1f kHz", offset_time, offset_freq / 1000); srslte_filesource_read(&q->file_source, dummy_buffer_nbiot0, offset_time); srslte_ue_sync_nbiot_reset(q); @@ -153,7 +153,7 @@ int srslte_ue_sync_nbiot_init(srslte_nbiot_ue_sync_t* q, int srslte_ue_sync_nbiot_init_multi(srslte_nbiot_ue_sync_t* q, uint32_t max_prb, - int(recv_callback)(void*, cf_t * [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), + int(recv_callback)(void*, cf_t* [SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*), uint32_t nof_rx_antennas, void* stream_handler) { @@ -340,7 +340,7 @@ static int find_peak_ok(srslte_nbiot_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX // set subframe idx to NPSS position q->sf_idx = 5; q->frame_find_cnt++; - DEBUG("Found peak %d at %d, value %.3f, n_id_ncell: %d\n", + DEBUG("Found peak %d at %d, value %.3f, n_id_ncell: %d", q->frame_find_cnt, q->peak_idx, srslte_sync_nbiot_get_peak_value(&q->sfind), @@ -348,7 +348,7 @@ static int find_peak_ok(srslte_nbiot_ue_sync_t* q, cf_t* input_buffer[SRSLTE_MAX if (q->frame_find_cnt >= q->nof_avg_find_frames || q->peak_idx < 2 * q->fft_size) { int num_drop = (q->peak_idx - SRSLTE_NPSS_CORR_OFFSET + q->frame_len / 2) % q->frame_len; - INFO("Realigning frame, reading %d samples\n", num_drop); + INFO("Realigning frame, reading %d samples", num_drop); /* Receive the rest of the subframe so that we are subframe aligned */ if (q->recv_callback(q->stream, input_buffer, num_drop, &q->last_timestamp) < 0) { return SRSLTE_ERROR; @@ -408,7 +408,7 @@ static int track_peak_ok(srslte_nbiot_ue_sync_t* q, uint32_t track_idx) q->mean_sfo = SRSLTE_VEC_EMA(q->mean_sample_offset, q->mean_sfo, q->sfo_ema); if (q->next_rf_sample_offset) { - INFO("Time offset adjustment: %d samples (%.2f), mean SFO: %.2f Hz, %.5f samples/10-sf, ema=%f, length=%d\n", + INFO("Time offset adjustment: %d samples (%.2f), mean SFO: %.2f Hz, %.5f samples/10-sf, ema=%f, length=%d", q->next_rf_sample_offset, q->mean_sample_offset, srslte_ue_sync_nbiot_get_sfo(q), @@ -421,7 +421,7 @@ static int track_peak_ok(srslte_nbiot_ue_sync_t* q, uint32_t track_idx) ///< If the NPSS peak is beyond the frame we sample too slow, discard the offseted samples to align next frame if (q->next_rf_sample_offset > 0 && q->next_rf_sample_offset < MAX_TIME_OFFSET) { - DEBUG("Positive time offset %d samples.\n", q->next_rf_sample_offset); + DEBUG("Positive time offset %d samples.", q->next_rf_sample_offset); if (q->recv_callback( q->stream, &dummy_offset_buffer_nbiot[0], (uint32_t)q->next_rf_sample_offset, &q->last_timestamp) < 0) { fprintf(stderr, "Error receiving from USRP\n"); @@ -441,13 +441,13 @@ static int track_peak_no(srslte_nbiot_ue_sync_t* q) ///< if we missed too many NPSS, we go back to FIND and consider this frame unsynchronized q->frame_no_cnt++; if (q->frame_no_cnt >= TRACK_MAX_LOST) { - INFO("%d frames lost. Going back to FIND\n", (int)q->frame_no_cnt); + INFO("%d frames lost. Going back to FIND", (int)q->frame_no_cnt); q->nof_recv_sf = 10; q->frame_len = q->nof_recv_sf * q->sf_len; q->state = SF_FIND; return 0; } else { - INFO("Tracking peak not found. Peak %.3f, %d lost\n", + INFO("Tracking peak not found. Peak %.3f, %d lost", srslte_sync_nbiot_get_peak_value(&q->strack), (int)q->frame_no_cnt); /* @@ -518,7 +518,7 @@ int srslte_ue_sync_nbiot_zerocopy_multi(srslte_nbiot_ue_sync_t* q, cf_t** input_ if (q->sf_idx == 10) { q->sf_idx = 0; } - DEBUG("Reading %d samples. sf_idx = %d\n", q->sf_len, q->sf_idx); + DEBUG("Reading %d samples. sf_idx = %d", q->sf_len, q->sf_idx); ret = 1; } else { if (receive_samples(q, input_buffer)) { diff --git a/lib/src/phy/ue/ue_ul.c b/lib/src/phy/ue/ue_ul.c index ea8ad2394..4236c2fef 100644 --- a/lib/src/phy/ue/ue_ul.c +++ b/lib/src/phy/ue/ue_ul.c @@ -52,21 +52,21 @@ int srslte_ue_ul_init(srslte_ue_ul_t* q, cf_t* out_buffer, uint32_t max_prb) ofdm_cfg.freq_shift_f = 0.5f; ofdm_cfg.normalize = true; if (srslte_ofdm_tx_init_cfg(&q->fft, &ofdm_cfg)) { - ERROR("Error initiating FFT\n"); + ERROR("Error initiating FFT"); goto clean_exit; } if (srslte_cfo_init(&q->cfo, MAX_SFLEN)) { - ERROR("Error creating CFO object\n"); + ERROR("Error creating CFO object"); goto clean_exit; } if (srslte_pusch_init_ue(&q->pusch, max_prb)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto clean_exit; } if (srslte_pucch_init_ue(&q->pucch)) { - ERROR("Error creating PUSCH object\n"); + ERROR("Error creating PUSCH object"); goto clean_exit; } q->refsignal = srslte_vec_cf_malloc(2 * SRSLTE_NRE * max_prb); @@ -84,7 +84,7 @@ int srslte_ue_ul_init(srslte_ue_ul_t* q, cf_t* out_buffer, uint32_t max_prb) q->signals_pregenerated = false; ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid parameters\n"); + ERROR("Invalid parameters"); } clean_exit: @@ -131,36 +131,36 @@ int srslte_ue_ul_set_cell(srslte_ue_ul_t* q, srslte_cell_t cell) q->cell = cell; if (srslte_ofdm_tx_set_prb(&q->fft, q->cell.cp, q->cell.nof_prb)) { - ERROR("Error resizing FFT\n"); + ERROR("Error resizing FFT"); return SRSLTE_ERROR; } if (srslte_cfo_resize(&q->cfo, SRSLTE_SF_LEN_PRB(q->cell.nof_prb))) { - ERROR("Error resizing CFO object\n"); + ERROR("Error resizing CFO object"); return SRSLTE_ERROR; } if (srslte_pusch_set_cell(&q->pusch, q->cell)) { - ERROR("Error resizing PUSCH object\n"); + ERROR("Error resizing PUSCH object"); return SRSLTE_ERROR; } if (srslte_pucch_set_cell(&q->pucch, q->cell)) { - ERROR("Error resizing PUSCH object\n"); + ERROR("Error resizing PUSCH object"); return SRSLTE_ERROR; } if (srslte_refsignal_ul_set_cell(&q->signals, q->cell)) { - ERROR("Error resizing srslte_refsignal_ul\n"); + ERROR("Error resizing srslte_refsignal_ul"); return SRSLTE_ERROR; } if (srslte_ra_ul_pusch_hopping_init(&q->hopping, q->cell)) { - ERROR("Error setting hopping procedure cell\n"); + ERROR("Error setting hopping procedure cell"); return SRSLTE_ERROR; } q->signals_pregenerated = false; } ret = SRSLTE_SUCCESS; } else { - ERROR("Invalid cell properties ue_ul: Id=%d, Ports=%d, PRBs=%d\n", cell.id, cell.nof_ports, cell.nof_prb); + ERROR("Invalid cell properties ue_ul: Id=%d, Ports=%d, PRBs=%d", cell.id, cell.nof_ports, cell.nof_prb); } return ret; } @@ -221,7 +221,7 @@ void srslte_ue_ul_pusch_hopping(srslte_ue_ul_t* q, srslte_pusch_grant_t* grant) { if (cfg->ul_cfg.srs.configured && cfg->ul_cfg.hopping.hopping_enabled) { - ERROR("UL SRS and frequency hopping not currently supported\n"); + ERROR("UL SRS and frequency hopping not currently supported"); } return srslte_ra_ul_pusch_hopping(&q->hopping, sf, &cfg->ul_cfg.hopping, grant); } @@ -295,15 +295,13 @@ static void add_srs(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, uint32_t tti) static int pusch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, srslte_pusch_data_t* data) { - int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q != NULL) { - srslte_vec_cf_zero(q->sf_symbols, SRSLTE_NOF_RE(q->cell)); if (srslte_pusch_encode(&q->pusch, sf, &cfg->ul_cfg.pusch, data, q->sf_symbols)) { - ERROR("Error encoding PUSCH\n"); + ERROR("Error encoding PUSCH"); return SRSLTE_ERROR; } @@ -316,7 +314,7 @@ static int pusch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_ sf->tti % 10, cfg->ul_cfg.pusch.grant.n_dmrs, q->refsignal)) { - ERROR("Error generating PUSCH DMRS signals\n"); + ERROR("Error generating PUSCH DMRS signals"); return ret; } srslte_refsignal_dmrs_pusch_put(&q->signals, &cfg->ul_cfg.pusch, q->refsignal, q->sf_symbols); @@ -365,7 +363,7 @@ float srslte_ue_ul_pusch_power(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, float float f = 0; float pusch_power = 10 * log10f(cfg->ul_cfg.pusch.grant.L_prb) + p0_pusch + alpha * PL + delta + f; - DEBUG("PUSCH: P=%f -- 10M=%f, p0=%f,alpha=%f,PL=%f,\n", + DEBUG("PUSCH: P=%f -- 10M=%f, p0=%f,alpha=%f,PL=%f,", pusch_power, 10 * log10f(cfg->ul_cfg.pusch.grant.L_prb), p0_pusch, @@ -412,7 +410,7 @@ float srslte_ue_ul_pucch_power(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, srslt float pucch_power = p0_pucch + PL + h + delta_f + g; - DEBUG("PUCCH: P=%f -- p0=%f, PL=%f, delta_f=%f, h=%f, g=%f\n", pucch_power, p0_pucch, PL, delta_f, h, g); + DEBUG("PUCCH: P=%f -- p0=%f, PL=%f, delta_f=%f, h=%f, g=%f", pucch_power, p0_pucch, PL, delta_f, h, g); return 0; } @@ -421,7 +419,6 @@ static int srs_encode(srslte_ue_ul_t* q, uint32_t tti, srslte_ue_ul_cfg_t* cfg) { int ret = SRSLTE_ERROR_INVALID_INPUTS; if (q && cfg) { - srslte_vec_cf_zero(q->sf_symbols, SRSLTE_NOF_RE(q->cell)); add_srs(q, cfg, tti); @@ -467,7 +464,7 @@ float srs_power(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, float PL) float p_srs = p_srs_offset + 10 * log10f(M_sc) + p0_pusch + alpha * PL + f; - DEBUG("SRS: P=%f -- p_offset=%f, 10M=%f, p0_pusch=%f, alpha=%f, PL=%f, f=%f\n", + DEBUG("SRS: P=%f -- p_offset=%f, 10M=%f, p0_pusch=%f, alpha=%f, PL=%f, f=%f", p_srs, p_srs_offset, 10 * log10f(M_sc), @@ -503,7 +500,7 @@ pucch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, ret = SRSLTE_ERROR; if (!srslte_pucch_cfg_isvalid(&cfg->ul_cfg.pucch, q->cell.nof_prb)) { - ERROR("Invalid PUCCH configuration\n"); + ERROR("Invalid PUCCH configuration"); return ret; } @@ -516,12 +513,12 @@ pucch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, srslte_refsignal_srs_pucch_shortened(&q->signals, sf, &cfg->ul_cfg.srs, &cfg->ul_cfg.pucch); if (srslte_pucch_encode(&q->pucch, sf, &cfg->ul_cfg.pucch, &uci_value2, q->sf_symbols)) { - ERROR("Error encoding TB\n"); + ERROR("Error encoding TB"); return ret; } if (srslte_refsignal_dmrs_pucch_gen(&q->signals, sf, &cfg->ul_cfg.pucch, q->refsignal)) { - ERROR("Error generating PUSCH DMRS signals\n"); + ERROR("Error generating PUSCH DMRS signals"); return ret; } srslte_refsignal_dmrs_pucch_put(&q->signals, &cfg->ul_cfg.pucch, q->refsignal, q->sf_symbols); @@ -535,7 +532,7 @@ pucch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, char txt[256]; srslte_pucch_tx_info(&cfg->ul_cfg.pucch, uci_data, txt, sizeof(txt)); - INFO("[PUCCH] Encoded %s\n", txt); + INFO("[PUCCH] Encoded %s", txt); ret = SRSLTE_SUCCESS; } diff --git a/lib/src/phy/ue/ue_ul_nr.c b/lib/src/phy/ue/ue_ul_nr.c index 985f19c0f..100d3bda4 100644 --- a/lib/src/phy/ue/ue_ul_nr.c +++ b/lib/src/phy/ue/ue_ul_nr.c @@ -47,7 +47,7 @@ int srslte_ue_ul_nr_init(srslte_ue_ul_nr_t* q, cf_t* output, const srslte_ue_ul_ } if (srslte_dmrs_sch_init(&q->dmrs, false) < SRSLTE_SUCCESS) { - ERROR("Error DMRS\n"); + ERROR("Error DMRS"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/utils/convolution.c b/lib/src/phy/utils/convolution.c index 8b24c6325..766f024df 100644 --- a/lib/src/phy/utils/convolution.c +++ b/lib/src/phy/utils/convolution.c @@ -35,15 +35,15 @@ int srslte_conv_fft_cc_init(srslte_conv_fft_cc_t* q, uint32_t input_len, uint32_ return SRSLTE_ERROR; } if (srslte_dft_plan(&q->input_plan, q->output_len, SRSLTE_DFT_FORWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error initiating input plan\n"); + ERROR("Error initiating input plan"); return SRSLTE_ERROR; } if (srslte_dft_plan(&q->filter_plan, q->output_len, SRSLTE_DFT_FORWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error initiating filter plan\n"); + ERROR("Error initiating filter plan"); return SRSLTE_ERROR; } if (srslte_dft_plan(&q->output_plan, q->output_len, SRSLTE_DFT_BACKWARD, SRSLTE_DFT_COMPLEX)) { - ERROR("Error initiating output plan\n"); + ERROR("Error initiating output plan"); return SRSLTE_ERROR; } srslte_dft_plan_set_norm(&q->input_plan, true); @@ -56,7 +56,7 @@ int srslte_conv_fft_cc_init(srslte_conv_fft_cc_t* q, uint32_t input_len, uint32_ int srslte_conv_fft_cc_replan(srslte_conv_fft_cc_t* q, uint32_t input_len, uint32_t filter_len) { if (input_len > q->max_input_len || filter_len > q->max_filter_len) { - ERROR("Error in conv_fft_cc_replan(): input_len and filter_len must be lower than initialized\n"); + ERROR("Error in conv_fft_cc_replan(): input_len and filter_len must be lower than initialized"); return -1; } @@ -68,15 +68,15 @@ int srslte_conv_fft_cc_replan(srslte_conv_fft_cc_t* q, uint32_t input_len, uint3 return SRSLTE_ERROR; } if (srslte_dft_replan(&q->input_plan, q->output_len)) { - ERROR("Error initiating input plan\n"); + ERROR("Error initiating input plan"); return SRSLTE_ERROR; } if (srslte_dft_replan(&q->filter_plan, q->output_len)) { - ERROR("Error initiating filter plan\n"); + ERROR("Error initiating filter plan"); return SRSLTE_ERROR; } if (srslte_dft_replan(&q->output_plan, q->output_len)) { - ERROR("Error initiating output plan\n"); + ERROR("Error initiating output plan"); return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -112,7 +112,6 @@ uint32_t srslte_conv_fft_cc_run_opt(srslte_conv_fft_cc_t* q, const cf_t* input, uint32_t srslte_conv_fft_cc_run(srslte_conv_fft_cc_t* q, const cf_t* input, const cf_t* filter, cf_t* output) { - srslte_dft_run_c(&q->filter_plan, filter, q->filter_fft); return srslte_conv_fft_cc_run_opt(q, input, q->filter_fft, output); diff --git a/lib/src/phy/utils/ringbuffer.c b/lib/src/phy/utils/ringbuffer.c index 57bb84f80..7519afe9c 100644 --- a/lib/src/phy/utils/ringbuffer.c +++ b/lib/src/phy/utils/ringbuffer.c @@ -110,7 +110,7 @@ int srslte_ringbuffer_write_timed_block(srslte_ringbuffer_t* q, void* p, int nof struct timeval now; if (q == NULL || q->buffer == NULL) { - ERROR("Invalid inputs\n"); + ERROR("Invalid inputs"); return SRSLTE_ERROR_INVALID_INPUTS; } @@ -130,7 +130,7 @@ int srslte_ringbuffer_write_timed_block(srslte_ringbuffer_t* q, void* p, int nof pthread_cond_wait(&q->read_cvar, &q->mutex); } else { w_bytes = q->capacity - q->count; - ERROR("Buffer overrun: lost %d bytes\n", nof_bytes - w_bytes); + ERROR("Buffer overrun: lost %d bytes", nof_bytes - w_bytes); } } if (ret == ETIMEDOUT) { diff --git a/lib/src/phy/utils/vector.c b/lib/src/phy/utils/vector.c index 494ca4beb..69b6b9605 100644 --- a/lib/src/phy/utils/vector.c +++ b/lib/src/phy/utils/vector.c @@ -356,7 +356,7 @@ void srslte_vec_sprint_hex(char* str, const uint32_t max_str_len, uint8_t* x, co nbytes = len / 8; // check that hex string fits in buffer (every byte takes 3 characters, plus brackets) if ((3 * (len / 8 + ((len % 8) ? 1 : 0))) + 2 >= max_str_len) { - ERROR("Buffer too small for printing hex string (max_str_len=%d, payload_len=%d).\n", max_str_len, len); + ERROR("Buffer too small for printing hex string (max_str_len=%d, payload_len=%d).", max_str_len, len); return; } diff --git a/lib/src/radio/test/benchmark_radio.cc b/lib/src/radio/test/benchmark_radio.cc index af984774d..66385f5f8 100644 --- a/lib/src/radio/test/benchmark_radio.cc +++ b/lib/src/radio/test/benchmark_radio.cc @@ -362,7 +362,7 @@ static void* radio_thread_run(void* arg) if (capture) { for (uint32_t r = 0; r < nof_radios; r++) { snprintf(filename, 256, file_pattern.c_str(), r); - INFO("Opening filesink %s for radio %d\n", filename, r); + INFO("Opening filesink %s for radio %d", filename, r); if (srslte_filesink_init(&filesink[r], filename, SRSLTE_COMPLEX_FLOAT_BIN)) { ERROR("Initiating filesink for radio %d\n", r); goto clean_exit; @@ -490,7 +490,7 @@ static void* radio_thread_run(void* arg) } delay_idx[r] += relative_delay; - INFO("Radio %d relative delay is %d sample in frame %d/%d (average %.1f)\n", + INFO("Radio %d relative delay is %d sample in frame %d/%d (average %.1f)", r, relative_delay, i + 1, @@ -510,7 +510,7 @@ static void* radio_thread_run(void* arg) gap = (int32_t)round(srslte_timestamp_real(&ts_diff) * current_rate) - (int32_t)frame_size; if (gap != 0) { - INFO("Timestamp gap (%d samples) detected! Frame %d/%d. ts=%.9f+%.9f=%.9f\n", + INFO("Timestamp gap (%d samples) detected! Frame %d/%d. ts=%.9f+%.9f=%.9f", gap, i + 1, nof_frames, diff --git a/lib/test/common/timer_test.cc b/lib/test/common/timer_test.cc index 2b56325d7..0fef98b66 100644 --- a/lib/test/common/timer_test.cc +++ b/lib/test/common/timer_test.cc @@ -322,7 +322,7 @@ int timers_test5() timers.defer_callback(2, [&vals, string]() { vals.push_back(2); if (string != "test string") { - ERROR("string was not captured correctly\n"); + ERROR("string was not captured correctly"); exit(-1); } }); diff --git a/lib/test/phy/phy_dl_nr_test.c b/lib/test/phy/phy_dl_nr_test.c index 6582c2247..4e0553754 100644 --- a/lib/test/phy/phy_dl_nr_test.c +++ b/lib/test/phy/phy_dl_nr_test.c @@ -91,7 +91,7 @@ static int work_gnb_dl(srslte_enb_dl_nr_t* enb_dl, uint8_t** data_tx) { if (srslte_enb_dl_nr_base_zero(enb_dl) < SRSLTE_SUCCESS) { - ERROR("Error setting base to zero\n"); + ERROR("Error setting base to zero"); return SRSLTE_ERROR; } @@ -104,14 +104,14 @@ static int work_gnb_dl(srslte_enb_dl_nr_t* enb_dl, // Put actual DCI if (srslte_enb_dl_nr_pdcch_put(enb_dl, slot, dci_dl) < SRSLTE_SUCCESS) { - ERROR("Error putting PDCCH\n"); + ERROR("Error putting PDCCH"); return SRSLTE_ERROR; } // Put PDSCH transmission pdsch_cfg.grant = pdsch_grant; if (srslte_enb_dl_nr_pdsch_put(enb_dl, slot, &pdsch_cfg, data_tx) < SRSLTE_SUCCESS) { - ERROR("Error putting PDSCH\n"); + ERROR("Error putting PDSCH"); return SRSLTE_ERROR; } @@ -127,18 +127,18 @@ static int work_ue_dl(srslte_ue_dl_nr_t* ue_dl, srslte_slot_cfg_t* slot, srslte_ srslte_dci_dl_nr_t dci_dl_rx = {}; int nof_found_dci = srslte_ue_dl_nr_find_dl_dci(ue_dl, slot, rnti, &dci_dl_rx, 1); if (nof_found_dci < SRSLTE_SUCCESS) { - ERROR("Error decoding\n"); + ERROR("Error decoding"); return SRSLTE_ERROR; } if (nof_found_dci < 1) { - ERROR("Error DCI not found\n"); + ERROR("Error DCI not found"); return SRSLTE_ERROR; } pdsch_cfg.grant = pdsch_grant; if (srslte_ue_dl_nr_decode_pdsch(ue_dl, slot, &pdsch_cfg, pdsch_res) < SRSLTE_SUCCESS) { - ERROR("Error decoding\n"); + ERROR("Error decoding"); return SRSLTE_ERROR; } @@ -164,7 +164,7 @@ int main(int argc, char** argv) buffer = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(carrier.nof_prb)); if (buffer == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } @@ -208,32 +208,32 @@ int main(int argc, char** argv) } if (srslte_ue_dl_nr_init(&ue_dl, &buffer, &ue_dl_args)) { - ERROR("Error UE DL\n"); + ERROR("Error UE DL"); goto clean_exit; } if (srslte_enb_dl_nr_init(&enb_dl, &buffer, &enb_dl_args)) { - ERROR("Error UE DL\n"); + ERROR("Error UE DL"); goto clean_exit; } if (srslte_ue_dl_nr_set_carrier(&ue_dl, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } if (srslte_ue_dl_nr_set_pdcch_config(&ue_dl, &pdcch_cfg)) { - ERROR("Error setting CORESET\n"); + ERROR("Error setting CORESET"); goto clean_exit; } if (srslte_enb_dl_nr_set_carrier(&enb_dl, &carrier)) { - ERROR("Error setting SCH NR carrier\n"); + ERROR("Error setting SCH NR carrier"); goto clean_exit; } if (srslte_enb_dl_nr_set_coreset(&enb_dl, coreset)) { - ERROR("Error setting CORESET\n"); + ERROR("Error setting CORESET"); goto clean_exit; } @@ -241,7 +241,7 @@ int main(int argc, char** argv) data_tx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); data_rx[i] = srslte_vec_u8_malloc(SRSLTE_SLOT_MAX_NOF_BITS_NR); if (data_tx[i] == NULL || data_rx[i] == NULL) { - ERROR("Error malloc\n"); + ERROR("Error malloc"); goto clean_exit; } @@ -253,19 +253,19 @@ int main(int argc, char** argv) if (srslte_softbuffer_tx_init_guru(&softbuffer_tx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } if (srslte_softbuffer_rx_init_guru(&softbuffer_rx, SRSLTE_SCH_NR_MAX_NOF_CB_LDPC, SRSLTE_LDPC_MAX_LEN_ENCODED_CB) < SRSLTE_SUCCESS) { - ERROR("Error init soft-buffer\n"); + ERROR("Error init soft-buffer"); goto clean_exit; } // Use grant default A time resources with m=0 if (srslte_ra_dl_nr_time_default_A(0, pdsch_cfg.dmrs.typeA_pos, &pdsch_grant) < SRSLTE_SUCCESS) { - ERROR("Error loading default grant\n"); + ERROR("Error loading default grant"); goto clean_exit; } pdsch_grant.nof_layers = carrier.max_mimo_layers; @@ -295,7 +295,7 @@ int main(int argc, char** argv) } if (srslte_ra_nr_fill_tb(&pdsch_cfg, &pdsch_grant, mcs, &pdsch_grant.tb[0]) < SRSLTE_SUCCESS) { - ERROR("Error filing tb\n"); + ERROR("Error filing tb"); goto clean_exit; } @@ -317,7 +317,7 @@ int main(int argc, char** argv) int nof_candidates = srslte_pdcch_nr_locations_coreset(coreset, search_space, rnti, L, slot.idx, ncce_candidates); if (nof_candidates < SRSLTE_SUCCESS) { - ERROR("Error getting PDCCH candidates\n"); + ERROR("Error getting PDCCH candidates"); goto clean_exit; } @@ -331,7 +331,7 @@ int main(int argc, char** argv) gettimeofday(&t[1], NULL); if (work_gnb_dl(&enb_dl, &slot, search_space, &dci_dl, &dci_location, data_tx) < SRSLTE_ERROR) { - ERROR("Error running eNb DL\n"); + ERROR("Error running eNb DL"); goto clean_exit; } gettimeofday(&t[2], NULL); @@ -345,7 +345,7 @@ int main(int argc, char** argv) gettimeofday(&t[1], NULL); if (work_ue_dl(&ue_dl, &slot, pdsch_res) < SRSLTE_SUCCESS) { - ERROR("Error running UE DL\n"); + ERROR("Error running UE DL"); goto clean_exit; } gettimeofday(&t[2], NULL); @@ -353,17 +353,17 @@ int main(int argc, char** argv) pdsch_decode_us += (size_t)(t[0].tv_sec * 1e6 + t[0].tv_usec); if (pdsch_res->evm > 0.001f) { - ERROR("Error PDSCH EVM is too high %f\n", pdsch_res->evm); + ERROR("Error PDSCH EVM is too high %f", pdsch_res->evm); goto clean_exit; } if (!pdsch_res[0].crc) { - ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pdsch_grant.tb[0].tbs); + ERROR("Failed to match CRC; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pdsch_grant.tb[0].tbs); goto clean_exit; } if (memcmp(data_tx[0], data_rx[0], pdsch_grant.tb[0].tbs / 8) != 0) { - ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;\n", n_prb, mcs, pdsch_grant.tb[0].tbs); + ERROR("Failed to match Tx/Rx data; n_prb=%d; mcs=%d; TBS=%d;", n_prb, mcs, pdsch_grant.tb[0].tbs); printf("Tx data: "); srslte_vec_fprint_byte(stdout, data_tx[0], pdsch_grant.tb[0].tbs / 8); printf("Rx data: "); @@ -371,7 +371,7 @@ int main(int argc, char** argv) goto clean_exit; } - INFO("n_prb=%d; mcs=%d; TBS=%d; EVM=%f; PASSED!\n", n_prb, mcs, pdsch_grant.tb[0].tbs, pdsch_res[0].evm); + INFO("n_prb=%d; mcs=%d; TBS=%d; EVM=%f; PASSED!", n_prb, mcs, pdsch_grant.tb[0].tbs, pdsch_res[0].evm); // Count the Tx/Rx'd number of bits nof_bits += pdsch_grant.tb[0].tbs; diff --git a/lib/test/phy/phy_dl_test.c b/lib/test/phy/phy_dl_test.c index 3ffbc0bb2..b02dd97e1 100644 --- a/lib/test/phy/phy_dl_test.c +++ b/lib/test/phy/phy_dl_test.c @@ -66,7 +66,7 @@ void parse_extensive_param(char* param, char* arg) } if (ext_code) { - ERROR("Error parsing parameter '%s' and argument '%s'\n", param, arg); + ERROR("Error parsing parameter '%s' and argument '%s'", param, arg); exit(ext_code); } } @@ -142,19 +142,19 @@ int work_enb(srslte_enb_dl_t* enb_dl, srslte_enb_dl_put_base(enb_dl, dl_sf); if (srslte_enb_dl_put_pdcch_dl(enb_dl, dci_cfg, dci)) { - ERROR("Error putting PDCCH sf_idx=%d\n", dl_sf->tti); + ERROR("Error putting PDCCH sf_idx=%d", dl_sf->tti); goto quit; } // Create pdsch config srslte_pdsch_cfg_t pdsch_cfg; if (srslte_ra_dl_dci_to_grant(&cell, dl_sf, transmission_mode, enable_256qam, dci, &pdsch_cfg.grant)) { - ERROR("Computing DL grant sf_idx=%d\n", dl_sf->tti); + ERROR("Computing DL grant sf_idx=%d", dl_sf->tti); goto quit; } char str[512]; srslte_dci_dl_info(dci, str, 512); - INFO("eNb PDCCH: rnti=0x%x, %s\n", rnti, str); + INFO("eNb PDCCH: rnti=0x%x, %s", rnti, str); for (uint32_t i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { pdsch_cfg.softbuffers.tx[i] = softbuffer_tx[i]; @@ -168,11 +168,11 @@ int work_enb(srslte_enb_dl_t* enb_dl, pdsch_cfg.meas_time_en = false; if (srslte_enb_dl_put_pdsch(enb_dl, &pdsch_cfg, data_tx) < 0) { - ERROR("Error putting PDSCH sf_idx=%d\n", dl_sf->tti); + ERROR("Error putting PDSCH sf_idx=%d", dl_sf->tti); goto quit; } srslte_pdsch_tx_info(&pdsch_cfg, str, 512); - INFO("eNb PDSCH: rnti=0x%x, %s\n", rnti, str); + INFO("eNb PDSCH: rnti=0x%x, %s", rnti, str); srslte_enb_dl_gen_signal(enb_dl); @@ -190,16 +190,16 @@ int work_ue(srslte_ue_dl_t* ue_dl, srslte_pdsch_res_t pdsch_res[SRSLTE_MAX_CODEWORDS]) { if (srslte_ue_dl_decode_fft_estimate(ue_dl, sf_cfg_dl, ue_dl_cfg) < 0) { - ERROR("Getting PDCCH FFT estimate sf_idx=%d\n", sf_idx); + ERROR("Getting PDCCH FFT estimate sf_idx=%d", sf_idx); return SRSLTE_ERROR; } int nof_grants = srslte_ue_dl_find_dl_dci(ue_dl, sf_cfg_dl, ue_dl_cfg, rnti, dci_dl); if (nof_grants < 0) { - ERROR("Looking for DL grants sf_idx=%d\n", sf_idx); + ERROR("Looking for DL grants sf_idx=%d", sf_idx); return SRSLTE_ERROR; } else if (nof_grants == 0) { - ERROR("Failed to find DCI in sf_idx=%d\n", sf_idx); + ERROR("Failed to find DCI in sf_idx=%d", sf_idx); return SRSLTE_ERROR; } @@ -214,12 +214,12 @@ int work_ue(srslte_ue_dl_t* ue_dl, if (srslte_verbose >= SRSLTE_VERBOSE_INFO) { char str[512]; srslte_dci_dl_info(&dci_dl[0], str, 512); - INFO("UE PDCCH: rnti=0x%x, %s\n", rnti, str); + INFO("UE PDCCH: rnti=0x%x, %s", rnti, str); } if (srslte_ra_dl_dci_to_grant( &cell, sf_cfg_dl, transmission_mode, enable_256qam, &dci_dl[0], &ue_dl_cfg->cfg.pdsch.grant)) { - ERROR("Computing DL grant sf_idx=%d\n", sf_idx); + ERROR("Computing DL grant sf_idx=%d", sf_idx); return SRSLTE_ERROR; } @@ -231,14 +231,14 @@ int work_ue(srslte_ue_dl_t* ue_dl, } if (srslte_ue_dl_decode_pdsch(ue_dl, sf_cfg_dl, &ue_dl_cfg->cfg.pdsch, pdsch_res)) { - ERROR("ERROR: Decoding PDSCH sf_idx=%d\n", sf_idx); + ERROR("ERROR: Decoding PDSCH sf_idx=%d", sf_idx); return SRSLTE_ERROR; } if (srslte_verbose >= SRSLTE_VERBOSE_INFO) { char str[512]; srslte_pdsch_rx_info(&ue_dl_cfg->cfg.pdsch, pdsch_res, str, 512); - INFO("eNb PDSCH: rnti=0x%x, %s\n", rnti, str); + INFO("eNb PDSCH: rnti=0x%x, %s", rnti, str); } return SRSLTE_SUCCESS; @@ -323,7 +323,7 @@ int main(int argc, char** argv) for (int i = 0; i < cell.nof_ports; i++) { signal_buffer[i] = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(cell.nof_prb)); if (!signal_buffer[i]) { - ERROR("Error allocating buffer\n"); + ERROR("Error allocating buffer"); goto quit; } } @@ -331,35 +331,35 @@ int main(int argc, char** argv) for (int i = 0; i < SRSLTE_MAX_TB; i++) { softbuffer_tx[i] = (srslte_softbuffer_tx_t*)calloc(sizeof(srslte_softbuffer_tx_t), 1); if (!softbuffer_tx[i]) { - ERROR("Error allocating softbuffer_tx\n"); + ERROR("Error allocating softbuffer_tx"); goto quit; } if (srslte_softbuffer_tx_init(softbuffer_tx[i], cell.nof_prb)) { - ERROR("Error initiating softbuffer_tx\n"); + ERROR("Error initiating softbuffer_tx"); goto quit; } softbuffer_rx[i] = (srslte_softbuffer_rx_t*)calloc(sizeof(srslte_softbuffer_rx_t), 1); if (!softbuffer_rx[i]) { - ERROR("Error allocating softbuffer_rx\n"); + ERROR("Error allocating softbuffer_rx"); goto quit; } if (srslte_softbuffer_rx_init(softbuffer_rx[i], cell.nof_prb)) { - ERROR("Error initiating softbuffer_rx\n"); + ERROR("Error initiating softbuffer_rx"); goto quit; } data_tx[i] = srslte_vec_u8_malloc(MAX_DATABUFFER_SIZE); if (!data_tx[i]) { - ERROR("Error allocating data tx\n"); + ERROR("Error allocating data tx"); goto quit; } data_rx[i] = srslte_vec_u8_malloc(MAX_DATABUFFER_SIZE); if (!data_rx[i]) { - ERROR("Error allocating data tx\n"); + ERROR("Error allocating data tx"); goto quit; } } @@ -368,17 +368,17 @@ int main(int argc, char** argv) * Initialise eNb */ if (srslte_enb_dl_init(enb_dl, signal_buffer, cell.nof_prb)) { - ERROR("Error initiating eNb downlink\n"); + ERROR("Error initiating eNb downlink"); goto quit; } if (srslte_enb_dl_set_cell(enb_dl, cell)) { - ERROR("Error setting eNb DL cell\n"); + ERROR("Error setting eNb DL cell"); goto quit; } if (srslte_enb_dl_add_rnti(enb_dl, rnti)) { - ERROR("Error adding RNTI\n"); + ERROR("Error adding RNTI"); goto quit; } @@ -386,12 +386,12 @@ int main(int argc, char** argv) * Initialise UE */ if (srslte_ue_dl_init(ue_dl, signal_buffer, cell.nof_prb, nof_rx_ant)) { - ERROR("Error initiating UE downlink\n"); + ERROR("Error initiating UE downlink"); goto quit; } if (srslte_ue_dl_set_cell(ue_dl, cell)) { - ERROR("Error setting UE downlink cell\n"); + ERROR("Error setting UE downlink cell"); goto quit; } @@ -492,13 +492,13 @@ int main(int argc, char** argv) dci.tb[i].cw_idx = i; } } else { - ERROR("Wrong transmission mode (%d)\n", transmission_mode); + ERROR("Wrong transmission mode (%d)", transmission_mode); } /* * Loop */ - INFO("--- Starting test ---\n"); + INFO("--- Starting test ---"); for (uint32_t sf_idx = 0; sf_idx < nof_subframes; sf_idx++) { /* Generate random data */ for (int j = 0; j < SRSLTE_MAX_TB; j++) { @@ -511,9 +511,9 @@ int main(int argc, char** argv) * Run eNodeB */ srslte_dl_sf_cfg_t sf_cfg_dl = {}; - sf_cfg_dl.tti = sf_idx % 10; - sf_cfg_dl.cfi = cfi; - sf_cfg_dl.sf_type = SRSLTE_SF_NORM; + sf_cfg_dl.tti = sf_idx % 10; + sf_cfg_dl.cfi = cfi; + sf_cfg_dl.sf_type = SRSLTE_SF_NORM; // Set DCI Location dci.location = dci_locations[sf_idx % 10][(sf_idx / 10) % nof_locations[sf_idx % 10]]; @@ -526,7 +526,7 @@ int main(int argc, char** argv) dci.tb[i].mcs_idx = (sf_idx % 5 == 0) ? SRSLTE_MIN(mcs, 27) : mcs; } } - INFO("--- Process eNb ---\n"); + INFO("--- Process eNb ---"); gettimeofday(&t[1], NULL); if (work_enb(enb_dl, &sf_cfg_dl, &dci_cfg, &dci, softbuffer_tx, data_tx)) { @@ -553,7 +553,7 @@ int main(int argc, char** argv) /* * Run UE */ - INFO("--- Process UE ---\n"); + INFO("--- Process UE ---"); gettimeofday(&t[1], NULL); srslte_ue_dl_cfg_t ue_dl_cfg = {}; diff --git a/lib/test/phy/pucch_ca_test.c b/lib/test/phy/pucch_ca_test.c index c6cf2ca7c..ed1dfb572 100644 --- a/lib/test/phy/pucch_ca_test.c +++ b/lib/test/phy/pucch_ca_test.c @@ -87,7 +87,6 @@ static int test_pucch_ca(srslte_ack_nack_feedback_mode_t ack_nack_feedback_mode, // The test itself starts here for (ul_sf.tti = 0; ul_sf.tti < (1U << (nof_carriers * 2U)); ul_sf.tti++) { - // Generate new data pusch_data.uci.ack.valid = true; for (uint32_t i = 0, k = 0; i < nof_carriers; i++) { @@ -113,7 +112,7 @@ static int test_pucch_ca(srslte_ack_nack_feedback_mode_t ack_nack_feedback_mode, // Check results for (int i = 0, k = 0; i < nof_carriers; i++) { for (int j = 0; j < nof_tb[i]; j++, k++) { - INFO("cc=%d; tb=%d; tx_ack=%d; rx_ack=%d;\n", + INFO("cc=%d; tb=%d; tx_ack=%d; rx_ack=%d;", i, j, pusch_data.uci.ack.ack_value[k], diff --git a/srsenb/src/phy/phy_common.cc b/srsenb/src/phy/phy_common.cc index b35ea1427..35750830f 100644 --- a/srsenb/src/phy/phy_common.cc +++ b/srsenb/src/phy/phy_common.cc @@ -46,7 +46,8 @@ bool phy_common::init(const phy_cell_cfg_list_t& cell_list_, // Instantiate DL channel emulator if (params.dl_channel_args.enable) { - dl_channel = srslte::channel_ptr(new srslte::channel(params.dl_channel_args, get_nof_rf_channels())); + dl_channel = srslte::channel_ptr( + new srslte::channel(params.dl_channel_args, get_nof_rf_channels(), srslog::fetch_basic_logger("PHY"))); dl_channel->set_srate((uint32_t)srslte_sampling_freq_hz(cell_list_lte[0].cell.nof_prb)); dl_channel->set_signal_power_dBfs(srslte_enb_dl_get_maximum_signal_power_dBfs(cell_list_lte[0].cell.nof_prb)); } diff --git a/srsenb/src/phy/txrx.cc b/srsenb/src/phy/txrx.cc index f57f7e51a..9635b0633 100644 --- a/srsenb/src/phy/txrx.cc +++ b/srsenb/src/phy/txrx.cc @@ -61,8 +61,8 @@ bool txrx::init(stack_interface_phy_lte* stack_, // Instantiate UL channel emulator if (worker_com->params.ul_channel_args.enable) { - ul_channel = - srslte::channel_ptr(new srslte::channel(worker_com->params.ul_channel_args, worker_com->get_nof_rf_channels())); + ul_channel = srslte::channel_ptr( + new srslte::channel(worker_com->params.ul_channel_args, worker_com->get_nof_rf_channels(), logger)); } start(prio_); diff --git a/srsenb/src/stack/upper/pdcp_nr.cc b/srsenb/src/stack/upper/pdcp_nr.cc index 8fb870811..45faa0b2a 100644 --- a/srsenb/src/stack/upper/pdcp_nr.cc +++ b/srsenb/src/stack/upper/pdcp_nr.cc @@ -149,17 +149,17 @@ void pdcp_nr::user_interface_rrc::write_pdu(uint32_t lcid, srslte::unique_byte_b void pdcp_nr::user_interface_rrc::write_pdu_bcch_bch(srslte::unique_byte_buffer_t pdu) { - ERROR("Error: Received BCCH from ue=%d\n", rnti); + ERROR("Error: Received BCCH from ue=%d", rnti); } void pdcp_nr::user_interface_rrc::write_pdu_bcch_dlsch(srslte::unique_byte_buffer_t pdu) { - ERROR("Error: Received BCCH from ue=%d\n", rnti); + ERROR("Error: Received BCCH from ue=%d", rnti); } void pdcp_nr::user_interface_rrc::write_pdu_pcch(srslte::unique_byte_buffer_t pdu) { - ERROR("Error: Received PCCH from ue=%d\n", rnti); + ERROR("Error: Received PCCH from ue=%d", rnti); } std::string pdcp_nr::user_interface_rrc::get_rb_name(uint32_t lcid) diff --git a/srsenb/src/stack/upper/rlc_nr.cc b/srsenb/src/stack/upper/rlc_nr.cc index 02bd7454a..2b4981164 100644 --- a/srsenb/src/stack/upper/rlc_nr.cc +++ b/srsenb/src/stack/upper/rlc_nr.cc @@ -189,17 +189,17 @@ void rlc_nr::user_interface::write_pdu(uint32_t lcid, srslte::unique_byte_buffer void rlc_nr::user_interface::write_pdu_bcch_bch(srslte::unique_byte_buffer_t sdu) { - ERROR("Error: Received BCCH from ue=%d\n", rnti); + ERROR("Error: Received BCCH from ue=%d", rnti); } void rlc_nr::user_interface::write_pdu_bcch_dlsch(srslte::unique_byte_buffer_t sdu) { - ERROR("Error: Received BCCH from ue=%d\n", rnti); + ERROR("Error: Received BCCH from ue=%d", rnti); } void rlc_nr::user_interface::write_pdu_pcch(srslte::unique_byte_buffer_t sdu) { - ERROR("Error: Received PCCH from ue=%d\n", rnti); + ERROR("Error: Received PCCH from ue=%d", rnti); } std::string rlc_nr::user_interface::get_rb_name(uint32_t lcid) diff --git a/srsue/src/phy/phy_common.cc b/srsue/src/phy/phy_common.cc index 6fda31108..d3da20178 100644 --- a/srsue/src/phy/phy_common.cc +++ b/srsue/src/phy/phy_common.cc @@ -53,8 +53,8 @@ void phy_common::init(phy_args_t* _args, // Instantiate UL channel emulator if (args->ul_channel_args.enable) { - ul_channel = - srslte::channel_ptr(new srslte::channel(args->ul_channel_args, args->nof_lte_carriers * args->nof_rx_ant)); + ul_channel = srslte::channel_ptr( + new srslte::channel(args->ul_channel_args, args->nof_lte_carriers * args->nof_rx_ant, logger)); } } @@ -123,7 +123,6 @@ void phy_common::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRAN uint16_t rnti, srslte_tdd_config_t tdd_config) { - #if MSG3_DELAY_MS < 0 #error "Error MSG3_DELAY_MS can't be negative" #endif /* MSG3_DELAY_MS < 0 */ @@ -193,7 +192,6 @@ const static uint32_t k_phich[7][10] = {{0, 0, 4, 7, 6, 0, 0, 4, 7, 6}, uint32_t phy_common::ul_pidof(uint32_t tti, srslte_tdd_config_t* tdd_config) { - if (tdd_config->configured) { /* In TDD modes 1-5, each PID is associated with a unique subframe and the number of harq processes equals the * number of UL subframes Modes 0 and 6 have more processes than UL subframes and PID depends on sfn @@ -501,7 +499,6 @@ bool phy_common::get_dl_pending_ack(srslte_ul_sf_cfg_t* sf, uint32_t cc_idx, srs M = das_table[sf->tdd_config.sf_config][sf->tti % 10].M; } for (uint32_t i = 0; i < M; i++) { - uint32_t k = (cell.frame_type == SRSLTE_FDD) ? FDD_HARQ_DELAY_UL_MS : das_table[sf->tdd_config.sf_config][sf->tti % 10].K[i]; uint32_t pdsch_tti = TTI_SUB(sf->tti, k + (FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS)); @@ -571,7 +568,6 @@ void phy_common::worker_end(void* tx_sem_id, // For each radio, transmit if (tx_enable) { - if (ul_channel) { ul_channel->run(buffer.to_cf_t(), buffer.to_cf_t(), buffer.get_nof_samples(), tx_time.get(0)); } @@ -584,7 +580,6 @@ void phy_common::worker_end(void* tx_sem_id, is_pending_tx_end = false; } else { if (!radio_h->get_is_start_of_burst()) { - if (ul_channel) { srslte_vec_cf_zero(zeros_multi.get(0), buffer.get_nof_samples()); ul_channel->run(zeros_multi.to_cf_t(), zeros_multi.to_cf_t(), buffer.get_nof_samples(), tx_time.get(0)); @@ -641,7 +636,6 @@ void phy_common::update_measurements(uint32_t cc_idx, // Only worker 0 reads the RSSI sensor if (rssi_power_buffer) { - if (!rssi_read_cnt) { // Average RSSI over all symbols in antenna port 0 (make sure SF length is non-zero) float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0 diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index b710e7dcc..4629a3b92 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -75,7 +75,8 @@ void sync::init(srslte::radio_interface_phy* _radio, } if (worker_com->args->dl_channel_args.enable) { - channel_emulator = srslte::channel_ptr(new srslte::channel(worker_com->args->dl_channel_args, nof_rf_channels)); + channel_emulator = + srslte::channel_ptr(new srslte::channel(worker_com->args->dl_channel_args, nof_rf_channels, phy_logger)); } // Initialize cell searcher diff --git a/srsue/test/phy/scell_search_test.cc b/srsue/test/phy/scell_search_test.cc index a8f98a933..5fec081d5 100644 --- a/srsue/test/phy/scell_search_test.cc +++ b/srsue/test/phy/scell_search_test.cc @@ -93,20 +93,19 @@ uint32_t prbset_to_bitmask() class test_enb { private: - srslte_enb_dl_t enb_dl; - srslte::channel_ptr channel; - cf_t* signal_buffer[SRSLTE_MAX_PORTS] = {}; - srslte::log_filter channel_log; + srslte_enb_dl_t enb_dl; + srslte::channel_ptr channel; + cf_t* signal_buffer[SRSLTE_MAX_PORTS] = {}; + srslog::basic_logger& logger; public: test_enb(const srslte_cell_t& cell, const srslte::channel::args_t& channel_args) : - enb_dl(), channel_log("Channel pci=" + std::to_string(cell.id)) + enb_dl(), logger(srslog::fetch_basic_logger("Channel pci=" + std::to_string(cell.id))) { - channel_log.set_level(channel_log_level); + logger.set_level(srslog::str_to_basic_level(channel_log_level)); - channel = srslte::channel_ptr(new srslte::channel(channel_args, cell_base.nof_ports)); + channel = srslte::channel_ptr(new srslte::channel(channel_args, cell_base.nof_ports, logger)); channel->set_srate(srslte_sampling_freq_hz(cell.nof_prb)); - channel->set_logger(&channel_log); // Allocate buffer for eNb for (uint32_t i = 0; i < cell_base.nof_ports; i++) { @@ -137,7 +136,6 @@ public: cf_t* baseband_buffer, const srslte::rf_timestamp_t& ts) { - int ret = SRSLTE_SUCCESS; uint32_t sf_len = SRSLTE_SF_LEN_PRB(enb_dl.cell.nof_prb); @@ -382,7 +380,6 @@ static void pci_list_parse_helper(std::string& list_str, std::set& lis } else if (list_str == "none") { // Do nothing } else if (not list_str.empty()) { - // Remove spaces from neightbour cell list list_str = srslte::string_remove_char(list_str, ' ');