diff --git a/lib/examples/npdsch_enodeb.c b/lib/examples/npdsch_enodeb.c index a44cda4b7..e19fbb8d4 100644 --- a/lib/examples/npdsch_enodeb.c +++ b/lib/examples/npdsch_enodeb.c @@ -324,7 +324,7 @@ void sig_int_handler(int signo) } #endif -int update_radl() +static int update_radl(void) { bzero(&ra_dl_sib1, sizeof(srslte_ra_nbiot_dl_dci_t)); @@ -362,7 +362,7 @@ int update_radl() } /* Read new MCS from stdin */ -int update_control() +static int update_control(void) { char input[128]; @@ -516,7 +516,7 @@ int main(int argc, char** argv) } #endif - if (update_radl(sf_idx)) { + if (update_radl()) { exit(-1); } @@ -626,7 +626,7 @@ int main(int argc, char** argv) } // Update DL resource allocation from control port - if (update_control(sf_idx)) { + if (update_control()) { fprintf(stderr, "Error updating parameters from control port\n"); } diff --git a/lib/examples/npdsch_ue.c b/lib/examples/npdsch_ue.c index 06b3d98e2..c01c536df 100644 --- a/lib/examples/npdsch_ue.c +++ b/lib/examples/npdsch_ue.c @@ -1024,15 +1024,15 @@ void* plot_thread_run(void* arg) #endif // update MIB and SIB widget only if their content changed - if (memcmp(mib_buffer_disp, mib_buffer_decode, sizeof(mib_buffer_disp) != 0)) { + if (memcmp(mib_buffer_disp, mib_buffer_decode, sizeof(mib_buffer_disp)) != 0) { memcpy(mib_buffer_disp, mib_buffer_decode, sizeof(mib_buffer_disp)); text_edit_setMessage(&miblog, mib_buffer_disp); } - if (memcmp(sib1_buffer_disp, sib1_buffer_decode, sizeof(sib1_buffer_disp) != 0)) { + if (memcmp(sib1_buffer_disp, sib1_buffer_decode, sizeof(sib1_buffer_disp)) != 0) { memcpy(sib1_buffer_disp, sib1_buffer_decode, sizeof(sib1_buffer_disp)); text_edit_setMessage(&sib1log, sib1_buffer_disp); } - if (memcmp(sib2_buffer_disp, sib2_buffer_decode, sizeof(sib2_buffer_disp) != 0)) { + if (memcmp(sib2_buffer_disp, sib2_buffer_decode, sizeof(sib2_buffer_disp)) != 0) { memcpy(sib2_buffer_disp, sib2_buffer_decode, sizeof(sib2_buffer_disp)); text_edit_setMessage(&sib2log, sib2_buffer_disp); } diff --git a/lib/include/srslte/phy/utils/simd.h b/lib/include/srslte/phy/utils/simd.h index b8dcf7745..6379ac968 100644 --- a/lib/include/srslte/phy/utils/simd.h +++ b/lib/include/srslte/phy/utils/simd.h @@ -22,14 +22,14 @@ #ifndef SRSLTE_SIMD_H #define SRSLTE_SIMD_H -typedef _Complex float cf_t; - #ifdef LV_HAVE_SSE /* AVX, AVX2, FMA, AVX512 are in this group */ #ifndef __OPTIMIZE__ #define __OPTIMIZE__ #endif #include #endif /* LV_HAVE_SSE */ + +#include "srslte/config.h" #include #ifdef HAVE_NEON diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index 7d8caaba3..f811c72ea 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -91,13 +91,13 @@ void srslte_cell_fprint(FILE* stream, srslte_cell_t* cell, uint32_t sfn) // Internal type for srslte_tdd_sf_t typedef enum { D = 0, U = 1, S = 2 } tdd_sf_t; -static srslte_tdd_sf_t tdd_sf[7][10] = {{D, S, U, U, U, D, S, U, U, U}, - {D, S, U, U, D, D, S, U, U, D}, - {D, S, U, D, D, D, S, U, D, D}, - {D, S, U, U, U, D, D, D, D, D}, - {D, S, U, U, D, D, D, D, D, D}, - {D, S, U, D, D, D, D, D, D, D}, - {D, S, U, U, U, D, S, U, U, D}}; +static tdd_sf_t tdd_sf[7][10] = {{D, S, U, U, U, D, S, U, U, U}, + {D, S, U, U, D, D, S, U, U, D}, + {D, S, U, D, D, D, S, U, D, D}, + {D, S, U, U, U, D, D, D, D, D}, + {D, S, U, U, D, D, D, D, D, D}, + {D, S, U, D, D, D, D, D, D, D}, + {D, S, U, U, U, D, S, U, U, D}}; static uint32_t tdd_nof_sf_symbols[10][3] = {{3, 10, 1}, {9, 4, 1}, @@ -113,7 +113,7 @@ static uint32_t tdd_nof_sf_symbols[10][3] = {{3, 10, 1}, srslte_tdd_sf_t srslte_sfidx_tdd_type(srslte_tdd_config_t tdd_config, uint32_t sf_idx) { if (tdd_config.sf_config < 7 && sf_idx < 10 && tdd_config.configured) { - return tdd_sf[tdd_config.sf_config][sf_idx]; + return (srslte_tdd_sf_t)tdd_sf[tdd_config.sf_config][sf_idx]; } else { return SRSLTE_TDD_SF_D; } diff --git a/lib/src/phy/io/filesink.c b/lib/src/phy/io/filesink.c index ee8508cb0..6789bea28 100644 --- a/lib/src/phy/io/filesink.c +++ b/lib/src/phy/io/filesink.c @@ -52,7 +52,7 @@ int srslte_filesink_write(srslte_filesink_t* q, void* buffer, int nsamples) float* fbuf = (float*)buffer; _Complex float* cbuf = (_Complex float*)buffer; _Complex short* sbuf = (_Complex short*)buffer; - int size; + int size = 0; switch (q->type) { case SRSLTE_TEXT: @@ -90,7 +90,6 @@ int srslte_filesink_write(srslte_filesink_t* q, void* buffer, int nsamples) size = sizeof(_Complex short); } return fwrite(buffer, size, nsamples, q->f); - break; default: i = -1; break; @@ -104,7 +103,7 @@ int srslte_filesink_write_multi(srslte_filesink_t* q, void** buffer, int nsample float** fbuf = (float**)buffer; _Complex float** cbuf = (_Complex float**)buffer; _Complex short** sbuf = (_Complex short**)buffer; - int size; + int size = 0; switch (q->type) { case SRSLTE_FLOAT: @@ -155,4 +154,4 @@ int srslte_filesink_write_multi(srslte_filesink_t* q, void** buffer, int nsample break; } return i; -} \ No newline at end of file +} diff --git a/lib/src/phy/io/filesource.c b/lib/src/phy/io/filesource.c index 040dd5cb9..8d5d226c4 100644 --- a/lib/src/phy/io/filesource.c +++ b/lib/src/phy/io/filesource.c @@ -77,7 +77,7 @@ int srslte_filesource_read(srslte_filesource_t* q, void* buffer, int nsamples) float* fbuf = (float*)buffer; _Complex float* cbuf = (_Complex float*)buffer; _Complex short* sbuf = (_Complex short*)buffer; - int size; + int size = 0; switch (q->type) { case SRSLTE_FLOAT: @@ -144,4 +144,4 @@ int srslte_filesource_read_multi(srslte_filesource_t* q, void** buffer, int nsam break; } return count; -} \ No newline at end of file +} diff --git a/lib/src/phy/mimo/test/pmi_select_test.h b/lib/src/phy/mimo/test/pmi_select_test.h index 41b9b6cd1..36adc0795 100644 --- a/lib/src/phy/mimo/test/pmi_select_test.h +++ b/lib/src/phy/mimo/test/pmi_select_test.h @@ -25,8 +25,7 @@ #define PMI_SELECT_TEST_NOF_CASES 20 #include - -typedef _Complex float cf_t; +#include "srslte/config.h" typedef struct { cf_t h[2][2]; /* Channel estimate */ diff --git a/lib/src/phy/modem/demod_soft.c b/lib/src/phy/modem/demod_soft.c index 3cd29f35b..fdaeaf341 100644 --- a/lib/src/phy/modem/demod_soft.c +++ b/lib/src/phy/modem/demod_soft.c @@ -658,8 +658,8 @@ void demod_64qam_lte_s_sse(const cf_t* symbols, short* llr, int nsymbols) llr[6 * i + 0] = -yre; llr[6 * i + 1] = -yim; - llr[6 * i + 2] = abs(yre) - 4 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); - llr[6 * i + 3] = abs(yim) - 4 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); + llr[6 * i + 2] = fabs(yre) - 4 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); + llr[6 * i + 3] = fabs(yim) - 4 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); llr[6 * i + 4] = abs(llr[6 * i + 2]) - 2 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); llr[6 * i + 5] = abs(llr[6 * i + 3]) - 2 * SCALE_SHORT_CONV_QAM64 / sqrtf(42); } @@ -741,8 +741,8 @@ void demod_64qam_lte_b_sse(const cf_t* symbols, int8_t* llr, int nsymbols) llr[6 * i + 0] = -yre; llr[6 * i + 1] = -yim; - llr[6 * i + 2] = abs(yre) - 4 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); - llr[6 * i + 3] = abs(yim) - 4 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); + llr[6 * i + 2] = fabs(yre) - 4 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); + llr[6 * i + 3] = fabs(yim) - 4 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); llr[6 * i + 4] = abs(llr[6 * i + 2]) - 2 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); llr[6 * i + 5] = abs(llr[6 * i + 3]) - 2 * SCALE_BYTE_CONV_QAM64 / sqrtf(42); } diff --git a/lib/src/phy/modem/hard_demod_lte.h b/lib/src/phy/modem/hard_demod_lte.h index 402ff7487..5049dfcd2 100644 --- a/lib/src/phy/modem/hard_demod_lte.h +++ b/lib/src/phy/modem/hard_demod_lte.h @@ -20,8 +20,7 @@ */ #include - -typedef _Complex float cf_t; +#include "srslte/config.h" /* Thresholds for Demodulation */ /* Assume perfect amplitude and phase alignment. diff --git a/lib/src/phy/phch/cqi.c b/lib/src/phy/phch/cqi.c index 29ae53d79..72662caea 100644 --- a/lib/src/phy/phch/cqi.c +++ b/lib/src/phy/phch/cqi.c @@ -115,7 +115,7 @@ static int cqi_format2_subband_pack(srslte_cqi_cfg_t* cfg, srslte_cqi_format2_su uint8_t* body_ptr = buff; srslte_bit_unpack(msg->subband_cqi, &body_ptr, 4); srslte_bit_unpack(msg->subband_label, &body_ptr, cfg->subband_label_2_bits ? 2 : 1); - return 4 + (cfg->subband_label_2_bits) ? 2 : 1; + return 4 + ((cfg->subband_label_2_bits) ? 2 : 1); } int srslte_cqi_value_pack(srslte_cqi_cfg_t* cfg, srslte_cqi_value_t* value, uint8_t buff[SRSLTE_CQI_MAX_BITS]) @@ -211,7 +211,7 @@ static int cqi_format2_subband_unpack(srslte_cqi_cfg_t* cfg, uint8_t* buff, srsl uint8_t* body_ptr = buff; msg->subband_cqi = srslte_bit_pack(&body_ptr, 4); msg->subband_label = srslte_bit_pack(&body_ptr, cfg->subband_label_2_bits ? 2 : 1); - return 4 + (cfg->subband_label_2_bits) ? 2 : 1; + return 4 + ((cfg->subband_label_2_bits) ? 2 : 1); } int srslte_cqi_value_unpack(srslte_cqi_cfg_t* cfg, uint8_t buff[SRSLTE_CQI_MAX_BITS], srslte_cqi_value_t* value) @@ -349,7 +349,7 @@ int srslte_cqi_size(srslte_cqi_cfg_t* cfg) } break; case SRSLTE_CQI_TYPE_SUBBAND: - size = 4 + (cfg->subband_label_2_bits) ? 2 : 1; + size = 4 + ((cfg->subband_label_2_bits) ? 2 : 1); break; case SRSLTE_CQI_TYPE_SUBBAND_UE: size = 4 + 2 + cfg->L; diff --git a/lib/src/phy/phch/test/psbch_file_test.c b/lib/src/phy/phch/test/psbch_file_test.c index 369461d9f..be0e41313 100644 --- a/lib/src/phy/phch/test/psbch_file_test.c +++ b/lib/src/phy/phch/test/psbch_file_test.c @@ -159,6 +159,11 @@ int main(int argc, char** argv) // 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"); + return SRSLTE_ERROR; + } + 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"); diff --git a/lib/src/phy/sync/test/npss_file.c b/lib/src/phy/sync/test/npss_file.c index 6a1ad2914..dc30154aa 100644 --- a/lib/src/phy/sync/test/npss_file.c +++ b/lib/src/phy/sync/test/npss_file.c @@ -39,7 +39,6 @@ void write_to_file(); srslte_nbiot_cell_t cell = { .base = {.nof_prb = 1, .cp = SRSLTE_CP_NORM, .id = 0}, .base.nof_ports = 1, - .base.nof_prb = 1, .nbiot_prb = 0, }; diff --git a/lib/src/phy/utils/bit.c b/lib/src/phy/utils/bit.c index 8fea51d45..7a1a0d932 100644 --- a/lib/src/phy/utils/bit.c +++ b/lib/src/phy/utils/bit.c @@ -101,7 +101,7 @@ void srslte_bit_interleaver_run(srslte_bit_interleaver_t* q, uint8_t* input, uin #ifdef LV_HAVE_SSE for (; i < (int)q->nof_bits - 15; i += 16) { - __m128i in128; + __m128i in128 = _mm_setzero_si128(); in128 = _mm_insert_epi8(in128, input[*(byte_idx++)], 0x7); in128 = _mm_insert_epi8(in128, input[*(byte_idx++)], 0x6); in128 = _mm_insert_epi8(in128, input[*(byte_idx++)], 0x5); diff --git a/lib/src/phy/utils/test/vector_test.c b/lib/src/phy/utils/test/vector_test.c index 080de048c..3ffcdbdb5 100644 --- a/lib/src/phy/utils/test/vector_test.c +++ b/lib/src/phy/utils/test/vector_test.c @@ -115,7 +115,7 @@ TEST(srslte_vec_acc_ff, MALLOC(float, x); float z = 0; for (int i = 0; i < block_size; i++) { gold += x[i]; } - mse += fabs(gold - z) / gold; + mse += cabsf(gold - z) / gold; free(x);) @@ -399,7 +399,7 @@ TEST(srslte_vec_convert_fi, MALLOC(float, x); MALLOC(short, z); float scale = 10 for (int i = 0; i < block_size; i++) { gold = (short)((x[i] * scale)); - double err = cabsf((float)gold - (float)z[i]); + double err = fabsf((float)gold - (float)z[i]); if (err > mse) { mse = err; } @@ -418,7 +418,7 @@ TEST(srslte_vec_convert_if, MALLOC(int16_t, x); MALLOC(float, z); float scale = for (int i = 0; i < block_size; i++) { gold = ((float)x[i]) * k; - double err = cabsf((float)gold - (float)z[i]); + double err = fabsf((float)gold - (float)z[i]); if (err > mse) { mse = err; } @@ -482,7 +482,7 @@ TEST(srslte_vec_sc_prod_fff, MALLOC(float, x); MALLOC(float, z); float y = RANDO for (int i = 0; i < block_size; i++) { gold = x[i] * y; - mse += cabsf(gold - z[i]); + mse += fabsf(gold - z[i]); } free(x); @@ -497,7 +497,7 @@ TEST( for (int i = 0; i < block_size; i++) { gold = sqrtf(crealf(x[i]) * crealf(x[i]) + cimagf(x[i]) * cimagf(x[i])); - mse += cabsf(gold - z[i]) / block_size; + mse += fabsf(gold - z[i]) / block_size; } free(x); @@ -511,7 +511,7 @@ TEST(srslte_vec_abs_square_cf, MALLOC(cf_t, x); MALLOC(float, z); float gold; for (int i = 0; i < block_size; i++) { gold = crealf(x[i]) * crealf(x[i]) + cimagf(x[i]) * cimagf(x[i]); - mse += cabsf(gold - z[i]); + mse += fabsf(gold - z[i]); } free(x); diff --git a/srsenb/hdr/phy/cc_worker.h b/srsenb/hdr/phy/cc_worker.h index 9a97bbde3..c559d397d 100644 --- a/srsenb/hdr/phy/cc_worker.h +++ b/srsenb/hdr/phy/cc_worker.h @@ -105,7 +105,8 @@ private: void metrics_read(phy_metrics_t* metrics); void metrics_dl(uint32_t mcs); void metrics_ul(uint32_t mcs, float rssi, float sinr, float turbo_iters); - bool is_pcell() { return pcell; }; + bool is_pcell() { return pcell; } + uint32_t get_rnit() const {return rnti; } private: uint32_t rnti = 0; diff --git a/srsenb/hdr/stack/mac/mac.h b/srsenb/hdr/stack/mac/mac.h index f9afd54d1..6bf523a65 100644 --- a/srsenb/hdr/stack/mac/mac.h +++ b/srsenb/hdr/stack/mac/mac.h @@ -105,9 +105,7 @@ public: uint16_t allocate_rnti() final; private: - static const int MAX_LOCATIONS = 20; static const uint32_t cfi = 3; - srslte_dci_location_t locations[MAX_LOCATIONS] = {}; std::mutex rnti_mutex; diff --git a/srsenb/hdr/stack/mac/ue.h b/srsenb/hdr/stack/mac/ue.h index ca954c4c6..f4da7564d 100644 --- a/srsenb/hdr/stack/mac/ue.h +++ b/srsenb/hdr/stack/mac/ue.h @@ -152,8 +152,6 @@ private: srslte::log_ref log_h; sched_interface* sched = nullptr; - bool conres_id_available = false; - // Mutexes std::mutex mutex; diff --git a/srsenb/hdr/stack/rrc/rrc_mobility.h b/srsenb/hdr/stack/rrc/rrc_mobility.h index d67fa986b..5e2bb6d1e 100644 --- a/srsenb/hdr/stack/rrc/rrc_mobility.h +++ b/srsenb/hdr/stack/rrc/rrc_mobility.h @@ -79,6 +79,9 @@ public: // Note: Made const to forbid silent updates and enable comparison based on addr std::vector > cell_meas_cfg_list; + rrc *get_rrc() { return rrc_ptr; } + const rrc *get_rrc() const { return rrc_ptr; } + private: // args rrc* rrc_ptr = nullptr; diff --git a/srsenb/test/phy/enb_phy_test.cc b/srsenb/test/phy/enb_phy_test.cc index b9a130854..132e20fd6 100644 --- a/srsenb/test/phy/enb_phy_test.cc +++ b/srsenb/test/phy/enb_phy_test.cc @@ -252,7 +252,7 @@ public: typedef std::unique_ptr unique_dummy_radio_t; -class dummy_stack : public srsenb::stack_interface_phy_lte +class dummy_stack final : public srsenb::stack_interface_phy_lte { private: static constexpr float prob_dl_grant = 0.50f; diff --git a/srsepc/hdr/mme/s1ap_nas_transport.h b/srsepc/hdr/mme/s1ap_nas_transport.h index 25f0c2e5d..8f404cff8 100644 --- a/srsepc/hdr/mme/s1ap_nas_transport.h +++ b/srsepc/hdr/mme/s1ap_nas_transport.h @@ -53,8 +53,6 @@ private: srslte::byte_buffer_pool* m_pool; s1ap* m_s1ap; - hss_interface_nas* m_hss; - mme_gtpc* m_mme_gtpc; nas_init_t m_nas_init; nas_if_t m_nas_if; diff --git a/srsue/hdr/phy/phy_common.h b/srsue/hdr/phy/phy_common.h index 2081d682a..05a50c1cf 100644 --- a/srsue/hdr/phy/phy_common.h +++ b/srsue/hdr/phy/phy_common.h @@ -187,7 +187,6 @@ private: bool is_pending_tx_end = false; srslte::radio_interface_phy* radio_h = nullptr; - float cfo = 0.0f; srslte::log* log_h = nullptr; srslte::channel_ptr ul_channel = nullptr; diff --git a/srsue/hdr/phy/sync.h b/srsue/hdr/phy/sync.h index 1ad5a19ae..01b1369a8 100644 --- a/srsue/hdr/phy/sync.h +++ b/srsue/hdr/phy/sync.h @@ -339,7 +339,6 @@ private: // This is the primary cell srslte_cell_t cell = {}; - bool started = false; uint32_t tti = 0; srslte_timestamp_t tti_ts = {}; std::array mib = {}; diff --git a/srsue/hdr/stack/upper/usim.h b/srsue/hdr/stack/upper/usim.h index 896cce101..85a8c10c4 100644 --- a/srsue/hdr/stack/upper/usim.h +++ b/srsue/hdr/stack/upper/usim.h @@ -96,7 +96,6 @@ private: std::string imei_str; // Security variables - uint8_t rand[16] = {}; uint8_t ck[16] = {}; uint8_t ik[16] = {}; uint8_t ak[6] = {};