diff --git a/lib/examples/cell_measurement.c b/lib/examples/cell_measurement.c index 71c0864c8..3185b74f1 100644 --- a/lib/examples/cell_measurement.c +++ b/lib/examples/cell_measurement.c @@ -239,7 +239,7 @@ int main(int argc, char **argv) { exit(-1); } - INFO("Stopping RF and flushing buffer...\n",0); + INFO("Stopping RF and flushing buffer...\n"); srslte_rf_stop_rx_stream(&rf); srslte_rf_flush_buffer(&rf); diff --git a/lib/examples/cell_search.c b/lib/examples/cell_search.c index 17e75369f..4ea89a0ca 100644 --- a/lib/examples/cell_search.c +++ b/lib/examples/cell_search.c @@ -220,7 +220,7 @@ int main(int argc, char **argv) { INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000); srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ); - INFO("Starting receiver...\n", 0); + INFO("Starting receiver...\n"); srslte_rf_start_rx_stream(&rf, false); n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL); diff --git a/lib/examples/pdsch_enodeb.c b/lib/examples/pdsch_enodeb.c index 2f0f4836f..c95fd50a9 100644 --- a/lib/examples/pdsch_enodeb.c +++ b/lib/examples/pdsch_enodeb.c @@ -858,7 +858,7 @@ int main(int argc, char **argv) { if (net_port > 0) { send_data = net_packet_ready; if (net_packet_ready) { - INFO("Transmitting packet\n",0); + INFO("Transmitting packet\n"); } } else { INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs[0].tbs + pdsch_cfg.grant.mcs[1].tbs); diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 2ad33ea02..8ef620b56 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -473,7 +473,7 @@ int main(int argc, char **argv) { exit(-1); } - INFO("Stopping RF and flushing buffer...\r",0); + INFO("Stopping RF and flushing buffer...\r"); } #endif @@ -606,7 +606,7 @@ int main(int argc, char **argv) { srslte_pbch_decode_reset(&ue_mib.pbch); - INFO("\nEntering main loop...\n\n", 0); + INFO("\nEntering main loop...\n\n"); /* Main loop */ while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) { bool acks [SRSLTE_MAX_CODEWORDS] = {false}; diff --git a/lib/src/phy/io/filesource.c b/lib/src/phy/io/filesource.c index 048ecb584..1324bf2b0 100644 --- a/lib/src/phy/io/filesource.c +++ b/lib/src/phy/io/filesource.c @@ -50,7 +50,9 @@ void srslte_filesource_free(srslte_filesource_t *q) { } void srslte_filesource_seek(srslte_filesource_t *q, int pos) { - fseek(q->f, pos, SEEK_SET); + if (!fseek(q->f, pos, SEEK_SET)){ + perror("srslte_filesource_seek"); + } } int read_complex_f(FILE *f, _Complex float *y) { diff --git a/lib/src/phy/mimo/precoding.c b/lib/src/phy/mimo/precoding.c index a78c13056..6d50e3ed2 100644 --- a/lib/src/phy/mimo/precoding.c +++ b/lib/src/phy/mimo/precoding.c @@ -2205,7 +2205,9 @@ int srslte_precoding_pmi_select_2l_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT } /* Divide average by noise */ - sinr_list[i] /= count; + if (count) { + sinr_list[i] /= count; + } if (sinr_list[i] > max_sinr) { max_sinr = sinr_list[i]; @@ -2326,7 +2328,9 @@ int srslte_precoding_pmi_select_2l_sse(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT } /* Divide average by noise */ - sinr_list[i] /= count; + if (count) { + sinr_list[i] /= count; + } if (sinr_list[i] > max_sinr) { max_sinr = sinr_list[i]; @@ -2473,7 +2477,9 @@ int srslte_precoding_pmi_select_2l_avx(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT } /* Divide average by noise */ - sinr_list[i] /= count; + if (count) { + sinr_list[i] /= count; + } if (sinr_list[i] > max_sinr) { max_sinr = sinr_list[i]; @@ -2545,7 +2551,11 @@ float srslte_precoding_2x2_cn_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], u count++; } - return cn_avg/count; + if (count) { + cn_avg /= count; + } + + return cn_avg; } /* Computes the condition number for a given number of antennas, diff --git a/lib/src/phy/mimo/test/pmi_select_test.c b/lib/src/phy/mimo/test/pmi_select_test.c index c7e5b5c8e..a40723d34 100644 --- a/lib/src/phy/mimo/test/pmi_select_test.c +++ b/lib/src/phy/mimo/test/pmi_select_test.c @@ -124,7 +124,7 @@ int main(int argc, char **argv) { /* Condition number */ if (srslte_precoding_cn(h, 2, 2, nof_symbols, &cn)) { - ERROR("Test case %d condition number returned error\n"); + ERROR("Test case %d condition number returned error\n", c + 1); goto clean; } diff --git a/lib/src/phy/mimo/test/precoder_test.c b/lib/src/phy/mimo/test/precoder_test.c index ec022319f..1054545c3 100644 --- a/lib/src/phy/mimo/test/precoder_test.c +++ b/lib/src/phy/mimo/test/precoder_test.c @@ -42,7 +42,7 @@ int nof_symbols = 1000; uint32_t codebook_idx = 0; int nof_layers = 1, nof_tx_ports = 1, nof_rx_ports = 1, nof_re = 1; char *mimo_type_name = NULL; -char decoder_type_name [16] = "zf"; +char decoder_type_name [17] = "zf"; float snr_db = 100.0f; float scaling = 0.1f; @@ -56,7 +56,7 @@ void usage(char *prog) { printf("\t-g Scaling [Default %.1f]*\n", scaling); printf("\t-d decoder type [zf|mmse] [Default %s]\n", decoder_type_name); printf("\n"); - printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n", decoder_type_name); + printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n"); } void parse_args(int argc, char **argv) { diff --git a/lib/src/phy/phch/cqi.c b/lib/src/phy/phch/cqi.c index 3d8c3e27d..522cdf10b 100644 --- a/lib/src/phy/phch/cqi.c +++ b/lib/src/phy/phch/cqi.c @@ -383,7 +383,7 @@ bool srslte_ri_send(uint32_t I_cqi_pmi, uint32_t I_ri, uint32_t tti) { return false; } - if (M_ri) { + if (M_ri && N_p) { if ((tti - N_offset_p + N_offset_ri) % (N_p * M_ri) == 0) { return true; } diff --git a/lib/src/phy/phch/dci.c b/lib/src/phy/phch/dci.c index e4d6dd159..6766ca5f0 100644 --- a/lib/src/phy/phch/dci.c +++ b/lib/src/phy/phch/dci.c @@ -577,7 +577,7 @@ int dci_format0_unpack(srslte_dci_msg_t *msg, srslte_ra_ul_dci_t *data, uint32_t return SRSLTE_ERROR; } if (*y++ != 0) { - INFO("DCI message is Format1A\n", 0); + INFO("DCI message is Format1A\n"); return SRSLTE_ERROR; } if (*y++ == 0) { @@ -836,7 +836,7 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32 } if (*y++ != 1) { - INFO("DCI message is Format0\n", 0); + INFO("DCI message is Format0\n"); return SRSLTE_ERROR; } diff --git a/lib/src/phy/phch/pdcch.c b/lib/src/phy/phch/pdcch.c index ca8480bc6..969b53cf7 100644 --- a/lib/src/phy/phch/pdcch.c +++ b/lib/src/phy/phch/pdcch.c @@ -557,7 +557,7 @@ int srslte_pdcch_dci_encode(srslte_pdcch_t *q, uint8_t *data, uint8_t *e, uint32 srslte_pdcch_dci_encode_conv(q, data, nof_bits, tmp, rnti); - DEBUG("CConv output: ", 0); + DEBUG("CConv output: "); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_b(stdout, tmp, 3 * (nof_bits + 16)); } @@ -617,7 +617,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc srslte_scrambling_b_offset(&q->seq[nsubframe], q->e, 72 * location.ncce, e_bits); - DEBUG("Scrambling output: ", 0); + DEBUG("Scrambling output: "); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_b(stdout, q->e, e_bits); } diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index fbf0860be..1cf4af4e2 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "prb_dl.h" #include "srslte/phy/phch/pdsch.h" @@ -656,8 +658,8 @@ int srslte_pdsch_decode(srslte_pdsch_t *q, { uint32_t nof_tb = SRSLTE_RA_DL_GRANT_NOF_TB(&cfg->grant); - INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%d, nof_layers=%d, nof_tb=%d\n", - cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, cfg->nof_layers, nof_tb); + INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%s, nof_layers=%d, nof_tb=%d\n", + cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, srslte_mod_string(cfg->grant.mcs->mod), cfg->nof_layers, nof_tb); // Extract Symbols and Channel Estimates for (int j=0;jnof_rx_antennas;j++) { diff --git a/lib/src/phy/phch/phich.c b/lib/src/phy/phch/phich.c index 37b8e1b7a..6990d69e2 100644 --- a/lib/src/phy/phch/phich.c +++ b/lib/src/phy/phch/phich.c @@ -148,7 +148,7 @@ uint8_t srslte_phich_ack_decode(float bits[SRSLTE_PHICH_NBITS], float *distance) uint8_t index=0; if (SRSLTE_VERBOSE_ISINFO()) { - INFO("Received bits: ", 0); + INFO("Received bits: "); srslte_vec_fprint_f(stdout, bits, SRSLTE_PHICH_NBITS); } @@ -244,8 +244,8 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS], srslte_predecoding_diversity_multi(q_sf_symbols, q_ce, x, 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", 0); - DEBUG("d0: ", 0); + DEBUG("Recv!!: \n"); + DEBUG("d0: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB); @@ -265,7 +265,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS], memcpy(q->d, q->d0, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t)); } - DEBUG("d: ", 0); + DEBUG("d: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB); @@ -290,7 +290,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS], } } - DEBUG("z: ", 0); + DEBUG("z: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS); @@ -353,7 +353,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_ srslte_mod_modulate(&q->mod, q->data, q->z, SRSLTE_PHICH_NBITS); - DEBUG("data: ", 0); + DEBUG("data: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS); @@ -370,7 +370,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_ } } - DEBUG("d: ", 0); + DEBUG("d: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB); @@ -397,7 +397,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_ memcpy(q->d0, q->d, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t)); } - DEBUG("d0: ", 0); + DEBUG("d0: "); if (SRSLTE_VERBOSE_ISDEBUG()) srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB); diff --git a/lib/src/phy/phch/sch.c b/lib/src/phy/phch/sch.c index a2da3195c..3a8285f73 100644 --- a/lib/src/phy/phch/sch.c +++ b/lib/src/phy/phch/sch.c @@ -494,7 +494,7 @@ 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",0); + INFO("TB decoded OK\n"); return SRSLTE_SUCCESS; } else { INFO("Error in TB parity: par_tx=0x%x, par_rx=0x%x\n", par_tx, par_rx); diff --git a/lib/src/phy/phch/test/pbch_file_test.c b/lib/src/phy/phch/test/pbch_file_test.c index 2ca12e4c9..6b79db422 100644 --- a/lib/src/phy/phch/test/pbch_file_test.c +++ b/lib/src/phy/phch/test/pbch_file_test.c @@ -154,7 +154,7 @@ int base_init() { return -1; } - DEBUG("Memory init OK\n",0); + DEBUG("Memory init OK\n"); return 0; } diff --git a/lib/src/phy/phch/test/pcfich_file_test.c b/lib/src/phy/phch/test/pcfich_file_test.c index e92d6c7ba..98ff829be 100644 --- a/lib/src/phy/phch/test/pcfich_file_test.c +++ b/lib/src/phy/phch/test/pcfich_file_test.c @@ -170,7 +170,7 @@ int base_init() { return -1; } - DEBUG("Memory init OK\n",0); + DEBUG("Memory init OK\n"); return 0; } @@ -232,7 +232,7 @@ int main(int argc, char **argv) { /* Get channel estimates for each port */ srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0); - INFO("Decoding PCFICH\n", 0); + INFO("Decoding PCFICH\n"); n = srslte_pcfich_decode(&pcfich, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), 0, &cfi, &cfi_corr); diff --git a/lib/src/phy/phch/test/pdcch_file_test.c b/lib/src/phy/phch/test/pdcch_file_test.c index 5482d9f98..2f0ae30cc 100644 --- a/lib/src/phy/phch/test/pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdcch_file_test.c @@ -180,7 +180,7 @@ int base_init() { exit(-1); } - DEBUG("Memory init OK\n",0); + DEBUG("Memory init OK\n"); return 0; } @@ -244,7 +244,7 @@ int main(int argc, char **argv) { return -1; } if (rnti == SRSLTE_SIRNTI) { - INFO("Initializing common search space for SI-RNTI\n",0); + INFO("Initializing common search space for SI-RNTI\n"); nof_locations = srslte_pdcch_common_locations(&pdcch, locations, MAX_CANDIDATES, cfi); } else { INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti); 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 ba662bc49..76f48b959 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -148,7 +148,7 @@ int base_init() { srslte_ue_dl_set_rnti(&ue_dl, rnti); - DEBUG("Memory init OK\n",0); + DEBUG("Memory init OK\n"); return 0; } diff --git a/lib/src/phy/phch/test/phich_file_test.c b/lib/src/phy/phch/test/phich_file_test.c index 65f7ce9c0..45eec4921 100644 --- a/lib/src/phy/phch/test/phich_file_test.c +++ b/lib/src/phy/phch/test/phich_file_test.c @@ -194,7 +194,7 @@ int base_init() { return -1; } - DEBUG("Memory init OK\n",0); + DEBUG("Memory init OK\n"); return 0; } @@ -257,7 +257,7 @@ int main(int argc, char **argv) { /* Get channel estimates for each port */ srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0); - INFO("Decoding PHICH\n", 0); + INFO("Decoding PHICH\n"); /* Receive all PHICH groups and sequence numbers */ for (ngroup=0;ngrouptmp_cqi, data, sizeof(uint8_t) * nof_bits); srslte_crc_attach(&q->crc, q->tmp_cqi, nof_bits); - DEBUG("cqi_crc_tx=", 0); + DEBUG("cqi_crc_tx="); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8); } srslte_convcoder_encode(&encoder, q->tmp_cqi, q->encoded_cqi, nof_bits + 8); - DEBUG("cconv_tx=", 0); + DEBUG("cconv_tx="); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_b(stdout, q->encoded_cqi, 3 * (nof_bits + 8)); } @@ -400,14 +400,14 @@ int decode_cqi_long(srslte_uci_cqi_pusch_t *q, int16_t *q_bits, uint32_t Q, srslte_rm_conv_rx_s(q_bits, Q, q->encoded_cqi_s, 3 * (nof_bits + 8)); - DEBUG("cconv_rx=", 0); + DEBUG("cconv_rx="); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_s(stdout, q->encoded_cqi_s, 3 * (nof_bits + 8)); } srslte_viterbi_decode_s(&q->viterbi, q->encoded_cqi_s, q->tmp_cqi, nof_bits + 8); - DEBUG("cqi_crc_rx=", 0); + DEBUG("cqi_crc_rx="); if (SRSLTE_VERBOSE_ISDEBUG()) { srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8); } diff --git a/lib/src/phy/rf/rf_utils.c b/lib/src/phy/rf/rf_utils.c index ea016c721..4587ebdcb 100644 --- a/lib/src/phy/rf/rf_utils.c +++ b/lib/src/phy/rf/rf_utils.c @@ -117,7 +117,7 @@ int rf_mib_decoder(srslte_rf_t *rf, uint32_t nof_rx_antennas,cell_search_cfg_t * INFO("Setting sampling frequency %.2f MHz for PSS search\n", (float) srate/1000000); srslte_rf_set_rx_srate(rf, (float) srate); - INFO("Starting receiver...\n", 0); + INFO("Starting receiver...\n"); srslte_rf_start_rx_stream(rf, false); // Copy CFO estimate if provided and disable CP estimation during find @@ -174,7 +174,7 @@ int rf_cell_search(srslte_rf_t *rf, uint32_t nof_rx_antennas, INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000); srslte_rf_set_rx_srate(rf, SRSLTE_CS_SAMP_FREQ); - INFO("Starting receiver...\n", 0); + INFO("Starting receiver...\n"); srslte_rf_start_rx_stream(rf, false); /* Find a cell in the given N_id_2 or go through the 3 of them to find the strongest */ diff --git a/lib/src/phy/ue/ue_sync.c b/lib/src/phy/ue/ue_sync.c index 480835e6b..7ee97c21b 100644 --- a/lib/src/phy/ue/ue_sync.c +++ b/lib/src/phy/ue/ue_sync.c @@ -751,7 +751,7 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE 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",0); + INFO("No space for SSS/CP detection. Realigning frame...\n"); q->recv_callback(q->stream, dummy_offset_buffer, q->frame_len/2, NULL); srslte_sync_reset(&q->sfind); ret = SRSLTE_SUCCESS;