Commit 5823e184 authored by kn.raju's avatar kn.raju Committed by p.shashikala

Multi-user RACH

parent 228be922
...@@ -619,8 +619,10 @@ typedef struct { ...@@ -619,8 +619,10 @@ typedef struct {
uint16_t prgSize; uint16_t prgSize;
/// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
uint8_t digBFInterfaces; uint8_t digBFInterfaces;
// Depends on numPRGs
uint16_t PMIdx[275]; uint16_t PMIdx[275];
uint16_t *beamIdx[275]; // Depends on digBFInterfaces
uint16_t beamIdx[256];
} nfapi_nr_tx_precoding_and_beamforming_t; } nfapi_nr_tx_precoding_and_beamforming_t;
//table 3-37 //table 3-37
......
...@@ -405,10 +405,18 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -405,10 +405,18 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
UE_info->UE_sched_ctrl[UE_id].active_ubwp = ubwpList->list.array[bwp_id - 1]; UE_info->UE_sched_ctrl[UE_id].active_ubwp = ubwpList->list.array[bwp_id - 1];
LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti); LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti);
} else if (add_ue == 1 && !get_softmodem_params()->phy_test) { } else if (add_ue == 1 && !get_softmodem_params()->phy_test) {
/* TODO: should check for free RA process */
const int CC_id = 0; const int CC_id = 0;
NR_RA_t *ra = &RC.nrmac[Mod_idP]->common_channels[CC_id].ra[0]; NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id];
ra->state = RA_IDLE; uint8_t ra_index = 0;
/* checking for free RA process */
for(; ra_index < NR_NB_RA_PROC_MAX; ra_index++) {
if((cc->ra[ra_index].state == RA_IDLE) && (!cc->ra[ra_index].cfra)) break;
}
if (ra_index == NR_NB_RA_PROC_MAX) {
LOG_E(MAC, "%s() %s:%d RA processes are not available for CFRA RNTI :%x\n", __FUNCTION__, __FILE__, __LINE__, rnti);
return -1;
}
NR_RA_t *ra = &cc->ra[ra_index];
ra->secondaryCellGroup = secondaryCellGroup; ra->secondaryCellGroup = secondaryCellGroup;
if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) { if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) {
if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) { if (secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) {
...@@ -418,8 +426,15 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -418,8 +426,15 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
uint8_t num_preamble = cfra.resources.choice.ssb->ssb_ResourceList.list.count; uint8_t num_preamble = cfra.resources.choice.ssb->ssb_ResourceList.list.count;
ra->preambles.num_preambles = num_preamble; ra->preambles.num_preambles = num_preamble;
ra->preambles.preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t)); ra->preambles.preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
for (int i = 0; i < num_preamble; i++) for(int i=0; i<cc->num_active_ssb; i++) {
ra->preambles.preamble_list[i] = cfra.resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex; for(int j=0; j<num_preamble; j++) {
if(cc->ssb_index[i] == secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ssb) {
//one dedicated preamble for each beam
ra->preambles.preamble_list[i] = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
break;
}
}
}
} }
} }
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti); LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
......
...@@ -151,6 +151,38 @@ void find_SSB_and_RO_available(module_id_t module_idP) { ...@@ -151,6 +151,38 @@ void find_SSB_and_RO_available(module_id_t module_idP) {
uint8_t num_active_ssb = 0; uint8_t num_active_ssb = 0;
uint8_t max_association_period = 1; uint8_t max_association_period = 1;
struct NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB *ssb_perRACH_OccasionAndCB_PreamblesPerSSB = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB;
switch (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present){
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
cc->cb_preambles_per_ssb = 4 * (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1);
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
cc->cb_preambles_per_ssb = 4 * (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1);
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
cc->cb_preambles_per_ssb = 4 * (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1);
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
cc->cb_preambles_per_ssb = 4 * (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1);
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
cc->cb_preambles_per_ssb = 4 * (ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1);
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
cc->cb_preambles_per_ssb = ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four;
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
cc->cb_preambles_per_ssb = ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight;
break;
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
cc->cb_preambles_per_ssb = ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen;
break;
default:
AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present);
break;
}
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
mu = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; mu = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
else else
...@@ -179,24 +211,20 @@ void find_SSB_and_RO_available(module_id_t module_idP) { ...@@ -179,24 +211,20 @@ void find_SSB_and_RO_available(module_id_t module_idP) {
cc->ssb_index[num_active_ssb] = i; cc->ssb_index[num_active_ssb] = i;
num_active_ssb++; num_active_ssb++;
} }
} }
cc->total_prach_occasions_per_config_period = total_RA_occasions;
for(int i = 1; (1 << (i-1)) <= max_association_period;i++) { for(int i=1; (1 << (i-1)) < max_association_period; i++) {
cc->max_association_period = (1 <<(i-1));
total_RA_occasions = total_RA_occasions * cc->max_association_period;
if(total_RA_occasions >= (int) (num_active_ssb/num_ssb_per_RO)) { if(total_RA_occasions >= (int) (num_active_ssb/num_ssb_per_RO)) {
repetition = (uint16_t)((total_RA_occasions * num_ssb_per_RO )/num_active_ssb); repetition = (uint16_t)((total_RA_occasions * num_ssb_per_RO )/num_active_ssb);
break; break;
} }
else {
total_RA_occasions = total_RA_occasions * i;
cc->max_association_period = i;
}
} }
if(cc->max_association_period == 0)
cc->max_association_period = 1;
unused_RA_occasion = total_RA_occasions - (int)((num_active_ssb * repetition)/num_ssb_per_RO); unused_RA_occasion = total_RA_occasions - (int)((num_active_ssb * repetition)/num_ssb_per_RO);
cc->total_prach_occasions = total_RA_occasions - unused_RA_occasion; cc->total_prach_occasions = total_RA_occasions - unused_RA_occasion;
cc->num_active_ssb = num_active_ssb; cc->num_active_ssb = num_active_ssb;
LOG_I(MAC, "Total available RO %d, num of active SSB %d: unused RO = %d max_association_period %u N_RA_sfn %u \n", LOG_I(MAC, "Total available RO %d, num of active SSB %d: unused RO = %d max_association_period %u N_RA_sfn %u \n",
cc->total_prach_occasions, cc->num_active_ssb, unused_RA_occasion, max_association_period, N_RA_sfn); cc->total_prach_occasions, cc->num_active_ssb, unused_RA_occasion, max_association_period, N_RA_sfn);
...@@ -422,7 +450,6 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, ...@@ -422,7 +450,6 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
} }
} }
void nr_initiate_ra_proc(module_id_t module_idP, void nr_initiate_ra_proc(module_id_t module_idP,
int CC_id, int CC_id,
frame_t frameP, frame_t frameP,
...@@ -439,8 +466,23 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -439,8 +466,23 @@ void nr_initiate_ra_proc(module_id_t module_idP,
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
uint8_t total_RApreambles = 64;
uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
if( scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL)
total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles;
if(num_ssb_per_RO > 3) { /*num of ssb per RO >= 1*/
num_ssb_per_RO -= 3;
total_RApreambles = total_RApreambles/num_ssb_per_RO ;
}
for(int i=0; i<NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
if (ra->state == RA_IDLE) {
if((preamble_index < total_RApreambles) && (preamble_index > cc->cb_preambles_per_ssb) && (!ra->cfra)) continue;
uint16_t ra_rnti; uint16_t ra_rnti;
// ra_rnti from 5.1.3 in 38.321 // ra_rnti from 5.1.3 in 38.321
...@@ -450,23 +492,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -450,23 +492,6 @@ void nr_initiate_ra_proc(module_id_t module_idP,
else else
ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8); ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8);
// if the preamble received correspond to one of the listed
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
int pr_found=0;
for (int i = 0; i < ra->preambles.num_preambles; i++) {
if (preamble_index == ra->preambles.preamble_list[i]) {
pr_found=1;
break;
}
}
if (!pr_found) {
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
module_idP, preamble_index);
return; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
}
// This should be handled differently when we use the initialBWP for RA // This should be handled differently when we use the initialBWP for RA
ra->bwp_id=1; ra->bwp_id=1;
NR_BWP_Downlink_t *bwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; NR_BWP_Downlink_t *bwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
...@@ -475,14 +500,22 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -475,14 +500,22 @@ void nr_initiate_ra_proc(module_id_t module_idP,
LOG_I(MAC, "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, slotP, preamble_index); LOG_I(MAC, "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, slotP, preamble_index);
if (ra->state == RA_IDLE) {
uint8_t beam_index = ssb_index_from_prach(module_idP, uint8_t beam_index = ssb_index_from_prach(module_idP,
frameP, frameP,
slotP, slotP,
preamble_index, preamble_index,
freq_index, freq_index,
symbol); symbol);
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
if (ra->cfra) {
// if the preamble received correspond to one of the listed
if (!(preamble_index == ra->preambles.preamble_list[beam_index])) {
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
module_idP, preamble_index);
continue; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
}
}
int loop = 0; int loop = 0;
LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP);
ra->state = Msg2; ra->state = Msg2;
...@@ -536,6 +569,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -536,6 +569,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
return; return;
} }
}
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index); LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
...@@ -543,18 +577,13 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -543,18 +577,13 @@ void nr_initiate_ra_proc(module_id_t module_idP,
void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
//uint8_t i = 0;
int CC_id = 0;
gNB_MAC_INST *mac = RC.nrmac[module_idP]; gNB_MAC_INST *mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
start_meas(&mac->schedule_ra); start_meas(&mac->schedule_ra);
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
// for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
// for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
// NR_RA_t *ra = &cc->ra[i];
NR_RA_t *ra = &cc->ra[0];
LOG_D(MAC,"RA[state:%d]\n",ra->state); LOG_D(MAC,"RA[state:%d]\n",ra->state);
switch (ra->state){ switch (ra->state){
...@@ -570,8 +599,8 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ ...@@ -570,8 +599,8 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
default: default:
break; break;
} }
// } }
// } }
stop_meas(&mac->schedule_ra); stop_meas(&mac->schedule_ra);
} }
...@@ -632,12 +661,11 @@ void nr_get_Msg3alloc(module_id_t module_id, ...@@ -632,12 +661,11 @@ void nr_get_Msg3alloc(module_id_t module_id,
ra->msg3_first_rb = rbStart; ra->msg3_first_rb = rbStart;
} }
void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP,NR_RA_t *ra,uint8_t *RAR_pdu){
gNB_MAC_INST *mac = RC.nrmac[module_idP]; gNB_MAC_INST *mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
if (ra->state == RA_IDLE) { if (ra->state == RA_IDLE) {
LOG_W(MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti); LOG_W(MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti);
...@@ -673,7 +701,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t ...@@ -673,7 +701,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
AssertFatal(ra->secondaryCellGroup, AssertFatal(ra->secondaryCellGroup,
"no secondaryCellGroup for RNTI %04x\n", "no secondaryCellGroup for RNTI %04x\n",
ra->crnti); ra->rnti);
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); "downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
...@@ -752,8 +780,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t ...@@ -752,8 +780,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
pusch_pdu->nrOfLayers = 1)>>3; pusch_pdu->nrOfLayers = 1)>>3;
// calling function to fill rar message // calling function to fill rar message
nr_fill_rar(module_idP, ra, cc->RAR_pdu.payload, pusch_pdu); nr_fill_rar(module_idP, ra, RAR_pdu, pusch_pdu);
} }
// WIP // WIP
...@@ -763,25 +790,56 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t ...@@ -763,25 +790,56 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
void nr_generate_Msg2(module_id_t module_idP, void nr_generate_Msg2(module_id_t module_idP,
int CC_id, int CC_id,
frame_t frameP, frame_t frameP,
sub_frame_t slotP) sub_frame_t slotP){
{
int dci_formats[2], rnti_types[2], mcsIndex; int dci_formats[2], rnti_types[2], mcsIndex;
int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 0; int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 0;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_RA_t *ra = &cc->ra[CC_id]; NR_RA_t *ra = &cc->ra[0];
NR_SearchSpace_t *ss = ra->ra_ss; NR_SearchSpace_t *ss = ra->ra_ss;
nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
uint8_t dci_pdu_index = 0;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
int dci10_bw = 0;
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
// This code from this point on will not work on initialBWP or CORESET0
AssertFatal(ra->bwp_id>0,"cannot work on initialBWP for now\n");
AssertFatal(ra->secondaryCellGroup,
"no secondaryCellGroup for RNTI %04x\n",
ra->rnti);
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1];
uint8_t nr_of_candidates, aggregation_level;
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0 /* common */);
nr_configure_pdcch(nr_mac,
pdcch_pdu_rel15,
ss,
coreset,
scc,
bwp);
dl_req->nPDUs+=1; //Adding PDCCH pdu count
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
if (ra->state == Msg2) {
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
uint16_t RA_rnti = ra->RA_rnti; uint16_t RA_rnti = ra->RA_rnti;
long locationAndBandwidth; long locationAndBandwidth;
// check if UE is doing RA on CORESET0 , InitialBWP or configured BWP from SCD // check if UE is doing RA on CORESET0 , InitialBWP or configured BWP from SCD
// get the BW of the PDCCH for PDCCH size and RAR PDSCH size // get the BW of the PDCCH for PDCCH size and RAR PDSCH size
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
int dci10_bw;
if (ra->coreset0_configured == 1) { if (ra->coreset0_configured == 1) {
AssertFatal(1==0,"This is a standalone condition\n"); AssertFatal(1==0,"This is a standalone condition\n");
} }
...@@ -789,18 +847,22 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -789,18 +847,22 @@ void nr_generate_Msg2(module_id_t module_idP,
locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth;
dci10_bw = NRRIV2BW(locationAndBandwidth,275); dci10_bw = NRRIV2BW(locationAndBandwidth,275);
} }
uint16_t *vrb_map = cc[CC_id].vrb_map;
int rbStart = 0,rbSize = 6;
for (int i=0;(i < rbSize) && (rbStart <= (dci10_bw - rbSize)); i++) {
if(vrb_map[rbStart + i]) {
rbStart += i;
i = 0;
}
}
if(rbStart > (dci10_bw - rbSize)) {
LOG_E(MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti);
return;
}
LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw);
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE;
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
...@@ -816,19 +878,6 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -816,19 +878,6 @@ void nr_generate_Msg2(module_id_t module_idP,
LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state);
// This code from this point on will not work on initialBWP or CORESET0
AssertFatal(ra->bwp_id>0,"cannot work on initialBWP for now\n");
AssertFatal(ra->secondaryCellGroup,
"no secondaryCellGroup for RNTI %04x\n",
ra->crnti);
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1];
LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw);
// Qm>2 not allowed for RAR // Qm>2 not allowed for RAR
if (get_softmodem_params()->do_ra) if (get_softmodem_params()->do_ra)
mcsIndex = 9; mcsIndex = 9;
...@@ -839,7 +888,6 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -839,7 +888,6 @@ void nr_generate_Msg2(module_id_t module_idP,
pdsch_pdu_rel15->rnti = RA_rnti; pdsch_pdu_rel15->rnti = RA_rnti;
pdsch_pdu_rel15->pduIndex = 0; pdsch_pdu_rel15->pduIndex = 0;
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
...@@ -867,8 +915,8 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -867,8 +915,8 @@ void nr_generate_Msg2(module_id_t module_idP,
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2;
pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->dmrsPorts = 1;
pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->resourceAlloc = 1;
pdsch_pdu_rel15->rbStart = 0; pdsch_pdu_rel15->rbStart = rbStart;
pdsch_pdu_rel15->rbSize = 6; pdsch_pdu_rel15->rbSize = rbSize;
pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved
for (int i=0; i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { for (int i=0; i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) {
...@@ -885,29 +933,8 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -885,29 +933,8 @@ void nr_generate_Msg2(module_id_t module_idP,
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols); pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols);
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,dci10_bw);
dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment;
dci_pdu_rel15[0].vrb_to_prb_mapping.val = 0;
dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0];
dci_pdu_rel15[0].tb_scaling = 0;
LOG_I(MAC, "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
dci_pdu_rel15[0].frequency_domain_assignment.val,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
dci10_bw,
dci_pdu_rel15[0].time_domain_assignment.val,
dci_pdu_rel15[0].vrb_to_prb_mapping.val,
dci_pdu_rel15[0].mcs,
dci_pdu_rel15[0].tb_scaling);
uint8_t nr_of_candidates, aggregation_level;
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0 /* common */);
int CCEIndex = allocate_nr_CCEs(nr_mac, int CCEIndex = allocate_nr_CCEs(nr_mac,
bwp, bwp,
coreset, coreset,
...@@ -920,15 +947,33 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -920,15 +947,33 @@ void nr_generate_Msg2(module_id_t module_idP,
LOG_E(MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); LOG_E(MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti);
return; return;
} }
nr_configure_pdcch(nr_mac, nr_configure_dci(nr_mac,
pdcch_pdu_rel15, pdcch_pdu_rel15,
RA_rnti, RA_rnti,
ss, ss,
coreset, coreset,
scc, scc,
bwp, bwp,
aggregation_level, ra->beam_id,
CCEIndex); aggregation_level,
CCEIndex);
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,dci10_bw);
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].time_domain_assignment.val = time_domain_assignment;
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].vrb_to_prb_mapping.val = 0;
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].mcs = pdsch_pdu_rel15->mcsIndex[0];
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].tb_scaling = 0;
LOG_I(MAC, "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].frequency_domain_assignment.val,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
dci10_bw,
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].time_domain_assignment.val,
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].vrb_to_prb_mapping.val,
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].mcs,
dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].tb_scaling);
LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x\n", frameP, slotP, RA_rnti); LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x\n", frameP, slotP, RA_rnti);
...@@ -943,19 +988,15 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -943,19 +988,15 @@ void nr_generate_Msg2(module_id_t module_idP,
pdcch_pdu_rel15->StartSymbolIndex, pdcch_pdu_rel15->StartSymbolIndex,
pdcch_pdu_rel15->DurationSymbols); pdcch_pdu_rel15->DurationSymbols);
fill_dci_pdu_rel15(scc,ra->secondaryCellGroup,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types,dci10_bw,ra->bwp_id);
dl_req->nPDUs+=2;
// Program UL processing for Msg3 // Program UL processing for Msg3
nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra); nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra);
LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
nr_add_msg3(module_idP, CC_id, frameP, slotP); nr_add_msg3(module_idP, CC_id, frameP, slotP,ra,(void *)&tx_req->TLVs[0].value.direct[0]);
ra->state = WAIT_Msg3; ra->state = WAIT_Msg3;
LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
x_Overhead = 0; x_Overhead = 0;
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_pdu_rel15[0].tb_scaling); nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_pdu_rel15[pdcch_pdu_rel15->numDlDci].tb_scaling);
// DL TX request // DL TX request
tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0];
...@@ -965,17 +1006,21 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -965,17 +1006,21 @@ void nr_generate_Msg2(module_id_t module_idP,
nr_mac->TX_req[CC_id].SFN = frameP; nr_mac->TX_req[CC_id].SFN = frameP;
nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Number_of_PDUs++;
nr_mac->TX_req[CC_id].Slot = slotP; nr_mac->TX_req[CC_id].Slot = slotP;
memcpy((void*)&tx_req->TLVs[0].value.direct[0], (void*)&cc[CC_id].RAR_pdu.payload[0], tx_req->TLVs[0].length);
T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id),
T_INT(RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0) /* harq pid, meaningful? */, T_INT(RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0) /* harq pid, meaningful? */,
T_BUFFER(&cc[CC_id].RAR_pdu.payload[0], tx_req->TLVs[0].length)); T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length));
/* mark the corresponding RBs as used */ /* mark the corresponding RBs as used */
uint16_t *vrb_map = cc[CC_id].vrb_map; for (int rb = 0; rb < rbSize; rb++)
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) vrb_map[rb + rbStart] = 1;
vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1;
dci_pdu_index+=1;
dl_req->nPDUs+=1; //Adding PDSCH pdu count
pdcch_pdu_rel15->numDlDci++;
}
}
} }
fill_dci_pdu_rel15(scc,ra->secondaryCellGroup,pdcch_pdu_rel15, dci_pdu_rel15, dci_formats, rnti_types,dci10_bw,ra->bwp_id);
} }
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){
......
...@@ -620,7 +620,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -620,7 +620,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
nrOfSymbols, nrOfSymbols,
current_harq_pid, current_harq_pid,
harq->ndi, harq->ndi,
harq->round); harq->round,
UE_info->UE_beam_index[UE_id]);
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
if (harq->round != 0) { /* retransmission */ if (harq->round != 0) { /* retransmission */
......
...@@ -245,7 +245,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -245,7 +245,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
TX_req->PDU_index = nr_mac->pdu_index[CC_id]++; TX_req->PDU_index = nr_mac->pdu_index[CC_id]++;
TX_req->num_TLV = 1; TX_req->num_TLV = 1;
TX_req->TLVs[0].length = 8; TX_req->TLVs[0].length = 8;
memcpy((void*)&TX_req->TLVs[0].value.direct[0],(void*)&cc[CC_id].RAR_pdu.payload[0],TX_req->TLVs[0].length);
nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Number_of_PDUs++;
nr_mac->TX_req[CC_id].SFN=frameP; nr_mac->TX_req[CC_id].SFN=frameP;
nr_mac->TX_req[CC_id].Slot=slotP; nr_mac->TX_req[CC_id].Slot=slotP;
......
...@@ -171,9 +171,6 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, ...@@ -171,9 +171,6 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
uint16_t Y, uint16_t Y,
int m, int m,
int nr_of_candidates) { int nr_of_candidates) {
// uncomment these when we allocate for common search space
// NR_COMMON_channels_t *cc = nr_mac->common_channels;
// NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
int coreset_id = coreset->controlResourceSetId; int coreset_id = coreset->controlResourceSetId;
int *cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; int *cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
...@@ -496,6 +493,37 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, ...@@ -496,6 +493,37 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
} }
void nr_configure_dci(gNB_MAC_INST *nr_mac,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
uint16_t rnti,
NR_SearchSpace_t *ss,
NR_ControlResourceSet_t *coreset,
NR_ServingCellConfigCommon_t *scc,
NR_BWP_Downlink_t *bwp,
uint8_t beam_index,
uint8_t aggregation_level,
int CCEIndex) {
pdcch_pdu->dci_pdu.RNTI[pdcch_pdu->numDlDci]=rnti;
if (coreset->pdcch_DMRS_ScramblingID != NULL &&
ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *coreset->pdcch_DMRS_ScramblingID;
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=rnti;
}
else {
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *scc->physCellId;
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=0;
}
pdcch_pdu->dci_pdu.AggregationLevel[pdcch_pdu->numDlDci] = aggregation_level;
pdcch_pdu->dci_pdu.CceIndex[pdcch_pdu->numDlDci] = CCEIndex;
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats==NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0)
pdcch_pdu->dci_pdu.beta_PDCCH_1_0[pdcch_pdu->numDlDci]=0;
pdcch_pdu->dci_pdu.powerControlOffsetSS[pdcch_pdu->numDlDci]=1;
}
void nr_fill_nfapi_dl_pdu(int Mod_idP, void nr_fill_nfapi_dl_pdu(int Mod_idP,
nfapi_nr_dl_tti_request_body_t *dl_req, nfapi_nr_dl_tti_request_body_t *dl_req,
rnti_t rnti, rnti_t rnti,
...@@ -510,7 +538,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP, ...@@ -510,7 +538,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
int NrOfSymbols, int NrOfSymbols,
int harq_pid, int harq_pid,
int ndi, int ndi,
int round) { int round,
int UE_beam_index) {
gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP];
NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_COMMON_channels_t *cc = nr_mac->common_channels;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
...@@ -657,14 +686,22 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP, ...@@ -657,14 +686,22 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
nr_configure_pdcch(nr_mac, nr_configure_pdcch(nr_mac,
pdcch_pdu_rel15, pdcch_pdu_rel15,
rnti,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
scc, scc,
bwp, bwp);
sched_ctrl->aggregation_level,
sched_ctrl->cce_index); nr_configure_dci(nr_mac,
pdcch_pdu_rel15,
rnti,
sched_ctrl->search_space,
sched_ctrl->coreset,
scc,
bwp,
UE_beam_index,
sched_ctrl->aggregation_level,
sched_ctrl->cce_index);
pdcch_pdu_rel15->numDlDci++;
int dci_formats[2]; int dci_formats[2];
int rnti_types[2]; int rnti_types[2];
...@@ -780,13 +817,10 @@ void config_uldci(NR_BWP_Uplink_t *ubwp, ...@@ -780,13 +817,10 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
void nr_configure_pdcch(gNB_MAC_INST *nr_mac, void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
uint16_t rnti,
NR_SearchSpace_t *ss, NR_SearchSpace_t *ss,
NR_ControlResourceSet_t *coreset, NR_ControlResourceSet_t *coreset,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
NR_BWP_Downlink_t *bwp, NR_BWP_Downlink_t *bwp) {
uint8_t aggregation_level,
int CCEIndex) {
if (bwp) { // This is not the InitialBWP if (bwp) { // This is not the InitialBWP
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
...@@ -837,27 +871,6 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, ...@@ -837,27 +871,6 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
//precoderGranularity //precoderGranularity
pdcch_pdu->precoderGranularity = coreset->precoderGranularity; pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
pdcch_pdu->dci_pdu.RNTI[pdcch_pdu->numDlDci]=rnti;
if (coreset->pdcch_DMRS_ScramblingID != NULL &&
ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *coreset->pdcch_DMRS_ScramblingID;
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=rnti;
}
else {
pdcch_pdu->dci_pdu.ScramblingId[pdcch_pdu->numDlDci] = *scc->physCellId;
pdcch_pdu->dci_pdu.ScramblingRNTI[pdcch_pdu->numDlDci]=0;
}
pdcch_pdu->dci_pdu.AggregationLevel[pdcch_pdu->numDlDci] = aggregation_level;
pdcch_pdu->dci_pdu.CceIndex[pdcch_pdu->numDlDci] = CCEIndex;
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats==NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0)
pdcch_pdu->dci_pdu.beta_PDCCH_1_0[pdcch_pdu->numDlDci]=0;
pdcch_pdu->dci_pdu.powerControlOffsetSS[pdcch_pdu->numDlDci]=1;
pdcch_pdu->numDlDci++;
} }
else { // this is for InitialBWP else { // this is for InitialBWP
AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n"); AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n");
......
...@@ -775,13 +775,22 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -775,13 +775,22 @@ void nr_schedule_ulsch(module_id_t module_id,
nr_configure_pdcch(RC.nrmac[0], nr_configure_pdcch(RC.nrmac[0],
pdcch_pdu_rel15, pdcch_pdu_rel15,
rnti,
sched_ctrl->search_space, sched_ctrl->search_space,
sched_ctrl->coreset, sched_ctrl->coreset,
scc, scc,
sched_ctrl->active_bwp, sched_ctrl->active_bwp);
sched_ctrl->aggregation_level,
sched_ctrl->cce_index); nr_configure_dci(RC.nrmac[0],
pdcch_pdu_rel15,
rnti,
sched_ctrl->search_space,
sched_ctrl->coreset,
scc,
sched_ctrl->active_bwp,
UE_info->UE_beam_index[UE_id],
sched_ctrl->aggregation_level,
sched_ctrl->cce_index);
pdcch_pdu_rel15->numDlDci++;
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15)); memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15));
......
...@@ -178,7 +178,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_id, ...@@ -178,7 +178,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_id,
int NrOfSymbols, int NrOfSymbols,
int harq_pid, int harq_pid,
int ndi, int ndi,
int round); int round,
int UE_beam_index);
void handle_nr_uci_pucch_0_1(module_id_t mod_id, void handle_nr_uci_pucch_0_1(module_id_t mod_id,
frame_t frame, frame_t frame,
...@@ -262,15 +263,23 @@ void find_search_space(int ss_type, ...@@ -262,15 +263,23 @@ void find_search_space(int ss_type,
NR_BWP_Downlink_t *bwp, NR_BWP_Downlink_t *bwp,
NR_SearchSpace_t *ss); NR_SearchSpace_t *ss);
void nr_configure_dci(gNB_MAC_INST *nr_mac,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
uint16_t rnti,
NR_SearchSpace_t *ss,
NR_ControlResourceSet_t *coreset,
NR_ServingCellConfigCommon_t *scc,
NR_BWP_Downlink_t *bwp,
uint8_t beam_index,
uint8_t aggregation_level,
int CCEIndex);
void nr_configure_pdcch(gNB_MAC_INST *nr_mac, void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
uint16_t rnti,
NR_SearchSpace_t *ss, NR_SearchSpace_t *ss,
NR_ControlResourceSet_t *coreset, NR_ControlResourceSet_t *coreset,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
NR_BWP_Downlink_t *bwp, NR_BWP_Downlink_t *bwp);
uint8_t aggregation_level,
int CCEIndex);
void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc, void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc,
NR_CellGroupConfig_t *secondaryCellGroup, NR_CellGroupConfig_t *secondaryCellGroup,
......
...@@ -182,8 +182,6 @@ typedef struct { ...@@ -182,8 +182,6 @@ typedef struct {
uint32_t PCCH_alloc_pdu; uint32_t PCCH_alloc_pdu;
/// Outgoing PCCH pdu for PHY /// Outgoing PCCH pdu for PHY
PCCH_PDU PCCH_pdu; PCCH_PDU PCCH_pdu;
/// Outgoing RAR pdu for PHY
RAR_PDU RAR_pdu;
/// Template for RA computations /// Template for RA computations
NR_RA_t ra[NR_NB_RA_PROC_MAX]; NR_RA_t ra[NR_NB_RA_PROC_MAX];
/// VRB map for common channels /// VRB map for common channels
...@@ -203,6 +201,8 @@ typedef struct { ...@@ -203,6 +201,8 @@ typedef struct {
uint8_t max_association_period; uint8_t max_association_period;
//SSB index //SSB index
uint8_t ssb_index[MAX_NUM_OF_SSB]; uint8_t ssb_index[MAX_NUM_OF_SSB];
//CB preambles for each SSB
uint8_t cb_preambles_per_ssb;
} NR_COMMON_channels_t; } NR_COMMON_channels_t;
......
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