nzp csi-rs scheduling function
This commit is contained in:
@@ -433,11 +433,36 @@ typedef struct {
|
|||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_rel15;
|
fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_rel15;
|
||||||
} fapi_nr_dl_config_dlsch_pdu;
|
} fapi_nr_dl_config_dlsch_pdu;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t bwp_size;//
|
||||||
|
uint16_t bwp_start;//
|
||||||
|
uint8_t subcarrier_spacing;//
|
||||||
|
uint8_t cyclic_prefix;//
|
||||||
|
uint16_t start_rb;
|
||||||
|
uint16_t nr_of_rbs;
|
||||||
|
uint8_t csi_type;//Value: 0:TRS 1:CSI-RS NZP 2:CSI-RS ZP
|
||||||
|
uint8_t row;//Row entry into the CSI Resource location table. [TS38.211, sec 7.4.1.5.3 and table 7.4.1.5.3-1] Value: 1-18
|
||||||
|
uint16_t freq_domain;//Value: Up to the 12 LSBs, actual size is determined by the Row parameter
|
||||||
|
uint8_t symb_l0;//The time domain location l0 and firstOFDMSymbolInTimeDomain Value: 0->13
|
||||||
|
uint8_t symb_l1;//
|
||||||
|
uint8_t cdm_type;
|
||||||
|
uint8_t freq_density;//The density field, p and comb offset (for dot5).0: dot5 (even RB), 1: dot5 (odd RB), 2: one, 3: three
|
||||||
|
uint16_t scramb_id;//ScramblingID of the CSI-RS [TS38.214, sec 5.2.2.3.1] Value: 0->1023
|
||||||
|
} fapi_nr_dl_config_csirs_pdu_rel15_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_rel15;
|
||||||
|
} fapi_nr_dl_config_csirs_pdu;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t pdu_type;
|
uint8_t pdu_type;
|
||||||
union {
|
union {
|
||||||
fapi_nr_dl_config_dci_pdu dci_config_pdu;
|
fapi_nr_dl_config_dci_pdu dci_config_pdu;
|
||||||
fapi_nr_dl_config_dlsch_pdu dlsch_config_pdu;
|
fapi_nr_dl_config_dlsch_pdu dlsch_config_pdu;
|
||||||
|
fapi_nr_dl_config_csirs_pdu csirs_config_pdu;
|
||||||
};
|
};
|
||||||
} fapi_nr_dl_config_request_pdu_t;
|
} fapi_nr_dl_config_request_pdu_t;
|
||||||
|
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ and fills the PRACH PDU per each FD occasion.
|
|||||||
*/
|
*/
|
||||||
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id);
|
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id);
|
||||||
void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id);
|
void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id);
|
||||||
|
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot);
|
||||||
|
|
||||||
/* \brief This function schedules the Msg3 transmission
|
/* \brief This function schedules the Msg3 transmission
|
||||||
@param
|
@param
|
||||||
|
|||||||
@@ -899,6 +899,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
nr_dcireq_t dcireq;
|
nr_dcireq_t dcireq;
|
||||||
|
|
||||||
if(mac->cg != NULL){ // we have a cg
|
if(mac->cg != NULL){ // we have a cg
|
||||||
|
|
||||||
|
nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
|
||||||
|
|
||||||
dcireq.module_id = mod_id;
|
dcireq.module_id = mod_id;
|
||||||
dcireq.gNB_index = gNB_index;
|
dcireq.gNB_index = gNB_index;
|
||||||
dcireq.cc_id = cc_id;
|
dcireq.cc_id = cc_id;
|
||||||
@@ -2095,7 +2098,8 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CSI
|
// CSI
|
||||||
if (mac->ra.ra_state == RA_SUCCEEDED)
|
if (mac->ra.ra_state == RA_SUCCEEDED ||
|
||||||
|
get_softmodem_params()->phy_test == 1)
|
||||||
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, pucch);
|
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, pucch);
|
||||||
|
|
||||||
// ACKNACK
|
// ACKNACK
|
||||||
@@ -2141,7 +2145,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
|
|||||||
|
|
||||||
if (N_UCI > 0) {
|
if (N_UCI > 0) {
|
||||||
|
|
||||||
pucch->resource_set_id = find_pucch_resource_set(mac, N_UCI);
|
pucch->resource_set_id = find_pucch_resource_set(mac, O_ACK + O_CSI);
|
||||||
select_pucch_resource(mac, pucch);
|
select_pucch_resource(mac, pucch);
|
||||||
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
|
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP);
|
||||||
fapi_nr_ul_config_pucch_pdu *pucch_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pucch_config_pdu;
|
fapi_nr_ul_config_pucch_pdu *pucch_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pucch_config_pdu;
|
||||||
@@ -2161,6 +2165,146 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
|
||||||
|
|
||||||
|
if (mac->ra.ra_state == RA_SUCCEEDED ||
|
||||||
|
get_softmodem_params()->phy_test == 1) {
|
||||||
|
|
||||||
|
NR_CellGroupConfig_t *CellGroup = mac->cg;
|
||||||
|
|
||||||
|
if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated ||
|
||||||
|
!CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)
|
||||||
|
return;
|
||||||
|
|
||||||
|
NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||||
|
|
||||||
|
if (csi_measconfig->nzp_CSI_RS_ResourceToAddModList == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||||
|
NR_NZP_CSI_RS_Resource_t *nzpcsi;
|
||||||
|
int period, offset;
|
||||||
|
NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
|
||||||
|
int mu = mac->DLbwp[dl_bwp_id-1] ?
|
||||||
|
mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
|
||||||
|
mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
|
||||||
|
|
||||||
|
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
|
||||||
|
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
|
||||||
|
csi_period_offset(NULL,nzpcsi,&period,&offset);
|
||||||
|
if((frame*nr_slots_per_frame[mu]+slot-offset)%period == 0) {
|
||||||
|
LOG_I(MAC,"Scheduling reception of CSI-RS in frame %d slot %d\n",frame,slot);
|
||||||
|
fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csirs_config_pdu.csirs_config_rel15;
|
||||||
|
|
||||||
|
NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
|
||||||
|
|
||||||
|
if(mac->DLbwp[dl_bwp_id-1]){
|
||||||
|
csirs_config_pdu->bwp_size = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
csirs_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
csirs_config_pdu->bwp_size = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
csirs_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
}
|
||||||
|
csirs_config_pdu->subcarrier_spacing = mu;
|
||||||
|
csirs_config_pdu->start_rb = resourceMapping.freqBand.startingRB;
|
||||||
|
csirs_config_pdu->nr_of_rbs = resourceMapping.freqBand.nrofRBs;
|
||||||
|
csirs_config_pdu->csi_type = 1; // NZP-CSI-RS
|
||||||
|
csirs_config_pdu->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain;
|
||||||
|
if (resourceMapping.firstOFDMSymbolInTimeDomain2)
|
||||||
|
csirs_config_pdu->symb_l1 = *resourceMapping.firstOFDMSymbolInTimeDomain2;
|
||||||
|
csirs_config_pdu->cdm_type = resourceMapping.cdm_Type;
|
||||||
|
csirs_config_pdu->freq_density = resourceMapping.density.present;
|
||||||
|
if ((resourceMapping.density.present == NR_CSI_RS_ResourceMapping__density_PR_dot5)
|
||||||
|
&& (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs))
|
||||||
|
csirs_config_pdu->freq_density--;
|
||||||
|
csirs_config_pdu->scramb_id = nzpcsi->scramblingID;
|
||||||
|
switch(resourceMapping.frequencyDomainAllocation.present){
|
||||||
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1:
|
||||||
|
csirs_config_pdu->row = 1;
|
||||||
|
csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
|
||||||
|
csirs_config_pdu->row = 2;
|
||||||
|
csirs_config_pdu->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) |
|
||||||
|
((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xff0));
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4:
|
||||||
|
csirs_config_pdu->row = 4;
|
||||||
|
csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x07;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other:
|
||||||
|
csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x3f;
|
||||||
|
// determining the row of table 7.4.1.5.3-1 in 38.211
|
||||||
|
switch(resourceMapping.nrofPorts){
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p1:
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p2:
|
||||||
|
csirs_config_pdu->row = 3;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p4:
|
||||||
|
csirs_config_pdu->row = 5;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p8:
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
|
||||||
|
csirs_config_pdu->row = 8;
|
||||||
|
else{
|
||||||
|
int num_k = 0;
|
||||||
|
for (int k=0; k<6; k++)
|
||||||
|
num_k+=(((csirs_config_pdu->freq_domain)>>k)&0x01);
|
||||||
|
if(num_k==4)
|
||||||
|
csirs_config_pdu->row = 6;
|
||||||
|
else
|
||||||
|
csirs_config_pdu->row = 7;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p12:
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
|
||||||
|
csirs_config_pdu->row = 10;
|
||||||
|
else
|
||||||
|
csirs_config_pdu->row = 9;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p16:
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
|
||||||
|
csirs_config_pdu->row = 12;
|
||||||
|
else
|
||||||
|
csirs_config_pdu->row = 11;
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p24:
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
|
||||||
|
csirs_config_pdu->row = 14;
|
||||||
|
else{
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4)
|
||||||
|
csirs_config_pdu->row = 15;
|
||||||
|
else
|
||||||
|
csirs_config_pdu->row = 13;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NR_CSI_RS_ResourceMapping__nrofPorts_p32:
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
|
||||||
|
csirs_config_pdu->row = 17;
|
||||||
|
else{
|
||||||
|
if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4)
|
||||||
|
csirs_config_pdu->row = 18;
|
||||||
|
else
|
||||||
|
csirs_config_pdu->row = 16;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(1==0,"Invalid number of ports in CSI-RS resource\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n");
|
||||||
|
}
|
||||||
|
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
|
// This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
|
||||||
// PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3.
|
// PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3.
|
||||||
// - todo:
|
// - todo:
|
||||||
|
|||||||
@@ -2229,7 +2229,7 @@ void nr_csirs_scheduling(int Mod_idP,
|
|||||||
|
|
||||||
if((frame*n_slots_frame+slot-offset)%period == 0) {
|
if((frame*n_slots_frame+slot-offset)%period == 0) {
|
||||||
|
|
||||||
LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
|
LOG_D(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
|
||||||
|
|
||||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||||
memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||||
|
|||||||
Reference in New Issue
Block a user