Fix an ODR issue detected by ASAN in arch, where the global variable handler_registered was defined multiple times.

master
faluco 3 years ago committed by Andre Puschmann
parent 6c8324d95e
commit fa8e8ddf1f

@ -24,18 +24,24 @@
#include "phy_logger.h" #include "phy_logger.h"
#include "srsran/config.h" #include "srsran/config.h"
#include <stdio.h> #include <stdio.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define SRSRAN_VERBOSE_DEBUG 2 #define SRSRAN_VERBOSE_DEBUG 2
#define SRSRAN_VERBOSE_INFO 1 #define SRSRAN_VERBOSE_INFO 1
#define SRSRAN_VERBOSE_NONE 0 #define SRSRAN_VERBOSE_NONE 0
#include <sys/time.h>
SRSRAN_API void get_time_interval(struct timeval* tdata); SRSRAN_API void get_time_interval(struct timeval* tdata);
#define SRSRAN_DEBUG_ENABLED 1 #define SRSRAN_DEBUG_ENABLED 1
SRSRAN_API extern int srsran_verbose; SRSRAN_API extern int srsran_verbose;
SRSRAN_API extern int handler_registered;
SRSRAN_API bool is_handler_registered(void);
SRSRAN_API void set_handler_enabled(bool enable);
#define SRSRAN_VERBOSE_ISINFO() (srsran_verbose >= SRSRAN_VERBOSE_INFO) #define SRSRAN_VERBOSE_ISINFO() (srsran_verbose >= SRSRAN_VERBOSE_INFO)
#define SRSRAN_VERBOSE_ISDEBUG() (srsran_verbose >= SRSRAN_VERBOSE_DEBUG) #define SRSRAN_VERBOSE_ISDEBUG() (srsran_verbose >= SRSRAN_VERBOSE_DEBUG)
@ -47,7 +53,7 @@ SRSRAN_API extern int handler_registered;
#define DEBUG(_fmt, ...) \ #define DEBUG(_fmt, ...) \
do { \ do { \
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { \ if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) { \
fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__); \ fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__); \
} else { \ } else { \
srsran_phy_log_print(LOG_LEVEL_DEBUG_S, _fmt, ##__VA_ARGS__); \ srsran_phy_log_print(LOG_LEVEL_DEBUG_S, _fmt, ##__VA_ARGS__); \
@ -56,7 +62,7 @@ SRSRAN_API extern int handler_registered;
#define INFO(_fmt, ...) \ #define INFO(_fmt, ...) \
do { \ do { \
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { \ if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) { \
fprintf(stdout, "[INFO]: " _fmt "\n", ##__VA_ARGS__); \ fprintf(stdout, "[INFO]: " _fmt "\n", ##__VA_ARGS__); \
} else { \ } else { \
srsran_phy_log_print(LOG_LEVEL_INFO_S, _fmt, ##__VA_ARGS__); \ srsran_phy_log_print(LOG_LEVEL_INFO_S, _fmt, ##__VA_ARGS__); \
@ -67,7 +73,7 @@ SRSRAN_API extern int handler_registered;
/* In debug mode, it prints out the */ /* In debug mode, it prints out the */
#define ERROR(_fmt, ...) \ #define ERROR(_fmt, ...) \
do { \ do { \
if (!handler_registered) { \ if (!is_handler_registered()) { \
fprintf(stderr, "\e[31m%s:%d: " _fmt "\e[0m\n", __FILE__, __LINE__, ##__VA_ARGS__); \ fprintf(stderr, "\e[31m%s:%d: " _fmt "\e[0m\n", __FILE__, __LINE__, ##__VA_ARGS__); \
} else { \ } else { \
srsran_phy_log_print(LOG_LEVEL_ERROR_S, _fmt, ##__VA_ARGS__); \ srsran_phy_log_print(LOG_LEVEL_ERROR_S, _fmt, ##__VA_ARGS__); \
@ -75,11 +81,15 @@ SRSRAN_API extern int handler_registered;
} while (0) } while (0)
#else #else
#define ERROR(_fmt, ...) \ #define ERROR(_fmt, ...) \
if (!handler_registered) { \ if (!is_handler_registered()) { \
fprintf(stderr, "[ERROR in %s]:" _fmt "\n", __FUNCTION__, ##__VA_ARGS__); \ fprintf(stderr, "[ERROR in %s]:" _fmt "\n", __FUNCTION__, ##__VA_ARGS__); \
} else { \ } else { \
srsran_phy_log_print(LOG_LEVEL_ERROR, _fmt, ##__VA_ARGS__); \ srsran_phy_log_print(LOG_LEVEL_ERROR, _fmt, ##__VA_ARGS__); \
} // } //
#endif /* CMAKE_BUILD_TYPE==Debug */ #endif /* CMAKE_BUILD_TYPE==Debug */
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // SRSRAN_DEBUG_H #endif // SRSRAN_DEBUG_H

@ -440,7 +440,7 @@ int srsran_dmrs_pdcch_get_measure(const srsran_dmrs_pdcch_estimator_t* q,
nof_pilots += NOF_PILOTS_X_RB; nof_pilots += NOF_PILOTS_X_RB;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DMRS_PDCCH_DEBUG_RX("Measuring PDCCH l=%d; lse=", l); DMRS_PDCCH_DEBUG_RX("Measuring PDCCH l=%d; lse=", l);
srsran_vec_fprint_c(stdout, tmp, nof_pilots); srsran_vec_fprint_c(stdout, tmp, nof_pilots);
} }

@ -87,7 +87,7 @@ int main(int argc, char** argv)
data[i] = rand() % 2; data[i] = rand() % 2;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
INFO("data="); INFO("data=");
srsran_vec_fprint_b(stdout, data, num_bits); srsran_vec_fprint_b(stdout, data, num_bits);
} }

@ -222,7 +222,7 @@ pbch_nr_pbch_msg_pack(const srsran_pbch_nr_cfg_t* cfg, const srsran_pbch_msg_nr_
a[G[13]] = 0; // Reserved a[G[13]] = 0; // Reserved
} }
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_TX("Packed PBCH bits: "); PBCH_NR_DEBUG_TX("Packed PBCH bits: ");
srsran_vec_fprint_byte(stdout, a, PBCH_NR_A); srsran_vec_fprint_byte(stdout, a, PBCH_NR_A);
} }
@ -230,7 +230,7 @@ pbch_nr_pbch_msg_pack(const srsran_pbch_nr_cfg_t* cfg, const srsran_pbch_msg_nr_
static void static void
pbch_nr_pbch_msg_unpack(const srsran_pbch_nr_cfg_t* cfg, const uint8_t a[PBCH_NR_A], srsran_pbch_msg_nr_t* msg) pbch_nr_pbch_msg_unpack(const srsran_pbch_nr_cfg_t* cfg, const uint8_t a[PBCH_NR_A], srsran_pbch_msg_nr_t* msg)
{ {
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_RX("Packed PBCH bits: "); PBCH_NR_DEBUG_RX("Packed PBCH bits: ");
srsran_vec_fprint_byte(stdout, a, PBCH_NR_A); srsran_vec_fprint_byte(stdout, a, PBCH_NR_A);
} }
@ -330,7 +330,7 @@ static int pbch_nr_polar_encode(srsran_pbch_nr_t* q, const uint8_t c[PBCH_NR_K],
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_TX("Allocated: "); PBCH_NR_DEBUG_TX("Allocated: ");
srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N); srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N);
} }
@ -347,7 +347,7 @@ static int pbch_nr_polar_decode(srsran_pbch_nr_t* q, const int8_t d[PBCH_NR_N],
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_RX("Allocated: "); PBCH_NR_DEBUG_RX("Allocated: ");
srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N); srsran_vec_fprint_byte(stdout, allocated, PBCH_NR_N);
} }
@ -369,7 +369,7 @@ static int pbch_nr_polar_rm_tx(srsran_pbch_nr_t* q, const uint8_t d[PBCH_NR_N],
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_TX("d: "); PBCH_NR_DEBUG_TX("d: ");
srsran_vec_fprint_byte(stdout, d, PBCH_NR_N); srsran_vec_fprint_byte(stdout, d, PBCH_NR_N);
} }
@ -389,7 +389,7 @@ static int pbch_nr_polar_rm_rx(srsran_pbch_nr_t* q, const int8_t llr[PBCH_NR_E],
d[i] *= -1; d[i] *= -1;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PBCH_NR_DEBUG_RX("d: "); PBCH_NR_DEBUG_RX("d: ");
srsran_vec_fprint_bs(stdout, d, PBCH_NR_N); srsran_vec_fprint_bs(stdout, d, PBCH_NR_N);
} }
@ -497,7 +497,7 @@ pbch_nr_mapping(const srsran_pbch_nr_cfg_t* cfg, const cf_t symbols[PBCH_NR_M],
ssb_grid[3 * SRSRAN_SSB_BW_SUBC + k] = symbols[count++]; ssb_grid[3 * SRSRAN_SSB_BW_SUBC + k] = symbols[count++];
} }
// if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { // if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
// PBCH_NR_DEBUG_TX("Symbols: "); // PBCH_NR_DEBUG_TX("Symbols: ");
// srsran_vec_fprint_c(stdout, symbols, PBCH_NR_M); // srsran_vec_fprint_c(stdout, symbols, PBCH_NR_M);
// } // }
@ -549,7 +549,7 @@ pbch_nr_demapping(const srsran_pbch_nr_cfg_t* cfg, const cf_t ssb_grid[SRSRAN_SS
symbols[count++] = ssb_grid[3 * SRSRAN_SSB_BW_SUBC + k]; symbols[count++] = ssb_grid[3 * SRSRAN_SSB_BW_SUBC + k];
} }
// if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { // if (srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
// PBCH_NR_DEBUG_RX("Symbols: "); // PBCH_NR_DEBUG_RX("Symbols: ");
// srsran_vec_fprint_c(stdout, symbols, PBCH_NR_M); // srsran_vec_fprint_c(stdout, symbols, PBCH_NR_M);
// } // }

@ -521,7 +521,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_
srsran_polar_interleaver_run_u8(c, c_prime, q->K, true); srsran_polar_interleaver_run_u8(c, c_prime, q->K, true);
// Print c and c_prime (after interleaving) // Print c and c_prime (after interleaving)
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
PDCCH_INFO_TX("c="); PDCCH_INFO_TX("c=");
srsran_vec_fprint_hex(stdout, c, q->K); srsran_vec_fprint_hex(stdout, c, q->K);
PDCCH_INFO_TX("c_prime="); PDCCH_INFO_TX("c_prime=");
@ -537,7 +537,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_
} }
// Print d // Print d
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
PDCCH_INFO_TX("d="); PDCCH_INFO_TX("d=");
srsran_vec_fprint_byte(stdout, q->d, q->code.N); srsran_vec_fprint_byte(stdout, q->d, q->code.N);
} }
@ -564,7 +564,7 @@ int srsran_pdcch_nr_encode(srsran_pdcch_nr_t* q, const srsran_dci_msg_nr_t* dci_
q->meas_time_us = (uint32_t)t[0].tv_usec; q->meas_time_us = (uint32_t)t[0].tv_usec;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
char str[128] = {}; char str[128] = {};
srsran_pdcch_nr_info(q, NULL, str, sizeof(str)); srsran_pdcch_nr_info(q, NULL, str, sizeof(str));
PDCCH_INFO_TX("%s", str); PDCCH_INFO_TX("%s", str);
@ -613,7 +613,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
} }
// Print channel estimates if enabled // Print channel estimates if enabled
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PDCCH_DEBUG_RX("ce="); PDCCH_DEBUG_RX("ce=");
srsran_vec_fprint_c(stdout, ce->ce, q->M); srsran_vec_fprint_c(stdout, ce->ce, q->M);
} }
@ -622,7 +622,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
srsran_predecoding_single(q->symbols, ce->ce, q->symbols, NULL, q->M, 1.0f, ce->noise_var); srsran_predecoding_single(q->symbols, ce->ce, q->symbols, NULL, q->M, 1.0f, ce->noise_var);
// Print symbols if enabled // Print symbols if enabled
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PDCCH_DEBUG_RX("symbols="); PDCCH_DEBUG_RX("symbols=");
srsran_vec_fprint_c(stdout, q->symbols, q->M); srsran_vec_fprint_c(stdout, q->symbols, q->M);
} }
@ -653,7 +653,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
} }
// Print d // Print d
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
PDCCH_DEBUG_RX("d="); PDCCH_DEBUG_RX("d=");
srsran_vec_fprint_bs(stdout, d, q->K); srsran_vec_fprint_bs(stdout, d, q->K);
} }
@ -676,7 +676,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
srsran_polar_interleaver_run_u8(c_prime, c, q->K, false); srsran_polar_interleaver_run_u8(c_prime, c, q->K, false);
// Print c // Print c
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
PDCCH_INFO_RX("c_prime="); PDCCH_INFO_RX("c_prime=");
srsran_vec_fprint_hex(stdout, c_prime, q->K); srsran_vec_fprint_hex(stdout, c_prime, q->K);
PDCCH_INFO_RX("c="); PDCCH_INFO_RX("c=");
@ -697,7 +697,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
uint32_t checksum2 = srsran_bit_pack(&ptr, 24); uint32_t checksum2 = srsran_bit_pack(&ptr, 24);
res->crc = checksum1 == checksum2; res->crc = checksum1 == checksum2;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
PDCCH_INFO_RX("CRC={%06x, %06x}; msg=", checksum1, checksum2); PDCCH_INFO_RX("CRC={%06x, %06x}; msg=", checksum1, checksum2);
srsran_vec_fprint_hex(stdout, c, dci_msg->nof_bits); srsran_vec_fprint_hex(stdout, c, dci_msg->nof_bits);
} }
@ -711,7 +711,7 @@ int srsran_pdcch_nr_decode(srsran_pdcch_nr_t* q,
q->meas_time_us = (uint32_t)t[0].tv_usec; q->meas_time_us = (uint32_t)t[0].tv_usec;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
char str[128] = {}; char str[128] = {};
srsran_pdcch_nr_info(q, res, str, sizeof(str)); srsran_pdcch_nr_info(q, res, str, sizeof(str));
PDCCH_INFO_RX("%s", str); PDCCH_INFO_RX("%s", str);

@ -321,7 +321,7 @@ static inline int pdsch_nr_encode_codeword(srsran_pdsch_nr_t* q,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("b="); DEBUG("b=");
srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits); srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits);
} }
@ -333,7 +333,7 @@ static inline int pdsch_nr_encode_codeword(srsran_pdsch_nr_t* q,
// 7.3.1.2 Modulation // 7.3.1.2 Modulation
srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], tb->nof_bits); srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], tb->nof_bits);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("d="); DEBUG("d=");
srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re);
} }
@ -437,7 +437,7 @@ static inline int pdsch_nr_decode_codeword(srsran_pdsch_nr_t* q,
return SRSRAN_ERROR_OUT_OF_BOUNDS; return SRSRAN_ERROR_OUT_OF_BOUNDS;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("d="); DEBUG("d=");
srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re);
} }
@ -460,7 +460,7 @@ static inline int pdsch_nr_decode_codeword(srsran_pdsch_nr_t* q,
// Descrambling // Descrambling
srsran_sequence_apply_c(llr, llr, tb->nof_bits, pdsch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx)); srsran_sequence_apply_c(llr, llr, tb->nof_bits, pdsch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx));
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("b="); DEBUG("b=");
srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits); srsran_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits);
} }
@ -516,7 +516,7 @@ int srsran_pdsch_nr_decode(srsran_pdsch_nr_t* q,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("ce="); DEBUG("ce=");
srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re); srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re);
DEBUG("x="); DEBUG("x=");

@ -643,7 +643,7 @@ static int pucch_nr_format2_decode(srsran_pucch_nr_t* q,
} }
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
INFO("d="); INFO("d=");
srsran_vec_fprint_c(stdout, q->d, resource->nof_symbols * resource->nof_prb * (SRSRAN_NRE - 4)); srsran_vec_fprint_c(stdout, q->d, resource->nof_symbols * resource->nof_prb * (SRSRAN_NRE - 4));
INFO("ce="); INFO("ce=");

@ -556,7 +556,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
} }
// Print debug information if configured for ity // Print debug information if configured for ity
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
if (m_ulsch_count != 0) { if (m_ulsch_count != 0) {
DEBUG("UL-SCH bit positions:"); DEBUG("UL-SCH bit positions:");
srsran_vec_fprint_i(stdout, (int*)pos_ulsch, m_ulsch_count); srsran_vec_fprint_i(stdout, (int*)pos_ulsch, m_ulsch_count);
@ -662,7 +662,7 @@ static inline int pusch_nr_encode_codeword(srsran_pusch_nr_t* q,
} }
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("b="); DEBUG("b=");
srsran_vec_fprint_b(stdout, b, nof_bits); srsran_vec_fprint_b(stdout, b, nof_bits);
} }
@ -688,7 +688,7 @@ static inline int pusch_nr_encode_codeword(srsran_pusch_nr_t* q,
// 7.3.1.2 Modulation // 7.3.1.2 Modulation
srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], nof_bits); srsran_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], nof_bits);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("d="); DEBUG("d=");
srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re);
} }
@ -794,7 +794,7 @@ static inline int pusch_nr_decode_codeword(srsran_pusch_nr_t* q,
return SRSRAN_ERROR_OUT_OF_BOUNDS; return SRSRAN_ERROR_OUT_OF_BOUNDS;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("d="); DEBUG("d=");
srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re); srsran_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re);
} }
@ -842,7 +842,7 @@ static inline int pusch_nr_decode_codeword(srsran_pusch_nr_t* q,
// Descrambling // Descrambling
srsran_sequence_apply_c(llr, llr, nof_bits, pusch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx)); srsran_sequence_apply_c(llr, llr, nof_bits, pusch_nr_cinit(&q->carrier, cfg, rnti, tb->cw_idx));
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("b="); DEBUG("b=");
srsran_vec_fprint_bs(stdout, llr, nof_bits); srsran_vec_fprint_bs(stdout, llr, nof_bits);
} }
@ -968,7 +968,7 @@ int srsran_pusch_nr_decode(srsran_pusch_nr_t* q,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("ce="); DEBUG("ce=");
srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re); srsran_vec_fprint_c(stdout, channel->ce[0][0], nof_re);
DEBUG("x="); DEBUG("x=");

