From c74b2dd6330208c1342ebec3428abf983e7d47b6 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 25 May 2021 10:56:30 +0100 Subject: [PATCH] Fix some warnings in PHY due to array parameter mismatch for a few functions --- lib/include/srsran/phy/mimo/precoding.h | 2 +- lib/include/srsran/phy/phch/cqi.h | 3 ++- lib/include/srsran/phy/phch/pusch_nr.h | 2 +- lib/include/srsran/phy/ue/ue_dl.h | 2 +- lib/src/phy/phch/pdsch_nr.c | 5 ++--- lib/src/phy/phch/pusch_nr.c | 9 ++++----- lib/src/phy/phch/test/pbch_file_test.c | 2 +- lib/src/phy/phch/test/pcfich_file_test.c | 2 +- lib/src/phy/phch/test/pdcch_file_test.c | 2 +- lib/src/phy/phch/test/pdsch_pdcch_file_test.c | 2 +- lib/src/phy/phch/test/phich_file_test.c | 2 +- lib/src/phy/phch/test/pmch_file_test.c | 9 ++++++--- lib/src/phy/phch/test/pucch_test.c | 2 +- lib/src/phy/phch/test/pusch_nr_test.c | 4 +++- lib/src/phy/phch/uci.c | 9 +++++---- lib/src/phy/rf/rf_zmq_imp.c | 7 +------ lib/src/phy/ue/ue_dl_nr.c | 10 +++++----- lib/test/phy/phy_dl_nr_test.c | 6 ++++-- 18 files changed, 41 insertions(+), 39 deletions(-) diff --git a/lib/include/srsran/phy/mimo/precoding.h b/lib/include/srsran/phy/mimo/precoding.h index 3a29172c1..ebe44f2c9 100644 --- a/lib/include/srsran/phy/mimo/precoding.h +++ b/lib/include/srsran/phy/mimo/precoding.h @@ -80,7 +80,7 @@ SRSRAN_API int srsran_predecoding_diversity(cf_t* y, SRSRAN_API int srsran_predecoding_diversity_multi(cf_t* y[SRSRAN_MAX_PORTS], cf_t* h[SRSRAN_MAX_PORTS][SRSRAN_MAX_PORTS], cf_t* x[SRSRAN_MAX_LAYERS], - float* csi[SRSRAN_MAX_LAYERS], + float* csi[SRSRAN_MAX_CODEWORDS], int nof_rxant, int nof_ports, int nof_symbols, diff --git a/lib/include/srsran/phy/phch/cqi.h b/lib/include/srsran/phy/phch/cqi.h index ab9ddd3b4..fb2d6b60b 100644 --- a/lib/include/srsran/phy/phch/cqi.h +++ b/lib/include/srsran/phy/phch/cqi.h @@ -135,7 +135,8 @@ typedef struct { SRSRAN_API int srsran_cqi_size(srsran_cqi_cfg_t* cfg); -SRSRAN_API int srsran_cqi_value_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, uint8_t* buff); +SRSRAN_API int +srsran_cqi_value_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, uint8_t buff[SRSRAN_CQI_MAX_BITS]); SRSRAN_API int srsran_cqi_value_unpack(srsran_cqi_cfg_t* cfg, uint8_t buff[SRSRAN_CQI_MAX_BITS], srsran_cqi_value_t* value); diff --git a/lib/include/srsran/phy/phch/pusch_nr.h b/lib/include/srsran/phy/phch/pusch_nr.h index 5073fd9ec..f917dd195 100644 --- a/lib/include/srsran/phy/phch/pusch_nr.h +++ b/lib/include/srsran/phy/phch/pusch_nr.h @@ -104,7 +104,7 @@ SRSRAN_API int srsran_pusch_nr_decode(srsran_pusch_nr_t* q, const srsran_sch_grant_nr_t* grant, srsran_chest_dl_res_t* channel, cf_t* sf_symbols[SRSRAN_MAX_PORTS], - srsran_pusch_res_nr_t data[SRSRAN_MAX_TB]); + srsran_pusch_res_nr_t* data[SRSRAN_MAX_TB]); SRSRAN_API uint32_t srsran_pusch_nr_rx_info(const srsran_pusch_nr_t* q, const srsran_sch_cfg_nr_t* cfg, diff --git a/lib/include/srsran/phy/ue/ue_dl.h b/lib/include/srsran/phy/ue/ue_dl.h index 366b062dc..7d6012579 100644 --- a/lib/include/srsran/phy/ue/ue_dl.h +++ b/lib/include/srsran/phy/ue/ue_dl.h @@ -199,7 +199,7 @@ SRSRAN_API int srsran_ue_dl_decode_pdsch(srsran_ue_dl_t* q, SRSRAN_API int srsran_ue_dl_decode_pmch(srsran_ue_dl_t* q, srsran_dl_sf_cfg_t* sf, srsran_pmch_cfg_t* pmch_cfg, - srsran_pdsch_res_t* data); + srsran_pdsch_res_t data[SRSRAN_MAX_CODEWORDS]); SRSRAN_API int srsran_ue_dl_decode_phich(srsran_ue_dl_t* q, srsran_dl_sf_cfg_t* sf, diff --git a/lib/src/phy/phch/pdsch_nr.c b/lib/src/phy/phch/pdsch_nr.c index c44ffc992..d23fa9380 100644 --- a/lib/src/phy/phch/pdsch_nr.c +++ b/lib/src/phy/phch/pdsch_nr.c @@ -482,7 +482,7 @@ int srsran_pdsch_nr_decode(srsran_pdsch_nr_t* q, srsran_pdsch_res_nr_t* data) { // Check input pointers - if (!q || !cfg || !grant || !data || !sf_symbols) { + if (!q || !cfg || !grant || !data || !sf_symbols || !channel) { return SRSRAN_ERROR_INVALID_INPUTS; } @@ -528,8 +528,7 @@ int srsran_pdsch_nr_decode(srsran_pdsch_nr_t* q, // Antenna port demapping // ... Not implemented - srsran_predecoding_type( - q->x, channel->ce, q->d, NULL, 1, 1, 1, 0, nof_re, SRSRAN_TXSCHEME_PORT0, 1.0f, channel->noise_estimate); + srsran_predecoding_single(q->x[0], channel->ce[0][0], q->d[0], NULL, nof_re, 1.0f, channel->noise_estimate); // Layer demapping if (grant->nof_layers > 1) { diff --git a/lib/src/phy/phch/pusch_nr.c b/lib/src/phy/phch/pusch_nr.c index 6c94788a7..504136d06 100644 --- a/lib/src/phy/phch/pusch_nr.c +++ b/lib/src/phy/phch/pusch_nr.c @@ -909,10 +909,10 @@ int srsran_pusch_nr_decode(srsran_pusch_nr_t* q, const srsran_sch_grant_nr_t* grant, srsran_chest_dl_res_t* channel, cf_t* sf_symbols[SRSRAN_MAX_PORTS], - srsran_pusch_res_nr_t* data) + srsran_pusch_res_nr_t* data[SRSRAN_MAX_TB]) { // Check input pointers - if (!q || !cfg || !grant || !data || !sf_symbols) { + if (!q || !cfg || !grant || !data || !sf_symbols || !channel) { return SRSRAN_ERROR_INVALID_INPUTS; } @@ -969,8 +969,7 @@ int srsran_pusch_nr_decode(srsran_pusch_nr_t* q, // Antenna port demapping // ... Not implemented - srsran_predecoding_type( - q->x, channel->ce, q->d, NULL, 1, 1, 1, 0, nof_re, SRSRAN_TXSCHEME_PORT0, 1.0f, channel->noise_estimate); + srsran_predecoding_single(q->x[0], channel->ce[0][0], q->d[0], NULL, nof_re, 1.0f, channel->noise_estimate); // Layer demapping if (grant->nof_layers > 1) { @@ -979,7 +978,7 @@ int srsran_pusch_nr_decode(srsran_pusch_nr_t* q, // SCH decode for (uint32_t tb = 0; tb < SRSRAN_MAX_TB; tb++) { - if (pusch_nr_decode_codeword(q, cfg, &grant->tb[tb], data, grant->rnti) < SRSRAN_SUCCESS) { + if (pusch_nr_decode_codeword(q, cfg, &grant->tb[tb], data[0], grant->rnti) < SRSRAN_SUCCESS) { ERROR("Error encoding TB %d", tb); return SRSRAN_ERROR; } diff --git a/lib/src/phy/phch/test/pbch_file_test.c b/lib/src/phy/phch/test/pbch_file_test.c index be7cc06ed..1d52ec98a 100644 --- a/lib/src/phy/phch/test/pbch_file_test.c +++ b/lib/src/phy/phch/test/pbch_file_test.c @@ -39,7 +39,7 @@ uint8_t bch_payload_file[SRSRAN_BCH_PAYLOAD_LEN] = {0, 1, 1, 0, 1, 0, 0, 0, 0, 0 #define FLEN (10 * SRSRAN_SF_LEN(srsran_symbol_sz(cell.nof_prb))) srsran_filesource_t fsrc; -cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_CODEWORDS]; +cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_PORTS]; srsran_pbch_t pbch; srsran_ofdm_t fft; srsran_chest_dl_t chest; diff --git a/lib/src/phy/phch/test/pcfich_file_test.c b/lib/src/phy/phch/test/pcfich_file_test.c index 8622d373d..a744262bc 100644 --- a/lib/src/phy/phch/test/pcfich_file_test.c +++ b/lib/src/phy/phch/test/pcfich_file_test.c @@ -33,7 +33,7 @@ int flen; FILE* fmatlab = NULL; srsran_filesource_t fsrc; -cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_CODEWORDS]; +cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_PORTS]; srsran_pcfich_t pcfich; srsran_regs_t regs; srsran_ofdm_t fft; diff --git a/lib/src/phy/phch/test/pdcch_file_test.c b/lib/src/phy/phch/test/pdcch_file_test.c index a46ec6b56..c3adfa35a 100644 --- a/lib/src/phy/phch/test/pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdcch_file_test.c @@ -39,7 +39,7 @@ int max_frames = 10; srsran_dci_format_t dci_format = SRSRAN_DCI_FORMAT1A; srsran_filesource_t fsrc; srsran_pdcch_t pdcch; -cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_CODEWORDS]; +cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_PORTS]; srsran_regs_t regs; srsran_ofdm_t fft; srsran_chest_dl_t chest; 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 238984289..a3a00c899 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -165,7 +165,7 @@ int main(int argc, char** argv) exit(-1); } - uint8_t* data[] = {malloc(100000)}; + uint8_t* data[SRSRAN_MAX_CODEWORDS] = {malloc(100000)}; if (!data[0]) { perror("malloc"); exit(-1); diff --git a/lib/src/phy/phch/test/phich_file_test.c b/lib/src/phy/phch/test/phich_file_test.c index dc9e61c9a..b82fa7845 100644 --- a/lib/src/phy/phch/test/phich_file_test.c +++ b/lib/src/phy/phch/test/phich_file_test.c @@ -39,7 +39,7 @@ int numsubframe = 0; FILE* fmatlab = NULL; srsran_filesource_t fsrc; -cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_CODEWORDS]; +cf_t * input_buffer, *fft_buffer[SRSRAN_MAX_PORTS]; srsran_phich_t phich; srsran_regs_t regs; srsran_ofdm_t fft; diff --git a/lib/src/phy/phch/test/pmch_file_test.c b/lib/src/phy/phch/test/pmch_file_test.c index 4188bc9ed..c1e2246a2 100644 --- a/lib/src/phy/phch/test/pmch_file_test.c +++ b/lib/src/phy/phch/test/pmch_file_test.c @@ -207,9 +207,12 @@ int main(int argc, char** argv) SRSRAN_DCI_TB_DISABLE(dci.tb[1]); srsran_ra_dl_dci_to_grant(&cell, &dl_sf, SRSRAN_TM1, false, &dci, &pmch_cfg.pdsch_cfg.grant); - srsran_pdsch_res_t pdsch_res; - pdsch_res.payload = data; - ret = srsran_ue_dl_decode_pmch(&ue_dl, &dl_sf, &pmch_cfg, &pdsch_res); + srsran_pdsch_res_t pdsch_res = {}; + pdsch_res.payload = data; + + srsran_pdsch_res_t pdsch_res_vec[SRSRAN_MAX_CODEWORDS]; + pdsch_res_vec[0] = pdsch_res; + ret = srsran_ue_dl_decode_pmch(&ue_dl, &dl_sf, &pmch_cfg, pdsch_res_vec); if (pdsch_res.crc == 1) { printf("PMCH Decoded OK!\n"); } else if (pdsch_res.crc == 0) { diff --git a/lib/src/phy/phch/test/pucch_test.c b/lib/src/phy/phch/test/pucch_test.c index ca8f98d26..76edd6e09 100644 --- a/lib/src/phy/phch/test/pucch_test.c +++ b/lib/src/phy/phch/test/pucch_test.c @@ -80,7 +80,7 @@ int test_uci_cqi_pucch(void) int ret = SRSRAN_SUCCESS; __attribute__((aligned(256))) uint8_t o_bits[SRSRAN_UCI_MAX_CQI_LEN_PUCCH] = {0}; __attribute__((aligned(256))) uint8_t e_bits[SRSRAN_UCI_CQI_CODED_PUCCH_B] = {0}; - __attribute__((aligned(256))) int16_t e_symb[SRSRAN_UCI_CQI_CODED_PUCCH_B] = {0}; + __attribute__((aligned(256))) int16_t e_symb[SRSRAN_CQI_MAX_BITS] = {0}; __attribute__((aligned(256))) uint8_t d_bits[SRSRAN_UCI_MAX_CQI_LEN_PUCCH] = {0}; srsran_uci_cqi_pucch_t uci_cqi_pucch = {0}; diff --git a/lib/src/phy/phch/test/pusch_nr_test.c b/lib/src/phy/phch/test/pusch_nr_test.c index f88e1b938..f1357c130 100644 --- a/lib/src/phy/phch/test/pusch_nr_test.c +++ b/lib/src/phy/phch/test/pusch_nr_test.c @@ -266,7 +266,9 @@ int main(int argc, char** argv) } chest.nof_re = pusch_cfg.grant.tb->nof_re; - if (srsran_pusch_nr_decode(&pusch_rx, &pusch_cfg, &pusch_cfg.grant, &chest, sf_symbols, &data_rx) < + srsran_pusch_res_nr_t* data_rx_vec[SRSRAN_MAX_TB] = {}; + data_rx_vec[0] = &data_rx; + if (srsran_pusch_nr_decode(&pusch_rx, &pusch_cfg, &pusch_cfg.grant, &chest, sf_symbols, data_rx_vec) < SRSRAN_SUCCESS) { ERROR("Error encoding"); goto clean_exit; diff --git a/lib/src/phy/phch/uci.c b/lib/src/phy/phch/uci.c index f2545fb1e..aa8e2689c 100644 --- a/lib/src/phy/phch/uci.c +++ b/lib/src/phy/phch/uci.c @@ -120,7 +120,7 @@ int16_t srsran_uci_decode_cqi_pucch(srsran_uci_cqi_pucch_t* q, uint8_t* cqi_data, uint32_t cqi_len) { - if (cqi_len < SRSRAN_UCI_MAX_CQI_LEN_PUCCH && b_bits != NULL && cqi_data != NULL) { + if (q != NULL && cqi_len < SRSRAN_UCI_MAX_CQI_LEN_PUCCH && b_bits != NULL && cqi_data != NULL) { uint32_t max_w = 0; int32_t max_corr = INT32_MIN; uint32_t nwords = 1 << SRSRAN_UCI_MAX_CQI_LEN_PUCCH; @@ -646,9 +646,10 @@ int srsran_uci_decode_ack_ri(srsran_pusch_cfg_t* cfg, uint32_t Qm = srsran_mod_bits_x_symbol(cfg->grant.tb.mod); int16_t llr_acc[32] = {}; ///< LLR accumulator - uint32_t nof_acc = - (nof_bits == 1) ? Qm : (nof_bits == 2) ? Qm * 3 : SRSRAN_FEC_BLOCK_SIZE; ///< Number of required LLR - uint32_t count_acc = 0; ///< LLR counter + uint32_t nof_acc = (nof_bits == 1) ? Qm + : (nof_bits == 2) ? Qm * 3 + : SRSRAN_FEC_BLOCK_SIZE; ///< Number of required LLR + uint32_t count_acc = 0; ///< LLR counter for (uint32_t i = 0; i < Qprime; i++) { if (is_ri) { diff --git a/lib/src/phy/rf/rf_zmq_imp.c b/lib/src/phy/rf/rf_zmq_imp.c index c63c4e878..09eb3e7fd 100644 --- a/lib/src/phy/rf/rf_zmq_imp.c +++ b/lib/src/phy/rf/rf_zmq_imp.c @@ -597,12 +597,7 @@ int rf_zmq_recv_with_time(void* h, void* data, uint32_t nsamples, bool blocking, return rf_zmq_recv_with_time_multi(h, &data, nsamples, blocking, secs, frac_secs); } -int rf_zmq_recv_with_time_multi(void* h, - void* data[4], - uint32_t nsamples, - bool blocking, - time_t* secs, - double* frac_secs) +int rf_zmq_recv_with_time_multi(void* h, void** data, uint32_t nsamples, bool blocking, time_t* secs, double* frac_secs) { int ret = SRSRAN_ERROR; diff --git a/lib/src/phy/ue/ue_dl_nr.c b/lib/src/phy/ue/ue_dl_nr.c index fab77bdf7..0611f5993 100644 --- a/lib/src/phy/ue/ue_dl_nr.c +++ b/lib/src/phy/ue/ue_dl_nr.c @@ -573,11 +573,11 @@ int srsran_ue_dl_nr_decode_pdsch(srsran_ue_dl_nr_t* q, return SRSRAN_SUCCESS; } -int srsran_ue_dl_nr_pdsch_info(const srsran_ue_dl_nr_t* q, - const srsran_sch_cfg_nr_t* cfg, - const srsran_pdsch_res_nr_t* res, - char* str, - uint32_t str_len) +int srsran_ue_dl_nr_pdsch_info(const srsran_ue_dl_nr_t* q, + const srsran_sch_cfg_nr_t* cfg, + const srsran_pdsch_res_nr_t res[SRSRAN_MAX_CODEWORDS], + char* str, + uint32_t str_len) { int len = 0; diff --git a/lib/test/phy/phy_dl_nr_test.c b/lib/test/phy/phy_dl_nr_test.c index 9447488df..d9fd1960f 100644 --- a/lib/test/phy/phy_dl_nr_test.c +++ b/lib/test/phy/phy_dl_nr_test.c @@ -471,8 +471,10 @@ int main(int argc, char** argv) } if (srsran_verbose >= SRSRAN_VERBOSE_INFO) { - char str[512]; - srsran_ue_dl_nr_pdsch_info(&ue_dl, &pdsch_cfg, &pdsch_res, str, (uint32_t)sizeof(str)); + char str[512]; + srsran_pdsch_res_nr_t pdsch_res_vec[SRSRAN_MAX_CODEWORDS] = {}; + pdsch_res_vec[0] = pdsch_res; + srsran_ue_dl_nr_pdsch_info(&ue_dl, &pdsch_cfg, pdsch_res_vec, str, (uint32_t)sizeof(str)); char str_extra[2048]; srsran_sch_cfg_nr_info(&pdsch_cfg, str_extra, (uint32_t)sizeof(str_extra));