Commit 0d9bba4c authored by Florian Kaltenberger's avatar Florian Kaltenberger Committed by Florian Kaltenberger

adding srs estimation at secondary gNB

parent 0ca1426f
......@@ -46,6 +46,7 @@
#include "openair1/PHY/defs_gNB.h"
#include "NR_MIB.h"
#include "RRC/NR/nr_rrc_config.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "../../../../nfapi/oai_integration/vendor_ext.h"
/* Softmodem params */
......@@ -524,6 +525,20 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
ra->preambles.preamble_list[i] = i;
}
}
//configure SRS for secondary cell
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
RC.nrmac[Mod_idP]->setup_srs_config[0] = calloc(1,sizeof(NR_SetupRelease_SRS_Config_t));
config_srs(scc,
RC.nrmac[Mod_idP]->setup_srs_config[0],
NULL,
curr_bwp,
0, //lets assume ue_id = 0.
0, //res_id = 0 for initial BWP
1, //maxMIMO_Layers
1); //do_srsg
//NR_SCHED_UNLOCK(&nrmac->sched_lock);
}
......
......@@ -232,6 +232,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
nr_schedule_srs(module_idP, frame, slot);
if ((slot==0) && (get_softmodem_params()->phy_test == 0))
nr_schedule_srs_secondary(module_idP,frame,0/*UE_id*/);
// This schedule RA procedure if not in phy_test mode
// Otherwise consider 5G already connected
if (get_softmodem_params()->phy_test == 0) {
......
......@@ -589,3 +589,78 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
}
}
}
/*******************************************************************
*
* NAME : nr_schedule_srs_secondary
*
* PARAMETERS : module id
* frame number for possible SRS reception
*
* DESCRIPTION : It informs the PHY layer that has an SRS to receive.
* To be used at secondary gNB (where UE is not connected).
* Only for periodic scheduling yet.
*
*********************************************************************/
void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) {
const int CC_id = 0;
// lets configure SRS on the initial BWP. This will only work for cell sizes of 60MHz or lower.
// for anything else this needs to be adapted to use the dedicated BWP.
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
NR_SRS_Config_t *srs_config = RC.nrmac[module_id]->setup_srs_config[0]->choice.setup;
if(!scc) {
LOG_W(MAC,"no scc, returning\n");
return;
}
for(int rs = 0; rs < srs_config->srs_ResourceSetToAddModList->list.count; rs++) {
// Find periodic resource set
NR_SRS_ResourceSet_t *srs_resource_set = srs_config->srs_ResourceSetToAddModList->list.array[rs];
if (srs_resource_set->resourceType.present != NR_SRS_ResourceSet__resourceType_PR_periodic) {
continue;
}
// Find the corresponding srs resource
NR_SRS_Resource_t *srs_resource = NULL;
for (int r1 = 0; r1 < srs_resource_set->srs_ResourceIdList->list.count; r1++) {
for (int r2 = 0; r2 < srs_config->srs_ResourceToAddModList->list.count; r2++) {
if ((*srs_resource_set->srs_ResourceIdList->list.array[r1] ==
srs_config->srs_ResourceToAddModList->list.array[r2]->srs_ResourceId) &&
(srs_config->srs_ResourceToAddModList->list.array[r2]->resourceType.present ==
NR_SRS_Resource__resourceType_PR_periodic)) {
srs_resource = srs_config->srs_ResourceToAddModList->list.array[r2];
break;
}
}
}
if (srs_resource == NULL) {
continue;
}
NR_BWP_t ubwp = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present];
uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing];
NR_UE_info_t dummy_ue_info;
dummy_ue_info.current_UL_BWP.BWPSize = NRRIV2BW(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
dummy_ue_info.current_UL_BWP.BWPStart = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
dummy_ue_info.current_UL_BWP.scs = ubwp.subcarrierSpacing;
// Check if UE will transmit the SRS in this frame
if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) {
LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame);
nr_fill_nfapi_srs(module_id, CC_id, &dummy_ue_info, offset%n_slots_frame, srs_resource);
}
}
}
......@@ -170,6 +170,8 @@ int get_pucch_resourceid(NR_PUCCH_Config_t *pucch_Config, int O_uci, int pucch_r
void nr_schedule_srs(int module_id, frame_t frame, int slot);
void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id);
void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slots_frame, nfapi_nr_dl_tti_request_t *DL_req);
void nr_csi_meas_reporting(int Mod_idP,
......
......@@ -243,6 +243,7 @@ typedef struct {
/// pre-configured ServingCellConfig that is default for every UE
NR_ServingCellConfig_t *pre_ServingCellConfig;
NR_ARFCN_ValueEUTRA_t ul_CarrierFreq;
long ul_Bandwidth;
/// Outgoing MIB PDU for PHY
uint8_t MIB_pdu[3];
......@@ -869,6 +870,9 @@ typedef struct gNB_MAC_INST_s {
pthread_mutex_t sched_lock;
//holds the SRS config for UEs of neighboring cells
//to be expanded to multiple users later
NR_SetupRelease_SRS_Config_t *setup_srs_config[1];
} gNB_MAC_INST;
#endif /*__LAYER2_NR_MAC_GNB_H__ */
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