@ -454,7 +454,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q,
// Calculate TB CRC // Calculate TB CRC
uint32_t checksum_tb = srsran_crc_checksum_byte(crc_tb, data, tb->tbs); uint32_t checksum_tb = srsran_crc_checksum_byte(crc_tb, data, tb->tbs);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("tb="); DEBUG("tb=");
srsran_vec_fprint_byte(stdout, data, tb->tbs / 8); srsran_vec_fprint_byte(stdout, data, tb->tbs / 8);
} }
@ -489,7 +489,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q,
srsran_bit_unpack_vector(input_ptr, q->temp_cb, (int)cb_len); srsran_bit_unpack_vector(input_ptr, q->temp_cb, (int)cb_len);
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("cb%d=", r); DEBUG("cb%d=", r);
srsran_vec_fprint_byte(stdout, input_ptr, cb_len / 8); srsran_vec_fprint_byte(stdout, input_ptr, cb_len / 8);
} }
@ -510,7 +510,7 @@ static inline int sch_nr_encode(srsran_sch_nr_t* q,
// Encode code block // Encode code block
srsran_ldpc_encoder_encode(encoder, q->temp_cb, rm_buffer, cfg.Kr); srsran_ldpc_encoder_encode(encoder, q->temp_cb, rm_buffer, cfg.Kr);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("encoded="); DEBUG("encoded=");
srsran_vec_fprint_b(stdout, rm_buffer, encoder->liftN - 2 * encoder->ls); srsran_vec_fprint_b(stdout, rm_buffer, encoder->liftN - 2 * encoder->ls);
} }
@ -668,7 +668,7 @@ static int sch_nr_decode(srsran_sch_nr_t* q,
SCH_INFO_RX("CB %d/%d iter=%d CRC=%s", r, cfg.C, n_iter_cb, tb->softbuffer.rx->cb_crc[r] ? "OK" : "KO"); SCH_INFO_RX("CB %d/%d iter=%d CRC=%s", r, cfg.C, n_iter_cb, tb->softbuffer.rx->cb_crc[r] ? "OK" : "KO");
// CB Debug trace // CB Debug trace
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("CB %d/%d:", r, cfg.C); DEBUG("CB %d/%d:", r, cfg.C);
srsran_vec_fprint_hex(stdout, q->temp_cb, cb_len); srsran_vec_fprint_hex(stdout, q->temp_cb, cb_len);
} }
@ -731,7 +731,7 @@ static int sch_nr_decode(srsran_sch_nr_t* q,
SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}", tb->tbs, checksum1, checksum2); SCH_INFO_RX("TB: TBS=%d; CRC={%06x, %06x}", tb->tbs, checksum1, checksum2);
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_DEBUG && !is_handler_registered()) {
DEBUG("Decode: "); DEBUG("Decode: ");
srsran_vec_fprint_byte(stdout, res->payload, tb->tbs / 8); srsran_vec_fprint_byte(stdout, res->payload, tb->tbs / 8);
} }

@ -198,7 +198,7 @@ static int uci_nr_pack_ack_sr(const srsran_uci_cfg_nr_t* cfg, const srsran_uci_v
srsran_bit_unpack(value->sr, &bits, cfg->o_sr); srsran_bit_unpack(value->sr, &bits, cfg->o_sr);
A += cfg->o_sr; A += cfg->o_sr;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Packed UCI bits: "); UCI_NR_INFO_TX("Packed UCI bits: ");
srsran_vec_fprint_byte(stdout, sequence, A); srsran_vec_fprint_byte(stdout, sequence, A);
} }
@ -219,7 +219,7 @@ static int uci_nr_unpack_ack_sr(const srsran_uci_cfg_nr_t* cfg, uint8_t* sequenc
value->sr = srsran_bit_pack(&bits, cfg->o_sr); value->sr = srsran_bit_pack(&bits, cfg->o_sr);
A += cfg->o_sr; A += cfg->o_sr;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Unpacked UCI bits: "); UCI_NR_INFO_RX("Unpacked UCI bits: ");
srsran_vec_fprint_byte(stdout, sequence, A); srsran_vec_fprint_byte(stdout, sequence, A);
} }
@ -248,7 +248,7 @@ static int uci_nr_pack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, const srsran_u
} }
A += n; A += n;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Packed UCI bits: "); UCI_NR_INFO_TX("Packed UCI bits: ");
srsran_vec_fprint_byte(stdout, sequence, A); srsran_vec_fprint_byte(stdout, sequence, A);
} }
@ -269,7 +269,7 @@ static int uci_nr_unpack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, uint8_t* seq
value->sr = srsran_bit_pack(&bits, cfg->o_sr); value->sr = srsran_bit_pack(&bits, cfg->o_sr);
A += cfg->o_sr; A += cfg->o_sr;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Unpacked UCI bits: "); UCI_NR_INFO_RX("Unpacked UCI bits: ");
srsran_vec_fprint_byte(stdout, sequence, A); srsran_vec_fprint_byte(stdout, sequence, A);
} }
@ -393,7 +393,7 @@ static int uci_nr_encode_1bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("One bit encoded NR-UCI; o="); UCI_NR_INFO_TX("One bit encoded NR-UCI; o=");
srsran_vec_fprint_b(stdout, o, E); srsran_vec_fprint_b(stdout, o, E);
} }
@ -434,7 +434,7 @@ static int uci_nr_decode_1_bit(srsran_uci_nr_t* q,
// Save decoded bit // Save decoded bit
q->bit_sequence[0] = (corr < 0) ? 0 : 1; q->bit_sequence[0] = (corr < 0) ? 0 : 1;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("One bit decoding NR-UCI llr="); UCI_NR_INFO_RX("One bit decoding NR-UCI llr=");
srsran_vec_fprint_bs(stdout, llr, E); srsran_vec_fprint_bs(stdout, llr, E);
UCI_NR_INFO_RX("One bit decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s", UCI_NR_INFO_RX("One bit decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s",
@ -539,7 +539,7 @@ static int uci_nr_encode_2bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Two bit encoded NR-UCI; E=%d; o=", E); UCI_NR_INFO_TX("Two bit encoded NR-UCI; E=%d; o=", E);
srsran_vec_fprint_b(stdout, o, E); srsran_vec_fprint_b(stdout, o, E);
} }
@ -585,7 +585,7 @@ static int uci_nr_decode_2_bit(srsran_uci_nr_t* q,
q->bit_sequence[0] = c0 ? 1 : 0; q->bit_sequence[0] = c0 ? 1 : 0;
q->bit_sequence[1] = c1 ? 1 : 0; q->bit_sequence[1] = c1 ? 1 : 0;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Two bit decoding NR-UCI llr="); UCI_NR_INFO_RX("Two bit decoding NR-UCI llr=");
srsran_vec_fprint_bs(stdout, llr, E); srsran_vec_fprint_bs(stdout, llr, E);
UCI_NR_INFO_RX("Two bit decoding NR-UCI A=%d; E=%d; Qm=%d; c0=%d; c1=%d; c2=%d %s", UCI_NR_INFO_RX("Two bit decoding NR-UCI A=%d; E=%d; Qm=%d; c0=%d; c1=%d; c2=%d %s",
@ -606,7 +606,7 @@ uci_nr_encode_3_11_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, uint3
{ {
srsran_block_encode(q->bit_sequence, A, o, E); srsran_block_encode(q->bit_sequence, A, o, E);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Block encoded UCI bits; o="); UCI_NR_INFO_TX("Block encoded UCI bits; o=");
srsran_vec_fprint_b(stdout, o, E); srsran_vec_fprint_b(stdout, o, E);
} }
@ -649,7 +649,7 @@ static int uci_nr_decode_3_11_bit(srsran_uci_nr_t* q,
// Take decoded decision with threshold // Take decoded decision with threshold
*decoded_ok = (corr > q->block_code_threshold); *decoded_ok = (corr > q->block_code_threshold);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Block decoding NR-UCI llr="); UCI_NR_INFO_RX("Block decoding NR-UCI llr=");
srsran_vec_fprint_bs(stdout, llr, E); srsran_vec_fprint_bs(stdout, llr, E);
UCI_NR_INFO_RX("Block decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s", UCI_NR_INFO_RX("Block decoding NR-UCI A=%d; E=%d; pwr=%f; corr=%f; norm=%f; thr=%f; %s",
@ -713,7 +713,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui
srsran_crc_attach(crc, q->c, A_prime / C); srsran_crc_attach(crc, q->c, A_prime / C);
UCI_NR_INFO_TX("Attaching %d/%d CRC%d=%" PRIx64, r, C, L, srsran_crc_checksum_get(crc)); UCI_NR_INFO_TX("Attaching %d/%d CRC%d=%" PRIx64, r, C, L, srsran_crc_checksum_get(crc));
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Polar cb %d/%d c=", r, C); UCI_NR_INFO_TX("Polar cb %d/%d c=", r, C);
srsran_vec_fprint_byte(stdout, q->c, K_r); srsran_vec_fprint_byte(stdout, q->c, K_r);
} }
@ -721,7 +721,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui
// Allocate channel // Allocate channel
srsran_polar_chanalloc_tx(q->c, q->allocated, q->code.N, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set); srsran_polar_chanalloc_tx(q->c, q->allocated, q->code.N, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Polar alloc %d/%d ", r, C); UCI_NR_INFO_TX("Polar alloc %d/%d ", r, C);
srsran_vec_fprint_byte(stdout, q->allocated, q->code.N); srsran_vec_fprint_byte(stdout, q->allocated, q->code.N);
} }
@ -731,7 +731,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Polar encoded %d/%d ", r, C); UCI_NR_INFO_TX("Polar encoded %d/%d ", r, C);
srsran_vec_fprint_byte(stdout, q->d, q->code.N); srsran_vec_fprint_byte(stdout, q->d, q->code.N);
} }
@ -739,7 +739,7 @@ uci_nr_encode_11_1706_bit(srsran_uci_nr_t* q, const srsran_uci_cfg_nr_t* cfg, ui
// Rate matching // Rate matching
srsran_polar_rm_tx(&q->rm_tx, q->d, &o[E_r * r], q->code.n, E_r, K_r, UCI_NR_POLAR_RM_IBIL); srsran_polar_rm_tx(&q->rm_tx, q->d, &o[E_r * r], q->code.n, E_r, K_r, UCI_NR_POLAR_RM_IBIL);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_TX("Polar RM cw %d/%d ", r, C); UCI_NR_INFO_TX("Polar RM cw %d/%d ", r, C);
srsran_vec_fprint_byte(stdout, &o[E_r * r], E_r); srsran_vec_fprint_byte(stdout, &o[E_r * r], E_r);
} }
@ -790,7 +790,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q,
for (uint32_t r = 0, s = 0; r < C; r++) { for (uint32_t r = 0, s = 0; r < C; r++) {
uint32_t k = 0; uint32_t k = 0;
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Polar LLR %d/%d ", r, C); UCI_NR_INFO_RX("Polar LLR %d/%d ", r, C);
srsran_vec_fprint_bs(stdout, &llr[E_r * r], q->code.N); srsran_vec_fprint_bs(stdout, &llr[E_r * r], q->code.N);
} }
@ -805,7 +805,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Polar alloc %d/%d ", r, C); UCI_NR_INFO_RX("Polar alloc %d/%d ", r, C);
srsran_vec_fprint_byte(stdout, q->allocated, q->code.N); srsran_vec_fprint_byte(stdout, q->allocated, q->code.N);
} }
@ -813,7 +813,7 @@ static int uci_nr_decode_11_1706_bit(srsran_uci_nr_t* q,
// Undo channel allocation // Undo channel allocation
srsran_polar_chanalloc_rx(q->allocated, q->c, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set); srsran_polar_chanalloc_rx(q->allocated, q->c, q->code.K, q->code.nPC, q->code.K_set, q->code.PC_set);
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
UCI_NR_INFO_RX("Polar cb %d/%d c=", r, C); UCI_NR_INFO_RX("Polar cb %d/%d c=", r, C);
srsran_vec_fprint_byte(stdout, q->c, K_r); srsran_vec_fprint_byte(stdout, q->c, K_r);
} }

