int srslte_ue_dl_decode_phich(srslte_ue_dl_t* q, srslte_dl_sf_cfg_t* sf, srslte_ue_dl_cfg_t* cfg, srslte_phich_grant_t* grant, srslte_phich_res_t* result) { srslte_phich_resource_t n_phich; uint32_t sf_idx = sf->tti % 10; set_mi_value(q, sf, cfg); srslte_phich_calc(&q->phich, grant, &n_phich); INFO("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, I_phich=%d, n_group=%d, n_seq=%d, Ngroups=%d, Nsf=%d\n", sf_idx, grant->n_prb_lowest, grant->n_dmrs, grant->I_phich, n_phich.ngroup, n_phich.nseq, srslte_phich_ngroups(&q->phich), srslte_phich_nsf(&q->phich)); if (!srslte_phich_decode(&q->phich, sf, &q->chest_res, n_phich, q->sf_symbols, result)) { INFO("Decoded PHICH %d with distance %f\n", result->ack_value, result->distance); return 0; } else { ERROR("Error decoding PHICH\n"); return -1; } }
/* Computes n_group and n_seq according to Section 9.1.2 in 36.213 and calls phich processing function */ bool srslte_ue_dl_decode_phich(srslte_ue_dl_t *q, uint32_t sf_idx, uint32_t n_prb_lowest, uint32_t n_dmrs) { uint8_t ack_bit; float distance; uint32_t Ngroups = srslte_phich_ngroups(&q->phich); uint32_t ngroup = (n_prb_lowest+n_dmrs)%Ngroups; uint32_t nseq = ((n_prb_lowest/Ngroups)+n_dmrs)%(2*srslte_phich_nsf(&q->phich)); DEBUG("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, n_group=%d, n_seq=%d\n", sf_idx, n_prb_lowest, n_dmrs, ngroup, nseq); if (!srslte_phich_decode(&q->phich, q->sf_symbols, q->ce, 0, ngroup, nseq, sf_idx, &ack_bit, &distance)) { INFO("Decoded PHICH %d with distance %f\n", ack_bit, distance); } else { fprintf(stderr, "Error decoding PHICH\n"); return false; } if (ack_bit && distance > 1.5) { return true; } else { return false; } }
bool srslte_ue_dl_decode_phich(srslte_ue_dl_t *q, uint32_t sf_idx, uint32_t n_prb_lowest, uint32_t n_dmrs) { uint8_t ack_bit; float distance; uint32_t ngroup, nseq; srslte_phich_calc(&q->phich, n_prb_lowest, n_dmrs, &ngroup, &nseq); INFO("Decoding PHICH sf_idx=%d, n_prb_lowest=%d, n_dmrs=%d, n_group=%d, n_seq=%d, Ngroups=%d, Nsf=%d\n", sf_idx, n_prb_lowest, n_dmrs, ngroup, nseq, srslte_phich_ngroups(&q->phich), srslte_phich_nsf(&q->phich)); if (!srslte_phich_decode(&q->phich, q->sf_symbols_m, q->ce_m, 0, ngroup, nseq, sf_idx, &ack_bit, &distance)) { q->last_phich_corr = distance; INFO("Decoded PHICH %d with distance %f\n", ack_bit, distance); } else { fprintf(stderr, "Error decoding PHICH\n"); return false; } if (ack_bit) { return true; } else { return false; } }