Commit 54c89ccd authored by Parminder Singh's avatar Parminder Singh

MAC layer changes to process PTRS RRC values and validation

- Get RRC values from dedicated bandwidth part and process it
- Validate all settings in MAC layer and enable PTRS processing in PHY
parent 3651107f
......@@ -1804,7 +1804,8 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
}
uint8_t N_sh_symb = pdsch_rel15->NrOfSymbols;
uint8_t Imcs = pdsch_rel15->mcsIndex[0];
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
uint16_t dmrs_length = get_num_dmrs(pdsch_rel15->dlDmrsSymbPos);
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS*dmrs_length - N_PRB_oh;
LOG_D(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
uint16_t R;
......@@ -1823,7 +1824,7 @@ void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
R,
pdsch_rel15->rbSize,
N_sh_symb,
N_PRB_DMRS, // FIXME // This should be multiplied by the number of dmrs symbols
N_PRB_DMRS*dmrs_length, // FIXME // This should be multiplied by the number of dmrs symbols
N_PRB_oh,
tb_scaling,
pdsch_rel15->nrOfLayers)>>3;
......@@ -2705,6 +2706,8 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8);
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10);
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10);
}
}
else if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB &&
......@@ -2767,3 +2770,70 @@ int binomial(int n, int k) {
return c;
}
/* extract PTRS values from RC and validate it based upon 38.214 5.1.6.3 */
bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable,
uint8_t *K_ptrs, uint8_t *L_ptrs,
uint8_t *portIndex,uint8_t *nERatio, uint8_t *reOffset,
uint8_t NrOfSymbols)
{
bool valid = true;
/* as defined in T 38.214 5.1.6.3 */
if(rbSize < 3)
{
valid = false;
return valid;
}
/* Check for Frequency Density values */
if(ptrs_config->frequencyDensity->list.count < 2)
{
/* Default value for K_PTRS = 2 as defined in T 38.214 5.1.6.3 */
*K_ptrs = 2;
}
else
{
*K_ptrs = get_K_ptrs(*ptrs_config->frequencyDensity->list.array[0],
*ptrs_config->frequencyDensity->list.array[1],
rbSize);
}
/* Check for time Density values */
if(ptrs_config->timeDensity->list.count < 3)
{
/* Default value for L_PTRS = 1 as defined in T 38.214 5.1.6.3 */
*L_ptrs = 1;
}
else
{
*L_ptrs = get_L_ptrs(*ptrs_config->timeDensity->list.array[0],
*ptrs_config->timeDensity->list.array[1],
*ptrs_config->timeDensity->list.array[2],
mcsIndex,
mcsTable);
}
*portIndex =*ptrs_config->epre_Ratio;
*nERatio = *ptrs_config->resourceElementOffset;
*reOffset = 0;
/* If either or both of the parameters PT-RS time density (LPT-RS) and PT-RS frequency density (KPT-RS), shown in Table
* 5.1.6.3-1 and Table 5.1.6.3-2, indicates that 'PT-RS not present', the UE shall assume that PT-RS is not present
*/
if((*K_ptrs !=2 || *K_ptrs !=4 ) || (*L_ptrs !=0 || *L_ptrs !=1 || *L_ptrs !=2 ))
{
valid = false;
return valid;
}
/* PTRS is not present also :
* When the UE is receiving a PDSCH with allocation duration of 4 symbols and if LPT-RS is set to 4, the UE shall assume
* PT-RS is not transmitted
* When the UE is receiving a PDSCH with allocation duration of 2 symbols as defined in Clause 7.4.1.1.2 of [4, TS
* 38.211] and if LPT-RS is set to 2 or 4, the UE shall assume PT-RS is not transmitted.
*/
if((NrOfSymbols == 4 && *L_ptrs ==2) || ((NrOfSymbols == 2 && *L_ptrs > 0)))
{
valid = false;
return valid;
}
//printf("[MAC] PTRS is set K= %u L= %u\n", *K_ptrs,1<<*L_ptrs);
return valid;
}
......@@ -143,4 +143,10 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
uint16_t rbSize, uint8_t mcsIndex, uint8_t mcsTable,
uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex,
uint8_t *nERatio,uint8_t *reOffset,
uint8_t NrOfSymbols);
#endif
......@@ -2444,7 +2444,7 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format){
int bwp_id = 1;
bool valid_ptrs_setup = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
......@@ -3178,6 +3178,21 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
dl_config->number_pdus = dl_config->number_pdus + 1;
/* TODO same calculation for MCS table as done in UL */
dlsch_config_pdu_1_1->mcs_table = 0;
/*PTRS configuration */
if(mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL)
{
valid_ptrs_setup = set_dl_ptrs_values(mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup,
dlsch_config_pdu_1_1->number_rbs, dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table,
&dlsch_config_pdu_1_1->PTRSFreqDensity,&dlsch_config_pdu_1_1->PTRSTimeDensity,
&dlsch_config_pdu_1_1->PTRSPortIndex,&dlsch_config_pdu_1_1->nEpreRatioOfPDSCHToPTRS,
&dlsch_config_pdu_1_1->PTRSReOffset, dlsch_config_pdu_1_1->number_symbols);
if(valid_ptrs_setup==true)
{
dlsch_config_pdu_1_1->pduBitmap |= 0x1;
}
}
break;
......
......@@ -268,6 +268,7 @@ int configure_fapi_dl_pdu_phytest(int Mod_idP,
int TBS;
int bwp_id=1;
int UE_id = 0;
bool valid_ptrs_setup = false;
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
......@@ -344,6 +345,20 @@ int configure_fapi_dl_pdu_phytest(int Mod_idP,
scc->dmrs_TypeA_Position,
pdsch_pdu_rel15->NrOfSymbols);
/* Check and validate PTRS values */
if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL)
{
valid_ptrs_setup = set_dl_ptrs_values(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup,
pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->mcsIndex[0],
pdsch_pdu_rel15->mcsTable[0],
&pdsch_pdu_rel15->PTRSFreqDensity,&pdsch_pdu_rel15->PTRSTimeDensity,
&pdsch_pdu_rel15->PTRSPortIndex,&pdsch_pdu_rel15->nEpreRatioOfPDSCHToPTRS,
&pdsch_pdu_rel15->PTRSReOffset, pdsch_pdu_rel15->NrOfSymbols);
if(valid_ptrs_setup==true)
{
pdsch_pdu_rel15->pduBitmap |=0x1;
}
}
dci_pdu_rel15_t *dci_pdu_rel15 = calloc(MAX_DCI_CORESET,sizeof(dci_pdu_rel15_t));
// bwp indicator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment