Refactored NR HARQ ACK feedback

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent 658b47d917
commit e3afd945bc

@ -75,7 +75,7 @@ bool make_phy_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type, srsran_
bool make_phy_tdd_cfg(const asn1::rrc_nr::tdd_ul_dl_cfg_common_s& tdd_ul_dl_cfg_common,
srsran_tdd_config_nr_t* srsran_tdd_config_nr);
bool make_phy_harq_ack_cfg(const asn1::rrc_nr::phys_cell_group_cfg_s& phys_cell_group_cfg,
srsran_ue_dl_nr_harq_ack_cfg_t* srsran_ue_dl_nr_harq_ack_cfg);
srsran_harq_ack_cfg_hl_t* srsran_ue_dl_nr_harq_ack_cfg);
bool make_phy_coreset_cfg(const asn1::rrc_nr::ctrl_res_set_s& ctrl_res_set, srsran_coreset_t* srsran_coreset);
bool make_phy_search_space_cfg(const asn1::rrc_nr::search_space_s& search_space,
srsran_search_space_t* srsran_search_space);

@ -35,16 +35,16 @@ struct phy_cfg_nr_t {
srsran_subcarrier_spacing_t scs = srsran_subcarrier_spacing_30kHz;
};
srsran_tdd_config_nr_t tdd = {};
srsran_sch_hl_cfg_nr_t pdsch = {};
srsran_sch_hl_cfg_nr_t pusch = {};
srsran_pucch_nr_hl_cfg_t pucch = {};
srsran_prach_cfg_t prach = {};
srsran_pdcch_cfg_nr_t pdcch = {};
srsran_ue_dl_nr_harq_ack_cfg_t harq_ack = {};
srsran_csi_hl_cfg_t csi = {};
srsran_carrier_nr_t carrier = {};
ssb_cfg_t ssb;
srsran_tdd_config_nr_t tdd = {};
srsran_sch_hl_cfg_nr_t pdsch = {};
srsran_sch_hl_cfg_nr_t pusch = {};
srsran_pucch_nr_hl_cfg_t pucch = {};
srsran_prach_cfg_t prach = {};
srsran_pdcch_cfg_nr_t pdcch = {};
srsran_harq_ack_cfg_hl_t harq_ack = {};
srsran_csi_hl_cfg_t csi = {};
srsran_carrier_nr_t carrier = {};
ssb_cfg_t ssb;
phy_cfg_nr_t() {}
@ -121,7 +121,7 @@ struct phy_cfg_nr_t {
/**
* @brief Get PDSCH ACK resource for a given PDSCH transmission
*/
bool get_pdsch_ack_resource(const srsran_dci_dl_nr_t& dci_dl, srsran_pdsch_ack_resource_nr_t& ack_resource) const;
bool get_pdsch_ack_resource(const srsran_dci_dl_nr_t& dci_dl, srsran_harq_ack_resource_t& ack_resource) const;
/**
* @brief Compute UCI configuration for the given slot from the pending PDSCH ACK resources, periodic CSI,

@ -0,0 +1,36 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#ifndef SRSRAN_HARQ_ACK_H
#define SRSRAN_HARQ_ACK_H
#include "srsran/phy/phch/dci_nr.h"
#include "srsran/phy/phch/harq_ack_cfg.h"
#include "srsran/phy/phch/uci_cfg_nr.h"
SRSRAN_API int srsran_harq_ack_resource(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_dci_dl_nr_t* dci_dl,
srsran_harq_ack_resource_t* pdsch_ack_resource);
SRSRAN_API int srsran_harq_ack_pack(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_data_nr_t* uci_data);
SRSRAN_API int srsran_harq_ack_unpack(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_uci_data_nr_t* uci_data,
srsran_pdsch_ack_nr_t* ack_info);
SRSRAN_API int srsran_harq_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_harq_ack_m_t* m);
SRSRAN_API uint32_t srsran_harq_ack_info(const srsran_pdsch_ack_nr_t* ack_info, char* str, uint32_t str_len);
#endif // SRSRAN_HARQ_ACK_H

@ -0,0 +1,107 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#ifndef SRSRAN_HARQ_ACK_CFG_H
#define SRSRAN_HARQ_ACK_CFG_H
#include "srsran/phy/common/phy_common_nr.h"
#include <stdbool.h>
#include <stdint.h>
/**
* @brief Maximum number of HARQ ACK feedback bits that can be carried in Uplink Control Information (UCI) message
*/
#define SRSRAN_HARQ_ACK_MAX_NOF_BITS 360
/**
* @brief Describes a HARQ ACK resource configuration
*/
typedef struct {
uint32_t scell_idx; ///< Serving cell index
uint32_t v_dai_dl; ///< Downlink Assigment Index
bool dci_format_1_1; ///< Set to true if the PDSCH transmission is triggered by a PDCCH DCI format 1_1 transmission
uint32_t k1; ///< HARQ feedback timing
uint32_t pid; ///< HARQ process identifier
uint16_t rnti;
uint32_t pucch_resource_id;
} srsran_harq_ack_resource_t;
/**
* @brief Describes a single PDSCH transmission HARQ ACK feedback
*/
typedef struct {
srsran_harq_ack_resource_t resource;
uint8_t value[SRSRAN_MAX_CODEWORDS]; // 0/1 or 2 for DTX
bool present; // set to true if there is a PDSCH on serving cell c associated with PDCCH in PDCCH monitoring occasion
// m, or there is a PDCCH indicating SPS PDSCH release on serving cell c
bool dl_bwp_changed; // set to true if PDCCH monitoring occasion m is before an active DL BWP change on serving cell c
bool ul_bwp_changed; // set to true if an active UL BWP change on the PCell and an active DL BWP change is not
// triggered by a DCI format 1_1 in PDCCH monitoring occasion m
bool second_tb_present; // set to true if two TB were detected in the PDCCH monitoring occasion m
} srsran_harq_ack_m_t;
#define SRSRAN_UCI_NR_MAX_M 10
/**
* @brief Describes a collection of PDSCH HARQ ACK feedback for a number of PDSCH transmissions within a component
* carrier
*/
typedef struct {
uint32_t M;
srsran_harq_ack_m_t m[SRSRAN_UCI_NR_MAX_M];
} srsran_harq_ack_cc_t;
/**
* @brief Describes a collection of PDSCH HARQ ACK feedback for a number of component carriers
*/
typedef struct {
srsran_harq_ack_cc_t cc[SRSRAN_MAX_CARRIERS];
uint32_t nof_cc;
bool use_pusch; // Set to true, if UCI bits are carried by PUSCH
} srsran_pdsch_ack_nr_t;
/**
* @brief Describes higher layer HARQ ACK feedback for PDSCH configuration
*/
typedef struct SRSRAN_API {
bool harq_ack_spatial_bundling_pucch; ///< Param harq-ACK-SpatialBundlingPUCCH, set to true if provided
bool harq_ack_spatial_bundling_pusch; ///< Param harq-ACK-SpatialBundlingPUSCH, set to true if provided
srsran_harq_ack_codebook_t harq_ack_codebook; ///< pdsch-HARQ-ACK-Codebook configuration
bool max_cw_sched_dci_is_2; ///< Param maxNrofCodeWordsScheduledByDCI, set to true if present and equal to 2
uint32_t dl_data_to_ul_ack[SRSRAN_MAX_NOF_DL_DATA_TO_UL];
uint32_t nof_dl_data_to_ul_ack;
} srsran_harq_ack_cfg_hl_t;
/**
* @brief Describes HARQ ACK bit configuration for UCI encoding/decoding
* @note if tb0 and tb1 are false, the HARQ ACK bit is not used
* @note if tb0 and tb1 are true, the HARQ ACK feedback are bundled, the actual HARQ ACK feedback bit is the result of
* the AND operation
*/
typedef struct SRSRAN_API {
bool tb0; ///< Set to true if this ACK bit is mapped into TB index 0
bool tb1; ///< Set to true if this ACK bit is mapped into TB index 1
uint32_t cc_idx; ///< Component carrier index
uint32_t m_idx; ///< M resource index for packing/unpacking
uint32_t pid; ///< HARQ process identifier
} srsran_harq_ack_bit_t;
/**
* @brief Describes HARQ ACK feedback configuration for UCI encoding/decoding
*/
typedef struct SRSRAN_API {
srsran_harq_ack_bit_t bits[SRSRAN_HARQ_ACK_MAX_NOF_BITS]; ///< HARQ-ACK feedback bits
uint32_t count; ///< Number of ACK bits
} srsran_harq_ack_cfg_t;
#endif // SRSRAN_HARQ_ACK_CFG_H

@ -14,6 +14,7 @@
#define SRSRAN_UCI_CFG_NR_H
#include "csi_cfg.h"
#include "harq_ack_cfg.h"
#include "srsran/phy/common/phy_common_nr.h"
#include <stdbool.h>
#include <stdint.h>
@ -24,11 +25,6 @@
*/
#define SRSRAN_UCI_NR_MAX_NOF_BITS 1706U
/**
* @brief Maximum number of HARQ ACK feedback bits that can be carried in Uplink Control Information (UCI) message
*/
#define SRSRAN_UCI_NR_MAX_ACK_BITS 360
/**
* @brief Maximum number of Channel State Information part 1 (CSI1) bits that can be carried in Uplink Control
* Information (UCI) message
@ -72,7 +68,7 @@ typedef struct {
*/
typedef struct SRSRAN_API {
/// Common Parameters
uint32_t o_ack; ///< Number of HARQ-ACK bits
srsran_harq_ack_cfg_t ack; ///< HARQ-ACK configuration
uint32_t o_sr; ///< Number of SR bits
srsran_csi_report_cfg_t csi[SRSRAN_CSI_MAX_NOF_REPORT]; ///< CSI report configuration
uint32_t nof_csi; ///< Number of CSI reports
@ -86,9 +82,9 @@ typedef struct SRSRAN_API {
* @brief Uplink Control Information (UCI) message packed information
*/
typedef struct SRSRAN_API {
uint8_t ack[SRSRAN_UCI_NR_MAX_ACK_BITS]; ///< HARQ ACK feedback bits
uint32_t sr; ///< Number of positive SR
srsran_csi_report_value_t csi[SRSRAN_CSI_MAX_NOF_REPORT]; ///< Packed CSI report values
uint8_t ack[SRSRAN_HARQ_ACK_MAX_NOF_BITS]; ///< HARQ ACK feedback bits
uint32_t sr; ///< Number of positive SR
srsran_csi_report_value_t csi[SRSRAN_CSI_MAX_NOF_REPORT]; ///< Packed CSI report values
bool valid; ///< Indicates whether the message has been decoded successfully, ignored in the transmitter
} srsran_uci_value_nr_t;

@ -38,49 +38,6 @@ typedef struct SRSRAN_API {
float pdcch_dmrs_epre_thr;
} srsran_ue_dl_nr_args_t;
typedef struct {
uint32_t scell_idx; ///< Serving cell index
uint32_t v_dai_dl; ///< Downlink Assigment Index
bool dci_format_1_1; ///< Set to true if the PDSCH transmission is triggered by a PDCCH DCI format 1_1 transmission
uint32_t k1; ///< HARQ feedback timing
uint16_t rnti;
uint32_t pucch_resource_id;
} srsran_pdsch_ack_resource_nr_t;
typedef struct {
srsran_pdsch_ack_resource_nr_t resource;
uint8_t value[SRSRAN_MAX_CODEWORDS]; // 0/1 or 2 for DTX
bool present; // set to true if there is a PDSCH on serving cell c associated with PDCCH in PDCCH monitoring occasion
// m, or there is a PDCCH indicating SPS PDSCH release on serving cell c
bool dl_bwp_changed; // set to true if PDCCH monitoring occasion m is before an active DL BWP change on serving cell c
bool ul_bwp_changed; // set to true if an active UL BWP change on the PCell and an active DL BWP change is not
// triggered by a DCI format 1_1 in PDCCH monitoring occasion m
bool second_tb_present; // set to true if two TB were detected in the PDCCH monitoring occasion m
} srsran_pdsch_ack_m_nr_t;
#define SRSRAN_UCI_NR_MAX_M 10
typedef struct {
uint32_t M;
srsran_pdsch_ack_m_nr_t m[SRSRAN_UCI_NR_MAX_M];
} srsran_pdsch_ack_cc_nr_t;
typedef struct {
srsran_pdsch_ack_cc_nr_t cc[SRSRAN_MAX_CARRIERS];
uint32_t nof_cc;
bool use_pusch; // Set to true, if UCI bits are carried by PUSCH
} srsran_pdsch_ack_nr_t;
typedef struct SRSRAN_API {
bool harq_ack_spatial_bundling_pucch; ///< Param harq-ACK-SpatialBundlingPUCCH, set to true if provided
bool harq_ack_spatial_bundling_pusch; ///< Param harq-ACK-SpatialBundlingPUSCH, set to true if provided
srsran_harq_ack_codebook_t harq_ack_codebook; ///< pdsch-HARQ-ACK-Codebook configuration
bool max_cw_sched_dci_is_2; ///< Param maxNrofCodeWordsScheduledByDCI, set to true if present and equal to 2
uint32_t dl_data_to_ul_ack[SRSRAN_MAX_NOF_DL_DATA_TO_UL];
uint32_t nof_dl_data_to_ul_ack;
} srsran_ue_dl_nr_harq_ack_cfg_t;
typedef struct SRSRAN_API {
srsran_dci_ctx_t dci_ctx;
srsran_dmrs_pdcch_measure_t measure;
@ -161,18 +118,6 @@ SRSRAN_API int srsran_ue_dl_nr_pdsch_info(const srsran_ue_dl_nr_t* q,
char* str,
uint32_t str_len);
SRSRAN_API int srsran_ue_dl_nr_pdsch_ack_resource(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg,
const srsran_dci_dl_nr_t* dci_dl,
srsran_pdsch_ack_resource_nr_t* pdsch_ack_resource);
SRSRAN_API int srsran_ue_dl_nr_gen_ack(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_data_nr_t* uci_data);
SRSRAN_API int srsran_ue_dl_nr_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_pdsch_ack_m_nr_t* m);
SRSRAN_API uint32_t srsran_ue_dl_nr_ack_info(const srsran_pdsch_ack_nr_t* ack_info, char* str, uint32_t str_len);
SRSRAN_API
int srsran_ue_dl_nr_csi_measure_trs(const srsran_ue_dl_nr_t* q,
const srsran_slot_cfg_t* slot_cfg,

@ -85,6 +85,7 @@ extern "C" {
#include "srsran/phy/phch/csi.h"
#include "srsran/phy/phch/dci.h"
#include "srsran/phy/phch/dci_nr.h"
#include "srsran/phy/phch/harq_ack.h"
#include "srsran/phy/phch/pbch.h"
#include "srsran/phy/phch/pbch_nr.h"
#include "srsran/phy/phch/pcfich.h"

@ -342,10 +342,10 @@ bool make_phy_tdd_cfg(const tdd_ul_dl_cfg_common_s& tdd_ul_dl_cfg_common,
return true;
}
bool make_phy_harq_ack_cfg(const phys_cell_group_cfg_s& phys_cell_group_cfg,
srsran_ue_dl_nr_harq_ack_cfg_t* in_srsran_ue_dl_nr_harq_ack_cfg)
bool make_phy_harq_ack_cfg(const phys_cell_group_cfg_s& phys_cell_group_cfg,
srsran_harq_ack_cfg_hl_t* in_srsran_ue_dl_nr_harq_ack_cfg)
{
srsran_ue_dl_nr_harq_ack_cfg_t srsran_ue_dl_nr_harq_ack_cfg = {};
srsran_harq_ack_cfg_hl_t srsran_ue_dl_nr_harq_ack_cfg = {};
switch (phys_cell_group_cfg.pdsch_harq_ack_codebook) {
case phys_cell_group_cfg_s::pdsch_harq_ack_codebook_opts::dynamic_value:
srsran_ue_dl_nr_harq_ack_cfg.harq_ack_codebook = srsran_pdsch_harq_ack_codebook_dynamic;

@ -274,10 +274,10 @@ bool phy_cfg_nr_t::get_pusch_cfg(const srsran_slot_cfg_t& slot_cfg,
SRSRAN_SUCCESS;
}
bool phy_cfg_nr_t::get_pdsch_ack_resource(const srsran_dci_dl_nr_t& dci_dl,
srsran_pdsch_ack_resource_nr_t& ack_resource) const
bool phy_cfg_nr_t::get_pdsch_ack_resource(const srsran_dci_dl_nr_t& dci_dl,
srsran_harq_ack_resource_t& ack_resource) const
{
return srsran_ue_dl_nr_pdsch_ack_resource(&harq_ack, &dci_dl, &ack_resource) == SRSRAN_SUCCESS;
return srsran_harq_ack_resource(&harq_ack, &dci_dl, &ack_resource) == SRSRAN_SUCCESS;
}
bool phy_cfg_nr_t::get_uci_cfg(const srsran_slot_cfg_t& slot_cfg,

@ -185,7 +185,7 @@ static int gnb_ul_decode_pucch_format1(srsran_gnb_ul_t* q,
uint8_t b[SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS] = {};
// Set ACK bits
uint32_t nof_bits = SRSRAN_MIN(SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS, uci_cfg->o_ack);
uint32_t nof_bits = SRSRAN_MIN(SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS, uci_cfg->ack.count);
// Set SR bits
// For a positive SR transmission using PUCCH format 1, the UE transmits the PUCCH as described in [4, TS

@ -0,0 +1,346 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#include "srsran/phy/phch/harq_ack.h"
#include "srsran/phy/utils/debug.h"
#include "srsran/phy/utils/vector.h"
// Implements TS 38.213 Table 9.1.3-1: Value of counter DAI in DCI format 1_0 and of counter DAI or total DAI DCI format
// 1_1
static uint32_t ue_dl_nr_V_DL_DAI(uint32_t dai)
{
return dai + 1;
}
static int harq_ack_gen_ack_type2(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_cfg_nr_t* uci_cfg)
{
bool harq_ack_spatial_bundling =
ack_info->use_pusch ? cfg->harq_ack_spatial_bundling_pusch : cfg->harq_ack_spatial_bundling_pucch;
uint32_t m = 0; // PDCCH with DCI format 1_0 or DCI format 1_1 monitoring occasion index: lower index corresponds to
// earlier PDCCH with DCI format 1_0 or DCI format 1_1 monitoring occasion
uint32_t j = 0;
uint32_t V_temp = 0;
uint32_t V_temp2 = 0;
uint32_t N_DL_cells = ack_info->nof_cc; // number of serving cells configured by higher layers for the UE
// Initialise ACK bits
SRSRAN_MEM_ZERO(uci_cfg->ack.bits, srsran_harq_ack_bit_t, SRSRAN_HARQ_ACK_MAX_NOF_BITS);
// The following code follows the exact pseudo-code provided in TS 38.213 9.1.3.1 Type-2 HARQ-ACK codebook ...
while (m < SRSRAN_UCI_NR_MAX_M) {
uint32_t c = 0; // serving cell index: lower indexes correspond to lower RRC indexes of corresponding cell
while (c < N_DL_cells) {
// Get ACK information of serving cell c for the PDCH monitoring occasion m
const srsran_harq_ack_m_t* ack = &ack_info->cc[c].m[m];
// Get DAI counter value
uint32_t V_DL_CDAI = ue_dl_nr_V_DL_DAI(ack->resource.v_dai_dl);
uint32_t V_DL_TDAI = ack->resource.dci_format_1_1 ? ue_dl_nr_V_DL_DAI(ack->resource.v_dai_dl) : UINT32_MAX;
// Get ACK values
srsran_harq_ack_bit_t ack_tb0 = {};
ack_tb0.tb0 = true;
ack_tb0.cc_idx = c;
ack_tb0.m_idx = m;
ack_tb0.pid = ack->resource.pid;
srsran_harq_ack_bit_t ack_tb1 = {};
ack_tb1.tb1 = true;
ack_tb1.cc_idx = c;
ack_tb1.m_idx = m;
ack_tb1.pid = ack->resource.pid;
// For a PDCCH monitoring occasion with DCI format 1_0 or DCI format 1_1 in the active DL BWP of a serving cell,
// when a UE receives a PDSCH with one transport block and the value of maxNrofCodeWordsScheduledByDCI is 2, the
// HARQ-ACK information is associated with the first transport block and the UE generates a NACK for the second
// transport block if harq-ACK-SpatialBundlingPUCCH is not provided and generates HARQ-ACK information with
// value of ACK for the second transport block if harq-ACK-SpatialBundlingPUCCH is provided.
if (cfg->max_cw_sched_dci_is_2 && !ack->second_tb_present) {
ack_tb1.tb1 = false;
}
// if PDCCH monitoring occasion m is before an active DL BWP change on serving cell c or an active UL
// BWP change on the PCell and an active DL BWP change is not triggered by a DCI format 1_1 in PDCCH
// monitoring occasion m
if (ack->dl_bwp_changed || ack->ul_bwp_changed) {
c = c + 1;
} else {
if (ack->present) {
// Load ACK resource data into UCI info
uci_cfg->pucch.resource_id = ack_info->cc[c].m[m].resource.pucch_resource_id;
uci_cfg->pucch.rnti = ack_info->cc[c].m[m].resource.rnti;
if (V_DL_CDAI <= V_temp) {
j = j + 1;
}
V_temp = V_DL_CDAI;
if (V_DL_TDAI == UINT32_MAX) {
V_temp2 = V_DL_CDAI;
} else {
V_temp2 = V_DL_TDAI;
}
// if harq-ACK-SpatialBundlingPUCCH is not provided and m is a monitoring occasion for PDCCH with DCI format
// 1_0 or DCI format 1_1 and the UE is configured by maxNrofCodeWordsScheduledByDCI with reception of two
// transport blocks for at least one configured DL BWP of at least one serving cell,
if (!harq_ack_spatial_bundling && cfg->max_cw_sched_dci_is_2) {
uci_cfg->ack.bits[8 * j + 2 * (V_DL_CDAI - 1) + 0] = ack_tb0;
uci_cfg->ack.bits[8 * j + 2 * (V_DL_CDAI - 1) + 1] = ack_tb1;
}
// elseif harq-ACK-SpatialBundlingPUCCH is provided to the UE and m is a monitoring occasion for
// PDCCH with DCI format 1_1 and the UE is configured by maxNrofCodeWordsScheduledByDCI with
// reception of two transport blocks in at least one configured DL BWP of a serving cell,
else if (harq_ack_spatial_bundling && ack->resource.dci_format_1_1 && cfg->max_cw_sched_dci_is_2) {
ack_tb0.tb1 = true;
uci_cfg->ack.bits[4 * j + (V_DL_CDAI - 1)] = ack_tb0;
}
// else
else {
uci_cfg->ack.bits[4 * j + (V_DL_CDAI - 1)] = ack_tb0;
}
}
c = c + 1;
}
}
m = m + 1;
}
if (V_temp2 < V_temp) {
j = j + 1;
}
// if harq-ACK-SpatialBundlingPUCCH is not provided to the UE and the UE is configured by
// maxNrofCodeWordsScheduledByDCI with reception of two transport blocks for at least one configured DL BWP of a
// serving cell,
if (!harq_ack_spatial_bundling && cfg->max_cw_sched_dci_is_2) {
uci_cfg->ack.count = 2 * (4 * j + V_temp2);
} else {
uci_cfg->ack.count = 4 * j + V_temp2;
}
// Implement here SPS PDSCH reception
// ...
return SRSRAN_SUCCESS;
}
static int harq_ack_k1(const srsran_harq_ack_cfg_hl_t* cfg, const srsran_dci_dl_nr_t* dci_dl)
{
// For DCI format 1_0, the PDSCH-to-HARQ_feedback timing indicator field values map to {1, 2, 3, 4, 5, 6, 7, 8}
if (dci_dl->ctx.format == srsran_dci_format_nr_1_0) {
return (int)dci_dl->harq_feedback + 1;
}
// For DCI format 1_1, if present, the PDSCH-to-HARQ_feedback timing indicator field values map to values for a set of
// number of slots provided by dl-DataToUL-ACK as defined in Table 9.2.3-1.
if (dci_dl->harq_feedback >= SRSRAN_MAX_NOF_DL_DATA_TO_UL || dci_dl->harq_feedback >= cfg->nof_dl_data_to_ul_ack) {
ERROR("Out-of-range PDSCH-to-HARQ feedback index (%d, max %d)", dci_dl->harq_feedback, cfg->nof_dl_data_to_ul_ack);
return SRSRAN_ERROR;
}
return (int)cfg->dl_data_to_ul_ack[dci_dl->harq_feedback];
}
int srsran_harq_ack_resource(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_dci_dl_nr_t* dci_dl,
srsran_harq_ack_resource_t* pdsch_ack_resource)
{
if (cfg == NULL || dci_dl == NULL || pdsch_ack_resource == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Calculate Data to UL ACK timing k1
int k1 = harq_ack_k1(cfg, dci_dl);
if (k1 < SRSRAN_ERROR) {
ERROR("Error calculating K1");
return SRSRAN_ERROR;
}
// Fill PDSCH resource
pdsch_ack_resource->dci_format_1_1 = (dci_dl->ctx.format == srsran_dci_format_nr_1_1);
pdsch_ack_resource->k1 = k1;
pdsch_ack_resource->v_dai_dl = dci_dl->dai;
pdsch_ack_resource->rnti = dci_dl->ctx.rnti;
pdsch_ack_resource->pucch_resource_id = dci_dl->pucch_resource;
pdsch_ack_resource->pid = dci_dl->pid;
return SRSRAN_SUCCESS;
}
int srsran_harq_ack_gen_uci_cfg(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_cfg_nr_t* uci_cfg)
{
// Check inputs
if (cfg == NULL || ack_info == NULL || uci_cfg == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// According TS 38.213 9.1.2 Type-1 HARQ-ACK codebook determination
if (cfg->harq_ack_codebook == srsran_pdsch_harq_ack_codebook_semi_static) {
// This clause applies if the UE is configured with pdsch-HARQ-ACK-Codebook = semi-static.
ERROR("Type-1 HARQ-ACK codebook determination is NOT implemented");
return SRSRAN_ERROR;
}
// According TS 38.213 9.1.3 Type-2 HARQ-ACK codebook determination
if (cfg->harq_ack_codebook == srsran_pdsch_harq_ack_codebook_dynamic) {
// This clause applies if the UE is configured with pdsch-HARQ-ACK-Codebook = dynamic.
return harq_ack_gen_ack_type2(cfg, ack_info, uci_cfg);
}
ERROR("No HARQ-ACK codebook determination is NOT implemented");
return SRSRAN_ERROR;
}
int srsran_harq_ack_pack(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_data_nr_t* uci_data)
{
// Check inputs
if (cfg == NULL || ack_info == NULL || uci_data == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Generate configuration
if (srsran_harq_ack_gen_uci_cfg(cfg, ack_info, &uci_data->cfg) < SRSRAN_SUCCESS) {
return SRSRAN_ERROR;
}
// Actual packing
for (uint32_t i = 0; i < uci_data->cfg.ack.count; i++) {
srsran_harq_ack_bit_t* ack_bit = &uci_data->cfg.ack.bits[i];
// Skip bit if no TB is used
if (!ack_bit->tb0 && !ack_bit->tb1) {
uci_data->value.ack[i] = 0;
continue;
}
// Only TB0
if (ack_bit->tb0 && !ack_bit->tb1) {
uci_data->value.ack[i] = ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[0];
continue;
}
// Only TB1
if (!ack_bit->tb0 && ack_bit->tb1) {
uci_data->value.ack[i] = ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[1];
continue;
}
// Both TB with bundling
uci_data->value.ack[i] = ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[0];
uci_data->value.ack[i] &= ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[1];
}
return SRSRAN_SUCCESS;
}
int srsran_harq_ack_unpack(const srsran_harq_ack_cfg_hl_t* cfg,
const srsran_uci_data_nr_t* uci_data,
srsran_pdsch_ack_nr_t* ack_info)
{
// Check inputs
if (cfg == NULL || ack_info == NULL || uci_data == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Actual packing
for (uint32_t i = 0; i < uci_data->cfg.ack.count; i++) {
const srsran_harq_ack_bit_t* ack_bit = &uci_data->cfg.ack.bits[i];
// Extract TB0
if (ack_bit->tb0) {
ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[0] = uci_data->value.ack[i];
}
// Extract TB1
if (ack_bit->tb1) {
ack_info->cc[ack_bit->cc_idx].m[ack_bit->m_idx].value[1] = uci_data->value.ack[i];
}
}
return SRSRAN_SUCCESS;
}
int srsran_harq_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_harq_ack_m_t* m)
{
// Check inputs
if (ack_info == NULL || m == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Protect SCell index and extract information
if (m->resource.scell_idx >= SRSRAN_MAX_CARRIERS) {
ERROR("Serving cell index (%d) exceeds maximum", m->resource.scell_idx);
return SRSRAN_ERROR;
}
srsran_harq_ack_cc_t* cc = &ack_info->cc[m->resource.scell_idx];
// Find insertion index
uint32_t idx = cc->M; // Append at the end by default
for (uint32_t i = 0; i < cc->M; i++) {
if (cc->m[i].resource.k1 < m->resource.k1) {
idx = i;
break;
}
}
// Increment count
cc->M += 1;
// Make space for insertion
for (uint32_t i = cc->M - 1; i > idx; i--) {
cc->m[i] = cc->m[i - 1];
}
// Actual insertion
cc->m[idx] = *m;
return SRSRAN_SUCCESS;
}
uint32_t srsran_harq_ack_info(const srsran_pdsch_ack_nr_t* ack_info, char* str, uint32_t str_len)
{
uint32_t len = 0;
if (ack_info == NULL || str == NULL) {
return 0;
}
// Print base info
len = srsran_print_check(
str, str_len, len, "use_pusch=%c nof_cc=%d\n", ack_info->use_pusch ? 'y' : 'n', ack_info->nof_cc);
// Iterate all carriers
for (uint32_t cc = 0; cc < ack_info->nof_cc; cc++) {
len = srsran_print_check(str, str_len, len, " CC %d: M=%d\n", cc, ack_info->cc[cc].M);
for (uint32_t m = 0; m < ack_info->cc[cc].M; m++) {
if (ack_info->cc[cc].m[m].present) {
len = srsran_print_check(str,
str_len,
len,
" m %d: k1=%d dai=%d ack=%d\n",
m,
ack_info->cc[cc].m[m].resource.k1,
ack_info->cc[cc].m[m].resource.v_dai_dl,
ack_info->cc[cc].m[m].value[0]);
}
}
}
return len;
}

@ -229,7 +229,7 @@ static uint32_t phch_cfg_uci_to_str(const srsran_uci_cfg_nr_t* uci, char* str, u
len = srsran_print_check(str, str_len, len, " beta_csi_part1_offset=%.2f\n", uci->pusch.beta_csi1_offset);
len = srsran_print_check(str, str_len, len, " beta_csi_part2_offset=%.2f\n", uci->pusch.beta_csi1_offset);
len = srsran_print_check(str, str_len, len, " o_csi1=%d\n", srsran_csi_part1_nof_bits(uci->csi, uci->nof_csi));
len = srsran_print_check(str, str_len, len, " o_ack=%d\n", uci->o_ack);
len = srsran_print_check(str, str_len, len, " o_ack=%d\n", uci->ack.count);
return len;
}

@ -374,7 +374,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
// if the number of HARQ-ACK information bits to be transmitted on PUSCH is 0, 1 or 2 bits
uint32_t G_ack_rvd = 0;
if (cfg->o_ack <= 2) {
if (cfg->ack.count <= 2) {
// the number of reserved resource elements for potential HARQ-ACK transmission is calculated according to Clause
// 6.3.2.4.2.1, by setting O_ACK = 2 ;
G_ack_rvd = srsran_uci_nr_pusch_ack_nof_bits(&cfg->pusch, 2);
@ -412,7 +412,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
uint32_t ack_d = 0;
uint32_t ack_m_re_count = 0;
if (l >= l1) {
if (cfg->o_ack <= 2 && m_ack_count < G_ack_rvd) {
if (cfg->ack.count <= 2 && m_ack_count < G_ack_rvd) {
ack_d = 1;
ack_m_re_count = M_ulsch_sc;
if (G_ack_rvd - m_ack_count < M_uci_sc * Nl * Qm) {
@ -498,7 +498,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
// Set reserved bits only if there are ACK bits
if (reserved) {
if (cfg->o_ack > 0) {
if (cfg->ack.count > 0) {
for (uint32_t j = 0; j < Nl * Qm; j++) {
pos_ack[m_ack_count++] = m_all_count + j;
}
@ -531,7 +531,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
q->G_ulsch = m_ulsch_count;
// Assert Number of bits
if (G_ack_rvd != 0 && G_ack_rvd != m_ack_count && cfg->o_ack > 0) {
if (G_ack_rvd != 0 && G_ack_rvd != m_ack_count && cfg->ack.count > 0) {
ERROR("Not matched %d!=%d", G_ack_rvd, m_ack_count);
}
if (G_ack != 0 && G_ack != m_ack_count) {
@ -551,7 +551,7 @@ static int pusch_nr_gen_mux_uci(srsran_pusch_nr_t* q, const srsran_uci_cfg_nr_t*
DEBUG("UL-SCH bit positions:");
srsran_vec_fprint_i(stdout, (int*)pos_ulsch, m_ulsch_count);
}
if (m_ack_count != 0 && cfg->o_ack > 0) {
if (m_ack_count != 0 && cfg->ack.count > 0) {
DEBUG("HARQ-ACK bit positions [%d]:", m_ack_count);
srsran_vec_fprint_i(stdout, (int*)pos_ack, m_ack_count);
}
@ -662,7 +662,7 @@ static inline int pusch_nr_encode_codeword(srsran_pusch_nr_t* q,
srsran_sequence_apply_bit(b, q->b[tb->cw_idx], nof_bits, cinit);
// Special Scrambling condition
if (cfg->uci.o_ack <= 2) {
if (cfg->uci.ack.count <= 2) {
for (uint32_t i = 0; i < q->G_ack; i++) {
uint32_t idx = q->pos_ack[i];
if (q->g_ack[i] == (uint8_t)UCI_BIT_REPETITION) {
@ -793,7 +793,7 @@ static inline int pusch_nr_decode_codeword(srsran_pusch_nr_t* q,
uint32_t nof_bits = tb->nof_re * srsran_mod_bits_x_symbol(tb->mod);
// Calculate HARQ-ACK bits
int n = srsran_uci_nr_pusch_ack_nof_bits(&cfg->uci.pusch, cfg->uci.o_ack);
int n = srsran_uci_nr_pusch_ack_nof_bits(&cfg->uci.pusch, cfg->uci.ack.count);
if (n < SRSRAN_SUCCESS) {
ERROR("Calculating G_ack");
return SRSRAN_ERROR;

@ -824,9 +824,9 @@ static float ra_ul_beta_offset_ack_semistatic(const srsran_beta_offsets_t* beta_
// Select Beta Offset index from the number of HARQ-ACK bits
uint32_t beta_offset_index = beta_offsets->ack_index1;
if (uci_cfg->o_ack > 11) {
if (uci_cfg->ack.count > 11) {
beta_offset_index = beta_offsets->ack_index3;
} else if (uci_cfg->o_ack > 2) {
} else if (uci_cfg->ack.count > 2) {
beta_offset_index = beta_offsets->ack_index2;
}
@ -834,7 +834,7 @@ static float ra_ul_beta_offset_ack_semistatic(const srsran_beta_offsets_t* beta_
if (beta_offset_index >= RA_NR_BETA_OFFSET_HARQACK_SIZE) {
ERROR("Beta offset index for HARQ-ACK (%d) for O_ack=%d exceeds table size (%d)",
beta_offset_index,
uci_cfg->o_ack,
uci_cfg->ack.count,
RA_NR_BETA_OFFSET_HARQACK_SIZE);
return NAN;
}
@ -1022,8 +1022,8 @@ int srsran_ra_ul_set_grant_uci_nr(const srsran_carrier_nr_t* carrier,
// Calculate number of UCI encoded bits
int Gack = 0;
if (pusch_cfg->uci.o_ack > 2) {
Gack = srsran_uci_nr_pusch_ack_nof_bits(&pusch_cfg->uci.pusch, pusch_cfg->uci.o_ack);
if (pusch_cfg->uci.ack.count > 2) {
Gack = srsran_uci_nr_pusch_ack_nof_bits(&pusch_cfg->uci.pusch, pusch_cfg->uci.ack.count);
if (Gack < SRSRAN_SUCCESS) {
ERROR("Error calculating Qdack");
return SRSRAN_ERROR;

@ -420,7 +420,7 @@ int srsran_ra_ul_nr_pucch_format_2_3_min_prb(const srsran_pucch_nr_resource_t* r
}
// Compute total number of UCI bits
uint32_t O_total = uci_cfg->o_ack + uci_cfg->o_sr + srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi);
uint32_t O_total = uci_cfg->ack.count + uci_cfg->o_sr + srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi);
// Add CRC bits if any
O_total += srsran_uci_nr_crc_len(O_total);
@ -530,7 +530,7 @@ int srsran_ra_ul_nr_pucch_resource(const srsran_pucch_nr_hl_cfg_t* pucch_cfg,
// - At least one positive SR
// - up to 2 HARQ-ACK
// - No CSI report
if (uci_cfg->pucch.sr_positive_present > 0 && uci_cfg->o_ack <= SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS &&
if (uci_cfg->pucch.sr_positive_present > 0 && uci_cfg->ack.count <= SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS &&
uci_cfg->nof_csi == 0) {
uint32_t sr_resource_id = uci_cfg->pucch.sr_resource_id;
if (sr_resource_id >= SRSRAN_PUCCH_MAX_NOF_SR_RESOURCES) {
@ -554,7 +554,7 @@ int srsran_ra_ul_nr_pucch_resource(const srsran_pucch_nr_hl_cfg_t* pucch_cfg,
// - Irrelevant SR opportunities
// - More than 2 HARQ-ACK
// - No CSI report
if (uci_cfg->o_sr > 0 && uci_cfg->o_ack > SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS && uci_cfg->nof_csi == 0) {
if (uci_cfg->o_sr > 0 && uci_cfg->ack.count > SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS && uci_cfg->nof_csi == 0) {
return ra_ul_nr_pucch_resource_hl(pucch_cfg, O_uci, uci_cfg->pucch.resource_id, resource);
}
@ -562,7 +562,7 @@ int srsran_ra_ul_nr_pucch_resource(const srsran_pucch_nr_hl_cfg_t* pucch_cfg,
// - Irrelevant SR opportunities
// - No HARQ-ACK
// - Single periodic CSI report
if (uci_cfg->o_ack == 0 && uci_cfg->nof_csi == 1 && uci_cfg->csi[0].type == SRSRAN_CSI_REPORT_TYPE_PERIODIC) {
if (uci_cfg->ack.count == 0 && uci_cfg->nof_csi == 1 && uci_cfg->csi[0].type == SRSRAN_CSI_REPORT_TYPE_PERIODIC) {
*resource = uci_cfg->csi[0].pucch_resource;
return SRSRAN_SUCCESS;
}

@ -177,13 +177,14 @@ static int test_pucch_format2(srsran_pucch_nr_t* pucch,
resource.start_symbol_idx += starting_symbol_stride) {
srsran_uci_cfg_nr_t uci_cfg = {};
for (uci_cfg.o_ack = SRSRAN_PUCCH_NR_FORMAT2_MIN_NOF_BITS; uci_cfg.o_ack <= SRSRAN_UCI_NR_MAX_ACK_BITS;
uci_cfg.o_ack++) {
for (uci_cfg.ack.count = SRSRAN_PUCCH_NR_FORMAT2_MIN_NOF_BITS;
uci_cfg.ack.count <= SRSRAN_HARQ_ACK_MAX_NOF_BITS;
uci_cfg.ack.count++) {
srsran_uci_value_nr_t uci_value = {};
// Maximum code rate is reserved
uint32_t max_code_rate_end = SRSRAN_PUCCH_NR_MAX_CODE_RATE;
if (uci_cfg.o_ack == 11) {
if (uci_cfg.ack.count == 11) {
max_code_rate_end = SRSRAN_PUCCH_NR_MAX_CODE_RATE - 1;
}
@ -198,7 +199,7 @@ static int test_pucch_format2(srsran_pucch_nr_t* pucch,
for (resource.starting_prb = 0; resource.starting_prb < (carrier.nof_prb - resource.nof_prb);
resource.starting_prb += starting_prb_stride) {
// Generate ACKs
for (uint32_t i = 0; i < uci_cfg.o_ack; i++) {
for (uint32_t i = 0; i < uci_cfg.ack.count; i++) {
uci_value.ack[i] = (uint8_t)srsran_random_uniform_int_dist(random_gen, 0, 1);
}
@ -234,7 +235,7 @@ static int test_pucch_format2(srsran_pucch_nr_t* pucch,
TESTASSERT(uci_value_rx.valid == true);
// Check received ACKs
for (uint32_t i = 0; i < uci_cfg.o_ack; i++) {
for (uint32_t i = 0; i < uci_cfg.ack.count; i++) {
TESTASSERT(uci_value.ack[i] == uci_value_rx.ack[i]);
}
}

@ -225,7 +225,7 @@ int main(int argc, char** argv)
// Generate HARQ ACK bits
if (nof_ack_bits > 0) {
pusch_cfg.uci.o_ack = nof_ack_bits;
pusch_cfg.uci.ack.count = nof_ack_bits;
for (uint32_t i = 0; i < nof_ack_bits; i++) {
data_tx.uci.ack[i] = (uint8_t)srsran_random_uniform_int_dist(rand_gen, 0, 1);
}

@ -156,8 +156,8 @@ static int uci_nr_pack_ack_sr(const srsran_uci_cfg_nr_t* cfg, const srsran_uci_v
int A = 0;
// Append ACK bits
srsran_vec_u8_copy(&sequence[A], value->ack, cfg->o_ack);
A += cfg->o_ack;
srsran_vec_u8_copy(&sequence[A], value->ack, cfg->ack.count);
A += cfg->ack.count;
// Append SR bits
uint8_t* bits = &sequence[A];
@ -177,8 +177,8 @@ static int uci_nr_unpack_ack_sr(const srsran_uci_cfg_nr_t* cfg, uint8_t* sequenc
int A = 0;
// Append ACK bits
srsran_vec_u8_copy(value->ack, &sequence[A], cfg->o_ack);
A += cfg->o_ack;
srsran_vec_u8_copy(value->ack, &sequence[A], cfg->ack.count);
A += cfg->ack.count;
// Append SR bits
uint8_t* bits = &sequence[A];
@ -198,8 +198,8 @@ static int uci_nr_pack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, const srsran_u
int A = 0;
// Append ACK bits
srsran_vec_u8_copy(&sequence[A], value->ack, cfg->o_ack);
A += cfg->o_ack;
srsran_vec_u8_copy(&sequence[A], value->ack, cfg->ack.count);
A += cfg->ack.count;
// Append SR bits
uint8_t* bits = &sequence[A];
@ -227,8 +227,8 @@ static int uci_nr_unpack_ack_sr_csi(const srsran_uci_cfg_nr_t* cfg, uint8_t* seq
int A = 0;
// Append ACK bits
srsran_vec_u8_copy(value->ack, &sequence[A], cfg->o_ack);
A += cfg->o_ack;
srsran_vec_u8_copy(value->ack, &sequence[A], cfg->ack.count);
A += cfg->ack.count;
// Append SR bits
uint8_t* bits = &sequence[A];
@ -256,11 +256,11 @@ static int uci_nr_A(const srsran_uci_cfg_nr_t* cfg)
// 6.3.1.1.1 HARQ-ACK/SR only UCI bit sequence generation
if (o_csi == 0) {
return cfg->o_ack + cfg->o_sr;
return cfg->ack.count + cfg->o_sr;
}
// 6.3.1.1.2 CSI only
if (cfg->o_ack == 0 && cfg->o_sr == 0) {
if (cfg->ack.count == 0 && cfg->o_sr == 0) {
return o_csi;
}
@ -279,7 +279,7 @@ static int uci_nr_pack_pucch(const srsran_uci_cfg_nr_t* cfg, const srsran_uci_va
}
// 6.3.1.1.2 CSI only
if (cfg->o_ack == 0 && cfg->o_sr == 0) {
if (cfg->ack.count == 0 && cfg->o_sr == 0) {
return srsran_csi_part1_pack(cfg->csi, value->csi, cfg->nof_csi, sequence, SRSRAN_UCI_NR_MAX_NOF_BITS);
}
@ -297,7 +297,7 @@ static int uci_nr_unpack_pucch(const srsran_uci_cfg_nr_t* cfg, uint8_t* sequence
}
// 6.3.1.1.2 CSI only
if (cfg->o_ack == 0 && cfg->o_sr == 0) {
if (cfg->ack.count == 0 && cfg->o_sr == 0) {
ERROR("CSI only are not implemented");
return SRSRAN_ERROR;
}
@ -980,16 +980,16 @@ uint32_t srsran_uci_nr_total_bits(const srsran_uci_cfg_nr_t* uci_cfg)
return 0;
}
return uci_cfg->o_ack + uci_cfg->o_sr + srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi);
return uci_cfg->ack.count + uci_cfg->o_sr + srsran_csi_part1_nof_bits(uci_cfg->csi, uci_cfg->nof_csi);
}
uint32_t srsran_uci_nr_info(const srsran_uci_data_nr_t* uci_data, char* str, uint32_t str_len)
{
uint32_t len = 0;
if (uci_data->cfg.o_ack > 0) {
if (uci_data->cfg.ack.count > 0) {
char str_ack[10];
srsran_vec_sprint_bin(str_ack, (uint32_t)sizeof(str_ack), uci_data->value.ack, uci_data->cfg.o_ack);
srsran_vec_sprint_bin(str_ack, (uint32_t)sizeof(str_ack), uci_data->value.ack, uci_data->cfg.ack.count);
len = srsran_print_check(str, str_len, len, "ack=%s ", str_ack);
}
@ -1066,7 +1066,7 @@ int srsran_uci_nr_encode_pusch_ack(srsran_uci_nr_t* q,
return SRSRAN_ERROR_INVALID_INPUTS;
}
int A = cfg->o_ack;
int A = cfg->ack.count;
// 6.3.2.1 UCI bit sequence generation
// 6.3.2.1.1 HARQ-ACK
@ -1079,7 +1079,7 @@ int srsran_uci_nr_encode_pusch_ack(srsran_uci_nr_t* q,
UCI_NR_INFO_TX("No HARQ-ACK to mux");
return SRSRAN_SUCCESS;
} else {
srsran_vec_u8_copy(q->bit_sequence, value->ack, cfg->o_ack);
srsran_vec_u8_copy(q->bit_sequence, value->ack, cfg->ack.count);
}
// Compute total of encoded bits according to 6.3.2.4 Rate matching
@ -1102,12 +1102,12 @@ int srsran_uci_nr_decode_pusch_ack(srsran_uci_nr_t* q,
return SRSRAN_ERROR_INVALID_INPUTS;
}
int A = cfg->o_ack;
int A = cfg->ack.count;
// 6.3.2.1 UCI bit sequence generation
// 6.3.2.1.1 HARQ-ACK
bool has_csi_part2 = srsran_csi_has_part2(cfg->csi, cfg->nof_csi);
if (cfg->pusch.K_sum == 0 && cfg->nof_csi > 1 && !has_csi_part2 && cfg->o_ack < 2) {
if (cfg->pusch.K_sum == 0 && cfg->nof_csi > 1 && !has_csi_part2 && cfg->ack.count < 2) {
A = 2;
}
@ -1178,7 +1178,7 @@ int srsran_uci_nr_pusch_csi1_nof_bits(const srsran_uci_cfg_nr_t* cfg)
ERROR("Errpr calculating CSI part 1 number of bits");
return SRSRAN_ERROR;
}
uint32_t O_ack = SRSRAN_MAX(2, cfg->o_ack);
uint32_t O_ack = SRSRAN_MAX(2, cfg->ack.count);
int Q_csi1_prime = uci_nr_pusch_Q_prime_csi1(&cfg->pusch, (uint32_t)O_csi1, O_ack);
if (Q_csi1_prime < SRSRAN_SUCCESS) {

@ -11,57 +11,58 @@
*/
#include "srsran/common/test_common.h"
#include "srsran/phy/ue/ue_dl_nr.h"
#include "srsran/phy/phch/harq_ack.h"
#include "srsran/phy/utils/debug.h"
#include <getopt.h>
static int test_case_1()
{
// Set configuration
srsran_ue_dl_nr_harq_ack_cfg_t cfg = {};
cfg.harq_ack_codebook = srsran_pdsch_harq_ack_codebook_dynamic;
srsran_harq_ack_cfg_hl_t cfg = {};
cfg.harq_ack_codebook = srsran_pdsch_harq_ack_codebook_dynamic;
// Generate ACK information
srsran_pdsch_ack_nr_t ack_info = {};
ack_info.nof_cc = 1;
ack_info.use_pusch = true;
srsran_pdsch_ack_m_nr_t m = {};
m.value[0] = 1;
m.present = true;
srsran_harq_ack_m_t m = {};
m.value[0] = 1;
m.present = true;
m.resource.k1 = 8;
m.resource.v_dai_dl = 0;
m.value[0] = 1;
m.present = true;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 5;
m.resource.v_dai_dl = 2;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 6;
m.resource.v_dai_dl = 1;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 4;
m.resource.v_dai_dl = 3;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 3;
m.resource.v_dai_dl = 0;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
// Print trace
char str[512] = {};
TESTASSERT(srsran_ue_dl_nr_ack_info(&ack_info, str, (uint32_t)sizeof(str)) > SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_info(&ack_info, str, (uint32_t)sizeof(str)) > SRSRAN_SUCCESS);
INFO("%s", str);
// Generate UCI data
srsran_uci_data_nr_t uci_data = {};
TESTASSERT(srsran_ue_dl_nr_gen_ack(&cfg, &ack_info, &uci_data) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_pack(&cfg, &ack_info, &uci_data) == SRSRAN_SUCCESS);
// Assert UCI data
TESTASSERT(uci_data.cfg.o_ack == 5);
TESTASSERT(uci_data.cfg.ack.count == 5);
return SRSRAN_SUCCESS;
}
@ -69,49 +70,56 @@ static int test_case_1()
static int test_case_2()
{
// Set configuration
srsran_ue_dl_nr_harq_ack_cfg_t cfg = {};
cfg.harq_ack_codebook = srsran_pdsch_harq_ack_codebook_dynamic;
srsran_harq_ack_cfg_hl_t cfg = {};
cfg.harq_ack_codebook = srsran_pdsch_harq_ack_codebook_dynamic;
// Generate ACK information
srsran_pdsch_ack_nr_t ack_info = {};
ack_info.nof_cc = 1;
ack_info.use_pusch = true;
srsran_pdsch_ack_m_nr_t m = {};
m.value[0] = 1;
m.present = true;
srsran_harq_ack_m_t m = {};
m.value[0] = 1;
m.present = true;
m.resource.k1 = 7;
m.resource.v_dai_dl = 1;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 6;
m.resource.v_dai_dl = 2;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 8;
m.resource.v_dai_dl = 0;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 5;
m.resource.v_dai_dl = 3;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
m.resource.k1 = 4;
m.resource.v_dai_dl = 0;
TESTASSERT(srsran_ue_dl_nr_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_insert_m(&ack_info, &m) == SRSRAN_SUCCESS);
// Print trace
char str[512] = {};
TESTASSERT(srsran_ue_dl_nr_ack_info(&ack_info, str, (uint32_t)sizeof(str)) > SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_info(&ack_info, str, (uint32_t)sizeof(str)) > SRSRAN_SUCCESS);
INFO("%s", str);
// Generate UCI data
srsran_uci_data_nr_t uci_data = {};
TESTASSERT(srsran_ue_dl_nr_gen_ack(&cfg, &ack_info, &uci_data) == SRSRAN_SUCCESS);
TESTASSERT(srsran_harq_ack_pack(&cfg, &ack_info, &uci_data) == SRSRAN_SUCCESS);
// Assert UCI data
TESTASSERT(uci_data.cfg.o_ack == 5);
TESTASSERT(uci_data.cfg.ack.count == 5);
// Unpack HARQ ACK UCI data
srsran_pdsch_ack_nr_t ack_info_rx = ack_info;
TESTASSERT(srsran_harq_ack_unpack(&cfg, &uci_data, &ack_info_rx) == SRSRAN_SUCCESS);
// Assert unpacked data
TESTASSERT(memcmp(&ack_info, &ack_info_rx, sizeof(srsran_pdsch_ack_nr_t)) == 0);
return SRSRAN_SUCCESS;
}

@ -590,255 +590,6 @@ int srsran_ue_dl_nr_pdsch_info(const srsran_ue_dl_nr_t* q,
return len;
}
// Implements TS 38.213 Table 9.1.3-1: Value of counter DAI in DCI format 1_0 and of counter DAI or total DAI DCI format
// 1_1
static uint32_t ue_dl_nr_V_DL_DAI(uint32_t dai)
{
return dai + 1;
}
static int ue_dl_nr_gen_ack_type2(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_data_nr_t* uci_data)
{
bool harq_ack_spatial_bundling =
ack_info->use_pusch ? cfg->harq_ack_spatial_bundling_pusch : cfg->harq_ack_spatial_bundling_pucch;
uint8_t* o_ack = uci_data->value.ack;
uint32_t m = 0; // PDCCH with DCI format 1_0 or DCI format 1_1 monitoring occasion index: lower index corresponds to
// earlier PDCCH with DCI format 1_0 or DCI format 1_1 monitoring occasion
uint32_t j = 0;
uint32_t V_temp = 0;
uint32_t V_temp2 = 0;
uint32_t N_DL_cells = ack_info->nof_cc; // number of serving cells configured by higher layers for the UE
// The following code follows the exact pseudo-code provided in TS 38.213 9.1.3.1 Type-2 HARQ-ACK codebook ...
while (m < SRSRAN_UCI_NR_MAX_M) {
uint32_t c = 0; // serving cell index: lower indexes correspond to lower RRC indexes of corresponding cell
while (c < N_DL_cells) {
// Get ACK information of serving cell c for the PDCH monitoring occasion m
const srsran_pdsch_ack_m_nr_t* ack = &ack_info->cc[c].m[m];
// Get DAI counter value
uint32_t V_DL_CDAI = ue_dl_nr_V_DL_DAI(ack->resource.v_dai_dl);
uint32_t V_DL_TDAI = ack->resource.dci_format_1_1 ? ue_dl_nr_V_DL_DAI(ack->resource.v_dai_dl) : UINT32_MAX;
// Get ACK values
uint32_t ack_tb0 = ack->value[0];
uint32_t ack_tb1 = ack->value[1];
// For a PDCCH monitoring occasion with DCI format 1_0 or DCI format 1_1 in the active DL BWP of a serving cell,
// when a UE receives a PDSCH with one transport block and the value of maxNrofCodeWordsScheduledByDCI is 2, the
// HARQ-ACK information is associated with the first transport block and the UE generates a NACK for the second
// transport block if harq-ACK-SpatialBundlingPUCCH is not provided and generates HARQ-ACK information with
// value of ACK for the second transport block if harq-ACK-SpatialBundlingPUCCH is provided.
if (cfg->max_cw_sched_dci_is_2 && ack->second_tb_present) {
ack_tb1 = harq_ack_spatial_bundling ? 1 : 0;
}
// if PDCCH monitoring occasion m is before an active DL BWP change on serving cell c or an active UL
// BWP change on the PCell and an active DL BWP change is not triggered by a DCI format 1_1 in PDCCH
// monitoring occasion m
if (ack->dl_bwp_changed || ack->ul_bwp_changed) {
c = c + 1;
} else {
if (ack->present) {
// Load ACK resource data into UCI info
uci_data->cfg.pucch.resource_id = ack_info->cc[c].m[m].resource.pucch_resource_id;
uci_data->cfg.pucch.rnti = ack_info->cc[c].m[m].resource.rnti;
if (V_DL_CDAI <= V_temp) {
j = j + 1;
}
V_temp = V_DL_CDAI;
if (V_DL_TDAI == UINT32_MAX) {
V_temp2 = V_DL_CDAI;
} else {
V_temp2 = V_DL_TDAI;
}
// if harq-ACK-SpatialBundlingPUCCH is not provided and m is a monitoring occasion for PDCCH with DCI format
// 1_0 or DCI format 1_1 and the UE is configured by maxNrofCodeWordsScheduledByDCI with reception of two
// transport blocks for at least one configured DL BWP of at least one serving cell,
if (!harq_ack_spatial_bundling && cfg->max_cw_sched_dci_is_2) {
o_ack[8 * j + 2 * (V_DL_CDAI - 1) + 0] = ack_tb0;
o_ack[8 * j + 2 * (V_DL_CDAI - 1) + 1] = ack_tb1;
}
// elseif harq-ACK-SpatialBundlingPUCCH is provided to the UE and m is a monitoring occasion for
// PDCCH with DCI format 1_1 and the UE is configured by maxNrofCodeWordsScheduledByDCI with
// reception of two transport blocks in at least one configured DL BWP of a serving cell,
else if (harq_ack_spatial_bundling && ack->resource.dci_format_1_1 && cfg->max_cw_sched_dci_is_2) {
o_ack[4 * j + (V_DL_CDAI - 1)] = ack_tb0 & ack_tb1;
}
// else
else {
o_ack[4 * j + (V_DL_CDAI - 1)] = ack_tb0;
}
}
c = c + 1;
}
}
m = m + 1;
}
if (V_temp2 < V_temp) {
j = j + 1;
}
// if harq-ACK-SpatialBundlingPUCCH is not provided to the UE and the UE is configured by
// maxNrofCodeWordsScheduledByDCI with reception of two transport blocks for at least one configured DL BWP of a
// serving cell,
if (!harq_ack_spatial_bundling && cfg->max_cw_sched_dci_is_2) {
uci_data->cfg.o_ack = 2 * (4 * j + V_temp2);
} else {
uci_data->cfg.o_ack = 4 * j + V_temp2;
}
// Implement here SPS PDSCH reception
// ...
return SRSRAN_SUCCESS;
}
int ue_dl_nr_pdsch_k1(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg, const srsran_dci_dl_nr_t* dci_dl)
{
// For DCI format 1_0, the PDSCH-to-HARQ_feedback timing indicator field values map to {1, 2, 3, 4, 5, 6, 7, 8}
if (dci_dl->ctx.format == srsran_dci_format_nr_1_0) {
return (int)dci_dl->harq_feedback + 1;
}
// For DCI format 1_1, if present, the PDSCH-to-HARQ_feedback timing indicator field values map to values for a set of
// number of slots provided by dl-DataToUL-ACK as defined in Table 9.2.3-1.
if (dci_dl->harq_feedback >= SRSRAN_MAX_NOF_DL_DATA_TO_UL || dci_dl->harq_feedback >= cfg->nof_dl_data_to_ul_ack) {
ERROR("Out-of-range PDSCH-to-HARQ feedback index (%d, max %d)", dci_dl->harq_feedback, cfg->nof_dl_data_to_ul_ack);
return SRSRAN_ERROR;
}
return (int)cfg->dl_data_to_ul_ack[dci_dl->harq_feedback];
}
int srsran_ue_dl_nr_pdsch_ack_resource(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg,
const srsran_dci_dl_nr_t* dci_dl,
srsran_pdsch_ack_resource_nr_t* pdsch_ack_resource)
{
if (cfg == NULL || dci_dl == NULL || pdsch_ack_resource == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Calculate Data to UL ACK timing k1
int k1 = ue_dl_nr_pdsch_k1(cfg, dci_dl);
if (k1 < SRSRAN_ERROR) {
ERROR("Error calculating K1");
return SRSRAN_ERROR;
}
// Fill PDSCH resource
pdsch_ack_resource->dci_format_1_1 = (dci_dl->ctx.format == srsran_dci_format_nr_1_1);
pdsch_ack_resource->k1 = k1;
pdsch_ack_resource->v_dai_dl = dci_dl->dai;
pdsch_ack_resource->rnti = dci_dl->ctx.rnti;
pdsch_ack_resource->pucch_resource_id = dci_dl->pucch_resource;
return SRSRAN_SUCCESS;
}
int srsran_ue_dl_nr_gen_ack(const srsran_ue_dl_nr_harq_ack_cfg_t* cfg,
const srsran_pdsch_ack_nr_t* ack_info,
srsran_uci_data_nr_t* uci_data)
{
// Check inputs
if (cfg == NULL || ack_info == NULL || uci_data == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// According TS 38.213 9.1.2 Type-1 HARQ-ACK codebook determination
if (cfg->harq_ack_codebook == srsran_pdsch_harq_ack_codebook_semi_static) {
// This clause applies if the UE is configured with pdsch-HARQ-ACK-Codebook = semi-static.
ERROR("Type-1 HARQ-ACK codebook determination is NOT implemented");
return SRSRAN_ERROR;
}
// According TS 38.213 9.1.3 Type-2 HARQ-ACK codebook determination
if (cfg->harq_ack_codebook == srsran_pdsch_harq_ack_codebook_dynamic) {
// This clause applies if the UE is configured with pdsch-HARQ-ACK-Codebook = dynamic.
return ue_dl_nr_gen_ack_type2(cfg, ack_info, uci_data);
}
ERROR("No HARQ-ACK codebook determination is NOT implemented");
return SRSRAN_ERROR;
}
int srsran_ue_dl_nr_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_pdsch_ack_m_nr_t* m)
{
// Check inputs
if (ack_info == NULL || m == NULL) {
return SRSRAN_ERROR_INVALID_INPUTS;
}
// Protect SCell index and extract information
if (m->resource.scell_idx >= SRSRAN_MAX_CARRIERS) {
ERROR("Serving cell index (%d) exceeds maximum", m->resource.scell_idx);
return SRSRAN_ERROR;
}
srsran_pdsch_ack_cc_nr_t* cc = &ack_info->cc[m->resource.scell_idx];
// Find insertion index
uint32_t idx = cc->M; // Append at the end by default
for (uint32_t i = 0; i < cc->M; i++) {
if (cc->m[i].resource.k1 < m->resource.k1) {
idx = i;
break;
}
}
// Increment count
cc->M += 1;
// Make space for insertion
for (uint32_t i = cc->M - 1; i > idx; i--) {
cc->m[i] = cc->m[i - 1];
}
// Actual insertion
cc->m[idx] = *m;
return SRSRAN_SUCCESS;
}
uint32_t srsran_ue_dl_nr_ack_info(const srsran_pdsch_ack_nr_t* ack_info, char* str, uint32_t str_len)
{
uint32_t len = 0;
if (ack_info == NULL || str == NULL) {
return 0;
}
// Print base info
len = srsran_print_check(
str, str_len, len, "use_pusch=%c nof_cc=%d\n", ack_info->use_pusch ? 'y' : 'n', ack_info->nof_cc);
// Iterate all carriers
for (uint32_t cc = 0; cc < ack_info->nof_cc; cc++) {
len = srsran_print_check(str, str_len, len, " CC %d: M=%d\n", cc, ack_info->cc[cc].M);
for (uint32_t m = 0; m < ack_info->cc[cc].M; m++) {
if (ack_info->cc[cc].m[m].present) {
len = srsran_print_check(str,
str_len,
len,
" m %d: k1=%d dai=%d ack=%d\n",
m,
ack_info->cc[cc].m[m].resource.k1,
ack_info->cc[cc].m[m].resource.v_dai_dl,
ack_info->cc[cc].m[m].value[0]);
}
}
}
return len;
}
int srsran_ue_dl_nr_csi_measure_trs(const srsran_ue_dl_nr_t* q,
const srsran_slot_cfg_t* slot_cfg,
const srsran_csi_rs_nzp_set_t* csi_rs_nzp_set,

@ -150,7 +150,7 @@ static int ue_ul_nr_encode_pucch_format1(srsran_ue_ul_nr_t* q,
uint8_t b[SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS] = {};
// Set ACK bits
uint32_t nof_bits = SRSRAN_MIN(SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS, uci_data->cfg.o_ack);
uint32_t nof_bits = SRSRAN_MIN(SRSRAN_PUCCH_NR_FORMAT1_MAX_NOF_BITS, uci_data->cfg.ack.count);
for (uint32_t i = 0; i < nof_bits; i++) {
b[i] = uci_data->value.ack[i];
}

@ -107,7 +107,7 @@ int make_phy_harq_ack_cfg_test()
phys_cell_group_cfg_s phys_cell_group_cfg = {};
phys_cell_group_cfg.pdsch_harq_ack_codebook = phys_cell_group_cfg_s::pdsch_harq_ack_codebook_opts::dynamic_value;
srsran_ue_dl_nr_harq_ack_cfg_t srsran_ue_dl_nr_harq_ack_cfg;
srsran_harq_ack_cfg_hl_t srsran_ue_dl_nr_harq_ack_cfg;
TESTASSERT(make_phy_harq_ack_cfg(phys_cell_group_cfg, &srsran_ue_dl_nr_harq_ack_cfg) == true);
TESTASSERT(srsran_ue_dl_nr_harq_ack_cfg.harq_ack_codebook == srsran_pdsch_harq_ack_codebook_dynamic);

@ -37,10 +37,10 @@ private:
mutable std::mutex pending_ul_grant_mutex;
struct pending_dl_grant_t {
bool enable;
uint32_t pid;
srsran_sch_cfg_nr_t sch_cfg;
srsran_pdsch_ack_resource_nr_t ack_resource;
bool enable;
uint32_t pid;
srsran_sch_cfg_nr_t sch_cfg;
srsran_harq_ack_resource_t ack_resource;
};
srsran::circular_array<pending_dl_grant_t, TTIMOD_SZ> pending_dl_grant = {};
mutable std::mutex pending_dl_grant_mutex;
@ -171,7 +171,7 @@ public:
}
// Calculate DL DCI to PDSCH ACK resource
srsran_pdsch_ack_resource_nr_t ack_resource = {};
srsran_harq_ack_resource_t ack_resource = {};
if (not cfg.get_pdsch_ack_resource(dci_dl, ack_resource)) {
ERROR("Computing UL ACK resource");
return;
@ -199,10 +199,10 @@ public:
* @param pid Provides the HARQ process identifier
* @return true if there is a pending grant for the given TX tti, false otherwise
*/
bool get_dl_pending_grant(uint32_t tti_rx,
srsran_sch_cfg_nr_t& pdsch_cfg,
srsran_pdsch_ack_resource_nr_t& ack_resource,
uint32_t& pid)
bool get_dl_pending_grant(uint32_t tti_rx,
srsran_sch_cfg_nr_t& pdsch_cfg,
srsran_harq_ack_resource_t& ack_resource,
uint32_t& pid)
{
// Scope mutex to protect read/write the list
std::lock_guard<std::mutex> lock(pending_dl_grant_mutex);
@ -231,16 +231,16 @@ public:
* @param tti_rx The TTI in which the PDSCH transmission was received
* @param dci_dl The DL DCI message to store
*/
void set_pending_ack(const uint32_t& tti_rx, const srsran_pdsch_ack_resource_nr_t& ack_resource, const bool& crc_ok)
void set_pending_ack(const uint32_t& tti_rx, const srsran_harq_ack_resource_t& ack_resource, const bool& crc_ok)
{
// Calculate Receive TTI
uint32_t tti_tx = TTI_ADD(tti_rx, ack_resource.k1);
// Prepare ACK information
srsran_pdsch_ack_m_nr_t ack_m = {};
ack_m.resource = ack_resource;
ack_m.value[0] = crc_ok ? 1 : 0;
ack_m.present = true;
srsran_harq_ack_m_t ack_m = {};
ack_m.resource = ack_resource;
ack_m.value[0] = crc_ok ? 1 : 0;
ack_m.present = true;
// Scope mutex to protect read/write the list
std::lock_guard<std::mutex> lock(pending_ack_mutex);
@ -250,7 +250,7 @@ public:
ack.nof_cc = 1;
// Insert PDSCH transmission information
if (srsran_ue_dl_nr_ack_insert_m(&ack, &ack_m) < SRSRAN_SUCCESS) {
if (srsran_harq_ack_insert_m(&ack, &ack_m) < SRSRAN_SUCCESS) {
ERROR("Error inserting ACK m value");
}
}

@ -226,9 +226,9 @@ void cc_worker::decode_pdcch_ul()
bool cc_worker::decode_pdsch_dl()
{
// Get DL grant for this TTI, if available
uint32_t pid = 0;
srsran_sch_cfg_nr_t pdsch_cfg = {};
srsran_pdsch_ack_resource_nr_t ack_resource = {};
uint32_t pid = 0;
srsran_sch_cfg_nr_t pdsch_cfg = {};
srsran_harq_ack_resource_t ack_resource = {};
if (not phy.get_dl_pending_grant(dl_slot_cfg.idx, pdsch_cfg, ack_resource, pid)) {
// Early return if no grant was available
return true;
@ -526,12 +526,12 @@ bool cc_worker::work_ul()
if (logger.debug.enabled()) {
std::array<char, 512> str = {};
if (srsran_ue_dl_nr_ack_info(&pdsch_ack, str.data(), (uint32_t)str.size()) > 0) {
if (srsran_harq_ack_info(&pdsch_ack, str.data(), (uint32_t)str.size()) > 0) {
logger.debug("%s", str.data());
}
}
if (srsran_ue_dl_nr_gen_ack(&phy.cfg.harq_ack, &pdsch_ack, &uci_data) < SRSRAN_SUCCESS) {
if (srsran_harq_ack_pack(&phy.cfg.harq_ack, &pdsch_ack, &uci_data) < SRSRAN_SUCCESS) {
ERROR("Filling UCI ACK bits");
return false;
}

@ -1274,7 +1274,7 @@ bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg)
bool rrc_nr::apply_phy_cell_group_cfg(const phys_cell_group_cfg_s& phys_cell_group_cfg)
{
srsran_ue_dl_nr_harq_ack_cfg_t harq_ack;
srsran_harq_ack_cfg_hl_t harq_ack;
if (make_phy_harq_ack_cfg(phys_cell_group_cfg, &harq_ack) == true) {
phy_cfg.harq_ack = harq_ack;
} else {

Loading…
Cancel
Save