|
|
|
@ -214,15 +214,15 @@ uint32_t srslte_pucch_get_npucch(uint32_t n_cce, srslte_pucch_format_t format, b
|
|
|
|
|
{
|
|
|
|
|
uint32_t n_pucch = 0;
|
|
|
|
|
if (has_scheduling_request) {
|
|
|
|
|
n_pucch = pucch_sched->n_pucch_sr;
|
|
|
|
|
n_pucch = pucch_sched->n_pucch_sr;
|
|
|
|
|
} else if (format < SRSLTE_PUCCH_FORMAT_2) {
|
|
|
|
|
if (pucch_sched->sps_enabled) {
|
|
|
|
|
n_pucch = pucch_sched->n_pucch_1[pucch_sched->tpc_for_pucch%4];
|
|
|
|
|
} else {
|
|
|
|
|
n_pucch = n_cce + pucch_sched->N_pucch_1;
|
|
|
|
|
n_pucch = n_cce + pucch_sched->N_pucch_1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
n_pucch = pucch_sched->n_pucch_2;
|
|
|
|
|
n_pucch = pucch_sched->n_pucch_2;
|
|
|
|
|
}
|
|
|
|
|
return n_pucch;
|
|
|
|
|
}
|
|
|
|
@ -411,9 +411,8 @@ static int pucch_get(srslte_pucch_t *q, srslte_pucch_format_t format, uint32_t n
|
|
|
|
|
return pucch_cp(q, format, n_pucch, input, z, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void srslte_pucch_set_threshold(srslte_pucch_t *q, float format1, float format1a) {
|
|
|
|
|
q->threshold_format1 = format1;
|
|
|
|
|
q->threshold_format1a = format1a;
|
|
|
|
|
void srslte_pucch_set_threshold(srslte_pucch_t *q, float format1_threshold) {
|
|
|
|
|
q->threshold_format1 = format1_threshold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Initializes the PDCCH transmitter and receiver */
|
|
|
|
@ -452,6 +451,8 @@ int srslte_pucch_init(srslte_pucch_t *q, srslte_cell_t cell) {
|
|
|
|
|
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->threshold_format1 = 0.8;
|
|
|
|
|
|
|
|
|
|
ret = SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
@ -612,6 +613,10 @@ static int uci_mod_bits(srslte_pucch_t *q, srslte_pucch_format_t format, uint8_t
|
|
|
|
|
// Declare this here, since we can not include refsignal_ul.h
|
|
|
|
|
void srslte_refsignal_r_uv_arg_1prb(float *arg, uint32_t u);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float tmp_alpha;
|
|
|
|
|
uint32_t tmp_noc, tmp_nprime, tmp_woc;
|
|
|
|
|
|
|
|
|
|
static int pucch_encode_(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
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)
|
|
|
|
@ -655,8 +660,14 @@ static int pucch_encode_(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
if (n_prime_ns%2) {
|
|
|
|
|
S_ns = M_PI/2;
|
|
|
|
|
}
|
|
|
|
|
DEBUG("PUCCH d_0: %.1f+%.1fi, alpha: %.1f, n_oc: %d, n_prime_ns: %d, n_rb_2=%d\n",
|
|
|
|
|
DEBUG("PUCCH d_0: %.1f+%.1fi, alpha: %.1f, n_oc: %d, n_prime_ns: %d, n_rb_2=%d\n",
|
|
|
|
|
__real__ q->d[0], __imag__ q->d[0], alpha, n_oc, n_prime_ns, q->pucch_cfg.n_rb_2);
|
|
|
|
|
|
|
|
|
|
tmp_alpha = alpha;
|
|
|
|
|
tmp_noc = n_oc;
|
|
|
|
|
tmp_nprime = n_prime_ns;
|
|
|
|
|
tmp_woc = w_n_oc[N_sf_widx][n_oc%3][m];
|
|
|
|
|
|
|
|
|
|
for (uint32_t n=0;n<SRSLTE_PUCCH_N_SEQ;n++) {
|
|
|
|
|
z[(ns%2)*N_sf_0*SRSLTE_PUCCH_N_SEQ+m*SRSLTE_PUCCH_N_SEQ+n] =
|
|
|
|
|
q->d[0]*cexpf(I*(w_n_oc[N_sf_widx][n_oc%3][m]+q->tmp_arg[n]+alpha*n+S_ns));
|
|
|
|
@ -767,7 +778,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
case SRSLTE_PUCCH_FORMAT_1:
|
|
|
|
|
bzero(bits, SRSLTE_PUCCH_MAX_BITS*sizeof(uint8_t));
|
|
|
|
|
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 = srslte_vec_corr_ccc(q->z, q->z_tmp, nof_re);
|
|
|
|
|
if (corr >= q->threshold_format1) {
|
|
|
|
|
ret = 1;
|
|
|
|
|
} else {
|
|
|
|
@ -778,11 +789,11 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
break;
|
|
|
|
|
case SRSLTE_PUCCH_FORMAT_1A:
|
|
|
|
|
bzero(bits, SRSLTE_PUCCH_MAX_BITS*sizeof(uint8_t));
|
|
|
|
|
ret = 0;
|
|
|
|
|
ret = 0;
|
|
|
|
|
for (int b=0;b<2;b++) {
|
|
|
|
|
bits[0] = b;
|
|
|
|
|
bits[0] = b;
|
|
|
|
|
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 = srslte_vec_corr_ccc(q->z, q->z_tmp, nof_re);
|
|
|
|
|
if (corr > corr_max) {
|
|
|
|
|
corr_max = corr;
|
|
|
|
|
b_max = b;
|
|
|
|
@ -790,7 +801,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|
|
|
|
if (corr_max > q->threshold_format1) { // check with format1 in case ack+sr because ack only is binary
|
|
|
|
|
ret = 1;
|
|
|
|
|
}
|
|
|
|
|
DEBUG("format1a b=%d, corr=%f, nof_re=%d, th=%f\n", b, corr, nof_re, q->threshold_format1a);
|
|
|
|
|
DEBUG("format1a b=%d, corr=%f, nof_re=%d\n", b, corr, nof_re);
|
|
|
|
|
}
|
|
|
|
|
q->last_corr = corr_max;
|
|
|
|
|
bits[0] = b_max;
|
|
|
|
|