From c9439857d7d5390e2ab618721c3ddccf71f2e0dd Mon Sep 17 00:00:00 2001 From: ahadi Date: Tue, 26 Oct 2021 15:52:22 +0000 Subject: [PATCH] Update nr_gold.c --- openair1/PHY/NR_REFSIG/nr_gold.c | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index cb2bff6625..7e3fb8ecf0 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -154,4 +154,42 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid) } -void nr_init_prs(PHY_VARS_gNB* gNB, uint32_t Nid, ...) +void nr_init_prs(PHY_VARS_gNB* gNB, uint32_t Nid, uint32_t slotnum, uint32_t symNum) +{ + unsigned int x1, x2; + uint16_t Nid, i_ssb, i_ssb2; + unsigned char Lmax, l, n_hf, N_hf; + nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + uint8_t reset; + + Nid = cfg->cell_config.phy_cell_id.value; + + Lmax = fp->Lmax; + N_hf = (Lmax == 4)? 2:1; + + for (n_hf = 0; n_hf < N_hf; n_hf++) { + for (l = 0; l < Lmax ; l++) { + i_ssb = l & (Lmax-1); + i_ssb2 = i_ssb + (n_hf<<2); + + reset = 1; + // initial x2 for prs as 38.211 + uint32_t c_init1, c_init2, c_init3; + uint32_t pow22=1<<22; + uint32_t pow10=1<<10; + c_init1 = pow22*ceil(Nid/1024); + c_init2 = pow10*(slotnum+symNum+1)*(2*(Nid%1024)+1); + c_init3 = Nid%1024; + x2 = c_init1 + c_init2 + c_init3; + + + for (uint8_t n=0; nnr_gold_prs[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } + + } + } + +}