Commit 8ad840cb authored by kn.raju's avatar kn.raju

Fixed issue in finding prach_id

parent 5d4acc2e
...@@ -1586,7 +1586,6 @@ void *ru_thread( void *param ) { ...@@ -1586,7 +1586,6 @@ void *ru_thread( void *param ) {
for(i = 0;i < NUMBER_OF_NR_RU_PRACH_MAX; i++) { for(i = 0;i < NUMBER_OF_NR_RU_PRACH_MAX; i++) {
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
if (prach_id>=0) { if (prach_id>=0) {
prach_id = 2;
rx_nr_prach_ru(ru, rx_nr_prach_ru(ru,
ru->prach_list[prach_id].fmt, ru->prach_list[prach_id].fmt,
ru->prach_list[prach_id].numRA, ru->prach_list[prach_id].numRA,
......
...@@ -46,22 +46,33 @@ void init_prach_list(PHY_VARS_gNB *gNB) { ...@@ -46,22 +46,33 @@ void init_prach_list(PHY_VARS_gNB *gNB) {
for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) gNB->prach_vars.list[i].frame=-1; for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) gNB->prach_vars.list[i].frame=-1;
} }
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) { void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id) {
gNB->prach_vars.list[prach_id].frame = -1;
gNB->prach_vars.list[prach_id].slot = -1;
uint16_t i; }
int16_t first_free_index=-1;
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) {
AssertFatal(gNB!=NULL,"gNB is null\n"); AssertFatal(gNB!=NULL,"gNB is null\n");
for (i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) { for (uint16_t i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d prach_index %d=> %d.%d\n", frame,slot,i, LOG_D(PHY,"searching for PRACH in %d.%d prach_index %d=> %d.%d\n", frame,slot,i,
gNB->prach_vars.list[i].frame,gNB->prach_vars.list[i].slot); gNB->prach_vars.list[i].frame,gNB->prach_vars.list[i].slot);
if ((gNB->prach_vars.list[i].frame == frame) && if((type == SEARCH_EXIST_OR_FREE) &&
(gNB->prach_vars.list[i].slot == slot)) return i; (gNB->prach_vars.list[i].frame == -1) &&
else if ((gNB->prach_vars.list[i].frame == -1) && (first_free_index==-1)) first_free_index=i; (gNB->prach_vars.list[i].slot == -1)) {
LOG_I(PHY, "Providing free prach index %d\n",i);
return i;
}
else if ((type == SEARCH_EXIST) &&
(gNB->prach_vars.list[i].frame == frame) &&
(gNB->prach_vars.list[i].slot == slot)) {
LOG_I(PHY, "Providing existing prach index %d\n",i);
return i;
}
} }
if (type == SEARCH_EXIST) return -1; return -1;
return first_free_index;
} }
void nr_fill_prach(PHY_VARS_gNB *gNB, void nr_fill_prach(PHY_VARS_gNB *gNB,
...@@ -70,8 +81,8 @@ void nr_fill_prach(PHY_VARS_gNB *gNB, ...@@ -70,8 +81,8 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_pdu_t *prach_pdu) { nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach(gNB,SFN,Slot,SEARCH_EXIST_OR_FREE); int prach_id = find_nr_prach(gNB,SFN,Slot,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX), AssertFatal( ((prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0),
"illegal or no prach_id found!!! numRA %d prach_id %d\n",prach_pdu->num_ra,prach_id); "illegal or no prach_id found!!! prach_id %d\n",prach_id);
gNB->prach_vars.list[prach_id].frame=SFN; gNB->prach_vars.list[prach_id].frame=SFN;
gNB->prach_vars.list[prach_id].slot=Slot; gNB->prach_vars.list[prach_id].slot=Slot;
...@@ -88,25 +99,28 @@ void init_prach_ru_list(RU_t *ru) { ...@@ -88,25 +99,28 @@ void init_prach_ru_list(RU_t *ru) {
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) { int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
AssertFatal(ru!=NULL,"ru is null\n"); AssertFatal(ru!=NULL,"ru is null\n");
pthread_mutex_lock(&ru->prach_list_mutex); pthread_mutex_lock(&ru->prach_list_mutex);
for (i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) { for (uint16_t i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n", frame,slot,i, LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n", frame,slot,i,
ru->prach_list[i].frame,ru->prach_list[i].slot); ru->prach_list[i].frame,ru->prach_list[i].slot);
if ((ru->prach_list[i].frame == frame) && if((type == SEARCH_EXIST_OR_FREE) &&
(ru->prach_list[i].slot == slot)) { (ru->prach_list[i].frame == -1) &&
(ru->prach_list[i].slot == -1)) {
LOG_I(PHY, "Providing free prach index %d in ru\n",i);
pthread_mutex_unlock(&ru->prach_list_mutex);
return i;
}
else if ((type == SEARCH_EXIST) &&
(ru->prach_list[i].frame == frame) &&
(ru->prach_list[i].slot == slot)) {
LOG_I(PHY, "Providing existing prach index %d in ru\n",i);
pthread_mutex_unlock(&ru->prach_list_mutex); pthread_mutex_unlock(&ru->prach_list_mutex);
return i; return i;
} }
else if ((ru->prach_list[i].frame == -1) && (first_free_index==-1)) first_free_index=i;
} }
pthread_mutex_unlock(&ru->prach_list_mutex); pthread_mutex_unlock(&ru->prach_list_mutex);
if (type == SEARCH_EXIST) return -1; return -1;
return first_free_index;
} }
void nr_fill_prach_ru(RU_t *ru, void nr_fill_prach_ru(RU_t *ru,
...@@ -115,7 +129,7 @@ void nr_fill_prach_ru(RU_t *ru, ...@@ -115,7 +129,7 @@ void nr_fill_prach_ru(RU_t *ru,
nfapi_nr_prach_pdu_t *prach_pdu) { nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach_ru(ru,SFN,Slot,SEARCH_EXIST_OR_FREE); int prach_id = find_nr_prach_ru(ru,SFN,Slot,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX), AssertFatal( ((prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0) ,
"illegal or no prach_id found!!! prach_id %d\n",prach_id); "illegal or no prach_id found!!! prach_id %d\n",prach_id);
pthread_mutex_lock(&ru->prach_list_mutex); pthread_mutex_lock(&ru->prach_list_mutex);
...@@ -132,7 +146,8 @@ void free_nr_ru_prach_entry(RU_t *ru, ...@@ -132,7 +146,8 @@ void free_nr_ru_prach_entry(RU_t *ru,
int prach_id) { int prach_id) {
pthread_mutex_lock(&ru->prach_list_mutex); pthread_mutex_lock(&ru->prach_list_mutex);
ru->prach_list[prach_id].frame=-1; ru->prach_list[prach_id].frame = -1;
ru->prach_list[prach_id].slot = -1;
pthread_mutex_unlock(&ru->prach_list_mutex); pthread_mutex_unlock(&ru->prach_list_mutex);
} }
......
...@@ -325,7 +325,7 @@ int nr_find_pucch(uint16_t rnti, ...@@ -325,7 +325,7 @@ int nr_find_pucch(uint16_t rnti,
void init_prach_list(PHY_VARS_gNB *gNB); void init_prach_list(PHY_VARS_gNB *gNB);
void init_prach_ru_list(RU_t *ru); void init_prach_ru_list(RU_t *ru);
void free_nr_ru_prach_entry(RU_t *ru, int prach_id); void free_nr_ru_prach_entry(RU_t *ru, int prach_id);
void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id);
void nr_decode_pucch1(int32_t **rxdataF, void nr_decode_pucch1(int32_t **rxdataF,
pucch_GroupHopping_t pucch_GroupHopping, pucch_GroupHopping_t pucch_GroupHopping,
......
...@@ -90,8 +90,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -90,8 +90,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
&max_preamble_energy[0], &max_preamble_energy[0],
&max_preamble_delay[0] &max_preamble_delay[0]
); );
free_nr_prach_entry(gNB,prach_id);
gNB->prach_vars.list[prach_id].frame=-1;
LOG_D(PHY,"[RAPROC] Frame %d, slot %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n", LOG_D(PHY,"[RAPROC] Frame %d, slot %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
frame,slot, frame,slot,
max_preamble[0], max_preamble[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