Commit c86faa4d authored by General ABS's avatar General ABS Committed by abs

Handle the newUE_Identity present in RACH-ConfigDedicated

parent 866c09fb
...@@ -100,15 +100,11 @@ uint8_t get_nr_prach_duration(uint8_t prach_format){ ...@@ -100,15 +100,11 @@ uint8_t get_nr_prach_duration(uint8_t prach_format){
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0};
uint8_t pdu_index = 0; uint8_t pdu_index = 0;
RU_t *ru; RU_t *ru;
int aa=0; int aa=0;
int ru_aa; int ru_aa;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
gNB->UL_INFO.rach_ind.sfn = frame; gNB->UL_INFO.rach_ind.sfn = frame;
gNB->UL_INFO.rach_ind.slot = slot; gNB->UL_INFO.rach_ind.slot = slot;
...@@ -120,71 +116,86 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -120,71 +116,86 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
int prach_id=find_nr_prach(gNB,frame,slot,SEARCH_EXIST); int prach_id=find_nr_prach(gNB,frame,slot,SEARCH_EXIST);
if (prach_id>=0) { if (prach_id>=0) {
nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_vars.list[prach_id].pdu; nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_vars.list[prach_id].pdu;
uint8_t prachStartSymbol;
uint8_t N_dur = get_nr_prach_duration(prach_pdu->prach_format); uint8_t N_dur = get_nr_prach_duration(prach_pdu->prach_format);
for(int prach_oc = 0; prach_oc < prach_pdu->num_prach_ocas; prach_oc++) { for(int prach_oc = 0; prach_oc < prach_pdu->num_prach_ocas; prach_oc++) {
for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) { for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
gNB->prach_vars.rxsigF[aa] = ru->prach_rxsigF[prach_oc][ru_aa]; gNB->prach_vars.rxsigF[aa] = ru->prach_rxsigF[prach_oc][ru_aa];
} }
prachStartSymbol = prach_pdu->prach_start_symbol+prach_oc*N_dur; uint16_t max_preamble, max_preamble_energy, max_preamble_delay;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}. uint8_t prachStartSymbol = prach_pdu->prach_start_symbol+prach_oc*N_dur;
/* comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot.
This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot.
Here we work slot based, so this function is anyway only called in slots where there is PRACH.
Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}. */
rx_nr_prach(gNB, rx_nr_prach(gNB,
prach_pdu, prach_pdu,
prach_oc, prach_oc,
frame, frame,
slot, slot,
&max_preamble[0], &max_preamble,
&max_preamble_energy[0], &max_preamble_energy,
&max_preamble_delay[0]); &max_preamble_delay);
free_nr_prach_entry(gNB,prach_id); free_nr_prach_entry(gNB,prach_id);
LOG_D(PHY,"[RAPROC] Frame %d, slot %d, occasion %d (prachStartSymbol %d) : Most likely preamble %d, energy %d.%d dB delay %d (prach_energy counter %d)\n", LOG_D(PHY,"[RAPROC] Frame %d, slot %d, occasion %d (prachStartSymbol %d) : Most likely preamble %d, energy %d.%d dB delay %d (prach_energy counter %d)\n",
frame,slot,prach_oc,prachStartSymbol, frame,slot,prach_oc,prachStartSymbol,
max_preamble[0], max_preamble,
max_preamble_energy[0]/10, max_preamble_energy/10,
max_preamble_energy[0]%10, max_preamble_energy%10,
max_preamble_delay[0], max_preamble_delay,
gNB->prach_energy_counter); gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { if ((gNB->prach_energy_counter == 100) && (max_preamble_energy > gNB->measurements.prach_I0+gNB->prach_thres)) {
LOG_I(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", LOG_I(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n",
gNB->Mod_id, gNB->Mod_id,
frame, frame,
slot, slot,
max_preamble[0], max_preamble,
max_preamble_energy[0]/10, max_preamble_energy/10,
max_preamble_energy[0]%10, max_preamble_energy%10,
gNB->measurements.prach_I0,gNB->prach_thres, gNB->measurements.prach_I0,gNB->prach_thres,
max_preamble_delay[0], max_preamble_delay,
prachStartSymbol, prachStartSymbol,
prach_pdu->num_ra); prach_pdu->num_ra);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot), T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot),
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0])); T_INT(max_preamble), T_INT(max_preamble_energy), T_INT(max_preamble_delay));
// to avoid the same preamble being selected in more than one occasion
gNB->UL_INFO.rach_ind.number_of_pdus += 1; bool skip_pdu = false;
for(int p = 0; p < pdu_index; p++) {
gNB->prach_pdu_indication_list[pdu_index].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value; nfapi_nr_prach_indication_pdu_t *old_prach = &gNB->prach_pdu_indication_list[p];
gNB->prach_pdu_indication_list[pdu_index].symbol_index = prachStartSymbol; if (max_preamble == old_prach->preamble_list[0].preamble_index) {
gNB->prach_pdu_indication_list[pdu_index].slot_index = slot; skip_pdu = true;
gNB->prach_pdu_indication_list[pdu_index].freq_index = prach_pdu->num_ra; break;
gNB->prach_pdu_indication_list[pdu_index].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254; }
gNB->prach_pdu_indication_list[pdu_index].avg_snr = 0xff; // invalid for now }
gNB->prach_pdu_indication_list[pdu_index].num_preamble = 1; if (skip_pdu) continue;
gNB->prach_pdu_indication_list[pdu_index].preamble_list = gNB->preamble_list;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_index = max_preamble[0]; gNB->UL_INFO.rach_ind.number_of_pdus += 1;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].timing_advance = max_preamble_delay[0];
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; gNB->prach_pdu_indication_list[pdu_index].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
pdu_index++; gNB->prach_pdu_indication_list[pdu_index].symbol_index = prachStartSymbol;
gNB->prach_pdu_indication_list[pdu_index].slot_index = slot;
gNB->prach_pdu_indication_list[pdu_index].freq_index = prach_pdu->num_ra;
gNB->prach_pdu_indication_list[pdu_index].avg_rssi = (max_preamble_energy<631) ? (128+(max_preamble_energy/5)) : 254;
gNB->prach_pdu_indication_list[pdu_index].avg_snr = 0xff; // invalid for now
gNB->prach_pdu_indication_list[pdu_index].num_preamble = 1;
gNB->prach_pdu_indication_list[pdu_index].preamble_list = gNB->preamble_list;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_index = max_preamble;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].timing_advance = max_preamble_delay;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
pdu_index++;
} }
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++; if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++;
} //if prach_id>0 } //if prach_id>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