Commit 74b2aec2 authored by Francesco Mani's avatar Francesco Mani

fix for rach pdus

parent c2889d3b
...@@ -1122,7 +1122,7 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, ...@@ -1122,7 +1122,7 @@ int get_nr_prach_occasion_info_from_index(uint8_t index,
uint8_t get_nr_prach_duration(uint8_t prach_format){ uint8_t get_nr_prach_duration(uint8_t prach_format){
switch(prach_format){ switch(prach_format){
case 0: // format 0 case 0: // format 0
return 0; return 0;
...@@ -1170,7 +1170,7 @@ switch(prach_format){ ...@@ -1170,7 +1170,7 @@ switch(prach_format){
AssertFatal(1==0,"Invalid Prach format\n"); AssertFatal(1==0,"Invalid Prach format\n");
break; break;
} }
} }
...@@ -1202,38 +1202,39 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1202,38 +1202,39 @@ int get_nr_prach_info_from_index(uint8_t index,
if ( (frame%x)==y || (frame%x)==y2 ) { if ( (frame%x)==y || (frame%x)==y2 ) {
slot_60khz = slot >> (mu-2); // in table slots are numbered wrt 60kHz slot_60khz = slot >> (mu-2); // in table slots are numbered wrt 60kHz
s_map = table_6_3_3_2_4_prachConfig_Index[index][5]; s_map = table_6_3_3_2_4_prachConfig_Index[index][5];
if ((s_map >> slot_60khz) & 0x01 ) { if ((s_map >> slot_60khz) & 0x01 ) {
for(int i = 0; i <= slot_60khz ;i++) { for(int i = 0; i <= slot_60khz ;i++) {
if ( (s_map >> i) & 0x01) { if ( (s_map >> i) & 0x01) {
(*RA_sfn_index)++; (*RA_sfn_index)++;
}
} }
} }
}
if ( ((s_map>>slot_60khz)&0x01) ) { if ( ((s_map>>slot_60khz)&0x01) ) {
*N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe *N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe
if (mu == 3) { if (mu == 3) {
if ( (*N_RA_slot == 1) && (slot%2 == 0) ) if ( (*N_RA_slot == 1) && (slot%2 == 0) )
return 0; // no prach in even slots @ 120kHz for 1 prach per 60khz slot return 0; // no prach in even slots @ 120kHz for 1 prach per 60khz slot
} }
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){
*config_period = x; *config_period = x;
*start_symbol = table_6_3_3_2_4_prachConfig_Index[index][6]; *start_symbol = table_6_3_3_2_4_prachConfig_Index[index][6];
*N_t_slot = table_6_3_3_2_4_prachConfig_Index[index][8]; *N_t_slot = table_6_3_3_2_4_prachConfig_Index[index][8];
*N_dur = table_6_3_3_2_4_prachConfig_Index[index][9]; *N_dur = table_6_3_3_2_4_prachConfig_Index[index][9];
if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1)
format2 = (uint8_t) table_6_3_3_2_4_prachConfig_Index[index][1]; format2 = (uint8_t) table_6_3_3_2_4_prachConfig_Index[index][1];
*format = ((uint8_t) table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2<<8); *format = ((uint8_t) table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2<<8);
LOG_I(MAC,"Frame %d slot %d: Getting PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u\n", frame, LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u\n",
slot, frame,
index, slot,
pointa, index,
mu, pointa,
unpaired, mu,
*start_symbol, unpaired,
*N_t_slot, *start_symbol,
*N_dur, *N_t_slot,
*N_RA_slot, *N_dur,
*RA_sfn_index); *N_RA_slot,
*RA_sfn_index);
} }
return 1; return 1;
} }
...@@ -1252,10 +1253,10 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1252,10 +1253,10 @@ int get_nr_prach_info_from_index(uint8_t index,
subframe = slot >> mu; subframe = slot >> mu;
s_map = table_6_3_3_2_3_prachConfig_Index[index][4]; s_map = table_6_3_3_2_3_prachConfig_Index[index][4];
if ((s_map >> subframe) & 0x01 ) { if ((s_map >> subframe) & 0x01 ) {
for(int i = 0; i <= subframe ;i++) { for(int i = 0; i <= subframe ;i++) {
if ( (s_map >> i) & 0x01) { if ( (s_map >> i) & 0x01) {
(*RA_sfn_index)++; (*RA_sfn_index)++;
} }
} }
} }
if ( (s_map>>subframe)&0x01 ) { if ( (s_map>>subframe)&0x01 ) {
...@@ -1265,24 +1266,26 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1265,24 +1266,26 @@ int get_nr_prach_info_from_index(uint8_t index,
return 0; // no prach in even slots @ 30kHz for 1 prach per subframe return 0; // no prach in even slots @ 30kHz for 1 prach per subframe
} }
if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){
*config_period = x; *config_period = x;
*start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5]; *start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5];
*N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7]; *N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7];
*N_dur = table_6_3_3_2_3_prachConfig_Index[index][8]; *N_dur = table_6_3_3_2_3_prachConfig_Index[index][8];
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1)
format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1]; format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1];
*format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8); *format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8);
LOG_I(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame, LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n",
slot, frame,
index, table_6_3_3_2_3_prachConfig_Index[index][6], slot,
pointa, index,
mu, table_6_3_3_2_3_prachConfig_Index[index][6],
unpaired, pointa,
*start_symbol, mu,
*N_t_slot, unpaired,
*N_dur, *start_symbol,
*N_RA_slot, *N_t_slot,
*RA_sfn_index); *N_dur,
*N_RA_slot,
*RA_sfn_index);
} }
return 1; return 1;
} }
...@@ -1310,15 +1313,16 @@ int get_nr_prach_info_from_index(uint8_t index, ...@@ -1310,15 +1313,16 @@ int get_nr_prach_info_from_index(uint8_t index,
if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1) if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1)
format2 = (uint8_t) table_6_3_3_2_2_prachConfig_Index[index][1]; format2 = (uint8_t) table_6_3_3_2_2_prachConfig_Index[index][1];
*format = ((uint8_t) table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2<<8); *format = ((uint8_t) table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2<<8);
LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", frame, LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u \n",
slot, frame,
index, slot,
pointa, index,
mu, pointa,
unpaired, mu,
*start_symbol, unpaired,
*N_t_slot, *start_symbol,
*N_dur); *N_t_slot,
*N_dur);
} }
return 1; return 1;
} }
......
...@@ -56,22 +56,25 @@ extern uint16_t sf_ahead; ...@@ -56,22 +56,25 @@ extern uint16_t sf_ahead;
extern uint16_t sl_ahead; extern uint16_t sl_ahead;
void handle_nr_rach(NR_UL_IND_t *UL_info) { void handle_nr_rach(NR_UL_IND_t *UL_info) {
if (UL_info->rach_ind.number_of_pdus>0) { if (UL_info->rach_ind.number_of_pdus>0) {
LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
for(int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) { int npdus = UL_info->rach_ind.number_of_pdus;
if (UL_info->rach_ind.pdu_list[i].num_preamble>0) for(int i = 0; i < npdus; i++) {
AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble==1, UL_info->rach_ind.number_of_pdus--;
"More than 1 preamble not supported\n"); if (UL_info->rach_ind.pdu_list[i].num_preamble>0)
AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble==1,
"More than 1 preamble not supported\n");
nr_initiate_ra_proc(UL_info->module_id, nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
UL_info->rach_ind.sfn, UL_info->rach_ind.sfn,
UL_info->rach_ind.slot, UL_info->rach_ind.slot,
UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_index, UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_index,
UL_info->rach_ind.pdu_list[i].freq_index, UL_info->rach_ind.pdu_list[i].freq_index,
UL_info->rach_ind.pdu_list[i].symbol_index, UL_info->rach_ind.pdu_list[i].symbol_index,
UL_info->rach_ind.pdu_list[i].preamble_list[0].timing_advance); UL_info->rach_ind.pdu_list[i].preamble_list[0].timing_advance);
} }
} }
} }
......
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