merge variants of prach_item_t as this is the same in gNB and RU

This commit is contained in:
Laurent THOMAS
2025-10-30 11:54:33 +01:00
committed by Robert Schmidt
parent d005336cb8
commit c48e0b1a32
9 changed files with 24 additions and 48 deletions
+1 -1
View File
@@ -188,7 +188,7 @@ void phy_init_nr_gNB(PHY_VARS_gNB *gNB)
common_vars->debugBuff_sample_offset = 0;
// PRACH
init_prach_list(&gNB->prach_list, prach_upper);
init_prach_list(&gNB->prach_list);
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
int n_buf = Prx*max_ul_mimo_layers;
+1 -1
View File
@@ -130,7 +130,7 @@ void nr_phy_init_RU(RU_t *ru)
LOG_D(PHY, "[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
} // !=IF5
init_prach_list(&ru->prach_list, prach_lower);
init_prach_list(&ru->prach_list);
}
void nr_phy_free_RU(RU_t *ru)
+9 -17
View File
@@ -36,11 +36,11 @@
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "openair1/PHY/NR_TRANSPORT/nr_prach.h"
void init_prach_list(prach_list_t *l, prach_type_t t)
void init_prach_list(prach_list_t *l)
{
pthread_mutex_init(&l->prach_list_mutex, NULL);
for (prach_item_t *p = l->list; p < l->list + NUMBER_OF_NR_PRACH_MAX; p++)
*p = (prach_item_t){.frame = -1, .slot = -1, .type = t};
*p = (prach_item_t){.frame = -1, .slot = -1};
}
void free_nr_prach_entry(prach_list_t *l, prach_item_t *p)
@@ -84,9 +84,10 @@ prach_item_t *nr_fill_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach
LOG_W(PHY, "no free space for a new detected rach, discarding\n");
return NULL;
}
*prach = (prach_item_t){.frame = SFN, .slot = Slot, .type = prach_upper};
const int format = prach_pdu->prach_format;
prach->num_slots = (format < 4) ? get_long_prach_dur(format, gNB->frame_parms.numerology_index) : 1;
const int fmt = prach_pdu->prach_format;
*prach = (prach_item_t){.frame = SFN,
.slot = Slot,
.num_slots = (fmt < 4) ? get_long_prach_dur(fmt, gNB->frame_parms.numerology_index) : 1};
if (gNB->common_vars.beam_id) {
int n_symb = get_nr_prach_duration(prach_pdu->prach_format);
AssertFatal(prach_pdu->beamforming.dig_bf_interface < NFAPI_MAX_NUM_BG_IF,
@@ -109,23 +110,14 @@ prach_item_t *nr_fill_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach
return prach;
}
void nr_fill_prach_ru(RU_t *ru, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu, int *beams)
void nr_fill_prach_ru(RU_t *ru, prach_item_t *gnb_prach)
{
prach_item_t *prach = find_nr_prach(&ru->prach_list, SFN, Slot, SEARCH_EXIST_OR_FREE);
prach_item_t *prach = find_nr_prach(&ru->prach_list, gnb_prach->frame, gnb_prach->slot, SEARCH_EXIST_OR_FREE);
if (!prach) {
LOG_E(PHY, "no prach memory found\n");
return;
}
const int fmt = prach_pdu->prach_format;
*prach = (prach_item_t){.frame = SFN,
.slot = Slot,
.type = prach_lower,
.num_slots = (fmt < 4) ? get_long_prach_dur(fmt, ru->nr_frame_parms->numerology_index) : 1,
.lower = {.fmt = fmt,
.numRA = prach_pdu->num_ra,
.prachStartSymbol = prach_pdu->prach_start_symbol,
.num_prach_ocas = prach_pdu->num_prach_ocas}};
memcpy(prach->beams, beams, sizeof(prach->beams));
*prach = *gnb_prach;
}
void rx_nr_prach_ru(RU_t *ru,
@@ -222,7 +222,7 @@ void rx_nr_prach_ru(RU_t *ru,
int frame,
int subframe);
void nr_fill_prach_ru(RU_t *ru,int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu, int *beam_nb);
void nr_fill_prach_ru(RU_t *ru,prach_item_t * );
prach_item_t *find_nr_prach(prach_list_t *, int frame, int slot, find_type_t type);
void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame,
+1 -15
View File
@@ -1001,25 +1001,11 @@ typedef struct {
// TODO will be removed in a late commit
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
#define NUMBER_OF_NR_PRACH_MAX 8
typedef enum { prach_upper, prach_lower } prach_type_t;
typedef struct {
int frame;
int slot;
int num_slots; // prach duration in slots
int beams[NFAPI_MAX_NUM_BG_IF];
prach_type_t type;
union {
struct {
// identifier for concurrent beams
nfapi_nr_prach_pdu_t pdu;
} upper;
struct {
int fmt;
int numRA;
int prachStartSymbol;
int num_prach_ocas;
} lower;
};
nfapi_nr_prach_pdu_t pdu;
} prach_item_t;
@@ -1029,7 +1015,7 @@ typedef struct {
/// mutex for prach_list access
pthread_mutex_t prach_list_mutex;
} prach_list_t;
void init_prach_list(prach_list_t *, prach_type_t);
void init_prach_list(prach_list_t *);
static inline void init_abort(decode_abort_t *ab)
{
+1 -4
View File
@@ -45,10 +45,7 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
int SFN,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu){}
void nr_fill_prach_ru(RU_t *ru,
int SFN,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu){}
void nr_fill_prach_ru(RU_t *ru,prach_item_t *gnb_prach){}
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
+1 -1
View File
@@ -156,7 +156,7 @@ void nr_schedule_ul_tti_req(PHY_VARS_gNB *gNB, nfapi_nr_ul_tti_request_t *UL_tti
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
prach_item_t *prach = nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
if (prach && (gNB->RU_list[0]->if_south == LOCAL_RF || gNB->RU_list[0]->if_south == REMOTE_IF5))
nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu, prach->beams);
nr_fill_prach_ru(gNB->RU_list[0], prach);
break;
case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
LOG_D(NR_PHY,
+4 -3
View File
@@ -774,9 +774,10 @@ int main(int argc, char **argv){
for (int i = 0; i < ru->nb_rx; ++i)
rxsigF[i] = (c16_t *)ru->prach_rxsigF[prachOccasion][i];
if (n_frames == 1)
printf("ncs %d,num_seq %d\n",
prach_pdu->num_cs,
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
LOG_I(PHY,
"ncs %d,num_seq %d\n",
prach_pdu->num_cs,
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_nr_prach(gNB, prach_pdu, prachOccasion, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay, rxsigF);
// printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx);