diff --git a/lib/include/srslte/phy/enb/enb_dl.h b/lib/include/srslte/phy/enb/enb_dl.h index b619d10d4..d3b8d27b8 100644 --- a/lib/include/srslte/phy/enb/enb_dl.h +++ b/lib/include/srslte/phy/enb/enb_dl.h @@ -118,15 +118,43 @@ SRSLTE_API int srslte_enb_dl_put_pmch(srslte_enb_dl_t* q, srslte_pmch_cfg_t* pmc SRSLTE_API void srslte_enb_dl_gen_signal(srslte_enb_dl_t* q); -SRSLTE_API bool srslte_enb_dl_gen_cqi_periodic(srslte_cell_t* cell, - srslte_dl_cfg_t* dl_cfg, - uint32_t tti, - uint32_t ri, - srslte_cqi_cfg_t* cqi_cfg); +SRSLTE_API bool srslte_enb_dl_gen_cqi_periodic(const srslte_cell_t* cell, + const srslte_dl_cfg_t* dl_cfg, + uint32_t tti, + uint32_t last_ri, + srslte_cqi_cfg_t* cqi_cfg); -SRSLTE_API bool -srslte_enb_dl_gen_cqi_aperiodic(srslte_cell_t* cell, srslte_dl_cfg_t* dl_cfg, uint32_t ri, srslte_cqi_cfg_t* cqi_cfg); +SRSLTE_API bool srslte_enb_dl_gen_cqi_aperiodic(const srslte_cell_t* cell, + const srslte_dl_cfg_t* dl_cfg, + uint32_t ri, + srslte_cqi_cfg_t* cqi_cfg); SRSLTE_API void srslte_enb_dl_save_signal(srslte_enb_dl_t* q); +/** + * Generates the uplink control information configuration from the cell, subframe and HARQ ACK information. Note that + * it expects the UCI configuration shall have been configured already with scheduling request and channel quality + * information prior to this call. + * + * @param cell points to the physical layer cell parameters + * @param sf points to the subframe configuration + * @param ack_info is the HARQ-ACK information + * @param uci_cfg the UCI configuration destination + */ +SRSLTE_API void srslte_enb_dl_gen_ack(const srslte_cell_t* cell, + const srslte_dl_sf_cfg_t* sf, + const srslte_pdsch_ack_t* ack_info, + srslte_uci_cfg_t* uci_cfg); + +/** + * gets the HARQ-ACK values from the received Uplink Control Information configuration, the cell, and HARQ ACK + * info itself. Note that it expects that the HARQ-ACK info has been set prior the UCI Data decoding. + * + * @param cell points to the physical layer cell parameters + * @param uci_value points to the received UCI values + * @param ack_info is the HARQ-ACK information + */ +SRSLTE_API void +srslte_enb_dl_get_ack(const srslte_cell_t* cell, const srslte_uci_value_t* uci_value, srslte_pdsch_ack_t* pdsch_ack); + #endif // SRSLTE_ENB_DL_H diff --git a/lib/include/srslte/phy/phch/cqi.h b/lib/include/srslte/phy/phch/cqi.h index 7fbe0eee9..721e9fa4f 100644 --- a/lib/include/srslte/phy/phch/cqi.h +++ b/lib/include/srslte/phy/phch/cqi.h @@ -122,9 +122,10 @@ typedef struct SRSLTE_API { bool data_enable; bool ri_present; bool pmi_present; - bool four_antenna_ports; // If cell has 4 antenna ports then true otherwise false - bool rank_is_not_one; // If rank > 1 then true otherwise false - bool subband_label_2_bits; // false, label=1-bit, true label=2-ack_value + bool four_antenna_ports; ///< If cell has 4 antenna ports then true otherwise false + bool rank_is_not_one; ///< If rank > 1 then true otherwise false + bool subband_label_2_bits; ///< false, label=1-bit, true label=2-ack_value + uint32_t scell_index; ///< Indicates the cell/carrier the measurement belongs, use 0 for PCell uint32_t L; uint32_t N; srslte_cqi_type_t type; @@ -152,10 +153,10 @@ SRSLTE_API int srslte_cqi_value_tostring(srslte_cqi_cfg_t* cfg, srslte_cqi_value_t* value, char* buff, uint32_t buff_len); SRSLTE_API bool -srslte_cqi_periodic_send(srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type); +srslte_cqi_periodic_send(const srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type); SRSLTE_API bool -srslte_cqi_periodic_ri_send(srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type); +srslte_cqi_periodic_ri_send(const srslte_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srslte_frame_type_t frame_type); SRSLTE_API int srslte_cqi_hl_get_no_subbands(int nof_prb); diff --git a/lib/include/srslte/phy/phch/pucch.h b/lib/include/srslte/phy/phch/pucch.h index 46f0894c3..18b5c8f03 100644 --- a/lib/include/srslte/phy/phch/pucch.h +++ b/lib/include/srslte/phy/phch/pucch.h @@ -53,6 +53,8 @@ #define SRSLTE_PUCCH_FORMAT3_MAX_CARRIERS 5 #define SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1 (0.1f) +#define SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1A (0.1f) +#define SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT2 (0.1f) typedef struct { srslte_sequence_t seq_f2[SRSLTE_NOF_SF_X_FRAME]; diff --git a/lib/include/srslte/phy/ue/ue_dl.h b/lib/include/srslte/phy/ue/ue_dl.h index 39a71d75a..41b4f6d80 100644 --- a/lib/include/srslte/phy/ue/ue_dl.h +++ b/lib/include/srslte/phy/ue/ue_dl.h @@ -151,6 +151,7 @@ typedef struct { bool is_pusch_available; bool tdd_ack_multiplex; bool simul_cqi_ack; + bool simul_cqi_ack_pucch3; } srslte_pdsch_ack_t; SRSLTE_API int @@ -227,10 +228,10 @@ SRSLTE_API void srslte_ue_dl_gen_cqi_aperiodic(srslte_ue_dl_t* q, uint32_t wideband_value, srslte_uci_data_t* uci_data); -SRSLTE_API void srslte_ue_dl_gen_ack(srslte_ue_dl_t* q, - srslte_dl_sf_cfg_t* sf, - srslte_pdsch_ack_t* ack_info, - srslte_uci_data_t* uci_data); +SRSLTE_API void srslte_ue_dl_gen_ack(const srslte_cell_t* cell, + const srslte_dl_sf_cfg_t* sf, + const srslte_pdsch_ack_t* ack_info, + srslte_uci_data_t* uci_data); /* Functions used for testing purposes */ SRSLTE_API int srslte_ue_dl_find_and_decode(srslte_ue_dl_t* q, diff --git a/lib/include/srslte/phy/ue/ue_ul.h b/lib/include/srslte/phy/ue/ue_ul.h index 7703febe1..73497ee37 100644 --- a/lib/include/srslte/phy/ue/ue_ul.h +++ b/lib/include/srslte/phy/ue/ue_ul.h @@ -141,7 +141,7 @@ SRSLTE_API void srslte_ue_ul_pusch_hopping(srslte_ue_ul_t* q, SRSLTE_API int srslte_ue_ul_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, srslte_pusch_data_t* data); -SRSLTE_API int srslte_ue_ul_sr_send_tti(srslte_pucch_cfg_t* cfg, uint32_t current_tti); +SRSLTE_API int srslte_ue_ul_sr_send_tti(const srslte_pucch_cfg_t* cfg, uint32_t current_tti); SRSLTE_API bool srslte_ue_ul_gen_sr(srslte_ue_ul_cfg_t* cfg, srslte_ul_sf_cfg_t* sf, srslte_uci_data_t* uci_data, bool sr_request); diff --git a/lib/src/phy/enb/enb_dl.c b/lib/src/phy/enb/enb_dl.c index e74e1e173..602551acc 100644 --- a/lib/src/phy/enb/enb_dl.c +++ b/lib/src/phy/enb/enb_dl.c @@ -413,11 +413,11 @@ void srslte_enb_dl_gen_signal(srslte_enb_dl_t* q) } } -bool srslte_enb_dl_gen_cqi_periodic(srslte_cell_t* cell, - srslte_dl_cfg_t* dl_cfg, - uint32_t tti, - uint32_t ri, - srslte_cqi_cfg_t* cqi_cfg) +bool srslte_enb_dl_gen_cqi_periodic(const srslte_cell_t* cell, + const srslte_dl_cfg_t* dl_cfg, + uint32_t tti, + uint32_t last_ri, + srslte_cqi_cfg_t* cqi_cfg) { bool cqi_enabled = false; if (srslte_cqi_periodic_ri_send(&dl_cfg->cqi_report, tti, cell->frame_type)) { @@ -427,7 +427,7 @@ bool srslte_enb_dl_gen_cqi_periodic(srslte_cell_t* cell, cqi_cfg->type = SRSLTE_CQI_TYPE_WIDEBAND; if (dl_cfg->tm == SRSLTE_TM4) { cqi_cfg->pmi_present = true; - cqi_cfg->rank_is_not_one = ri > 0; + cqi_cfg->rank_is_not_one = last_ri > 0; } cqi_enabled = true; cqi_cfg->data_enable = cqi_enabled; @@ -435,13 +435,13 @@ bool srslte_enb_dl_gen_cqi_periodic(srslte_cell_t* cell, return cqi_enabled; } -bool srslte_enb_dl_gen_cqi_aperiodic(srslte_cell_t* cell, - srslte_dl_cfg_t* dl_cfg, - uint32_t ri, - srslte_cqi_cfg_t* cqi_cfg) +bool srslte_enb_dl_gen_cqi_aperiodic(const srslte_cell_t* cell, + const srslte_dl_cfg_t* dl_cfg, + uint32_t ri, + srslte_cqi_cfg_t* cqi_cfg) { - bool cqi_enabled = false; - srslte_cqi_report_cfg_t* cqi_report_cfg = &dl_cfg->cqi_report; + bool cqi_enabled = false; + const srslte_cqi_report_cfg_t* cqi_report_cfg = &dl_cfg->cqi_report; cqi_cfg->type = SRSLTE_CQI_TYPE_SUBBAND_HL; if (dl_cfg->tm == SRSLTE_TM3 || dl_cfg->tm == SRSLTE_TM4) { @@ -476,3 +476,62 @@ void srslte_enb_dl_save_signal(srslte_enb_dl_t* q) // printf("Saved files for tti=%d, sf=%d, cfi=%d, mcs=%d, tbs=%d, rv=%d, rnti=0x%x\n", tti, tti%10, cfi, // q->dci.mcs[0].idx, q->dci.mcs[0].tbs, rv_idx, rnti); } + +void srslte_enb_dl_gen_ack(const srslte_cell_t* cell, + const srslte_dl_sf_cfg_t* sf, + const srslte_pdsch_ack_t* ack_info, + srslte_uci_cfg_t* uci_cfg) +{ + srslte_uci_data_t uci_data = {}; + + // Copy UCI configuration + uci_data.cfg = *uci_cfg; + + srslte_ue_dl_gen_ack(cell, sf, ack_info, &uci_data); + + // Copy back the result of uci configuration + *uci_cfg = uci_data.cfg; +} + +static void get_ack_fdd(const srslte_uci_value_t* uci_value, srslte_pdsch_ack_t* pdsch_ack) +{ + uint32_t nof_tb = 1; + if (pdsch_ack->transmission_mode > SRSLTE_TM2) { + nof_tb = SRSLTE_MAX_CODEWORDS; + } + + // Second clause: When 2 CC are configured with PUCCH CS mode and SR is also requested, bundle spatial codewords + if (pdsch_ack->nof_cc == SRSLTE_PUCCH_CS_MAX_CARRIERS && uci_value->scheduling_request == true && + pdsch_ack->ack_nack_feedback_mode == SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_CS) { + for (uint32_t cc_idx = 0; cc_idx < pdsch_ack->nof_cc; cc_idx++) { + if (pdsch_ack->cc[cc_idx].m[0].present) { + if (uci_value->ack.ack_value[cc_idx] == 1) { + for (uint32_t tb = 0; tb < nof_tb; tb++) { + pdsch_ack->cc[cc_idx].m[0].value[tb] = uci_value->ack.ack_value[cc_idx]; + } + } + } + } + } else { + // By default, in FDD we just pass through all HARQ-ACK bits + uint32_t n = 0; + for (uint32_t cc_idx = 0; cc_idx < pdsch_ack->nof_cc; cc_idx++) { + for (uint32_t tb = 0; tb < nof_tb; tb++, n++) { + if (pdsch_ack->cc[cc_idx].m[0].present) { + pdsch_ack->cc[cc_idx].m[0].value[tb] = uci_value->ack.ack_value[n]; + } + } + } + } +} + +void srslte_enb_dl_get_ack(const srslte_cell_t* cell, + const srslte_uci_value_t* uci_value, + srslte_pdsch_ack_t* pdsch_ack) +{ + if (cell->frame_type == SRSLTE_FDD) { + get_ack_fdd(uci_value, pdsch_ack); + } else { + ERROR("Not implemented for TDD\n"); + } +} \ No newline at end of file diff --git a/lib/src/phy/enb/enb_ul.c b/lib/src/phy/enb/enb_ul.c index 2885b5f9c..3a2401565 100644 --- a/lib/src/phy/enb/enb_ul.c +++ b/lib/src/phy/enb/enb_ul.c @@ -177,6 +177,10 @@ 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"); + return SRSLTE_ERROR; + } // Get possible resources int nof_resources = srslte_pucch_proc_get_resources(&q->cell, cfg, &cfg->uci_cfg, NULL, n_pucch_i); @@ -244,7 +248,7 @@ int srslte_enb_ul_get_pucch(srslte_enb_ul_t* q, if (cfg->uci_cfg.is_scheduling_request_tti && srslte_uci_cfg_total_ack(&cfg->uci_cfg) && !res->detected) { cfg->uci_cfg.is_scheduling_request_tti = false; if (get_pucch(q, ul_sf, cfg, res)) { - return -1; + return SRSLTE_ERROR; } } diff --git a/lib/src/phy/phch/cqi.c b/lib/src/phy/phch/cqi.c index 4a981a84e..209e4002f 100644 --- a/lib/src/phy/phch/cqi.c +++ b/lib/src/phy/phch/cqi.c @@ -526,13 +526,13 @@ static bool ri_send(uint32_t I_cqi_pmi, uint32_t I_ri, uint32_t tti, bool is_fdd return false; } -bool srslte_cqi_periodic_ri_send(srslte_cqi_report_cfg_t* cfg, uint32_t tti, srslte_frame_type_t frame_type) +bool srslte_cqi_periodic_ri_send(const srslte_cqi_report_cfg_t* cfg, uint32_t tti, srslte_frame_type_t frame_type) { return cfg->periodic_configured && cfg->ri_idx_present && ri_send(cfg->pmi_idx, cfg->ri_idx, tti, frame_type == SRSLTE_FDD); } -bool srslte_cqi_periodic_send(srslte_cqi_report_cfg_t* cfg, uint32_t tti, srslte_frame_type_t frame_type) +bool srslte_cqi_periodic_send(const srslte_cqi_report_cfg_t* cfg, uint32_t tti, srslte_frame_type_t frame_type) { return cfg->periodic_configured && cqi_send(cfg->pmi_idx, tti, frame_type == SRSLTE_FDD); } diff --git a/lib/src/phy/phch/pucch.c b/lib/src/phy/phch/pucch.c index 866112e2d..79376ee5b 100644 --- a/lib/src/phy/phch/pucch.c +++ b/lib/src/phy/phch/pucch.c @@ -278,8 +278,8 @@ 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 { - fprintf(stderr, "Error modulating PUCCH3 bits: rnti not set\n"); - return -1; + ERROR("Error modulating PUCCH3 bits: rnti not set\n"); + return SRSLTE_ERROR; } break; default: @@ -641,8 +641,8 @@ static int decode_signal_format3(srslte_pucch_t* q, return (int)srslte_uci_decode_ack_sr_pucch3(q->llr, bits); } else { - fprintf(stderr, "Error modulating PUCCH3 bits: rnti not set\n"); - return -1; + ERROR("Error modulating PUCCH3 bits: rnti not set\n"); + return SRSLTE_ERROR; } return SRSLTE_SUCCESS; @@ -1251,4 +1251,3 @@ void srslte_pucch_rx_info(srslte_pucch_cfg_t* cfg, srslte_uci_value_t* uci_data, srslte_uci_data_info(&cfg->uci_cfg, uci_data, &str[n], str_len - n); } } - diff --git a/lib/src/phy/phch/pucch_proc.c b/lib/src/phy/phch/pucch_proc.c index 8c86672b5..d5048c1c9 100644 --- a/lib/src/phy/phch/pucch_proc.c +++ b/lib/src/phy/phch/pucch_proc.c @@ -81,6 +81,10 @@ srslte_pucch_format_t srslte_pucch_proc_select_format(const srslte_cell_t* format = SRSLTE_PUCCH_FORMAT_2B; } } + if (format == SRSLTE_PUCCH_FORMAT_ERROR) { + ERROR("Returned Error while selecting PUCCH format\n"); + } + return format; } diff --git a/lib/src/phy/ue/test/gen_ack_test.c b/lib/src/phy/ue/test/gen_ack_test.c index 6a7b4d813..27e9071a7 100644 --- a/lib/src/phy/ue/test/gen_ack_test.c +++ b/lib/src/phy/ue/test/gen_ack_test.c @@ -96,7 +96,7 @@ int fdd_tests(uint32_t max_cc) simul_cqi_ack ? "yes" : "no", pusch_enabled ? "yes" : "no"); - srslte_ue_dl_gen_ack(&ue_dl, &sf_cfg_dl, &ack_info, &uci_data); + srslte_ue_dl_gen_ack(&ue_dl.cell, &sf_cfg_dl, &ack_info, &uci_data); // Check output if (nof_cc == 1) { diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index 6f44d8352..64487e6d4 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -947,7 +947,7 @@ void srslte_ue_dl_gen_cqi_aperiodic(srslte_ue_dl_t* q, /* UE downlink procedure for reporting HARQ-ACK bits in FDD, Section 7.3 36.213 */ -static void gen_ack_fdd(srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_data) +static void gen_ack_fdd(const srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_data) { uint32_t nof_tb = 1; if (ack_info->transmission_mode > SRSLTE_TM2) { @@ -955,7 +955,7 @@ static void gen_ack_fdd(srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_dat } // Second clause: When 2 CC are configured with PUCCH CS mode and SR is also requested, bundle spatial codewords - if (ack_info->nof_cc == 2 && uci_data->value.scheduling_request == true && + if (ack_info->nof_cc == SRSLTE_PUCCH_CS_MAX_CARRIERS && uci_data->value.scheduling_request == true && ack_info->ack_nack_feedback_mode == SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_CS) { for (uint32_t cc_idx = 0; cc_idx < ack_info->nof_cc; cc_idx++) { if (ack_info->cc[cc_idx].m[0].present) { @@ -990,6 +990,9 @@ static void gen_ack_fdd(srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_dat } } } + + uint32_t total_uci_bits = + tb_count + srslte_cqi_size(&uci_data->cfg.cqi) + (uci_data->value.scheduling_request ? 1 : 0); if (ack_info->nof_cc == 1) { // If only 1 configured cell, report 1 or 2 bits depending on number of detected TB uci_data->cfg.ack[0].nof_acks = tb_count; @@ -1018,21 +1021,18 @@ static void gen_ack_fdd(srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_dat // corresponds to a PDSCH transmission or PDCCH/EPDCCH indicating downlink SPS release only on the // primary cell, then the periodic CSI report is multiplexed with HARQ-ACK on PUCCH using PUCCH format 2/2a/2b uci_data->cfg.ack[0].nof_acks = tb_count_cc0; -#if 0 - } else if (ack_info->simul_cqi_ack_pucch3 && - tb_count + srslte_cqi_size(&uci_data->cfg.cqi) + uci_data->value.scheduling_request ? 1 : 0 <= 22) { + } else if (ack_info->simul_cqi_ack_pucch3 && total_uci_bits <= 22) { // - else if the UE is configured with PUCCH format 3 and if the parameter simultaneousAckNackAndCQI-Format3- // r11 provided by higher layers is set TRUE, and if PUCCH resource is determined according to subclause // 10.1.2.2.2, and // - if the total number of bits in the subframe corresponding to HARQ-ACKs, SR (if any), and the CSI is not // larger than 22 or - // - if the total number of bits in the subframe corresponding to spatially bundled HARQ-ACKs, SR (if any), and - // the CSI is not larger than 22 then the periodic CSI report is multiplexed with HARQ-ACK on PUCCH using - // the determined PUCCH format 3 resource according to [4] + // - if the total number of bits in the subframe corresponding to spatially bundled HARQ-ACKs, SR (if any), + // and the CSI is not larger than 22 then the periodic CSI report is multiplexed with HARQ-ACK on PUCCH + // using the determined PUCCH format 3 resource according to [4] for (int i = 0; i < ack_info->nof_cc; i++) { uci_data->cfg.ack[i].nof_acks = (tb_count != 0) ? nof_tb : 0; } -#endif } else { // - otherwise, CSI is dropped uci_data->cfg.cqi.data_enable = false; @@ -1065,7 +1065,7 @@ static const uint32_t multiple_acknack[10][2] = /* UE downlink procedure for reporting HARQ-ACK bits in TDD, Section 7.3 36.213 */ -static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_data) +static void gen_ack_tdd(bool is_tdd_mode16, const srslte_pdsch_ack_t* ack_info, srslte_uci_data_t* uci_data) { uint32_t V_dai_dl = 0; @@ -1079,8 +1079,8 @@ static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte } // Arrange bits for FDD or TDD Bundling or Multiplexing. - srslte_pdsch_ack_cc_t* ack_value = &ack_info->cc[0]; - srslte_uci_cfg_ack_t* ack_cfg = &uci_data->cfg.ack[0]; + const srslte_pdsch_ack_cc_t* ack_value = &ack_info->cc[0]; + srslte_uci_cfg_ack_t* ack_cfg = &uci_data->cfg.ack[0]; uint32_t min_k = 10; @@ -1166,7 +1166,7 @@ static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte // For TDD PUSCH if (is_tdd_mode16) { - ack_info->V_dai_ul++; // Table 7.3-x + 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; @@ -1188,14 +1188,14 @@ static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte } // Transmitting on PUSCH and based on detected PDCCH } else if (ack_info->is_grant_available) { - if (ack_info->V_dai_ul != (U_dai - 1) % 4 + 1) { + if (V_dai_ul != (U_dai - 1) % 4 + 1) { bzero(uci_data->value.ack.ack_value, nof_tb); - ack_cfg->N_bundle = ack_info->V_dai_ul + 2; + ack_cfg->N_bundle = V_dai_ul + 2; } else { - ack_cfg->N_bundle = ack_info->V_dai_ul; + ack_cfg->N_bundle = V_dai_ul; } // do not transmit case - if (ack_info->V_dai_ul == 4 && U_dai == 0) { + if (V_dai_ul == 4 && U_dai == 0) { ack_cfg->nof_acks = 0; } // Transmitting on PUSCH not based on grant @@ -1224,8 +1224,8 @@ static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte if (ack_info->is_pusch_available) { if (ack_info->is_grant_available) { // Do not transmit if... - if (!(ack_info->V_dai_ul == 4 && U_dai == 0)) { - ack_cfg->nof_acks = ack_info->V_dai_ul; + if (!(V_dai_ul == 4 && U_dai == 0)) { + ack_cfg->nof_acks = V_dai_ul; } } else { ack_cfg->nof_acks = ack_info->cc[0].M; @@ -1270,13 +1270,13 @@ static void gen_ack_tdd(bool is_tdd_mode16, srslte_pdsch_ack_t* ack_info, srslte /* UE downlink procedure for reporting ACK/NACK, Section 7.3 36.213 */ -void srslte_ue_dl_gen_ack(srslte_ue_dl_t* q, - srslte_dl_sf_cfg_t* sf, - srslte_pdsch_ack_t* ack_info, - srslte_uci_data_t* uci_data) +void srslte_ue_dl_gen_ack(const srslte_cell_t* cell, + const srslte_dl_sf_cfg_t* sf, + const srslte_pdsch_ack_t* ack_info, + srslte_uci_data_t* uci_data) { - if (q->cell.frame_type == SRSLTE_FDD) { + if (cell->frame_type == SRSLTE_FDD) { gen_ack_fdd(ack_info, uci_data); } else { bool is_tdd_mode16 = sf->tdd_config.sf_config >= 1 && sf->tdd_config.sf_config <= 6; diff --git a/lib/src/phy/ue/ue_ul.c b/lib/src/phy/ue/ue_ul.c index d67d47905..0a9239734 100644 --- a/lib/src/phy/ue/ue_ul.c +++ b/lib/src/phy/ue/ue_ul.c @@ -507,7 +507,7 @@ pucch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, if (q != NULL && cfg != NULL) { srslte_uci_value_t uci_value2 = *uci_data; ///< Make copy of UCI Data, so the original input does not get altered - ret = SRSLTE_ERROR; + ret = SRSLTE_ERROR; if (!srslte_pucch_cfg_isvalid(&cfg->ul_cfg.pucch, q->cell.nof_prb)) { ERROR("Invalid PUCCH configuration\n"); @@ -551,7 +551,7 @@ pucch_encode(srslte_ue_ul_t* q, srslte_ul_sf_cfg_t* sf, srslte_ue_ul_cfg_t* cfg, } /* Returns 1 if a SR needs to be sent at current_tti given I_sr, as defined in Section 10.1 of 36.213 */ -int srslte_ue_ul_sr_send_tti(srslte_pucch_cfg_t* cfg, uint32_t current_tti) +int srslte_ue_ul_sr_send_tti(const srslte_pucch_cfg_t* cfg, uint32_t current_tti) { if (!cfg->sr_configured) { return SRSLTE_SUCCESS; diff --git a/srsenb/test/phy/enb_phy_test.cc b/srsenb/test/phy/enb_phy_test.cc index 2bb7115d7..f55abfc07 100644 --- a/srsenb/test/phy/enb_phy_test.cc +++ b/srsenb/test/phy/enb_phy_test.cc @@ -689,7 +689,7 @@ public: srslte_ue_ul_gen_sr(&ue_ul_cfg, &sf_ul_cfg, &uci_data, (bool)(sf_ul_cfg.tti % 20 == 0)); // Generate Acknowledgements - srslte_ue_dl_gen_ack(ue_dl_v[0], &sf_dl_cfg, &pdsch_ack, &uci_data); + srslte_ue_dl_gen_ack(&ue_dl_v[0]->cell, &sf_dl_cfg, &pdsch_ack, &uci_data); } srslte_pusch_data_t pusch_data = {}; diff --git a/srsue/src/phy/cc_worker.cc b/srsue/src/phy/cc_worker.cc index 11b3033d0..5f7a7d6fb 100644 --- a/srsue/src/phy/cc_worker.cc +++ b/srsue/src/phy/cc_worker.cc @@ -891,7 +891,7 @@ void cc_worker::set_uci_ack(srslte_uci_data_t* uci_data, ack_info.transmission_mode = ue_dl_cfg.cfg.tm; // Generate ACK/NACK bits - srslte_ue_dl_gen_ack(&ue_dl, &sf_cfg_dl, &ack_info, uci_data); + srslte_ue_dl_gen_ack(&ue_dl.cell, &sf_cfg_dl, &ack_info, uci_data); } /************