@ -145,7 +145,7 @@ int srsran_resampler_fft_init(srsran_resampler_fft_t* q, srsran_resampler_mode_t
q->in_buffer[i] = (float)h; q->in_buffer[i] = (float)h;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
printf("h_%s=", q->mode == SRSRAN_RESAMPLER_MODE_INTERPOLATE ? "interp" : "decimate"); printf("h_%s=", q->mode == SRSRAN_RESAMPLER_MODE_INTERPOLATE ? "interp" : "decimate");
srsran_vec_fprint_c(stdout, q->in_buffer, high_size); srsran_vec_fprint_c(stdout, q->in_buffer, high_size);
} }

@ -129,7 +129,7 @@ int main(int argc, char** argv)
break; break;
} }
if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
printf("signal="); printf("signal=");
srsran_vec_fprint_c(stdout, src, buffer_size); srsran_vec_fprint_c(stdout, src, buffer_size);
} }
@ -143,7 +143,7 @@ int main(int argc, char** argv)
get_time_interval(t); get_time_interval(t);
uint64_t duration_us = (uint64_t)(t[0].tv_sec * 1000000UL + t[0].tv_usec); uint64_t duration_us = (uint64_t)(t[0].tv_sec * 1000000UL + t[0].tv_usec);
if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
printf("interp="); printf("interp=");
srsran_vec_fprint_c(stdout, interpolated, buffer_size * factor); srsran_vec_fprint_c(stdout, interpolated, buffer_size * factor);
printf("decim="); printf("decim=");
@ -156,7 +156,7 @@ int main(int argc, char** argv)
srsran_vec_sub_ccc(src, &decimated[delay], interpolated, nsamples); srsran_vec_sub_ccc(src, &decimated[delay], interpolated, nsamples);
float mse = sqrtf(srsran_vec_avg_power_cf(interpolated, nsamples)); float mse = sqrtf(srsran_vec_avg_power_cf(interpolated, nsamples));
if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
printf("recovered="); printf("recovered=");
srsran_vec_fprint_c(stdout, &decimated[delay], nsamples); srsran_vec_fprint_c(stdout, &decimated[delay], nsamples);
} }

