Minor NR-PUCCH related fixes

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 9faa2d5fcd
commit 5f70526ac5

@ -82,7 +82,7 @@ int srslte_pucch_nr_alpha_idx(const srslte_carrier_nr_t* carrier,
// Create n_cs parameter
uint32_t n_cs = 0;
for (uint32_t m = 0; m < 8; m++) {
n_cs += cs[SRSLTE_NSYMB_PER_SLOT_NR * n_slot + (l + l_prime) * 8 + m] << m;
n_cs += cs[(SRSLTE_NSYMB_PER_SLOT_NR * n_slot + (l + l_prime)) * 8 + m] << m;
}
*alpha_idx = (m0 + m_cs + n_cs) % SRSLTE_NRE;
@ -368,8 +368,6 @@ int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q,
uint32_t nof_bits,
cf_t* slot_symbols)
{
uint32_t m_cs = 0;
if (carrier == NULL || cfg == NULL || slot == NULL || resource == NULL || b == NULL || slot_symbols == NULL) {
return SRSLTE_ERROR_INVALID_INPUTS;
}
@ -410,7 +408,7 @@ int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q,
// Get Alpha index
uint32_t alpha_idx = 0;
if (srslte_pucch_nr_alpha_idx(carrier, cfg, slot, l, l_prime, resource->initial_cyclic_shift, m_cs, &alpha_idx) <
if (srslte_pucch_nr_alpha_idx(carrier, cfg, slot, l, l_prime, resource->initial_cyclic_shift, 0, &alpha_idx) <
SRSLTE_SUCCESS) {
return SRSLTE_ERROR;
}

@ -824,4 +824,4 @@ uint32_t srslte_uci_nr_info(const srslte_uci_data_nr_t* uci_data, char* str, uin
}
return len;
}
}

@ -10,6 +10,7 @@
*
*/
#include "srslte/phy/ue/ue_ul_nr.h"
#include "srslte/phy/ch_estimation/dmrs_pucch.h"
#include "srslte/phy/utils/debug.h"
#include <complex.h>
@ -102,6 +103,9 @@ int srslte_ue_ul_nr_encode_pusch(srslte_ue_ul_nr_t* q,
return SRSLTE_ERROR_INVALID_INPUTS;
}
// Fill with zeros the whole resource grid
srslte_vec_cf_zero(q->sf_symbols[0], SRSLTE_SLOT_LEN_RE_NR(q->carrier.nof_prb));
// Encode PUSCH
if (srslte_pusch_nr_encode(&q->pusch, pusch_cfg, &pusch_cfg->grant, data, q->sf_symbols) < SRSLTE_SUCCESS) {
ERROR("Encoding PUSCH");
@ -149,6 +153,10 @@ static int ue_ul_nr_encode_pucch_format1(srslte_ue_ul_nr_t* q,
b[0] = uci_data->value.ack[0];
uint32_t nof_bits = 1;
if (srslte_dmrs_pucch_format1_put(&q->pucch, &q->carrier, cfg, slot, resource, q->sf_symbols[0])) {
return SRSLTE_ERROR;
}
return srslte_pucch_nr_format1_encode(&q->pucch, &q->carrier, cfg, slot, resource, b, nof_bits, q->sf_symbols[0]);
}
@ -163,24 +171,35 @@ int srslte_ue_ul_nr_encode_pucch(srslte_ue_ul_nr_t* q,
return SRSLTE_ERROR_INVALID_INPUTS;
}
// Fill with zeros the whole resource grid
srslte_vec_cf_zero(q->sf_symbols[0], SRSLTE_SLOT_LEN_RE_NR(q->carrier.nof_prb));
// Actual PUCCH encoding
switch (resource->format) {
case SRSLTE_PUCCH_NR_FORMAT_0:
if (ue_ul_nr_encode_pucch_format0(q, resource, uci_data) < SRSLTE_SUCCESS) {
return SRSLTE_ERROR;
}
break;
case SRSLTE_PUCCH_NR_FORMAT_1:
if (ue_ul_nr_encode_pucch_format1(q, slot_cfg, cfg, resource, uci_data) < SRSLTE_SUCCESS) {
return SRSLTE_ERROR;
}
break;
case SRSLTE_PUCCH_NR_FORMAT_2:
case SRSLTE_PUCCH_NR_FORMAT_3:
case SRSLTE_PUCCH_NR_FORMAT_4:
if (srslte_dmrs_pucch_format2_put(&q->pucch, &q->carrier, cfg, slot_cfg, resource, q->sf_symbols[0])) {
return SRSLTE_ERROR;
}
if (srslte_pucch_nr_format_2_3_4_encode(
&q->pucch, &q->carrier, cfg, slot_cfg, resource, &uci_data->cfg, &uci_data->value, q->sf_symbols[0]) <
SRSLTE_SUCCESS) {
return SRSLTE_ERROR;
}
break;
case SRSLTE_PUCCH_NR_FORMAT_3:
case SRSLTE_PUCCH_NR_FORMAT_4:
ERROR("PUCCH format %d NOT implemented", (int)resource->format);
break;
case SRSLTE_PUCCH_NR_FORMAT_ERROR:
default:
ERROR("Invalid case");
@ -229,4 +248,4 @@ int srslte_ue_ul_nr_pucch_info(const srslte_pucch_nr_resource_t* resource,
len += srslte_pucch_nr_tx_info(resource, uci_data, &str[len], str_len - len);
return len;
}
}

Loading…
Cancel
Save