|
|
@ -42,6 +42,7 @@
|
|
|
|
#include "srslte/scrambling/scrambling.h"
|
|
|
|
#include "srslte/scrambling/scrambling.h"
|
|
|
|
#include "srslte/utils/debug.h"
|
|
|
|
#include "srslte/utils/debug.h"
|
|
|
|
#include "srslte/utils/vector.h"
|
|
|
|
#include "srslte/utils/vector.h"
|
|
|
|
|
|
|
|
#include "srslte/modem/demod_soft.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_PUSCH_RE(cp) (2 * SRSLTE_CP_NSYMB(cp) * 12)
|
|
|
|
#define MAX_PUSCH_RE(cp) (2 * SRSLTE_CP_NSYMB(cp) * 12)
|
|
|
|
|
|
|
|
|
|
|
@ -422,7 +423,6 @@ int srslte_pucch_init(srslte_pucch_t *q, srslte_cell_t cell) {
|
|
|
|
bzero(q, sizeof(srslte_pucch_t));
|
|
|
|
bzero(q, sizeof(srslte_pucch_t));
|
|
|
|
|
|
|
|
|
|
|
|
q->cell = cell;
|
|
|
|
q->cell = cell;
|
|
|
|
q->rnti_is_set = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srslte_pucch_cfg_default(&q->pucch_cfg);
|
|
|
|
srslte_pucch_cfg_default(&q->pucch_cfg);
|
|
|
|
|
|
|
|
|
|
|
@ -430,9 +430,6 @@ int srslte_pucch_init(srslte_pucch_t *q, srslte_cell_t cell) {
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
srslte_demod_hard_init(&q->demod);
|
|
|
|
|
|
|
|
srslte_demod_hard_table_set(&q->demod, SRSLTE_MOD_QPSK);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Precompute group hopping values u.
|
|
|
|
// Precompute group hopping values u.
|
|
|
|
if (srslte_group_hopping_f_gh(q->f_gh, q->cell.id)) {
|
|
|
|
if (srslte_group_hopping_f_gh(q->f_gh, q->cell.id)) {
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
@ -442,6 +439,14 @@ int srslte_pucch_init(srslte_pucch_t *q, srslte_cell_t cell) {
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q->users = calloc(sizeof(srslte_pucch_user_t*), 1+SRSLTE_SIRNTI);
|
|
|
|
|
|
|
|
if (!q->users) {
|
|
|
|
|
|
|
|
perror("malloc");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srslte_uci_cqi_pucch_init(&q->cqi);
|
|
|
|
|
|
|
|
|
|
|
|
q->z = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
q->z = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
q->z_tmp = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
q->z_tmp = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
q->ce = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
q->ce = srslte_vec_malloc(sizeof(cf_t)*SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
@ -452,10 +457,11 @@ int srslte_pucch_init(srslte_pucch_t *q, srslte_cell_t cell) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void srslte_pucch_free(srslte_pucch_t *q) {
|
|
|
|
void srslte_pucch_free(srslte_pucch_t *q) {
|
|
|
|
if (q->rnti_is_set) {
|
|
|
|
if (q->users) {
|
|
|
|
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
|
|
|
|
for (int rnti=0;rnti<SRSLTE_SIRNTI;rnti++) {
|
|
|
|
srslte_sequence_free(&q->seq_f2[sf_idx]);
|
|
|
|
srslte_pucch_clear_rnti(q, rnti);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(q->users);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (q->z) {
|
|
|
|
if (q->z) {
|
|
|
|
free(q->z);
|
|
|
|
free(q->z);
|
|
|
@ -471,15 +477,29 @@ void srslte_pucch_free(srslte_pucch_t *q) {
|
|
|
|
bzero(q, sizeof(srslte_pucch_t));
|
|
|
|
bzero(q, sizeof(srslte_pucch_t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int srslte_pucch_set_crnti(srslte_pucch_t *q, uint16_t c_rnti) {
|
|
|
|
void srslte_pucch_clear_rnti(srslte_pucch_t *q, uint16_t rnti) {
|
|
|
|
|
|
|
|
if (q->users[rnti]) {
|
|
|
|
|
|
|
|
for (int i = 0; i < SRSLTE_NSUBFRAMES_X_FRAME; i++) {
|
|
|
|
|
|
|
|
srslte_sequence_free(&q->users[rnti]->seq_f2[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(q->users[rnti]);
|
|
|
|
|
|
|
|
q->users[rnti] = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int srslte_pucch_set_crnti(srslte_pucch_t *q, uint16_t rnti) {
|
|
|
|
|
|
|
|
if (!q->users[rnti]) {
|
|
|
|
|
|
|
|
q->users[rnti] = malloc(sizeof(srslte_pucch_user_t));
|
|
|
|
|
|
|
|
if (q->users[rnti]) {
|
|
|
|
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
|
|
|
|
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
|
|
|
|
// Precompute scrambling sequence for pucch format 2
|
|
|
|
// Precompute scrambling sequence for pucch format 2
|
|
|
|
if (srslte_sequence_pucch(&q->seq_f2[sf_idx], c_rnti, 2*sf_idx, q->cell.id)) {
|
|
|
|
if (srslte_sequence_pucch(&q->users[rnti]->seq_f2[sf_idx], rnti, 2*sf_idx, q->cell.id)) {
|
|
|
|
fprintf(stderr, "Error computing PUCCH Format 2 scrambling sequence\n");
|
|
|
|
fprintf(stderr, "Error computing PUCCH Format 2 scrambling sequence\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
q->rnti_is_set = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -552,7 +572,7 @@ int srslte_pucch_format2ab_mod_bits(srslte_pucch_format_t format, uint8_t bits[2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Encode PUCCH bits according to Table 5.4.1-1 in Section 5.4.1 of 36.211 */
|
|
|
|
/* Encode PUCCH bits according to Table 5.4.1-1 in Section 5.4.1 of 36.211 */
|
|
|
|
static int uci_mod_bits(srslte_pucch_t *q, srslte_pucch_format_t format, uint8_t bits[SRSLTE_PUCCH_MAX_BITS], uint32_t sf_idx)
|
|
|
|
static int uci_mod_bits(srslte_pucch_t *q, srslte_pucch_format_t format, uint8_t bits[SRSLTE_PUCCH_MAX_BITS], uint32_t sf_idx, uint16_t rnti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t tmp[2];
|
|
|
|
uint8_t tmp[2];
|
|
|
|
|
|
|
|
|
|
|
@ -571,9 +591,14 @@ static int uci_mod_bits(srslte_pucch_t *q, srslte_pucch_format_t format, uint8_t
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2A:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2A:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2B:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2B:
|
|
|
|
memcpy(q->bits_scram, bits, SRSLTE_PUCCH_MAX_BITS*sizeof(uint8_t));
|
|
|
|
if (q->users[rnti]) {
|
|
|
|
srslte_scrambling_b(&q->seq_f2[sf_idx], q->bits_scram);
|
|
|
|
memcpy(q->bits_scram, bits, SRSLTE_PUCCH2_NOF_BITS*sizeof(uint8_t));
|
|
|
|
srslte_mod_modulate(&q->mod, q->bits_scram, q->d, SRSLTE_PUCCH_MAX_BITS);
|
|
|
|
srslte_scrambling_b(&q->users[rnti]->seq_f2[sf_idx], q->bits_scram);
|
|
|
|
|
|
|
|
srslte_mod_modulate(&q->mod, q->bits_scram, q->d, SRSLTE_PUCCH2_NOF_BITS);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error modulating PUCCH2 bits: rnti not set\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
fprintf(stderr, "PUCCH format 2 not supported\n");
|
|
|
|
fprintf(stderr, "PUCCH format 2 not supported\n");
|
|
|
@ -586,11 +611,11 @@ static int uci_mod_bits(srslte_pucch_t *q, srslte_pucch_format_t format, uint8_t
|
|
|
|
void srslte_refsignal_r_uv_arg_1prb(float *arg, uint32_t u);
|
|
|
|
void srslte_refsignal_r_uv_arg_1prb(float *arg, uint32_t u);
|
|
|
|
|
|
|
|
|
|
|
|
static int pucch_encode_(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
static int pucch_encode_(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, uint16_t rnti,
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS], cf_t z[SRSLTE_PUCCH_MAX_SYMBOLS], bool signal_only)
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS], cf_t z[SRSLTE_PUCCH_MAX_SYMBOLS], bool signal_only)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!signal_only) {
|
|
|
|
if (!signal_only) {
|
|
|
|
if (uci_mod_bits(q, format, bits, sf_idx)) {
|
|
|
|
if (uci_mod_bits(q, format, bits, sf_idx, rnti)) {
|
|
|
|
fprintf(stderr, "Error encoding PUCCH bits\n");
|
|
|
|
fprintf(stderr, "Error encoding PUCCH bits\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -641,16 +666,16 @@ static int pucch_encode_(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
static int pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, uint16_t rnti,
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS], cf_t z[SRSLTE_PUCCH_MAX_SYMBOLS])
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS], cf_t z[SRSLTE_PUCCH_MAX_SYMBOLS])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return pucch_encode_(q, format, n_pucch, sf_idx, bits, z, false);
|
|
|
|
return pucch_encode_(q, format, n_pucch, sf_idx, rnti, bits, z, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Encode, modulate and resource mapping of PUCCH bits according to Section 5.4.1 of 36.211 */
|
|
|
|
/* Encode, modulate and resource mapping of PUCCH bits according to Section 5.4.1 of 36.211 */
|
|
|
|
int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, uint8_t bits[SRSLTE_PUCCH_MAX_BITS],
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, uint16_t rnti, uint8_t bits[SRSLTE_PUCCH_MAX_BITS],
|
|
|
|
cf_t *sf_symbols)
|
|
|
|
cf_t *sf_symbols)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ret = SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
|
int ret = SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
@ -673,11 +698,7 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
|
|
|
|
|
|
|
q->last_n_pucch = n_pucch;
|
|
|
|
q->last_n_pucch = n_pucch;
|
|
|
|
|
|
|
|
|
|
|
|
if (format >= SRSLTE_PUCCH_FORMAT_2 && !q->rnti_is_set) {
|
|
|
|
if (pucch_encode(q, format, n_pucch, sf_idx, rnti, bits, q->z)) {
|
|
|
|
fprintf(stderr, "Error encoding PUCCH: C-RNTI must be set before encoding PUCCH Format 2/2a/2b\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pucch_encode(q, format, n_pucch, sf_idx, bits, q->z)) {
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pucch_put(q, format, n_pucch, q->z, sf_symbols) < 0) {
|
|
|
|
if (pucch_put(q, format, n_pucch, q->z, sf_symbols) < 0) {
|
|
|
@ -697,7 +718,7 @@ float srslte_pucch_get_last_corr(srslte_pucch_t* q)
|
|
|
|
|
|
|
|
|
|
|
|
/* Equalize, demodulate and decode PUCCH bits according to Section 5.4.1 of 36.211 */
|
|
|
|
/* Equalize, demodulate and decode PUCCH bits according to Section 5.4.1 of 36.211 */
|
|
|
|
int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, cf_t *sf_symbols, cf_t *ce, float noise_estimate,
|
|
|
|
uint32_t n_pucch, uint32_t sf_idx, uint16_t rnti, cf_t *sf_symbols, cf_t *ce, float noise_estimate,
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS])
|
|
|
|
uint8_t bits[SRSLTE_PUCCH_MAX_BITS])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ret = SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
|
int ret = SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
@ -707,6 +728,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
cf_t ref[SRSLTE_PUCCH_MAX_SYMBOLS];
|
|
|
|
cf_t ref[SRSLTE_PUCCH_MAX_SYMBOLS];
|
|
|
|
|
|
|
|
int16_t llr_pucch2[32];
|
|
|
|
|
|
|
|
|
|
|
|
// Shortened PUCCH happen in every cell-specific SRS subframes for Format 1/1a/1b
|
|
|
|
// Shortened PUCCH happen in every cell-specific SRS subframes for Format 1/1a/1b
|
|
|
|
if (q->pucch_cfg.srs_configured && format < SRSLTE_PUCCH_FORMAT_2) {
|
|
|
|
if (q->pucch_cfg.srs_configured && format < SRSLTE_PUCCH_FORMAT_2) {
|
|
|
@ -722,10 +744,6 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
|
|
|
|
|
|
|
q->last_n_pucch = n_pucch;
|
|
|
|
q->last_n_pucch = n_pucch;
|
|
|
|
|
|
|
|
|
|
|
|
if (format >= SRSLTE_PUCCH_FORMAT_2 && !q->rnti_is_set) {
|
|
|
|
|
|
|
|
fprintf(stderr, "Error decoding PUCCH: C-RNTI must be set before decoding PUCCH Format 2/2a/2b\n");
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int nof_re = pucch_get(q, format, n_pucch, sf_symbols, q->z_tmp);
|
|
|
|
int nof_re = pucch_get(q, format, n_pucch, sf_symbols, q->z_tmp);
|
|
|
|
if (nof_re < 0) {
|
|
|
|
if (nof_re < 0) {
|
|
|
|
fprintf(stderr, "Error getting PUCCH symbols\n");
|
|
|
|
fprintf(stderr, "Error getting PUCCH symbols\n");
|
|
|
@ -746,7 +764,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
switch(format) {
|
|
|
|
switch(format) {
|
|
|
|
case SRSLTE_PUCCH_FORMAT_1:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_1:
|
|
|
|
bzero(bits, SRSLTE_PUCCH_MAX_BITS*sizeof(uint8_t));
|
|
|
|
bzero(bits, SRSLTE_PUCCH_MAX_BITS*sizeof(uint8_t));
|
|
|
|
pucch_encode(q, format, n_pucch, sf_idx, bits, q->z_tmp);
|
|
|
|
pucch_encode(q, format, n_pucch, sf_idx, rnti, bits, q->z_tmp);
|
|
|
|
corr = crealf(srslte_vec_dot_prod_conj_ccc(q->z, q->z_tmp, nof_re))/nof_re;
|
|
|
|
corr = crealf(srslte_vec_dot_prod_conj_ccc(q->z, q->z_tmp, nof_re))/nof_re;
|
|
|
|
if (corr >= q->threshold_format1) {
|
|
|
|
if (corr >= q->threshold_format1) {
|
|
|
|
ret = 1;
|
|
|
|
ret = 1;
|
|
|
@ -761,7 +779,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
ret = 0;
|
|
|
|
ret = 0;
|
|
|
|
for (int b=0;b<2;b++) {
|
|
|
|
for (int b=0;b<2;b++) {
|
|
|
|
bits[0] = b;
|
|
|
|
bits[0] = b;
|
|
|
|
pucch_encode(q, format, n_pucch, sf_idx, bits, q->z_tmp);
|
|
|
|
pucch_encode(q, format, n_pucch, sf_idx, rnti, bits, q->z_tmp);
|
|
|
|
corr = crealf(srslte_vec_dot_prod_conj_ccc(q->z, q->z_tmp, nof_re))/nof_re;
|
|
|
|
corr = crealf(srslte_vec_dot_prod_conj_ccc(q->z, q->z_tmp, nof_re))/nof_re;
|
|
|
|
if (corr > corr_max) {
|
|
|
|
if (corr > corr_max) {
|
|
|
|
corr_max = corr;
|
|
|
|
corr_max = corr;
|
|
|
@ -776,17 +794,23 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
bits[0] = b_max;
|
|
|
|
bits[0] = b_max;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2:
|
|
|
|
case SRSLTE_PUCCH_FORMAT_2:
|
|
|
|
pucch_encode_(q, format, n_pucch, sf_idx, NULL, ref, true);
|
|
|
|
if (q->users[rnti]) {
|
|
|
|
|
|
|
|
pucch_encode_(q, format, n_pucch, sf_idx, rnti, NULL, ref, true);
|
|
|
|
srslte_vec_prod_conj_ccc(q->z, ref, q->z_tmp, SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
srslte_vec_prod_conj_ccc(q->z, ref, q->z_tmp, SRSLTE_PUCCH_MAX_SYMBOLS);
|
|
|
|
for (int i=0;i<SRSLTE_PUCCH_MAX_BITS/2;i++) {
|
|
|
|
for (int i=0;i<SRSLTE_PUCCH2_NOF_BITS/2;i++) {
|
|
|
|
q->z[i] = 0;
|
|
|
|
q->z[i] = 0;
|
|
|
|
for (int j=0;j<SRSLTE_NRE;j++) {
|
|
|
|
for (int j=0;j<SRSLTE_NRE;j++) {
|
|
|
|
q->z[i] += q->z_tmp[i*SRSLTE_NRE+j]/SRSLTE_NRE;
|
|
|
|
q->z[i] += q->z_tmp[i*SRSLTE_NRE+j]/SRSLTE_NRE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
srslte_demod_hard_demodulate(&q->demod, q->z, bits, SRSLTE_PUCCH_MAX_BITS/2);
|
|
|
|
srslte_demod_soft_demodulate_s(SRSLTE_MOD_QPSK, q->z, llr_pucch2, SRSLTE_PUCCH2_NOF_BITS/2);
|
|
|
|
srslte_scrambling_b(&q->seq_f2[sf_idx], bits);
|
|
|
|
srslte_scrambling_s(&q->users[rnti]->seq_f2[sf_idx], llr_pucch2);
|
|
|
|
|
|
|
|
q->last_corr = (float) srslte_uci_decode_cqi_pucch(&q->cqi, llr_pucch2, bits, 4)/2000;
|
|
|
|
ret = 1;
|
|
|
|
ret = 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fprintf(stderr, "Decoding PUCCH2: rnti not set\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
fprintf(stderr, "PUCCH format %d not implemented\n", format);
|
|
|
|
fprintf(stderr, "PUCCH format %d not implemented\n", format);
|
|
|
|