Commit 040b62e8 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/variable_nb_rx_ant_for_rach' into integration_2026_w12 (!3957)

replace static allocation of max antennas in a dynamic structure for gnb rach

NB_ANTENNAS_RX was used in 5G by mistake
there was also a error in O-RU implementation, with no consequences
(index not in right order)
parents 785f1272 8aebe7c4
...@@ -998,9 +998,10 @@ void *ru_thread(void *param) ...@@ -998,9 +998,10 @@ void *ru_thread(void *param)
proc->tti_rx * gNB->frame_parms.samples_per_slot_wCP); proc->tti_rx * gNB->frame_parms.samples_per_slot_wCP);
// Do PRACH RU processing // Do PRACH RU processing
prach_item_t *p = find_nr_prach(&gNB->prach_list, proc->frame_rx, proc->tti_rx, SEARCH_EXIST); prach_item_t *p =
find_nr_prach(&gNB->prach_list, proc->frame_rx, proc->tti_rx, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST);
if (p) { if (p) {
// need to extract RACH data for lqter processing by rx_nr_prach() // need to extract RACH data for later processing by rx_nr_prach()
rx_nr_prach_ru(p, ru->common.rxdata, ru->nr_frame_parms, ru->N_TA_offset); rx_nr_prach_ru(p, ru->common.rxdata, ru->nr_frame_parms, ru->N_TA_offset);
} // end if (prach_id >= 0) } // end if (prach_id >= 0)
} // end if (ru->feprx) } // end if (ru->feprx)
...@@ -1458,13 +1459,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) ...@@ -1458,13 +1459,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg)
} /* strcmp(local_rf, "yes") != 0 */ } /* strcmp(local_rf, "yes") != 0 */
ru->nb_tx = *param[RU_NB_TX_IDX].uptr; ru->nb_tx = *param[RU_NB_TX_IDX].uptr;
AssertFatal(ru->nb_tx <= NB_ANTENNAS_TX,
"Config file has %d TX antennas set, but the compile time max value in NB_ANTENNAS_TX\n",
ru->nb_tx);
ru->nb_rx = *param[RU_NB_RX_IDX].uptr; ru->nb_rx = *param[RU_NB_RX_IDX].uptr;
AssertFatal(ru->nb_rx <= NB_ANTENNAS_RX,
"Config file has %d RX antennas set, but the compile time max value in NB_ANTENNAS_RX\n",
ru->nb_rx);
ru->att_tx = *param[RU_ATT_TX_IDX].uptr; ru->att_tx = *param[RU_ATT_TX_IDX].uptr;
ru->att_rx = *param[RU_ATT_RX_IDX].uptr; ru->att_rx = *param[RU_ATT_RX_IDX].uptr;
ru->if_frequency = *param[RU_IF_FREQUENCY].u64ptr; ru->if_frequency = *param[RU_IF_FREQUENCY].u64ptr;
......
...@@ -211,12 +211,6 @@ void nrue_set_ru_params(configmodule_interface_t *cfg) ...@@ -211,12 +211,6 @@ void nrue_set_ru_params(configmodule_interface_t *cfg)
if (RUParamList.numelt <= 0) { if (RUParamList.numelt <= 0) {
nrue_ru_count = 1; nrue_ru_count = 1;
nrue_rus = calloc_or_fail(nrue_ru_count, sizeof(nrUE_RU_params_t)); nrue_rus = calloc_or_fail(nrue_ru_count, sizeof(nrUE_RU_params_t));
AssertFatal(get_nrUE_params()->nb_antennas_tx <= NB_ANTENNAS_TX,
"Config file has %d TX antennas set, but the compile time max value in NB_ANTENNAS_TX\n",
get_nrUE_params()->nb_antennas_tx);
AssertFatal(get_nrUE_params()->nb_antennas_rx <= NB_ANTENNAS_RX,
"Config file has %d RX antennas set, but the compile time max value in NB_ANTENNAS_RX\n",
get_nrUE_params()->nb_antennas_tx);
nrue_rus[0] = (nrUE_RU_params_t){.nb_tx = get_nrUE_params()->nb_antennas_tx, nrue_rus[0] = (nrUE_RU_params_t){.nb_tx = get_nrUE_params()->nb_antennas_tx,
.nb_rx = get_nrUE_params()->nb_antennas_rx, .nb_rx = get_nrUE_params()->nb_antennas_rx,
.att_tx = get_nrUE_params()->tx_gain, .att_tx = get_nrUE_params()->tx_gain,
......
...@@ -39,8 +39,7 @@ ...@@ -39,8 +39,7 @@
void init_prach_list(prach_list_t *l) void init_prach_list(prach_list_t *l)
{ {
pthread_mutex_init(&l->prach_list_mutex, NULL); pthread_mutex_init(&l->prach_list_mutex, NULL);
for (prach_item_t *p = l->list; p < l->list + NUMBER_OF_NR_PRACH_MAX; p++) memset(l->list, 0, sizeof(l->list));
*p = (prach_item_t){.frame = -1, .slot = -1};
} }
void free_nr_prach_entry(prach_list_t *l, prach_item_t *p) void free_nr_prach_entry(prach_list_t *l, prach_item_t *p)
...@@ -48,17 +47,18 @@ void free_nr_prach_entry(prach_list_t *l, prach_item_t *p) ...@@ -48,17 +47,18 @@ void free_nr_prach_entry(prach_list_t *l, prach_item_t *p)
pthread_mutex_lock(&l->prach_list_mutex); pthread_mutex_lock(&l->prach_list_mutex);
if (p->frame == -1) if (p->frame == -1)
LOG_E(NR_PHY_RACH, "Freeing a not allocated prach entry\n"); LOG_E(NR_PHY_RACH, "Freeing a not allocated prach entry\n");
*p = (prach_item_t){.frame = -1, .slot = -1, .num_slots = -1}; *p = (prach_item_t){.frame = -1, .slot = -1, .num_slots = -1, .nb_rx = p->nb_rx, .prach_buf = (void *)(p + 1)};
pthread_mutex_unlock(&l->prach_list_mutex); pthread_mutex_unlock(&l->prach_list_mutex);
} }
prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, find_type_t type) prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, int nb_rx, find_type_t type)
{ {
pthread_mutex_lock(&l->prach_list_mutex); pthread_mutex_lock(&l->prach_list_mutex);
prach_item_t *p = l->list; AssertFatal(nb_rx, "Error! Number of antennas set to 0.\n");
prach_item_t *end = p + NUMBER_OF_NR_PRACH_MAX; prach_item_t **p = l->list;
prach_item_t **end = p + NUMBER_OF_NR_PRACH_MAX;
for (; p < end; p++) for (; p < end; p++)
if (p->frame == frame && (p->slot + p->num_slots - 1) == slot) if ((*p) && (*p)->frame == frame && ((*p)->slot + (*p)->num_slots - 1) == slot)
break; break;
if (p == end) { if (p == end) {
if (type == SEARCH_EXIST) { if (type == SEARCH_EXIST) {
...@@ -66,7 +66,7 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, find_type_t ty ...@@ -66,7 +66,7 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, find_type_t ty
return NULL; return NULL;
} }
for (p = l->list; p < end; p++) for (p = l->list; p < end; p++)
if (p->frame == -1 && p->slot == -1) if (!(*p) || ((*p)->frame == -1 && (*p)->slot == -1))
break; break;
} }
if (p == end) { if (p == end) {
...@@ -74,14 +74,24 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, find_type_t ty ...@@ -74,14 +74,24 @@ prach_item_t *find_nr_prach(prach_list_t *l, int frame, int slot, find_type_t ty
return NULL; return NULL;
} }
// mark it used, it will be filled later // mark it used, it will be filled later
p->frame = frame; if (*p && (*p)->nb_rx != nb_rx) {
LOG_W(PHY, "rach procedure nb_rx ant changed from %d to %d\n", (*p)->nb_rx, nb_rx);
free(*p);
*p = NULL;
}
if (!(*p)) {
*p = calloc(1, sizeof(prach_item_t) + sizeof(c16_t) * nb_rx * NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX * NR_PRACH_SEQ_LEN_L);
(*p)->prach_buf = (void *)((*p) + 1);
}
(*p)->nb_rx = nb_rx;
(*p)->frame = frame;
pthread_mutex_unlock(&l->prach_list_mutex); pthread_mutex_unlock(&l->prach_list_mutex);
return p; return (*p);
} }
prach_item_t *nr_schedule_rx_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu) prach_item_t *nr_schedule_rx_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu)
{ {
prach_item_t *prach = find_nr_prach(&gNB->prach_list, SFN, Slot, SEARCH_EXIST_OR_FREE); prach_item_t *prach = find_nr_prach(&gNB->prach_list, SFN, Slot, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST_OR_FREE);
if (!prach) { if (!prach) {
LOG_W(PHY, "no free space for a new detected rach, discarding\n"); LOG_W(PHY, "no free space for a new detected rach, discarding\n");
return NULL; return NULL;
...@@ -380,7 +390,7 @@ static void rx_nr_prach_ru_internal(prach_item_t *p, ...@@ -380,7 +390,7 @@ static void rx_nr_prach_ru_internal(prach_item_t *p,
rxsigF_tmp[j] = c16add(rxsigF_tmp[j], tmp[k2]); rxsigF_tmp[j] = c16add(rxsigF_tmp[j], tmp[k2]);
} }
} }
memcpy(p->rxsigF[prachOccasion][aa], rxsigF_tmp, sizeof(rxsigF_tmp)); memcpy(p->prach_buf[aa][prachOccasion], rxsigF_tmp, sizeof(rxsigF_tmp));
} }
} }
...@@ -444,7 +454,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion) ...@@ -444,7 +454,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion)
int32_t prach_ifft[dft_sz] __attribute__((aligned(32))); int32_t prach_ifft[dft_sz] __attribute__((aligned(32)));
for (int preamble_index = 0; preamble_index < 64; preamble_index++) { for (int preamble_index = 0; preamble_index < 64; preamble_index++) {
if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if (LOG_DEBUGFLAG(DEBUG_PRACH)) {
int en = dB_fixed(signal_energy((int32_t *)in->rxsigF[occasion][0], N_ZC == 839 ? 840 : 140)); int en = dB_fixed(signal_energy((int32_t *)in->prach_buf[0][occasion], N_ZC == 839 ? 840 : 140));
if (en > 60) if (en > 60)
LOG_D(PHY, "frame %d, slot %d : Trying preamble %d \n", in->frame, in->slot, preamble_index); LOG_D(PHY, "frame %d, slot %d : Trying preamble %d \n", in->frame, in->slot, preamble_index);
} }
...@@ -520,7 +530,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion) ...@@ -520,7 +530,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion)
// Compute DFT of RX signal (conjugate in->rxsigF[occasion], results in conjugate output) for each new rootSequenceIndex // Compute DFT of RX signal (conjugate in->rxsigF[occasion], results in conjugate output) for each new rootSequenceIndex
if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if (LOG_DEBUGFLAG(DEBUG_PRACH)) {
int en = dB_fixed(signal_energy((int32_t *)in->rxsigF[occasion][0], 840)); int en = dB_fixed(signal_energy((int32_t *)in->prach_buf[0][occasion], 840));
if (en>60) if (en>60)
LOG_D(PHY, LOG_D(PHY,
"frame %d, slot %d : preamble index %d, NCS %d, N_ZC/NCS %d: offset %d, preamble shift %d , en %d)\n", "frame %d, slot %d : preamble index %d, NCS %d, N_ZC/NCS %d: offset %d, preamble shift %d , en %d)\n",
...@@ -549,14 +559,14 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion) ...@@ -549,14 +559,14 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *in, int occasion)
memset(prach_ifft, 0, sizeof(prach_ifft)); memset(prach_ifft, 0, sizeof(prach_ifft));
if (LOG_DUMPFLAG(DEBUG_PRACH)) { if (LOG_DUMPFLAG(DEBUG_PRACH)) {
LOG_M("prach_rxF0.m", "prach_rxF0", in->rxsigF[occasion][0], N_ZC, 1, 1); LOG_M("prach_rxF0.m", "prach_rxF0", in->prach_buf[0][occasion], N_ZC, 1, 1);
LOG_M("prach_rxF1.m", "prach_rxF1", in->rxsigF[occasion][1], 6144, 1, 1); LOG_M("prach_rxF1.m", "prach_rxF1", in->prach_buf[1][occasion], 6144, 1, 1);
} }
c16_t prachF[dft_sz] __attribute__((aligned(32))); c16_t prachF[dft_sz] __attribute__((aligned(32)));
for (int aa = 0; aa < nb_rx; aa++) { for (int aa = 0; aa < nb_rx; aa++) {
// Do componentwise product with Xu* on each antenna // Do componentwise product with Xu* on each antenna
for (int offset = 0; offset < N_ZC; offset++) { for (int offset = 0; offset < N_ZC; offset++) {
prachF[offset] = c16MulConjShift(Xu[offset], in->rxsigF[occasion][aa][offset], 15); prachF[offset] = c16MulConjShift(Xu[offset], in->prach_buf[aa][occasion][offset], 15);
} }
memset(prachF + N_ZC, 0, sizeof(*prachF) * (dft_sz - N_ZC)); memset(prachF + N_ZC, 0, sizeof(*prachF) * (dft_sz - N_ZC));
// Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
......
...@@ -202,7 +202,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *, int occasion); ...@@ -202,7 +202,7 @@ rx_prach_out_t rx_nr_prach(const prach_item_t *, int occasion);
void rx_nr_prach_ru(prach_item_t *, int32_t **, NR_DL_FRAME_PARMS *frame_parms, int N_TA_offset); void rx_nr_prach_ru(prach_item_t *, int32_t **, NR_DL_FRAME_PARMS *frame_parms, int N_TA_offset);
prach_item_t *find_nr_prach(prach_list_t *, int frame, int slot, find_type_t type); prach_item_t *find_nr_prach(prach_list_t *, int frame, int slot, int nb_rx, find_type_t type);
void nr_fill_pucch(PHY_VARS_gNB *gNB, void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
......
...@@ -147,37 +147,25 @@ uint32_t nr_ue_calculate_ssb_rsrp(const NR_DL_FRAME_PARMS *fp, ...@@ -147,37 +147,25 @@ uint32_t nr_ue_calculate_ssb_rsrp(const NR_DL_FRAME_PARMS *fp,
int symbol_offset, int symbol_offset,
int ssb_start_subcarrier) int ssb_start_subcarrier)
{ {
int k_start = 56; const int k_start = 56;
int k_end = 183; const int k_end = 183;
unsigned int ssb_offset = fp->first_carrier_offset + ssb_start_subcarrier; const unsigned int ssb_offset = fp->first_carrier_offset + ssb_start_subcarrier;
const uint8_t l_sss = (symbol_offset + 2) % fp->symbols_per_slot;
uint8_t l_sss = (symbol_offset + 2) % fp->symbols_per_slot;
uint32_t rsrp = 0; uint32_t rsrp = 0;
LOG_D(PHY, "In %s: l_sss %d ssb_offset %d\n", __FUNCTION__, l_sss, ssb_offset); LOG_D(PHY, "In %s: l_sss %d ssb_offset %d\n", __FUNCTION__, l_sss, ssb_offset);
int nb_re = 0; int nb_re = 0;
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++) { for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++) {
int16_t *rxF_sss = (int16_t *)&rxdataF[aarx][l_sss * fp->ofdm_symbol_size]; const c16_t *rxF_sss = &rxdataF[aarx][l_sss * fp->ofdm_symbol_size];
for(int k = k_start; k < k_end; k++){ for(int k = k_start; k < k_end; k++){
int re = (ssb_offset + k) % fp->ofdm_symbol_size; int re = (ssb_offset + k) % fp->ofdm_symbol_size;
rsrp += squaredMod(rxF_sss[re]);
#ifdef DEBUG_MEAS_UE
LOG_I(PHY, "In %s rxF_sss[%d] %d %d\n", __FUNCTION__, re, rxF_sss[re * 2], rxF_sss[re * 2 + 1]);
#endif
rsrp += (((int32_t)rxF_sss[re*2]*rxF_sss[re*2]) + ((int32_t)rxF_sss[re*2 + 1]*rxF_sss[re*2 + 1]));
nb_re++; nb_re++;
} }
} }
rsrp /= nb_re; rsrp /= nb_re;
LOG_D(PHY, "In %s: RSRP/nb_re: %d nb_re :%d\n", __FUNCTION__, rsrp, nb_re); LOG_D(PHY, "In %s: RSRP/nb_re: %d nb_re :%d\n", __FUNCTION__, rsrp, nb_re);
return rsrp; return rsrp;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#endif #endif
#endif #endif
#include "common/cmake_defs.h"
#include "defs_nr_common.h" #include "defs_nr_common.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/defs_nr_sl_UE.h" #include "PHY/defs_nr_sl_UE.h"
......
...@@ -141,14 +141,14 @@ typedef struct { ...@@ -141,14 +141,14 @@ typedef struct {
int restricted_set; int restricted_set;
int numerology_index; int numerology_index;
int nb_rx; int nb_rx;
c16_t rxsigF[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX][NB_ANTENNAS_RX][NR_PRACH_SEQ_LEN_L];
c16_t (*Xu)[839]; c16_t (*Xu)[839];
time_stats_t *rx_prach; time_stats_t *rx_prach;
c16_t (*prach_buf)[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX][NR_PRACH_SEQ_LEN_L];
} prach_item_t; } prach_item_t;
typedef struct { typedef struct {
/// prach commands /// prach commands
prach_item_t list[NUMBER_OF_NR_PRACH_MAX]; prach_item_t *list[NUMBER_OF_NR_PRACH_MAX];
/// mutex for prach_list access /// mutex for prach_list access
pthread_mutex_t prach_list_mutex; pthread_mutex_t prach_list_mutex;
} prach_list_t; } prach_list_t;
......
...@@ -51,7 +51,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rac ...@@ -51,7 +51,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rac
rach_ind->slot = slot; rach_ind->slot = slot;
rach_ind->number_of_pdus = 0; rach_ind->number_of_pdus = 0;
prach_item_t *prach_id = find_nr_prach(&gNB->prach_list, frame, slot, SEARCH_EXIST); prach_item_t *prach_id = find_nr_prach(&gNB->prach_list, frame, slot, gNB->frame_parms.nb_antennas_rx, SEARCH_EXIST);
if (!prach_id) { if (!prach_id) {
return; return;
} }
......
...@@ -563,7 +563,10 @@ int main(int argc, char **argv){ ...@@ -563,7 +563,10 @@ int main(int argc, char **argv){
phy_init_nr_gNB(gNB); phy_init_nr_gNB(gNB);
nr_phy_init_RU(ru); nr_phy_init_RU(ru);
nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_list.list[0].pdu;
prach_item_t *prach_data = calloc(1,sizeof(prach_item_t));
gNB->prach_list.list[0] = prach_data;
nfapi_nr_prach_pdu_t *prach_pdu = &prach_data->pdu;
prach_pdu->num_cs = get_NCS(NCS_config, format0, restrictedSetConfig); prach_pdu->num_cs = get_NCS(NCS_config, format0, restrictedSetConfig);
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = 1+(64/(N_ZC/prach_pdu->num_cs)); prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = 1+(64/(N_ZC/prach_pdu->num_cs));
prach_pdu->prach_format = prach_format; prach_pdu->prach_format = prach_format;
...@@ -765,26 +768,30 @@ int main(int argc, char **argv){ ...@@ -765,26 +768,30 @@ int main(int argc, char **argv){
nfapi_nr_prach_config_t *cfg = &gNB->gNB_config.prach_config; nfapi_nr_prach_config_t *cfg = &gNB->gNB_config.prach_config;
nfapi_nr_num_prach_fd_occasions_t *occ = &cfg->num_prach_fd_occasions_list[prach_pdu->num_ra]; nfapi_nr_num_prach_fd_occasions_t *occ = &cfg->num_prach_fd_occasions_list[prach_pdu->num_ra];
prach_pdu->num_prach_ocas=1; prach_pdu->num_prach_ocas=1;
prach_item_t in = {.frame = frame, prach_item_t *in = malloc(sizeof(prach_item_t)
.slot = slot, + sizeof(c16_t) * gNB->gNB_config.carrier_config.num_rx_ant.value
.pdu = *prach_pdu, * NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX * NR_PRACH_SEQ_LEN_L);
.rootSequenceIndex = occ->prach_root_sequence_index.value, *in = (prach_item_t){.frame = frame,
.numrootSequenceIndex = occ->num_root_sequences.value, .slot = slot,
.msg1_frequencystart = occ->k1.value, .pdu = *prach_pdu,
.mu = cfg->prach_sub_c_spacing.value, .rootSequenceIndex = occ->prach_root_sequence_index.value,
.prach_sequence_length = cfg->prach_sequence_length.value, .numrootSequenceIndex = occ->num_root_sequences.value,
.restricted_set = cfg->restricted_set_config.value, .msg1_frequencystart = occ->k1.value,
.numerology_index = gNB->frame_parms.numerology_index, .mu = cfg->prach_sub_c_spacing.value,
.nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value, .prach_sequence_length = cfg->prach_sequence_length.value,
.Xu = gNB->X_u, .restricted_set = cfg->restricted_set_config.value,
.rx_prach = &gNB->rx_prach}; .numerology_index = gNB->frame_parms.numerology_index,
rx_nr_prach_ru(&in, ru->common.rxdata, ru->nr_frame_parms, ru->N_TA_offset); .nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value,
.Xu = gNB->X_u,
.rx_prach = &gNB->rx_prach,
.prach_buf = (void *)(in + 1)};
rx_nr_prach_ru(in, ru->common.rxdata, ru->nr_frame_parms, ru->N_TA_offset);
if (n_frames == 1) if (n_frames == 1)
LOG_I(PHY, LOG_I(PHY,
"ncs %d,num_seq %d\n", "ncs %d,num_seq %d\n",
prach_pdu->num_cs, prach_pdu->num_cs,
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value); prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_prach_out_t out = rx_nr_prach(&in, prachOccasion); rx_prach_out_t out = rx_nr_prach(in, prachOccasion);
// printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", out.max_preamble_energy, out.max_preamble, // printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", out.max_preamble_energy, out.max_preamble,
// preamble_tx); // preamble_tx);
...@@ -807,13 +814,13 @@ int main(int argc, char **argv){ ...@@ -807,13 +814,13 @@ int main(int argc, char **argv){
LOG_M("rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1); LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1);
LOG_M("ru_prach_rxsigF0.m", "rxsF0", in.rxsigF[0][0], N_ZC, 1, 1); LOG_M("ru_prach_rxsigF0.m", "rxsF0", in->prach_buf[0][0], N_ZC, 1, 1);
LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1); LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1);
LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1); LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1);
#endif #endif
} }
free(in);
} }
printf("SNR %f dB, UE Speed %f km/h: errors %u/%d (delay %f)\n", SNR, ue_speed, prach_errors, n_frames, delay_avg/(double)(n_frames-prach_errors)); printf("SNR %f dB, UE Speed %f km/h: errors %u/%d (delay %f)\n", SNR, ue_speed, prach_errors, n_frames, delay_avg/(double)(n_frames-prach_errors));
if (input_fd) if (input_fd)
break; break;
...@@ -833,7 +840,7 @@ int main(int argc, char **argv){ ...@@ -833,7 +840,7 @@ int main(int argc, char **argv){
nr_phy_free_RU(ru); nr_phy_free_RU(ru);
free(RC.ru[0]); free(RC.ru[0]);
free(RC.ru); free(RC.ru);
free(prach_data);
phy_free_nr_gNB(gNB); phy_free_nr_gNB(gNB);
// allocated in set_tdd_config_nr() // allocated in set_tdd_config_nr()
int nb_slots_to_set = (1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; int nb_slots_to_set = (1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
......
...@@ -203,7 +203,7 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot) ...@@ -203,7 +203,7 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot)
int idx = 0; int idx = 0;
oran_buf_list_t *bufs = get_xran_buffers(aa / nb_rx_per_ru); oran_buf_list_t *bufs = get_xran_buffers(aa / nb_rx_per_ru);
// hardcoded to use only first prach occasion // hardcoded to use only first prach occasion
dst = (int16_t *)ru->prach_buf[0][aa]; dst = (int16_t *)ru->prach_buf[aa][0];
src = (int16_t *)bufs->prachdstdecomp[aa % nb_rx_per_ru][tti % XRAN_N_FE_BUF_LEN].pBuffers[sym_idx].pData; src = (int16_t *)bufs->prachdstdecomp[aa % nb_rx_per_ru][tti % XRAN_N_FE_BUF_LEN].pBuffers[sym_idx].pData;
/* convert Network order to host order */ /* convert Network order to host order */
if (ru_conf->compMeth_PRACH == XRAN_COMPMETHOD_NONE) { if (ru_conf->compMeth_PRACH == XRAN_COMPMETHOD_NONE) {
......
...@@ -222,7 +222,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot) ...@@ -222,7 +222,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot)
.prach_buf = NULL, .prach_buf = NULL,
}; };
prach_item_t *prach_id = find_nr_prach(&ru->gNB_list[0]->prach_list, *frame, *slot, SEARCH_EXIST); prach_item_t *prach_id = find_nr_prach(&ru->gNB_list[0]->prach_list, *frame, *slot, ru->nr_frame_parms->nb_antennas_rx, SEARCH_EXIST);
if (prach_id) { if (prach_id) {
struct xran_fh_config *fh_cfg = get_xran_fh_config(0); struct xran_fh_config *fh_cfg = get_xran_fh_config(0);
int slots_per_subframe = 1 << fh_cfg->frame_conf.nNumerology; int slots_per_subframe = 1 << fh_cfg->frame_conf.nNumerology;
...@@ -232,7 +232,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot) ...@@ -232,7 +232,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot)
bool is_prach_frame = (*frame % prach_info.x == prach_info.y); bool is_prach_frame = (*frame % prach_info.x == prach_info.y);
bool is_prach_slot = is_prach_frame && xran_is_prach_slot(0, subframe, (prach_id->slot % slots_per_subframe)); // `prach_id->slot` = slot in which PRACH is scheduled bool is_prach_slot = is_prach_frame && xran_is_prach_slot(0, subframe, (prach_id->slot % slots_per_subframe)); // `prach_id->slot` = slot in which PRACH is scheduled
if (is_prach_slot) { if (is_prach_slot) {
ru_info.prach_buf = prach_id->rxsigF; ru_info.prach_buf = prach_id->prach_buf;
} else { } else {
LOG_W(HW, "[%d.%d] Expected PRACH reception of scheduled slot %d\n", *frame, *slot, prach_id->slot); LOG_W(HW, "[%d.%d] Expected PRACH reception of scheduled slot %d\n", *frame, *slot, prach_id->slot);
} }
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#include <pthread.h> #include <pthread.h>
#include <stdint.h> #include <stdint.h>
#include "common/cmake_defs.h"
#include "xran_fh_o_du.h" #include "xran_fh_o_du.h"
#include "openair1/PHY/impl_defs_nr.h" #include "openair1/PHY/impl_defs_nr.h"
#include "openair1/PHY/TOOLS/tools_defs.h" #include "openair1/PHY/TOOLS/tools_defs.h"
#include "openair1/PHY/defs_common.h"
/* /*
* Structure added to bear the information needed from OAI RU * Structure added to bear the information needed from OAI RU
*/ */
...@@ -52,7 +52,7 @@ typedef struct ru_info_s { ...@@ -52,7 +52,7 @@ typedef struct ru_info_s {
int num_beams_period; int num_beams_period;
// Needed for Prach // Needed for Prach
c16_t (*prach_buf)[NB_ANTENNAS_RX][NR_PRACH_SEQ_LEN_L]; c16_t (*prach_buf)[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX][NR_PRACH_SEQ_LEN_L];
} ru_info_t; } ru_info_t;
/** @brief Reads RX data (PRACH/PUSCH) of next slot. /** @brief Reads RX data (PRACH/PUSCH) of next slot.
......
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