@ -567,7 +567,7 @@ int srsran_ue_dl_nr_decode_pdsch(srsran_ue_dl_nr_t* q,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !handler_registered) { if (SRSRAN_DEBUG_ENABLED && srsran_verbose >= SRSRAN_VERBOSE_INFO && !is_handler_registered()) {
char str[512]; char str[512];
srsran_ue_dl_nr_pdsch_info(q, cfg, res, str, sizeof(str)); srsran_ue_dl_nr_pdsch_info(q, cfg, res, str, sizeof(str));
INFO("PDSCH: %s", str); INFO("PDSCH: %s", str);

@ -14,7 +14,17 @@
#include <stdlib.h> #include <stdlib.h>
int srsran_verbose = 0; int srsran_verbose = 0;
int handler_registered = 0; static bool handler_registered = false;
bool is_handler_registered(void)
{
return handler_registered;
}
void set_handler_enabled(bool enable)
{
handler_registered = enable;
}
void get_time_interval(struct timeval* tdata) void get_time_interval(struct timeval* tdata)
{ {

@ -29,7 +29,7 @@ void srsran_phy_log_register_handler(void* ctx, phy_log_handler_t handler)
{ {
phy_log_handler = handler; phy_log_handler = handler;
callback_ctx = ctx; callback_ctx = ctx;
handler_registered++; set_handler_enabled(true);
} }
void srsran_phy_log_print(phy_logger_level_t log_level, const char* format, ...) void srsran_phy_log_print(phy_logger_level_t log_level, const char* format, ...)

@ -111,7 +111,7 @@ public:
} }
// Make sure PHY log is not set by UE or gNb PHY // Make sure PHY log is not set by UE or gNb PHY
handler_registered = 0; set_handler_enabled(false);
if (args.phy_lib_log_level == "info") { if (args.phy_lib_log_level == "info") {
srsran_verbose = SRSRAN_VERBOSE_INFO; srsran_verbose = SRSRAN_VERBOSE_INFO;
} else if (args.phy_lib_log_level == "debug") { } else if (args.phy_lib_log_level == "debug") {

Loading…
Cancel
Save