Commit a5d45a2c authored by Francesco Mani's avatar Francesco Mani

indentation in gNB MAC rach functions

parent 9e7c66d2
...@@ -113,12 +113,14 @@ int16_t ssb_index_from_prach(module_id_t module_idP, ...@@ -113,12 +113,14 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
slot_index = 0; //For scs = 30khz and 120khz slot_index = 0; //For scs = 30khz and 120khz
} }
// prach_occasion_id = subframe_index * N_t_slot * N_RA_slot * fdm + N_RA_slot_index * N_t_slot * fdm + freq_index + fdm * start_symbol_index; // prach_occasion_id = subframe_index * N_t_slot * N_RA_slot * fdm + N_RA_slot_index * N_t_slot * fdm + freq_index + fdm * start_symbol_index;
prach_occasion_id = (((frameP % (cc->max_association_period * config_period))/config_period)*cc->total_prach_occasions_per_config_period) + (RA_sfn_index + slot_index) * N_t_slot * fdm + start_symbol_index * fdm + freq_index; prach_occasion_id = (((frameP % (cc->max_association_period * config_period))/config_period)*cc->total_prach_occasions_per_config_period) +
//one RO is shared by one or more SSB (RA_sfn_index + slot_index) * N_t_slot * fdm + start_symbol_index * fdm + freq_index;
//one RO is shared by one or more SSB
if(num_ssb_per_RO <= 1 ) if(num_ssb_per_RO <= 1 )
index = (int) (prach_occasion_id / (int)(1/num_ssb_per_RO)) % num_active_ssb; index = (int) (prach_occasion_id / (int)(1/num_ssb_per_RO)) % num_active_ssb;
//one SSB have more than one continuous RO //one SSB have more than one continuous RO
else if ( num_ssb_per_RO > 1) { else if ( num_ssb_per_RO > 1) {
index = (prach_occasion_id * (int)num_ssb_per_RO)% num_active_ssb ; index = (prach_occasion_id * (int)num_ssb_per_RO)% num_active_ssb ;
for(int j = 0;j < num_ssb_per_RO;j++) { for(int j = 0;j < num_ssb_per_RO;j++) {
...@@ -127,7 +129,9 @@ int16_t ssb_index_from_prach(module_id_t module_idP, ...@@ -127,7 +129,9 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
} }
} }
LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n", frameP, slotP, prach_occasion_id, num_ssb_per_RO, num_active_ssb, index, fdm, start_symbol_index, freq_index, total_RApreambles); LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n",
frameP, slotP, prach_occasion_id, num_ssb_per_RO, num_active_ssb, index, fdm, start_symbol_index, freq_index, total_RApreambles);
return index; return index;
} }
//Compute Total active SSBs and RO available //Compute Total active SSBs and RO available
...@@ -191,8 +195,8 @@ void find_SSB_and_RO_available(module_id_t module_idP) { ...@@ -191,8 +195,8 @@ void find_SSB_and_RO_available(module_id_t module_idP) {
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", cc->total_prach_occasions, cc->num_active_ssb, unused_RA_occasion, max_association_period, N_RA_sfn); 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);
} }
void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
...@@ -232,27 +236,27 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP ...@@ -232,27 +236,27 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
&RA_sfn_index, &RA_sfn_index,
&N_RA_slot, &N_RA_slot,
&config_period) ) { &config_period) ) {
uint16_t format0 = format&0xff; // first column of format from table uint16_t format0 = format&0xff; // first column of format from table
uint16_t format1 = (format>>8)&0xff; // second column of format from table uint16_t format1 = (format>>8)&0xff; // second column of format from table
if (N_RA_slot > 1) { //more than 1 PRACH slot in a subframe if (N_RA_slot > 1) { //more than 1 PRACH slot in a subframe
if (slotP%2 == 1){ if (slotP%2 == 1)
slot_index = 1; slot_index = 1;
} else
else {
slot_index = 0; slot_index = 0;
}
}else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe }else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe
slot_index = 0; slot_index = 0;
} }
UL_tti_req->SFN = frameP; UL_tti_req->SFN = frameP;
UL_tti_req->Slot = slotP; UL_tti_req->Slot = slotP;
for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion
for (int td_index=0; td_index<N_t_slot; td_index++) { for (int td_index=0; td_index<N_t_slot; td_index++) {
prach_occasion_id = (((frameP % (cc->max_association_period * config_period))/config_period) * cc->total_prach_occasions_per_config_period) + (RA_sfn_index + slot_index) * N_t_slot * fdm + td_index * fdm + fdm_index; prach_occasion_id = (((frameP % (cc->max_association_period * config_period))/config_period) * cc->total_prach_occasions_per_config_period) +
(RA_sfn_index + slot_index) * N_t_slot * fdm + td_index * fdm + fdm_index;
if((prach_occasion_id < cc->total_prach_occasions) && (td_index == 0)){ if((prach_occasion_id < cc->total_prach_occasions) && (td_index == 0)){
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE; UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE;
......
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