diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index 493221d6a9..31c754738d 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -172,14 +172,16 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot) struct xran_fh_init *fh_init = get_xran_fh_init(); struct xran_fh_config *fh_cfg = get_xran_fh_config(0); - int prach_sym = get_prach_conf_duration(0); + nr_prach_info_t prach_info = get_prach_info(0); struct xran_ru_config *ru_conf = &fh_cfg->ru_conf; int slots_per_frame = 10 << fh_cfg->frame_conf.nNumerology; int slots_per_subframe = 1 << fh_cfg->frame_conf.nNumerology; int tti = slots_per_frame * (frame) + (slot); uint32_t subframe = slot / slots_per_subframe; - uint32_t is_prach_slot = xran_is_prach_slot(0, subframe, (slot % slots_per_subframe)); + // PRACH occasion in a frame if and only if SFN % x == y, TS 38.211 Table 6.3.3.2-2/3/4 + uint32_t is_prach_frame = (frame % prach_info.x == prach_info.y); + uint32_t is_prach_slot = is_prach_frame && xran_is_prach_slot(0, subframe, (slot % slots_per_subframe)); int nb_rx_per_ru = ru->nb_rx / fh_init->xran_ports; /* If it is PRACH slot, copy prach IQ from XRAN PRACH buffer to OAI PRACH buffer */ @@ -188,7 +190,7 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot) LOG_W(HW, "we get rach data from ru, but it is not scheduled %d.%d\n", frame, slot); return -1; } - for (sym_idx = 0; sym_idx < prach_sym; sym_idx++) { + for (sym_idx = 0; sym_idx < prach_info.N_dur; sym_idx++) { for (int aa = 0; aa < ru->nb_rx; aa++) { int16_t *dst, *src; int idx = 0; diff --git a/radio/fhi_72/oran-init.c b/radio/fhi_72/oran-init.c index 07517dcf18..516c2795fe 100644 --- a/radio/fhi_72/oran-init.c +++ b/radio/fhi_72/oran-init.c @@ -30,9 +30,7 @@ #include "common/utils/assertions.h" #include "common/utils/LOG/log.h" -#include "common/utils/nr/nr_common.h" #include "common_lib.h" -#include "openair2/LAYER2/NR_MAC_COMMON/nr_prach_config.h" /* PRACH data samples are 32 bits wide (16bits for I/Q). Each packet contains * 840 samples for long sequence or 144 for short sequence. The payload length @@ -50,7 +48,7 @@ void *gxran_handle; static struct xran_fh_init g_fh_init = {0}; static struct xran_fh_config g_fh_config[XRAN_PORTS_NUM] = {0}; -static uint32_t g_prach_conf_duration[XRAN_PORTS_NUM] = {0}; +static nr_prach_info_t g_prach_info[XRAN_PORTS_NUM] = {0}; static uint32_t get_nSW_ToFpga_FTH_TxBufferLen(int mu, int sections) { @@ -470,11 +468,9 @@ int *oai_oran_initialize(struct xran_fh_init *xran_fh_init, struct xran_fh_confi // retrieve and store prach duration uint8_t idx = xran_fh_config[o_xu_id].prach_conf.nPrachConfIdx; const struct xran_frame_config *fc = &xran_fh_config[o_xu_id].frame_conf; - g_prach_conf_duration[o_xu_id] = - get_nr_prach_occasion_info_from_index(idx, - fc->nNumerology > 2 ? FR2 : FR1, - fc->nFrameDuplexType == XRAN_FDD ? duplex_mode_FDD : duplex_mode_TDD) - .N_dur; + g_prach_info[o_xu_id] = get_nr_prach_occasion_info_from_index(idx, + fc->nNumerology > 2 ? FR2 : FR1, + fc->nFrameDuplexType == XRAN_FDD ? duplex_mode_FDD : duplex_mode_TDD); } // store config after xran initialization -- xran makes modifications to @@ -504,9 +500,9 @@ struct xran_fh_config *get_xran_fh_config(uint32_t port_id) return &g_fh_config[port_id]; } -uint32_t get_prach_conf_duration(uint32_t port_id) +nr_prach_info_t get_prach_info(uint32_t port_id) { struct xran_fh_init *fh_init = get_xran_fh_init(); DevAssert(port_id < fh_init->xran_ports); - return g_prach_conf_duration[port_id]; + return g_prach_info[port_id]; } diff --git a/radio/fhi_72/oran-init.h b/radio/fhi_72/oran-init.h index e56b683a9f..419cbccce4 100644 --- a/radio/fhi_72/oran-init.h +++ b/radio/fhi_72/oran-init.h @@ -22,6 +22,9 @@ #ifndef ORAN_INIT_H #define ORAN_INIT_H +#include "common/utils/nr/nr_common.h" +#include "openair2/LAYER2/NR_MAC_COMMON/nr_prach_config.h" + typedef struct oran_bufs { struct xran_flat_buffer tx[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN][XRAN_NUM_OF_SYMBOL_PER_SLOT]; struct xran_flat_buffer tx_prbmap[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]; @@ -62,6 +65,16 @@ int *oai_oran_initialize(struct xran_fh_init *fh_init, struct xran_fh_config *fh oran_buf_list_t *get_xran_buffers(uint32_t port_id); struct xran_fh_init *get_xran_fh_init(void); struct xran_fh_config *get_xran_fh_config(uint32_t port_id); -uint32_t get_prach_conf_duration(uint32_t port_id); + +/** + * @brief queries PRACH information necessary for the FHI + * + * @arg port_id XRAN port id + * @return PRACH information holding among other information: + * - N_dur PRACH duration from TS 38.211 Table 6.3.3.2-2/3/4 + * - x from TS 38.211 Table 6.3.3.2-2/3/4 + * - y from TS 38.211 Table 6.3.3.2-2/3/4 + */ +nr_prach_info_t get_prach_info(uint32_t port_id); #endif /* ORAN_INIT_H */