Commit 1f75a978 authored by francescomani's avatar francescomani

scheduling of csi for im

parent 79be6685
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04 #define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04
#define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05 #define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05
#define FAPI_NR_DL_CONFIG_TYPE_CSI_RS 0x06 #define FAPI_NR_DL_CONFIG_TYPE_CSI_RS 0x06
#define FAPI_NR_DL_CONFIG_TYPES 0x06 #define FAPI_NR_DL_CONFIG_TYPE_CSI_IM 0x07
#define FAPI_NR_DL_CONFIG_TYPES 0x07
#define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
#define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 #define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
......
...@@ -452,17 +452,34 @@ typedef struct { ...@@ -452,17 +452,34 @@ typedef struct {
} fapi_nr_dl_config_csirs_pdu_rel15_t; } fapi_nr_dl_config_csirs_pdu_rel15_t;
typedef struct {
uint16_t bwp_size;
uint16_t bwp_start;
uint8_t subcarrier_spacing;
uint16_t start_rb;
uint16_t nr_of_rbs;
uint8_t k_csiim[4];
uint8_t l_csiim[4];
} fapi_nr_dl_config_csiim_pdu_rel15_t;
typedef struct { typedef struct {
fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_rel15; fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_rel15;
} fapi_nr_dl_config_csirs_pdu; } fapi_nr_dl_config_csirs_pdu;
typedef struct {
fapi_nr_dl_config_csiim_pdu_rel15_t csiim_config_rel15;
} fapi_nr_dl_config_csiim_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_csirs_pdu csirs_config_pdu;
fapi_nr_dl_config_csiim_pdu csiim_config_pdu;
}; };
} fapi_nr_dl_config_request_pdu_t; } fapi_nr_dl_config_request_pdu_t;
......
...@@ -132,8 +132,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -132,8 +132,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
pdcch_vars->slot = slot; pdcch_vars->slot = slot;
LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space); LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space);
break; break;
case FAPI_NR_DL_CONFIG_TYPE_CSI_IM:
LOG_I(PHY,"Received CSI-IM PDU at FAPI\n");
break;
case FAPI_NR_DL_CONFIG_TYPE_CSI_RS: case FAPI_NR_DL_CONFIG_TYPE_CSI_RS:
LOG_D(PHY,"Received CSI-RS PDU at FAPI\n"); LOG_I(PHY,"Received CSI-RS PDU at FAPI\n");
break; break;
case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH:
dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
......
...@@ -3282,65 +3282,65 @@ uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i ...@@ -3282,65 +3282,65 @@ uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i
void csi_period_offset(NR_CSI_ReportConfig_t *csirep, void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
NR_NZP_CSI_RS_Resource_t *nzpcsi, struct NR_CSI_ResourcePeriodicityAndOffset *periodicityAndOffset,
int *period, int *offset) { int *period, int *offset) {
if(nzpcsi != NULL) { if(periodicityAndOffset != NULL) {
NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = nzpcsi->periodicityAndOffset->present; NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = periodicityAndOffset->present;
switch(p_and_o){ switch(p_and_o){
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4:
*period = 4; *period = 4;
*offset = nzpcsi->periodicityAndOffset->choice.slots4; *offset = periodicityAndOffset->choice.slots4;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5:
*period = 5; *period = 5;
*offset = nzpcsi->periodicityAndOffset->choice.slots5; *offset = periodicityAndOffset->choice.slots5;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8:
*period = 8; *period = 8;
*offset = nzpcsi->periodicityAndOffset->choice.slots8; *offset = periodicityAndOffset->choice.slots8;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10:
*period = 10; *period = 10;
*offset = nzpcsi->periodicityAndOffset->choice.slots10; *offset = periodicityAndOffset->choice.slots10;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16:
*period = 16; *period = 16;
*offset = nzpcsi->periodicityAndOffset->choice.slots16; *offset = periodicityAndOffset->choice.slots16;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20:
*period = 20; *period = 20;
*offset = nzpcsi->periodicityAndOffset->choice.slots20; *offset = periodicityAndOffset->choice.slots20;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32:
*period = 32; *period = 32;
*offset = nzpcsi->periodicityAndOffset->choice.slots32; *offset = periodicityAndOffset->choice.slots32;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40:
*period = 40; *period = 40;
*offset = nzpcsi->periodicityAndOffset->choice.slots40; *offset = periodicityAndOffset->choice.slots40;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64:
*period = 64; *period = 64;
*offset = nzpcsi->periodicityAndOffset->choice.slots64; *offset = periodicityAndOffset->choice.slots64;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80:
*period = 80; *period = 80;
*offset = nzpcsi->periodicityAndOffset->choice.slots80; *offset = periodicityAndOffset->choice.slots80;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160:
*period = 160; *period = 160;
*offset = nzpcsi->periodicityAndOffset->choice.slots160; *offset = periodicityAndOffset->choice.slots160;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320:
*period = 320; *period = 320;
*offset = nzpcsi->periodicityAndOffset->choice.slots320; *offset = periodicityAndOffset->choice.slots320;
break; break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640: case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640:
*period = 640; *period = 640;
*offset = nzpcsi->periodicityAndOffset->choice.slots640; *offset = periodicityAndOffset->choice.slots640;
break; break;
default: default:
AssertFatal(1==0,"No periodicity and offset found in CSI resource"); AssertFatal(1==0,"No periodicity and offset found in CSI resource");
......
...@@ -158,7 +158,7 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); ...@@ -158,7 +158,7 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
void find_period_offest_SR (NR_SchedulingRequestResourceConfig_t *SchedulingReqRec, int *period, int *offset); void find_period_offest_SR (NR_SchedulingRequestResourceConfig_t *SchedulingReqRec, int *period, int *offset);
void csi_period_offset(NR_CSI_ReportConfig_t *csirep, void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
NR_NZP_CSI_RS_Resource_t *nzpcsi, struct NR_CSI_ResourcePeriodicityAndOffset *periodicityAndOffset,
int *period, int *offset); int *period, int *offset);
void reverse_n_bits(uint8_t *value, uint16_t bitlen); void reverse_n_bits(uint8_t *value, uint16_t bitlen);
......
...@@ -354,6 +354,7 @@ and fills the PRACH PDU per each FD occasion. ...@@ -354,6 +354,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); void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot);
void nr_schedule_csi_for_im(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
......
...@@ -901,6 +901,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -901,6 +901,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
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); nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
nr_schedule_csi_for_im(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;
...@@ -2166,6 +2167,70 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in ...@@ -2166,6 +2167,70 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
} }
void nr_schedule_csi_for_im(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->csi_IM_ResourceToAddModList == NULL)
return;
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
NR_CSI_IM_Resource_t *imcsi;
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->csi_IM_ResourceToAddModList->list.count; id++){
imcsi = csi_measconfig->csi_IM_ResourceToAddModList->list.array[id];
csi_period_offset(NULL,imcsi->periodicityAndOffset,&period,&offset);
if((frame*nr_slots_per_frame[mu]+slot-offset)%period == 0) {
fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csiim_config_pdu.csiim_config_rel15;
if(mac->DLbwp[dl_bwp_id-1]){
csiim_config_pdu->bwp_size = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
csiim_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
}
else{
csiim_config_pdu->bwp_size = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
csiim_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
}
csiim_config_pdu->subcarrier_spacing = mu;
csiim_config_pdu->start_rb = imcsi->freqBand->startingRB;
csiim_config_pdu->nr_of_rbs = imcsi->freqBand->nrofRBs;
// As specified in 5.2.2.4 of 38.214
switch (imcsi->csi_IM_ResourceElementPattern->present) {
case NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern0:
for (int i = 0; i<4; i++) {
csiim_config_pdu->k_csiim[i] = (imcsi->csi_IM_ResourceElementPattern->choice.pattern0->subcarrierLocation_p0<<1) + (i>>1);
csiim_config_pdu->l_csiim[i] = imcsi->csi_IM_ResourceElementPattern->choice.pattern0->symbolLocation_p0 + (i%2);
}
break;
case NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern1:
for (int i = 0; i<4; i++) {
csiim_config_pdu->k_csiim[i] = (imcsi->csi_IM_ResourceElementPattern->choice.pattern1->subcarrierLocation_p1<<2) + i;
csiim_config_pdu->l_csiim[i] = imcsi->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1;
}
break;
default:
AssertFatal(1==0, "Invalid CSI-IM pattern\n");
}
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_CSI_IM;
dl_config->number_pdus = dl_config->number_pdus + 1;
}
}
}
}
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) { void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
if (mac->ra.ra_state == RA_SUCCEEDED || if (mac->ra.ra_state == RA_SUCCEEDED ||
...@@ -2192,9 +2257,9 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) { ...@@ -2192,9 +2257,9 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
csi_period_offset(NULL,nzpcsi,&period,&offset); csi_period_offset(NULL,nzpcsi->periodicityAndOffset,&period,&offset);
if((frame*nr_slots_per_frame[mu]+slot-offset)%period == 0) { 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); LOG_D(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; 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; NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
......
...@@ -2225,7 +2225,7 @@ void nr_csirs_scheduling(int Mod_idP, ...@@ -2225,7 +2225,7 @@ void nr_csirs_scheduling(int Mod_idP,
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping; NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
csi_period_offset(NULL,nzpcsi,&period,&offset); csi_period_offset(NULL,nzpcsi->periodicityAndOffset,&period,&offset);
if((frame*n_slots_frame+slot-offset)%period == 0) { if((frame*n_slots_frame+slot-offset)%period == 0) {
......
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