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; } }
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; } }
void srslte_enb_dl_put_phich(srslte_enb_dl_t* q, srslte_phich_grant_t* grant, bool ack) { srslte_phich_resource_t resource; srslte_phich_calc(&q->phich, grant, &resource); srslte_phich_encode(&q->phich, &q->dl_sf, resource, ack, q->sf_symbols); }