From 75df29a333689d334192b14f7442d907049ebcf3 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 18 Jun 2025 15:27:04 +0000 Subject: [PATCH 01/21] consistenty use suffix _t for openair0_* types --- executables/lte-ru.c | 4 +- executables/lte-ue.c | 5 +- executables/nr-ru.c | 4 +- executables/nr-ue.c | 21 ++-- openair1/PHY/INIT/nr_parms.c | 2 +- .../PHY/INIT/tests/test_nr_frame_params.cpp | 6 +- openair1/PHY/TOOLS/calibration_scope.c | 5 +- openair1/PHY/TOOLS/calibration_scope.h | 2 +- openair1/PHY/TOOLS/calibration_test.c | 4 +- openair1/PHY/defs_L1_NB_IoT.h | 22 ++-- openair1/PHY/defs_RU.h | 16 +-- openair1/PHY/defs_UE.h | 8 +- openair1/PHY/defs_eNB.h | 8 +- openair1/PHY/defs_gNB.h | 10 +- openair1/PHY/defs_nr_UE.h | 8 +- openair1/PHY/defs_nr_common.h | 2 +- openair1/SIMULATION/LTE_PHY/unitary_defs.h | 2 +- openair1/SIMULATION/TOOLS/sim.h | 4 +- radio/AW2SORI/oaiori.c | 23 ++-- radio/BLADERF/bladerf_lib.c | 44 +++---- radio/BLADERF/bladerf_lib.h | 6 +- radio/COMMON/common_lib.c | 31 ++--- radio/COMMON/common_lib.h | 117 ++++++++++-------- radio/COMMON/record_player.c | 3 +- radio/ETHERNET/eth_raw.c | 71 +++++------ radio/ETHERNET/eth_udp.c | 57 ++++----- radio/ETHERNET/ethernet_lib.c | 55 +++----- radio/ETHERNET/ethernet_lib.h | 75 +++++------ radio/IRIS/iris_lib.cpp | 45 +++---- radio/LMSSDR/lms_lib.cpp | 44 +++---- radio/LMSSDR/sodera_lib.cpp | 48 ++++--- radio/USRP/usrp_lib.cpp | 72 ++++++----- radio/emulator/rf_emulator.c | 22 ++-- radio/fhi_72/oran.h | 2 +- radio/fhi_72/oran_isolate.c | 26 ++-- radio/iqplayer/iqplayer_lib.c | 33 ++--- radio/rfsimulator/simulator.cpp | 61 ++++----- radio/vrtsim/vrtsim.c | 44 ++++--- 38 files changed, 499 insertions(+), 513 deletions(-) diff --git a/executables/lte-ru.c b/executables/lte-ru.c index 9c47c92a0d..0fa397cc04 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -390,7 +390,7 @@ void fh_if5_north_asynch_in(RU_t *ru, LTE_DL_FRAME_PARMS *fp = ru->frame_parms; RU_proc_t *proc = &ru->proc; int tti_tx,frame_tx; - openair0_timestamp timestamp_tx=0; + openair0_timestamp_t timestamp_tx = 0; //recv_IF5(ru, ×tamp_tx, *subframe, IF5_RRH_GW_DL); // LOG_I(PHY,"Received subframe %d (TS %llu) from RCC\n",tti_tx,timestamp_tx); tti_tx = (timestamp_tx/fp->samples_per_tti)%10; @@ -540,7 +540,7 @@ void rx_rf(RU_t *ru, unsigned int rxs; int i; int resynch=0; - openair0_timestamp ts=0,old_ts=0; + openair0_timestamp_t ts = 0, old_ts = 0; for (i=0; inb_rx; i++) rxp[i] = (void *)&ru->common.rxdata[i][*subframe*fp->samples_per_tti]; diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 2d7338c410..70da050d5d 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -1686,7 +1686,8 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) * \param arg unused * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { +void write_dummy(PHY_VARS_UE *UE, openair0_timestamp_t timestamp) +{ // we have to write to tell explicitly to the eNB, else it will wait for us forever // we write the next subframe (always write in future of what we received) // @@ -1709,7 +1710,7 @@ void *UE_thread(void *arg) { PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; // int tx_enabled = 0; int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32))); - openair0_timestamp timestamp,timestamp1; + openair0_timestamp_t timestamp, timestamp1; void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; int start_rx_stream = 0; int i; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 7d96eb6772..9a1e99d31a 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -570,10 +570,10 @@ static void rx_rf(RU_t *ru, int *frame, int *slot) rxp[i] = (void *)&ru->common.rxdata[i][get_samples_slot_timestamp(fp, *slot)]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1); - openair0_timestamp old_ts = proc->timestamp_rx; + openair0_timestamp_t old_ts = proc->timestamp_rx; LOG_D(PHY,"Reading %d samples for slot %d (%p)\n", samples_per_slot, *slot, rxp[0]); - openair0_timestamp ts; + openair0_timestamp_t ts; unsigned int rxs; rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, &ts, rxp, samples_per_slot, nb); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index c920a57b88..29a59fbc0d 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -379,7 +379,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx } } - openair0_timestamp writeTimestamp = proc->timestamp_tx; + openair0_timestamp_t writeTimestamp = proc->timestamp_tx; int writeBlockSize = rxtxD->writeBlockSize; // if writeBlockSize gets longer that slot size, fill with dummy const int maxWriteBlockSize = get_samples_per_slot(proc->nr_slot_tx, fp); @@ -647,7 +647,8 @@ void UE_dl_processing(void *arg) { TracyCZoneEnd(ctx); } -void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { +void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlockSize) +{ NR_DL_FRAME_PARMS *fp = &UE->frame_parms; if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; @@ -663,7 +664,7 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS AssertFatal(writeBlockSize == tmp, ""); } -void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_rx_to_tx, bool toTrash) +void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, bool toTrash) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; // two frames for initial sync @@ -693,7 +694,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_r if (IS_SOFTMODEM_RFSIM) { int ta = UE->timing_advance + UE->timing_advance_ntn; - const openair0_timestamp writeTimestamp = + const openair0_timestamp_t writeTimestamp = *timestamp + get_samples_slot_duration(fp, slot, duration_rx_to_tx) - UE->N_TA_offset - ta; dummyWrite(UE, writeTimestamp, get_samples_per_slot(slot, fp)); } @@ -705,7 +706,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_r free(rxp[i]); } -static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int duration_rx_to_tx, openair0_timestamp rx_offset) +static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; if (UE->sl_mode == 2) @@ -721,7 +722,7 @@ static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, int d DevAssert(unitTransfer == res); if (IS_SOFTMODEM_RFSIM) { int ta = UE->timing_advance + UE->timing_advance_ntn; - const openair0_timestamp writeTimestamp = + const openair0_timestamp_t writeTimestamp = *timestamp + get_samples_slot_duration(fp, slot, duration_rx_to_tx) - UE->N_TA_offset - ta; dummyWrite(UE, writeTimestamp, unitTransfer); } @@ -798,7 +799,7 @@ void *UE_thread(void *arg) } int shiftForNextFrame = 0; int intialSyncOffset = 0; - openair0_timestamp sync_timestamp; + openair0_timestamp_t sync_timestamp; bool stats_printed = false; if (get_softmodem_params()->sync_ref && UE->sl_mode == 2) { @@ -995,7 +996,7 @@ void *UE_thread(void *arg) } const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply; - openair0_timestamp rx_timestamp; + openair0_timestamp_t rx_timestamp; int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); metadata meta = {.slot = curMsg.proc.nr_slot_rx, .frame = curMsg.proc.frame_rx}; UEscopeCopyWithMetadata(UE, ueTimeDomainSamples, rxp[0] - firstSymSamp * sizeof(c16_t), sizeof(c16_t), 1, readBlockSize, 0, &meta); @@ -1010,7 +1011,7 @@ void *UE_thread(void *arg) int first_symbols = fp->ofdm_symbol_size + fp->nb_prefix_samples0; // first symbol of every frames if (first_symbols > 0) { - openair0_timestamp ignore_timestamp; + openair0_timestamp_t ignore_timestamp; int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, &ignore_timestamp, (void **)UE->common_vars.rxdata, @@ -1023,7 +1024,7 @@ void *UE_thread(void *arg) } // use previous timing_advance value to compute writeTimestamp - const openair0_timestamp writeTimestamp = + const openair0_timestamp_t writeTimestamp = rx_timestamp + get_samples_slot_duration(fp, slot_nr, duration_rx_to_tx) - firstSymSamp - UE->N_TA_offset - timing_advance; // Calculate TX deadline, approximately 1 symbol before the first sample should be written diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 6fbfcb3cac..d7ce4a64a4 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -320,7 +320,7 @@ uint32_t get_samples_symbol_timestamp(const NR_DL_FRAME_PARMS *fp, int slot, int return get_samples_symbol_duration(fp, slot, 0, symbol); } -uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, const NR_DL_FRAME_PARMS *fp) +uint32_t get_slot_from_timestamp(openair0_timestamp_t timestamp_rx, const NR_DL_FRAME_PARMS *fp) { timestamp_rx = timestamp_rx % fp->samples_per_frame; if (timestamp_rx < fp->samples_per_slot0) diff --git a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp index e3e541f8ab..acf43ec0b8 100644 --- a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp +++ b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp @@ -41,7 +41,7 @@ uint32_t ref_get_samples_slot_timestamp(NR_DL_FRAME_PARMS *fp, unsigned int slot return samp_count; } -uint32_t ref_get_slot_from_timestamp(openair0_timestamp ts, NR_DL_FRAME_PARMS *fp) +uint32_t ref_get_slot_from_timestamp(openair0_timestamp_t ts, NR_DL_FRAME_PARMS *fp) { uint32_t slot_idx = 0; int samples_till_the_slot = get_samples_per_slot(slot_idx, fp) - 1; @@ -75,7 +75,7 @@ void test_coherence_slot_api(NR_DL_FRAME_PARMS *fp) EXPECT_EQ(get_samples_slot_timestamp(fp, slot), ref_get_samples_slot_timestamp(fp, slot)); } - openair0_timestamp ts = get_samples_per_slot(0, fp); + openair0_timestamp_t ts = get_samples_per_slot(0, fp); // When timestamp is the last sample of the slot EXPECT_EQ(get_slot_from_timestamp(ts - 1, fp), 0); for (unsigned int slot = 0; slot < fp->slots_per_frame; slot++) { @@ -174,4 +174,4 @@ int main(int argc, char **argv) logInit(); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c index c7a305ab27..eb80dec38e 100644 --- a/openair1/PHY/TOOLS/calibration_scope.c +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -18,7 +18,7 @@ typedef struct { #define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) typedef struct { void ** samplesRx; - openair0_device *rfdevice; + openair0_device_t *rfdevice; } calibData_t; typedef struct OAIgraph { @@ -384,7 +384,8 @@ static void *scopeThread(void *arg) { return NULL; } -void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) { +void CalibrationInitScope(void **samplesRx, openair0_device_t *rfdevice) +{ pthread_t forms_thread; calibData_t *tmp = (calibData_t *)malloc_or_fail(sizeof(*tmp)); tmp->samplesRx=samplesRx; diff --git a/openair1/PHY/TOOLS/calibration_scope.h b/openair1/PHY/TOOLS/calibration_scope.h index 052a1a6b6e..f2646d79ab 100644 --- a/openair1/PHY/TOOLS/calibration_scope.h +++ b/openair1/PHY/TOOLS/calibration_scope.h @@ -1,5 +1,5 @@ #ifndef CALIB_SCOPE_H #define CALIB_SCOPE_H -void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice); +void CalibrationInitScope(void **samplesRx, openair0_device_t *rfdevice); #endif diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 8007040499..223c46e9a0 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) { .samples_per_tti=0, }; //----------------------- - openair0_device rfdevice= { + openair0_device_t rfdevice= { /*!tx write thread*/ //.write_thread={0}, /*!brief Module ID of this device */ @@ -306,7 +306,7 @@ int main(int argc, char **argv) { } CalibrationInitScope(samplesRx, &rfdevice); - openair0_timestamp timestamp=0; + openair0_timestamp_t timestamp=0; rfdevice.trx_start_func(&rfdevice); while(!oai_exit) { diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index 97f243fae8..41ab07a6b1 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -222,7 +222,7 @@ typedef struct { /// Context data structure for RX/TX portion of subframe processing typedef struct { /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe to act upon for transmission int subframe_tx; /// subframe to act upon for reception @@ -273,9 +273,9 @@ typedef struct eNB_proc_NB_IoT_t_s { /// thread index int thread_index; /// timestamp received from HW - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// timestamp to send to "slave rru" - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe to act upon for reception int subframe_rx; /// symbol mask for IF4p5 reception per subframe @@ -414,7 +414,7 @@ typedef struct { /// index of the current UE RX/TX proc int proc_id; /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe to act upon for transmission int subframe_tx; /// subframe to act upon for reception @@ -445,7 +445,7 @@ typedef struct { /// Context data structure for eNB subframe processing typedef struct { /// Last RX timestamp - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// pthread attributes for main UE thread pthread_attr_t attr_ue; /// scheduling parameters for main UE thread @@ -484,9 +484,9 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { eth_params_t eth_params_n; /// Ethernet parameters for fronthaul interface (upper L1 to Radio head) eth_params_t eth_params; - openair0_rf_map rf_map; + openair0_rf_map_t rf_map; int abstraction_flag; - openair0_timestamp ts_offset; + openair0_timestamp_t ts_offset; // indicator for synchronization state of eNB int in_synch; // indicator for master/slave (RRU) @@ -672,8 +672,8 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240]; /// RF and Interface devices per CC - openair0_device rfdevice; - openair0_device ifdevice; + openair0_device_t rfdevice; + openair0_device_t ifdevice; /// Pointer for ifdevice buffer struct if_buffer_t ifbuffer; @@ -731,7 +731,7 @@ typedef struct { /// \brief Module ID indicator for this instance uint8_t Mod_id; /// \brief Mapping of CC_id antennas to cards - openair0_rf_map rf_map; + openair0_rf_map_t rf_map; //uint8_t local_flag; /// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach) runmode_NB_IoT_t mode; @@ -956,7 +956,7 @@ typedef struct { time_stats_t tx_prach; /// RF and Interface devices per CC - openair0_device rfdevice; + openair0_device_t rfdevice; time_stats_t dlsch_encoding_SIC_stats; time_stats_t dlsch_scrambling_SIC_stats; time_stats_t dlsch_modulation_SIC_stats; diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 9e69bda093..851d417804 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -196,9 +196,9 @@ typedef struct RU_proc_t_s { /// Pointer to associated RU descriptor struct RU_t_s *ru; /// timestamp received from HW - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// timestamp to send to "slave rru" - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe (LTE) / slot (NR) to act upon for reception int tti_rx; /// subframe (LTE) / slot (NR) to act upon for transmission @@ -354,7 +354,7 @@ typedef struct RU_proc_t_s { /// subframe to act upon for transmission int subframe_phy_tx; /// timestamp to send to "slave rru" - openair0_timestamp timestamp_phy_tx; + openair0_timestamp_t timestamp_phy_tx; /// pthread structure for RF TX thread pthread_t pthread_rf_tx; pthread_mutex_t mutex_rf_tx; @@ -500,7 +500,7 @@ typedef struct RU_t_s { /// "end of burst delay" used in TDD (unit: number of samples at 30.72MHz) (this is an expert option) int end_of_burst_delay; /// RF device descriptor - openair0_device rfdevice; + openair0_device_t rfdevice; /// HW configuration openair0_config_t openair0_cfg; /// Number of NBs using this RU @@ -510,9 +510,9 @@ typedef struct RU_t_s { struct PHY_VARS_eNB_s *eNB_list[NUMBER_OF_eNB_MAX]; struct PHY_VARS_gNB_s *gNB_list[NUMBER_OF_gNB_MAX]; /// Mapping of antenna ports to RF chain index - openair0_rf_map rf_map; + openair0_rf_map_t rf_map; /// IF device descriptor - openair0_device ifdevice; + openair0_device_t ifdevice; /// Pointer for ifdevice buffer struct if_buffer_t ifbuffer; /// if prach processing is to be performed in RU @@ -599,7 +599,7 @@ typedef struct RU_t_s { /// sequence number for IF5 uint8_t seqno; /// initial timestamp used as an offset make first real timestamp 0 - openair0_timestamp ts_offset; + openair0_timestamp_t ts_offset; /// Current state of the RU rru_state_t state; /// Command to do @@ -758,7 +758,7 @@ typedef struct processingData_RU { int frame_tx; int slot_tx; int next_slot; - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; RU_t *ru; } processingData_RU_t; #endif //__PHY_DEFS_RU__H__ diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 20d5a9ab8d..84477cad8a 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -91,7 +91,7 @@ typedef struct { /// Component Carrier index uint8_t CC_id; /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe to act upon for transmission int subframe_tx; /// subframe to act upon for reception @@ -148,7 +148,7 @@ typedef struct { /// Component Carrier index uint8_t CC_id; /// Last RX timestamp - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// pthread attributes for main UE thread pthread_attr_t attr_ue; /// scheduling parameters for main UE thread @@ -550,7 +550,7 @@ typedef struct { /// \brief Component carrier ID for this PHY instance uint8_t CC_id; /// \brief Mapping of CC_id antennas to cards - openair0_rf_map rf_map; + openair0_rf_map_t rf_map; //uint8_t local_flag; /// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach) runmode_t mode; @@ -817,7 +817,7 @@ typedef struct { int instance_cnt_timer; /// RF and Interface devices per CC - openair0_device rfdevice; + openair0_device_t rfdevice; void *scopeData; } PHY_VARS_UE; diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 6ae50482cc..441c7b8f96 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -218,8 +218,8 @@ typedef struct { /// Component Carrier index uint8_t CC_id; /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_tx; + openair0_timestamp_t timestamp_rx; /// subframe to act upon for transmission int subframe_tx; /// subframe to act upon for reception @@ -285,9 +285,9 @@ typedef struct L1_proc_t_s { /// thread index int thread_index; /// timestamp received from HW - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// timestamp to send to "slave rru" - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// subframe to act upon for reception int subframe_rx; /// subframe to act upon for PRACH diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index f3350d707e..46ba246dbe 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -288,7 +288,7 @@ typedef struct { /// Component Carrier index uint8_t CC_id; /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// slot to act upon for transmission int slot_tx; /// slot to act upon for reception @@ -312,9 +312,9 @@ typedef struct gNB_L1_proc_t_s { /// Component Carrier index uint8_t CC_id; /// timestamp received from HW - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; /// timestamp to send to "slave rru" - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; /// slot to act upon for reception int slot_rx; /// frame to act upon for reception @@ -566,7 +566,7 @@ union ldpcReqUnion { typedef struct processingData_L1 { int frame_rx; int slot_rx; - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; PHY_VARS_gNB *gNB; notifiedFIFO_elt_t *elt; } processingData_L1_t; @@ -576,7 +576,7 @@ typedef struct processingData_L1tx { int slot; int frame_rx; int slot_rx; - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; PHY_VARS_gNB *gNB; } processingData_L1tx_t; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e96927fe21..e04a49c8e4 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -113,7 +113,7 @@ typedef struct { /// Component Carrier index uint8_t CC_id; /// Last RX timestamp - openair0_timestamp timestamp_rx; + openair0_timestamp_t timestamp_rx; } UE_nr_proc_t; typedef enum { @@ -350,7 +350,7 @@ typedef struct PHY_VARS_NR_UE_s { /// \brief Component carrier ID for this PHY instance uint8_t CC_id; /// \brief Mapping of CC_id antennas to cards - openair0_rf_map rf_map; + openair0_rf_map_t rf_map; /// \brief Indicator that UE should perform band scanning int UE_scan; /// \brief Indicator that UE should perform coarse scanning around carrier @@ -508,7 +508,7 @@ typedef struct PHY_VARS_NR_UE_s { nr_ue_phy_cpu_stat_t phy_cpu_stats; /// RF and Interface devices per CC - openair0_device rfdevice; + openair0_device_t rfdevice; /// Phase precompensation flag bool no_phase_pre_comp; @@ -540,7 +540,7 @@ typedef struct PHY_VARS_NR_UE_s { } PHY_VARS_NR_UE; typedef struct { - openair0_timestamp timestamp_tx; + openair0_timestamp_t timestamp_tx; int gNB_id; /// NR slot index within frame_tx [0 .. slots_per_frame - 1] to act upon for transmission int nr_slot_tx; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index b9948eaf92..96c03cd754 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -334,7 +334,7 @@ uint32_t get_samples_slot_duration(const NR_DL_FRAME_PARMS *fp, unsigned int sta // Get timestamp of slot from start of frame uint32_t get_samples_slot_timestamp(const NR_DL_FRAME_PARMS *fp, unsigned int slot); // Get slot from timestamp -uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, const NR_DL_FRAME_PARMS *fp); +uint32_t get_slot_from_timestamp(openair0_timestamp_t timestamp_rx, const NR_DL_FRAME_PARMS *fp); // Get number of samples in the slot uint32_t get_samples_per_slot(int slot, const NR_DL_FRAME_PARMS *fp); diff --git a/openair1/SIMULATION/LTE_PHY/unitary_defs.h b/openair1/SIMULATION/LTE_PHY/unitary_defs.h index f0c3f32b1b..8a411902c8 100644 --- a/openair1/SIMULATION/LTE_PHY/unitary_defs.h +++ b/openair1/SIMULATION/LTE_PHY/unitary_defs.h @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -openair0_device openair0; +openair0_device_t openair0; int oai_exit=0; void exit_function(const char* file, const char* function, const int line,const char* s, const int assert) { diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 6e60ce76de..d31109a836 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -328,8 +328,8 @@ typedef struct { int RU_output_mask[NUMBER_OF_UE_MAX]; pthread_mutex_t RU_output_mutex[NUMBER_OF_UE_MAX]; pthread_mutex_t UE_output_mutex[NUMBER_OF_RU_MAX]; - openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs]; - openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs]; + openair0_timestamp_t current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs]; + openair0_timestamp_t current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs]; double ru_amp[NUMBER_OF_RU_MAX]; } sim_t; diff --git a/radio/AW2SORI/oaiori.c b/radio/AW2SORI/oaiori.c index 8665abc86a..b17c7e5dfd 100644 --- a/radio/AW2SORI/oaiori.c +++ b/radio/AW2SORI/oaiori.c @@ -212,8 +212,8 @@ void cb(void * userData, ORI_IndicationType_e type, ORI_IndicationValue_u value) printf("<============\n"); } -int aw2s_oricleanup(openair0_device *device) { - +int aw2s_oricleanup(openair0_device_t *device) +{ ORI_s * ori = (ORI_s*)device->thirdparty_priv; ORI_Disconnect(ori); @@ -222,8 +222,8 @@ int aw2s_oricleanup(openair0_device *device) { return(0); } -int aw2s_startstreaming(openair0_device *device) { - +int aw2s_startstreaming(openair0_device_t *device) +{ ORI_s * ori = (ORI_s*)device->thirdparty_priv; ORI_Result_e result; ORI_Result_e RE_result; @@ -413,9 +413,8 @@ int aw2s_startstreaming(openair0_device *device) { printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); } - device->fhstate.active=1; - return(0); - + device->fhstate.active = 1; + return (0); } uint32_t to_nrarfcn(int nr_bandP, @@ -423,9 +422,8 @@ uint32_t to_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t bw); -int aw2s_oriinit(openair0_device *device) { - - +int aw2s_oriinit(openair0_device_t *device) +{ ORI_s * ori; ORI_Result_e result; ORI_Result_e RE_result; @@ -892,9 +890,8 @@ int aw2s_oriinit(openair0_device *device) { return 0; } - -int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params ) { - +int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params) +{ printf("Initializing AW2S (%p,%p,%p)\n",aw2s_oriinit,aw2s_oricleanup,aw2s_startstreaming); device->thirdparty_init = aw2s_oriinit; device->thirdparty_cleanup = aw2s_oricleanup; diff --git a/radio/BLADERF/bladerf_lib.c b/radio/BLADERF/bladerf_lib.c index bff12bee8e..2298287b5a 100644 --- a/radio/BLADERF/bladerf_lib.c +++ b/radio/BLADERF/bladerf_lib.c @@ -46,7 +46,7 @@ int num_devices=0; * \param device RF frontend parameters set by application * \returns 0 on success */ -int trx_brf_init(openair0_device *device) +int trx_brf_init(openair0_device_t *device) { return 0; } @@ -57,8 +57,7 @@ int trx_brf_init(openair0_device *device) *\param module the bladeRf module *\returns timestamp of BladeRF */ -openair0_timestamp trx_get_timestamp(openair0_device *device, - bladerf_module module) +openair0_timestamp_t trx_get_timestamp(openair0_device_t *device, bladerf_module module) { int status; struct bladerf_metadata meta; @@ -78,7 +77,7 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, * \param device the hardware to use * \returns 0 on success */ -int trx_brf_start(openair0_device *device) +int trx_brf_start(openair0_device_t *device) { brf_state_t *brf = (brf_state_t*)device->priv; int status; @@ -127,12 +126,7 @@ int trx_brf_start(openair0_device *device) \param flags Ignored for the moment \returns 0 on success */ -static int trx_brf_write(openair0_device *device, - openair0_timestamp ptimestamp, - void **buff, - int nsamps, - int cc, - int flags) +static int trx_brf_write(openair0_device_t *device, openair0_timestamp_t ptimestamp, void **buff, int nsamps, int cc, int flags) { int status; brf_state_t *brf = (brf_state_t*)device->priv; @@ -185,11 +179,7 @@ static int trx_brf_write(openair0_device *device, * \param cc Index of component carrier * \returns number of samples read */ -static int trx_brf_read(openair0_device *device, - openair0_timestamp *ptimestamp, - void **buff, - int nsamps, - int cc) +static int trx_brf_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc) { int status=0; brf_state_t *brf = (brf_state_t*)device->priv; @@ -235,7 +225,7 @@ static int trx_brf_read(openair0_device *device, /*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources * \param device the hardware to use */ -void trx_brf_end(openair0_device *device) +void trx_brf_end(openair0_device_t *device) { int status; brf_state_t *brf = (brf_state_t*)device->priv; @@ -255,7 +245,7 @@ void trx_brf_end(openair0_device *device) * \param device the hardware to use * \returns 0 on success */ -int trx_brf_get_stats(openair0_device* device) +int trx_brf_get_stats(openair0_device_t *device) { return(0); } @@ -265,7 +255,7 @@ int trx_brf_get_stats(openair0_device* device) * \param device the hardware to use * \returns 0 on success */ -int trx_brf_reset_stats(openair0_device* device) +int trx_brf_reset_stats(openair0_device_t *device) { return(0); } @@ -275,7 +265,7 @@ int trx_brf_reset_stats(openair0_device* device) * \param card the hardware to use * \returns 0 in success */ -int trx_brf_stop(openair0_device* device) +int trx_brf_stop(openair0_device_t *device) { return(0); } @@ -286,7 +276,7 @@ int trx_brf_stop(openair0_device* device) * \param openair0_cfg1 openair0 Config structure (ignored. It is there to comply with RF common API) * \returns 0 in success */ -int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1) +int trx_brf_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg1) { int status; brf_state_t *brf = (brf_state_t *)device->priv; @@ -315,12 +305,11 @@ int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1) * \param openair0_cfg openair0 Config structure * \returns 0 in success */ -int trx_brf_set_gains(openair0_device* device, - openair0_config_t *openair0_cfg) +int trx_brf_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { return(0); } -int trx_brf_write_init(openair0_device *device) +int trx_brf_write_init(openair0_device_t *device) { return 0; } @@ -368,13 +357,13 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, /*! \brief Calibrate LMSSDR RF * \param device the hardware to use */ -void calibrate_rf(openair0_device *device) +void calibrate_rf(openair0_device_t *device) { /* TODO: this function does not seem to work. Disabled until fixed. */ return; brf_state_t *brf = (brf_state_t *)device->priv; - openair0_timestamp ptimestamp; + openair0_timestamp_t ptimestamp; int16_t *calib_buffp,*calib_tx_buffp; int16_t calib_buff[2*RXDCLENGTH]; int16_t calib_tx_buff[2*RXDCLENGTH]; @@ -948,8 +937,7 @@ void calibrate_rf(openair0_device *device) * \param openair0_cfg RF frontend parameters set by application * \returns 0 on success */ -int device_init(openair0_device *device, - openair0_config_t *openair0_cfg) +int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) { int status; brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t)); @@ -1138,7 +1126,7 @@ int device_init(openair0_device *device, */ bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_INFO); - printf("BLADERF: Initializing openair0_device\n"); + printf("BLADERF: Initializing openair0_device_t\n"); device->Mod_id = num_devices++; device->type = BLADERF_DEV; device->trx_start_func = trx_brf_start; diff --git a/radio/BLADERF/bladerf_lib.h b/radio/BLADERF/bladerf_lib.h index 7c736eb098..a3ba44ee6c 100644 --- a/radio/BLADERF/bladerf_lib.h +++ b/radio/BLADERF/bladerf_lib.h @@ -94,7 +94,7 @@ typedef struct { //! number of RX count uint64_t rx_count; //! timestamp of RX packet - openair0_timestamp rx_timestamp; + openair0_timestamp_t rx_timestamp; } brf_state_t; /* @@ -103,13 +103,13 @@ typedef struct { /*! \brief BladeRF Init function (not used at the moment) * \param device RF frontend parameters set by application */ -int trx_brf_init(openair0_device *device); +int trx_brf_init(openair0_device_t *device); /*! \brief get current timestamp *\param device the hardware to use *\param module the bladeRf module */ -openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module); +openair0_timestamp_t trx_get_timestamp(openair0_device_t *device, bladerf_module module); /*! \brief bladeRF error report * \param status diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index 670a9cc852..104546b795 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -53,7 +53,7 @@ const char *get_devname(int devtype) { return "none"; } -int set_device(openair0_device *device) +int set_device(openair0_device_t *device) { const char *devname = get_devname(device->type); if (strcmp(devname,"none") != 0) { @@ -65,7 +65,7 @@ int set_device(openair0_device *device) return 0; } -int set_transport(openair0_device *device) +int set_transport(openair0_device_t *device) { switch (device->transp_type) { case ETHERNET_TP: @@ -85,14 +85,10 @@ int set_transport(openair0_device *device) } } -typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *); - +typedef int (*devfunc_t)(openair0_device_t *, openair0_config_t *, eth_params_t *); /* look for the interface library and load it */ -int load_lib(openair0_device *device, - openair0_config_t *openair0_cfg, - eth_params_t *cfg, - uint8_t flag) +int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag) { loader_shlibfunc_t shlib_fdesc[1]; int ret=0; @@ -139,9 +135,7 @@ int load_lib(openair0_device *device, return ((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg); } - -int openair0_device_load(openair0_device *device, - openair0_config_t *openair0_cfg) +int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_cfg) { int rc=0; rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD ); @@ -157,10 +151,7 @@ int openair0_device_load(openair0_device *device, return rc; } - -int openair0_transport_load(openair0_device *device, - openair0_config_t *openair0_cfg, - eth_params_t *eth_params) +int openair0_transport_load(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params) { int rc; rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD); @@ -175,7 +166,7 @@ int openair0_transport_load(openair0_device *device, return rc; } -static void writerEnqueue(re_order_t *ctx, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags) +static void writerEnqueue(re_order_t *ctx, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) { pthread_mutex_lock(&ctx->mutex_store); LOG_D(HW, "Enqueue write for TS: %lu\n", timestamp); @@ -196,7 +187,7 @@ static void writerEnqueue(re_order_t *ctx, openair0_timestamp timestamp, void ** pthread_mutex_unlock(&ctx->mutex_store); } -static void writerProcessWaitingQueue(openair0_device *device) +static void writerProcessWaitingQueue(openair0_device_t *device) { bool found = false; re_order_t *ctx = &device->reOrder; @@ -205,7 +196,7 @@ static void writerProcessWaitingQueue(openair0_device *device) pthread_mutex_lock(&ctx->mutex_store); for (int i = 0; i < WRITE_QUEUE_SZ; i++) { if (ctx->queue[i].active && llabs(ctx->queue[i].timestamp - ctx->nextTS) < MAX_GAP) { - openair0_timestamp timestamp = ctx->queue[i].timestamp; + openair0_timestamp_t timestamp = ctx->queue[i].timestamp; LOG_D(HW, "Dequeue write for TS: %lu\n", timestamp); int nsamps = ctx->queue[i].nsamps; int nbAnt = ctx->queue[i].nbAnt; @@ -235,7 +226,7 @@ static void writerProcessWaitingQueue(openair0_device *device) // but to make zerocopy and agnostic design, we need to make a proper ring buffer with mutex protection // mutex (or atomic flags) will be mandatory because this out order system root cause is there are several writer threads -int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags) +int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) { int wroteSamples = 0; re_order_t *ctx = &device->reOrder; @@ -270,7 +261,7 @@ int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp return nsamps; } -void openair0_write_reorder_clear_context(openair0_device *device) +void openair0_write_reorder_clear_context(openair0_device_t *device) { LOG_I(HW, "received write reorder clear context\n"); re_order_t *ctx = &device->reOrder; diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 5877506ea2..e5f55fe309 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -58,12 +58,11 @@ #define MAX_WRITE_THREAD_BUFFER_SIZE 8 #define MAX_CARDS 8 -typedef int64_t openair0_timestamp; -typedef volatile int64_t openair0_vtimestamp; - +typedef int64_t openair0_timestamp_t; +typedef volatile int64_t openair0_vtimestamp_t; /*!\brief structure holds the parameters to configure USRP devices*/ -typedef struct openair0_device_t openair0_device; +typedef struct openair0_device openair0_device_t; //#define USRP_GAIN_OFFSET (56.0) // 86 calibrated for USRP B210 @ 2.6 GHz to get equivalent RS EPRE in OAI to SMBV100 output @@ -167,7 +166,7 @@ typedef enum { /*! \brief Structure used for initializing UDP read threads */ typedef struct { - openair0_device *device; + openair0_device_t *device; int thread_id; pthread_t pthread; notifiedFIFO_t *resp; @@ -317,8 +316,7 @@ typedef struct { int card; //! rf chain id int chain; -} openair0_rf_map; - +} openair0_rf_map_t; typedef struct { char *remote_addr; @@ -350,7 +348,7 @@ typedef struct { } if_buffer_t; typedef struct { - openair0_timestamp timestamp; + openair0_timestamp_t timestamp; void *buff[MAX_WRITE_THREAD_BUFFER_SIZE];// buffer to be write; int nsamps; int cc; @@ -378,11 +376,11 @@ typedef struct { } openair0_thread_t; typedef struct fhstate_s { - openair0_timestamp TS[8]; - openair0_timestamp TS0; - openair0_timestamp olddeltaTS[8]; - openair0_timestamp oldTS[8]; - openair0_timestamp TS_read; + openair0_timestamp_t TS[8]; + openair0_timestamp_t TS0; + openair0_timestamp_t olddeltaTS[8]; + openair0_timestamp_t oldTS[8]; + openair0_timestamp_t TS_read; int first_read; uint32_t *buff[8]; uint32_t buff_size; @@ -395,10 +393,10 @@ typedef struct { bool initDone; pthread_mutex_t mutex_write; pthread_mutex_t mutex_store; - openair0_timestamp nextTS; + openair0_timestamp_t nextTS; struct { bool active; - openair0_timestamp timestamp; + openair0_timestamp_t timestamp; void *txp[NB_ANTENNAS_TX]; int nsamps; int nbAnt; @@ -407,7 +405,7 @@ typedef struct { } re_order_t; /*!\brief structure holds the parameters to configure USRP devices */ -struct openair0_device_t { +struct openair0_device { /*!tx write thread*/ openair0_thread_t write_thread; @@ -463,28 +461,27 @@ struct openair0_device_t { /*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error @param device pointer to the device structure specific to the RF hardware target */ - int (*trx_start_func)(openair0_device *device); + int (*trx_start_func)(openair0_device_t *device); - /*! \brief Called to configure the device - @param device pointer to the device structure specific to the RF hardware target - */ + /*! \brief Called to configure the device + @param device pointer to the device structure specific to the RF hardware target + */ - - int (*trx_config_func)(openair0_device* device, openair0_config_t *openair0_cfg); + int (*trx_config_func)(openair0_device_t *device, openair0_config_t *openair0_cfg); /*! \brief Called to send a request message between RAU-RRU on control port @param device pointer to the device structure specific to the RF hardware target @param msg pointer to the message structure passed between RAU-RRU @param msg_len length of the message */ - int (*trx_ctlsend_func)(openair0_device *device, void *msg, ssize_t msg_len); + int (*trx_ctlsend_func)(openair0_device_t *device, void *msg, ssize_t msg_len); /*! \brief Called to receive a reply message between RAU-RRU on control port @param device pointer to the device structure specific to the RF hardware target @param msg pointer to the message structure passed between RAU-RRU @param msg_len length of the message */ - int (*trx_ctlrecv_func)(openair0_device *device, void *msg, ssize_t msg_len); + int (*trx_ctlrecv_func)(openair0_device_t *device, void *msg, ssize_t msg_len); /*! \brief Called to send samples to the RF target @param device pointer to the device structure specific to the RF hardware target @@ -495,8 +492,8 @@ struct openair0_device_t { @param num_beams number of beams @param flags flags must be set to true if timestamp parameter needs to be applied */ - int (*trx_write_beams_func)(openair0_device *device, - openair0_timestamp timestamp, + int (*trx_write_beams_func)(openair0_device_t *device, + openair0_timestamp_t timestamp, void ***buff, int nsamps, int nb_antennas_tx, @@ -511,7 +508,12 @@ struct openair0_device_t { @param nb_antennas_tx number of antennas @param flags flags must be set to true if timestamp parameter needs to be applied */ - int (*trx_write_func)(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int nb_antennas_tx, int flags); + int (*trx_write_func)(openair0_device_t *device, + openair0_timestamp_t timestamp, + void **buff, + int nsamps, + int nb_antennas_tx, + int flags); /*! \brief Called to send samples to the RF target @param device pointer to the device structure specific to the RF hardware target @@ -520,7 +522,13 @@ struct openair0_device_t { @param nsamps number of samples to be sent @param flags flags must be set to true if timestamp parameter needs to be applied */ - int (*trx_write_func2)(openair0_device *device, openair0_timestamp timestamp, void **buff, int fd_ind,int nsamps, int flags,int nant); + int (*trx_write_func2)(openair0_device_t *device, + openair0_timestamp_t timestamp, + void **buff, + int fd_ind, + int nsamps, + int flags, + int nant); /*! \brief Receive samples from hardware. * Read nsamps samples from each channel to buffers. buff[0] is the array for @@ -533,7 +541,7 @@ struct openair0_device_t { * antennas from which to receive samples \returns the number of sample read */ - int (*trx_read_func)(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int num_antennas); + int (*trx_read_func)(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int num_antennas); /*! \brief Receive samples from hardware. * Read nsamps samples from each channel to buffers. buff[0] is the array for @@ -548,8 +556,8 @@ struct openair0_device_t { * \param num_beams number of beams from which to receive samples * \returns the number of sample read */ - int (*trx_read_beams_func)(openair0_device *device, - openair0_timestamp *ptimestamp, + int (*trx_read_beams_func)(openair0_device_t *device, + openair0_timestamp_t *ptimestamp, void ***buff, int nsamps, int num_antennas, @@ -567,28 +575,28 @@ struct openair0_device_t { * \param antenna_id Index of antenna from which samples were received * \returns the number of sample read */ - int (*trx_read_func2)(openair0_device *device, openair0_timestamp *ptimestamp, uint32_t **buff, int nsamps); + int (*trx_read_func2)(openair0_device_t *device, openair0_timestamp_t *ptimestamp, uint32_t **buff, int nsamps); /*! \brief print the device statistics * \param device the hardware to use * \returns 0 on success */ - int (*trx_get_stats_func)(openair0_device *device); + int (*trx_get_stats_func)(openair0_device_t *device); /*! \brief Reset device statistics * \param device the hardware to use * \returns 0 in success */ - int (*trx_reset_stats_func)(openair0_device *device); + int (*trx_reset_stats_func)(openair0_device_t *device); /*! \brief Terminate operation of the transceiver -- free all associated resources * \param device the hardware to use */ - void (*trx_end_func)(openair0_device *device); + void (*trx_end_func)(openair0_device_t *device); /*! \brief Stop operation of the transceiver */ - int (*trx_stop_func)(openair0_device *device); + int (*trx_stop_func)(openair0_device_t *device); /* Functions API related to UE*/ @@ -597,14 +605,14 @@ struct openair0_device_t { * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ - int (*trx_set_freq_func)(openair0_device *device, openair0_config_t *openair0_cfg); + int (*trx_set_freq_func)(openair0_device_t *device, openair0_config_t *openair0_cfg); /*! \brief Set gains * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ - int (*trx_set_gains_func)(openair0_device *device, openair0_config_t *openair0_cfg); + int (*trx_set_gains_func)(openair0_device_t *device, openair0_config_t *openair0_cfg); /*! \brief Set tx/rx beams * @@ -619,9 +627,9 @@ struct openair0_device_t { * \param beam_map the beams to receive * \return 0 on success */ - int (*trx_set_beams)(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp); + int (*trx_set_beams)(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp); - /*! \brief Set tx/rx beams + /*! \brief Set tx/rx beams * * Set the tx/rx beams. This has to be done in advance of the reception in order to * allow the underlying device to change receiver configuration. The exact time depends @@ -635,7 +643,7 @@ struct openair0_device_t { * \param num_beams number of beams * \return 0 on success */ - int (*trx_set_beams2)(openair0_device *device, int* beams, int num_beams, openair0_timestamp timestamp); + int (*trx_set_beams2)(openair0_device_t *device, int *beams, int num_beams, openair0_timestamp_t timestamp); /*! \brief RRU Configuration callback * \param idx RU index @@ -651,22 +659,22 @@ struct openair0_device_t { /*! \brief Callback for Third-party RRU Initialization routine \param device the hardware configuration to use */ - int (*thirdparty_init)(openair0_device *device); + int (*thirdparty_init)(openair0_device_t *device); /*! \brief Callback for Third-party RRU Cleanup routine \param device the hardware configuration to use */ - int (*thirdparty_cleanup)(openair0_device *device); + int (*thirdparty_cleanup)(openair0_device_t *device); /*! \brief Callback for Third-party start streaming routine \param device the hardware configuration to use */ - int (*thirdparty_startstreaming)(openair0_device *device); + int (*thirdparty_startstreaming)(openair0_device_t *device); /*! \brief RRU Configuration callback * \param idx RU index * \param arg pointer to capabilities or configuration */ - int (*trx_write_init)(openair0_device *device); + int (*trx_write_init)(openair0_device_t *device); /* \brief Get internal parameter * \param id parameter to get * \return a pointer to the parameter @@ -679,9 +687,9 @@ struct openair0_device_t { }; /* type of device init function, implemented in shared lib */ -typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg); +typedef int (*oai_device_initfunc_t)(openair0_device_t *device, openair0_config_t *openair0_cfg); /* type of transport init function, implemented in shared lib */ -typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); +typedef int (*oai_transport_initfunc_t)(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); #define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size) @@ -723,30 +731,29 @@ extern "C" /*! \brief get device name from device type */ const char *get_devname(int devtype); /*! \brief Initialize openair RF target. It returns 0 if OK */ -int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg); +int openair0_device_load(openair0_device_t *device, openair0_config_t *openair0_cfg); /*! \brief Initialize transport protocol . It returns 0 if OK */ -int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); - +int openair0_transport_load(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); /*! \brief Get current timestamp of USRP * \param device the hardware to use */ -openair0_timestamp get_usrp_time(openair0_device *device); +openair0_timestamp_t get_usrp_time(openair0_device_t *device); /*! \brief Set RX frequencies * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg); +int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg); /*! \brief read the iq record-player configuration */ extern int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state); /*! \brief store recorded iqs from memory to file. */ -extern void iqrecorder_end(openair0_device *device); +extern void iqrecorder_end(openair0_device_t *device); -int openair0_write_reorder(openair0_device *device, openair0_timestamp timestamp, void **txp, int nsamps, int nbAnt, int flags); -void openair0_write_reorder_clear_context(openair0_device *device); +int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags); +void openair0_write_reorder_clear_context(openair0_device_t *device); #include #ifndef gettid #define gettid() syscall(__NR_gettid) diff --git a/radio/COMMON/record_player.c b/radio/COMMON/record_player.c index 9e561f1d32..9286bb9ffd 100644 --- a/radio/COMMON/record_player.c +++ b/radio/COMMON/record_player.c @@ -78,7 +78,8 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ * used in record mode * \param device the hardware used */ -void iqrecorder_end(openair0_device *device) { +void iqrecorder_end(openair0_device_t *device) +{ if (device->recplay_state != NULL) { // subframes store iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID}; recplay_state_t *rs = device->recplay_state; diff --git a/radio/ETHERNET/eth_raw.c b/radio/ETHERNET/eth_raw.c index 1b48a762f4..44f17ae5da 100644 --- a/radio/ETHERNET/eth_raw.c +++ b/radio/ETHERNET/eth_raw.c @@ -52,8 +52,8 @@ //int addr_len[MAX_INST]; //struct ifreq if_index[MAX_INST]; -int eth_socket_init_raw(openair0_device *device) { - +int eth_socket_init_raw(openair0_device_t *device) +{ eth_state_t *eth = (eth_state_t*)device->priv; const char *local_mac, *remote_mac; int sock_dom=0; @@ -125,8 +125,8 @@ int eth_socket_init_raw(openair0_device *device) { } /* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */ -int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) { - +int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) +{ int bytes_sent=0; eth_state_t *eth = (eth_state_t*)device->priv; int sendto_flag =0; @@ -148,12 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi /* we don't want to ovewrite with the header info the previous tx buffer data so we store it*/ struct ether_header temp = *(struct ether_header *)buff2; int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES); - openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); - + openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); + bytes_sent = 0; memcpy(buff2,(void*)ð->ehd,MAC_HEADER_SIZE_BYTES); *(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1); - *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp; + *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp; /*printf("[RRU]write mod_%d %d , len %d, buff %p \n", Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/ @@ -180,15 +180,13 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi /* tx buffer values restored */ *(struct ether_header *)buff2 = temp; *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0; - *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1; + *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1; } return (bytes_sent-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2; } - - -int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { - +int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) +{ int nblocks = nsamps; int bytes_sent = 0; @@ -225,13 +223,11 @@ int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestam eth->tx_count++; } - return (bytes_sent-MAC_HEADER_SIZE_BYTES); + return (bytes_sent-MAC_HEADER_SIZE_BYTES); } - - -int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - +int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc) +{ int ret; int bytes_received=0; int i=0; @@ -251,7 +247,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi /* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/ struct ether_header temp = *(struct ether_header *)buff2; int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES); - openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); + openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); bytes_received=0; int receive_bytes; @@ -299,18 +295,18 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi } else { bytes_received+=ret; /* store the timestamp value from packet's header */ - *timestamp = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); + *timestamp = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)); eth->rx_actual_nsamps=bytes_received>>2; eth->rx_count++; } } -#if DEBUG +#if DEBUG printf("------- RX------: nu=%x an_id=%d ts%d bytes_recv=%d \n", - *(uint8_t *)(buff2+ETH_ALEN), - *(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)), - *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)), - bytes_received); + *(uint8_t *)(buff2 + ETH_ALEN), + *(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)), + *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)), + bytes_received); dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG); @@ -319,15 +315,13 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi /* tx buffer values restored */ *(struct ether_header *)buff2 = temp; *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0; - *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1; + *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1; } return (bytes_received-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2; } - - -int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - +int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc) +{ int ret; // Read nblocks info from packet itself int nblocks = nsamps; @@ -413,9 +407,8 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam return(bytes_received); } - -int eth_set_dev_conf_raw(openair0_device *device) { - +int eth_set_dev_conf_raw(openair0_device_t *device) +{ eth_state_t *eth = (eth_state_t*)device->priv; void *msg; ssize_t msg_len; @@ -443,9 +436,8 @@ int eth_set_dev_conf_raw(openair0_device *device) { return 0; } - - -int eth_set_dev_conf_raw_IF4p5(openair0_device *device) { +int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device) +{ // use for cc_id info eth_state_t *eth = (eth_state_t*)device->priv; @@ -475,9 +467,8 @@ int eth_set_dev_conf_raw_IF4p5(openair0_device *device) { return 0; } - -int eth_get_dev_conf_raw(openair0_device *device) { - +int eth_get_dev_conf_raw(openair0_device_t *device) +{ eth_state_t *eth = (eth_state_t*)device->priv; void *msg; ssize_t msg_len; @@ -503,8 +494,8 @@ int eth_get_dev_conf_raw(openair0_device *device) { return 0; } - -int eth_get_dev_conf_raw_IF4p5(openair0_device *device) { +int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device) +{ // use for cc_id info eth_state_t *eth = (eth_state_t*)device->priv; diff --git a/radio/ETHERNET/eth_udp.c b/radio/ETHERNET/eth_udp.c index ea290f21cb..657e190ae1 100644 --- a/radio/ETHERNET/eth_udp.c +++ b/radio/ETHERNET/eth_udp.c @@ -58,8 +58,8 @@ uint16_t pck_seq_num = 1; uint16_t pck_seq_num_cur=0; uint16_t pck_seq_num_prev=0; -int eth_socket_init_udp(openair0_device *device) { - +int eth_socket_init_udp(openair0_device_t *device) +{ eth_state_t *eth = (eth_state_t*)device->priv; eth_params_t *eth_params = device->eth_params; @@ -192,8 +192,8 @@ int eth_socket_init_udp(openair0_device *device) { return 0; } -int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - +int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc) +{ // Read nblocks info from packet itself int nblocks = nsamps; int bytes_received=-1; @@ -244,8 +244,8 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam return(bytes_received); } -int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { - +int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) +{ int nblocks = nsamps; int bytes_sent = 0; @@ -294,10 +294,10 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam -void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) { - - openair0_device *device=udpTXelem->device; - openair0_timestamp timestamp = udpTXelem->timestamp; +void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) +{ + openair0_device_t *device=udpTXelem->device; + openair0_timestamp_t timestamp = udpTXelem->timestamp; void **buff = udpTXelem->buff; int nsamps = udpTXelem->nsamps; int nant = udpTXelem->nant; @@ -331,7 +331,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) { // ECPRI Message type (1 byte) *(uint8_t *)(buff2 + 1) = 64; - openair0_timestamp TS = timestamp + fhstate->TS0; + openair0_timestamp_t TS = timestamp + fhstate->TS0; TS = (6*device->sampling_rate_ratio_d*TS)/device->sampling_rate_ratio_n; TS -= device->txrx_offset; int TSinc = (6*256*device->sampling_rate_ratio_d)/device->sampling_rate_ratio_n; @@ -386,8 +386,8 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) { return(NULL); } -int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant) { - +int trx_eth_write_udp(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant) +{ union udpTXReqUnion id = {.s={(uint64_t)timestamp,nsamps,0}}; notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(udpTXelem_t), id.p, device->utx[fd_ind]->resp,NULL); udpTXelem_t * udptxelem=(udpTXelem_t *) NotifiedFifoData(req); @@ -425,12 +425,13 @@ void *udp_write_thread(void *arg) { return(NULL); } -void *udp_read_thread(void *arg) { - openair0_timestamp TS; +void *udp_read_thread(void *arg) +{ + openair0_timestamp_t TS; int aid; udp_ctx_t *u = (udp_ctx_t *)arg; - openair0_device *device=u->device; + openair0_device_t *device=u->device; fhstate_t *fhstate = &device->fhstate; char buffer[UDP_PACKET_SIZE_BYTES(256)]; int first_read=0; @@ -457,7 +458,7 @@ void *udp_read_thread(void *arg) { if (oai_exit) break; aid = *(uint16_t*)(&buffer[ECPRICOMMON_BYTES]); - TS = *(openair0_timestamp *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]); + TS = *(openair0_timestamp_t *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]); // convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application TS = (device->sampling_rate_ratio_n*TS)/(device->sampling_rate_ratio_d*6); AssertFatal(aid < 8,"Cannot handle more than 8 antennas, got aid %d\n",aid); @@ -487,24 +488,24 @@ void *udp_read_thread(void *arg) { return(0); } -int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps) { - +int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps) +{ fhstate_t *fhstate = &device->fhstate; - openair0_timestamp prev_read_TS= fhstate->TS_read; - volatile openair0_timestamp min_TS; + openair0_timestamp_t prev_read_TS= fhstate->TS_read; + volatile openair0_timestamp_t min_TS; // block until FH is ready while (fhstate->r[0] == 0 || fhstate->r[1] == 0 || fhstate->r[2] == 0 || fhstate->r[3] == 0 || fhstate->r[4] == 0 || fhstate->r[5] == 0 || fhstate->r[6] == 0 || fhstate->r[7] == 0) usleep(100); // get minimum TS over all antennas - min_TS = (volatile openair0_timestamp)fhstate->TS[0]; + min_TS = (volatile openair0_timestamp_t)fhstate->TS[0]; for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,fhstate->TS[i]); // poll/sleep until we accumulated enough samples on each antenna port int count=0; while (fhstate->first_read == 1 && min_TS < (fhstate->TS0+prev_read_TS + nsamps)) { usleep(10); - min_TS = (volatile openair0_timestamp)fhstate->TS[0]; - for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp)fhstate->TS[i]); + min_TS = (volatile openair0_timestamp_t)fhstate->TS[0]; + for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp_t)fhstate->TS[i]); count++; } if (fhstate->first_read == 0) { @@ -524,8 +525,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uin -int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) { - +int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len) +{ return(sendto(((eth_state_t*)device->priv)->sockfdc, msg, msg_len, @@ -535,8 +536,8 @@ int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) { } -int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len) { - +int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len) +{ return (recvfrom(((eth_state_t*)device->priv)->sockfdc, msg, msg_len, diff --git a/radio/ETHERNET/ethernet_lib.c b/radio/ETHERNET/ethernet_lib.c index 038246c998..d54d66ce72 100644 --- a/radio/ETHERNET/ethernet_lib.c +++ b/radio/ETHERNET/ethernet_lib.c @@ -51,12 +51,9 @@ int num_devices_eth = 0; struct sockaddr_in dest_addr[MAX_INST]; int dest_addr_len[MAX_INST]; -int load_lib(openair0_device *device, - openair0_config_t *openair0_cfg, - eth_params_t *cfg, - uint8_t flag); +int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag); -int trx_eth_start(openair0_device *device) +int trx_eth_start(openair0_device_t *device) { eth_state_t *eth = (eth_state_t*)device->priv; @@ -225,8 +222,7 @@ int trx_eth_start(openair0_device *device) return 0; } - -void trx_eth_end(openair0_device *device) +void trx_eth_end(openair0_device_t *device) { eth_state_t *eth = (eth_state_t*)device->priv; /* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */ @@ -239,9 +235,8 @@ void trx_eth_end(openair0_device *device) } } - - -int trx_eth_stop(openair0_device *device) { +int trx_eth_stop(openair0_device_t *device) +{ eth_state_t *eth = (eth_state_t*)device->priv; if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) { @@ -251,38 +246,32 @@ int trx_eth_stop(openair0_device *device) { return(0); } - -int trx_eth_set_freq(openair0_device* device, openair0_config_t *openair0_cfg) +int trx_eth_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { return(0); } - -int trx_eth_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) +int trx_eth_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { return(0); } - -int trx_eth_get_stats(openair0_device* device) +int trx_eth_get_stats(openair0_device_t *device) { return(0); } - -int trx_eth_reset_stats(openair0_device* device) +int trx_eth_reset_stats(openair0_device_t *device) { return(0); } -int trx_eth_write_init(openair0_device *device) +int trx_eth_write_init(openair0_device_t *device) { return 0; } -int ethernet_tune(openair0_device *device, - unsigned int option, - int value) +int ethernet_tune(openair0_device_t *device, unsigned int option, int value) { eth_state_t *eth = (eth_state_t*)device->priv; struct timeval timeout; @@ -471,10 +460,7 @@ int ethernet_tune(openair0_device *device, return 0; } - -int transport_init(openair0_device *device, - openair0_config_t *openair0_cfg, - eth_params_t * eth_params ) +int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params) { eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t)); memset(eth, 0, sizeof(eth_state_t)); @@ -496,7 +482,7 @@ int transport_init(openair0_device *device, eth->num_fd = 1; - printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU")); + printf("[ETHERNET]: Initializing openair0_device_t for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU" : "RRU")); printf("[ETHERNET]: num_fd %d\n",eth->num_fd); device->Mod_id = 0;//num_devices_eth++; device->transp_type = ETHERNET_TP; @@ -577,8 +563,7 @@ unsigned short calc_csum (unsigned short *buf, return ~sum; } - -void dump_dev(openair0_device *device) +void dump_dev(openair0_device_t *device) { eth_state_t *eth = (eth_state_t*)device->priv; @@ -594,27 +579,21 @@ void dump_dev(openair0_device *device) } - -void inline dump_txcounters(openair0_device *device) +void inline dump_txcounters(openair0_device_t *device) { eth_state_t *eth = (eth_state_t*)device->priv; printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id); printf(" Sent packets: %llu send errors: %i\n", (long long unsigned int)eth->tx_count, eth->num_tx_errors); } - -void inline dump_rxcounters(openair0_device *device) +void inline dump_rxcounters(openair0_device_t *device) { eth_state_t *eth = (eth_state_t*)device->priv; printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id); printf(" Received packets: %llu missed packets errors: %i\n", (long long unsigned int)eth->rx_count, eth->num_underflows); } - -void inline dump_buff(openair0_device *device, - char *buff, - unsigned int tx_rx_flag, - int nsamps) +void inline dump_buff(openair0_device_t *device, char *buff, unsigned int tx_rx_flag, int nsamps) { char *strptr; eth_state_t *eth = (eth_state_t*)device->priv; diff --git a/radio/ETHERNET/ethernet_lib.h b/radio/ETHERNET/ethernet_lib.h index 2a5f2db4ca..a5eacec29d 100644 --- a/radio/ETHERNET/ethernet_lib.h +++ b/radio/ETHERNET/ethernet_lib.h @@ -51,7 +51,7 @@ #include "if_defs.h" #define ECPRICOMMON_BYTES 4 #define ECPRIPCID_BYTES 2 -#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp)) +#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp_t)) #define ECPRIREV 1 // ECPRI Version 1, C=0 - single ECPRI message per OAI TX packet /*!\brief opaque ethernet data structure */ @@ -111,11 +111,11 @@ typedef struct { int num_rx_errors; /*!\brief number of errors in interface's transmitter */ int num_tx_errors; - - /*!\brief current TX timestamp */ - openair0_timestamp tx_current_ts; - /*!\brief socket file desc */ - openair0_timestamp rx_current_ts; + + /*!\brief current TX timestamp */ + openair0_timestamp_t tx_current_ts; + /*!\brief socket file desc */ + openair0_timestamp_t rx_current_ts; /*!\brief actual number of samples transmitted */ uint64_t tx_actual_nsamps; /*!\brief actual number of samples received */ @@ -150,8 +150,8 @@ typedef struct { uint16_t seq_num ; /*!\brief antenna port used to resynchronize */ uint16_t antenna_id; - /*!\brief packet's timestamp */ - openair0_timestamp timestamp; + /*!\brief packet's timestamp */ + openair0_timestamp_t timestamp; } header_t; /*!\brief different options for ethernet tuning in socket and driver level */ @@ -204,8 +204,8 @@ typedef struct { } iqoai_t ; typedef struct udpTXelem_s { - openair0_device *device; - openair0_timestamp timestamp; + openair0_device_t *device; + openair0_timestamp_t timestamp; void **buff; int fd_ind; int nant; @@ -227,17 +227,17 @@ union udpTXReqUnion { void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_flag); unsigned short calc_csum (unsigned short *buf, int nwords); -void dump_dev(openair0_device *device); -/*void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_flag,int nsamps); -void inline dump_rxcounters(openair0_device *device); -void inline dump_txcounters(openair0_device *device); +void dump_dev(openair0_device_t *device); +/*void inline dump_buff(openair0_device_t *device, char *buff,unsigned int tx_rx_flag,int nsamps); +void inline dump_rxcounters(openair0_device_t *device); +void inline dump_txcounters(openair0_device_t *device); */ void dump_iqs(char * buff, int iq_cnt); void *udp_read_thread(void *arg); void *udp_write_thread(void *arg); -/*! \fn int ethernet_tune (openair0_device *device, unsigned int option, int value); +/*! \fn int ethernet_tune (openair0_device_t *device, unsigned int option, int value); * \brief this function allows you to configure certain ethernet parameters in socket or device level * \param[in] device device which bears the socket * \param[in] option of parameter to configure @@ -246,34 +246,39 @@ void *udp_write_thread(void *arg); * \note * @ingroup _oai */ -int ethernet_tune(openair0_device *device, unsigned int option, int value); +int ethernet_tune(openair0_device_t *device, unsigned int option, int value); -/*! \fn int eth_socket_init_udp(openair0_device *device) +/*! \fn int eth_socket_init_udp(openair0_device_t *device) * \brief initialization of UDP Socket to communicate with one destination * \param[in] device openair device for which the socket will be created * \return 0 on success, otherwise -1 * \note * @ingroup _oai */ -int eth_socket_init_udp(openair0_device *device); -int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buf, int fd_ind, int nsamps, int flags,int nant); -int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps); +int eth_socket_init_udp(openair0_device_t *device); +int trx_eth_write_udp(openair0_device_t *device, + openair0_timestamp_t timestamp, + void **buf, + int fd_ind, + int nsamps, + int flags, + int nant); +int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps); +int eth_socket_init_raw(openair0_device_t *device); +int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags); +int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc); +int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags); +int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc); +int trx_eth_read_raw_IF5_mobipass(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc); +int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags); +int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc); +int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len); +int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len); -int eth_socket_init_raw(openair0_device *device); -int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); -int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); -int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); -int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); -int trx_eth_read_raw_IF5_mobipass(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); -int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); -int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); -int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len); -int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len); - -int eth_get_dev_conf_raw(openair0_device *device); -int eth_set_dev_conf_raw(openair0_device *device); -int eth_get_dev_conf_raw_IF4p5(openair0_device *device); -int eth_set_dev_conf_raw_IF4p5(openair0_device *device); +int eth_get_dev_conf_raw(openair0_device_t *device); +int eth_set_dev_conf_raw(openair0_device_t *device); +int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device); +int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device); #endif diff --git a/radio/IRIS/iris_lib.cpp b/radio/IRIS/iris_lib.cpp index 927c63d72d..0251f8054c 100644 --- a/radio/IRIS/iris_lib.cpp +++ b/radio/IRIS/iris_lib.cpp @@ -71,14 +71,15 @@ extern "C" { //! rx count int64_t rx_count; //! timestamp of RX packet - openair0_timestamp rx_timestamp; + openair0_timestamp_t rx_timestamp; } iris_state_t; } /*! \brief Called to start the Iris lime transceiver. Return 0 if OK, < 0 if error @param device pointer to the device structure specific to the RF hardware target */ -static int trx_iris_start(openair0_device *device) { +static int trx_iris_start(openair0_device_t *device) +{ iris_state_t *s = (iris_state_t *) device->priv; long long timeNs = s->iris[0]->getHardwareTime("") + 500000; @@ -97,7 +98,8 @@ static int trx_iris_start(openair0_device *device) { /*! \brief Stop Iris * \param card refers to the hardware index to use */ -int trx_iris_stop(openair0_device *device) { +int trx_iris_stop(openair0_device_t *device) +{ iris_state_t *s = (iris_state_t *) device->priv; int r; for (r = 0; r < s->device_num; r++) { @@ -110,7 +112,8 @@ int trx_iris_stop(openair0_device *device) { /*! \brief Terminate operation of the Iris lime transceiver -- free all associated resources * \param device the hardware to use */ -static void trx_iris_end(openair0_device *device) { +static void trx_iris_end(openair0_device_t *device) +{ LOG_I(HW, "Closing Iris device.\n"); trx_iris_stop(device); iris_state_t *s = (iris_state_t *) device->priv; @@ -133,7 +136,7 @@ static void trx_iris_end(openair0_device *device) { static int -trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) +trx_iris_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) { using namespace std::chrono; @@ -209,7 +212,8 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf * \param antenna_id Index of antenna for which to receive samples * \returns the number of sample read */ -static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { +static int trx_iris_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc) +{ int ret = 0; static long long nextTime; static bool nextTimeValid = false; @@ -304,7 +308,8 @@ static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp /*! \brief Get current timestamp of Iris * \param device the hardware to use */ -openair0_timestamp get_iris_time(openair0_device *device) { +openair0_timestamp_t get_iris_time(openair0_device_t *device) +{ iris_state_t *s = (iris_state_t *) device->priv; return SoapySDR::timeNsToTicks(s->iris[0]->getHardwareTime(""), s->sample_rate); } @@ -317,9 +322,9 @@ static bool is_equal(double a, double b) { return std::fabs(a - b) < std::numeric_limits::epsilon(); } -void *set_freq_thread(void *arg) { - - openair0_device *device = (openair0_device *) arg; +void *set_freq_thread(void *arg) +{ + openair0_device_t *device = (openair0_device_t *) arg; iris_state_t *s = (iris_state_t *) device->priv; int r, i; printf("Setting Iris TX Freq %f, RX Freq %f\n", device->openair0_cfg[0].tx_freq[0], @@ -344,7 +349,7 @@ void *set_freq_thread(void *arg) { * \param dummy dummy variable not used * \returns 0 in success */ -int trx_iris_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +int trx_iris_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { iris_state_t *s = (iris_state_t *)device->priv; int r, i; @@ -369,7 +374,7 @@ int trx_iris_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int trx_iris_set_gains(openair0_device *device, +int trx_iris_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { iris_state_t *s = (iris_state_t *) device->priv; int r; @@ -448,23 +453,21 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index, int bw * \param device the hardware to use * \returns 0 on success */ -int trx_iris_get_stats(openair0_device *device) { - +int trx_iris_get_stats(openair0_device_t *device) +{ return (0); - } /*! \brief Reset the Iris statistics * \param device the hardware to use * \returns 0 on success */ -int trx_iris_reset_stats(openair0_device *device) { - +int trx_iris_reset_stats(openair0_device_t *device) +{ return (0); - } -int trx_iris_write_init(openair0_device *device) +int trx_iris_write_init(openair0_device_t *device) { return 0; } @@ -475,8 +478,8 @@ extern "C" { * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application */ -int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { - +int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ int bw_gain_adjust = 0; openair0_cfg[0].rx_gain_calib_table = calib_table_iris; iris_state_t *s = (iris_state_t *) calloc(1, sizeof(*s)); diff --git a/radio/LMSSDR/lms_lib.cpp b/radio/LMSSDR/lms_lib.cpp index 3d0dd78118..bca1f8efaf 100644 --- a/radio/LMSSDR/lms_lib.cpp +++ b/radio/LMSSDR/lms_lib.cpp @@ -72,7 +72,8 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d \param flags Ignored for the moment \returns 0 on success */ -int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int antenna_id, int flags) { +int trx_lms_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int antenna_id, int flags) +{ timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance; lms_stream_meta_t meta; meta.waitForTimestamp = true; @@ -93,8 +94,8 @@ int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void ** * \param antenna_id Index of antenna port * \returns number of samples read */ -int trx_lms_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int antenna_id) { - +int trx_lms_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int antenna_id) +{ lms_stream_meta_t meta; meta.waitForTimestamp = false; meta.flushPartialPacket = false; @@ -140,7 +141,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { * \param openair0_cfg openair0 Config structure * \returns 0 in success, -1 on error */ -int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { +int trx_lms_set_gains(openair0_device_t* device, openair0_config_t *openair0_cfg) +{ int ret = 0; if (openair0_cfg->rx_gain[0] > 70+openair0_cfg->rx_gain_offset[0]) { @@ -158,8 +160,8 @@ int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) * \param device the hardware to use * \returns 0 on success */ -int trx_lms_start(openair0_device *device){ - +int trx_lms_start(openair0_device_t *device) +{ lms_info_str_t list[16]={0}; int n= LMS_GetDeviceList(list); @@ -269,7 +271,8 @@ int trx_lms_start(openair0_device *device){ * \param card Index of the RF card to use * \returns 0 on success */ -int trx_lms_stop(openair0_device *device) { +int trx_lms_stop(openair0_device_t *device) +{ LMS_StopStream(&rx_stream); LMS_StopStream(&tx_stream); LMS_DestroyStream(lms_device,&rx_stream); @@ -283,7 +286,8 @@ int trx_lms_stop(openair0_device *device) { * \param openair0_cfg openair0 Config structure (ignored. It is there to comply with RF common API) * \returns 0 in success */ -int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg) { +int trx_lms_set_freq(openair0_device_t* device, openair0_config_t *openair0_cfg) +{ //Control port must be connected LMS_SetLOFrequency(lms_device,LMS_CH_TX,0,openair0_cfg->tx_freq[0]); LMS_SetLOFrequency(lms_device,LMS_CH_RX,0,openair0_cfg->rx_freq[0]); @@ -322,45 +326,43 @@ rx_gain_calib_table_t calib_table_lmssdr[] = { * \returns 0 in success */ -int trx_lms_get_stats(openair0_device* device) { - +int trx_lms_get_stats(openair0_device_t* device) +{ return(0); - } /*! \brief Reset LMSSDR Statistics * \param device the hardware to use * \returns 0 in success */ -int trx_lms_reset_stats(openair0_device* device) { - +int trx_lms_reset_stats(openair0_device_t* device) +{ return(0); - } /*! \brief Terminate operation of the LMSSDR transceiver -- free all associated resources * \param device the hardware to use */ -void trx_lms_end(openair0_device *device) { - - +void trx_lms_end(openair0_device_t *device) +{ } -int trx_lms_write_init(openair0_device *device) +int trx_lms_write_init(openair0_device_t *device) { return 0; } + extern "C" { /*! \brief Initialize Openair LMSSDR target. It returns 0 if OK * \param device the hardware to use * \param openair0_cfg RF frontend parameters set by application */ -int device_init(openair0_device *device, openair0_config_t *openair0_cfg){ - +int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ device->type=LMSSDR_DEV; - printf("LMSSDR: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU")); + printf("LMSSDR: Initializing openair0_device_t for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU")); switch ((int)openair0_cfg[0].sample_rate) { case 30720000: diff --git a/radio/LMSSDR/sodera_lib.cpp b/radio/LMSSDR/sodera_lib.cpp index 7c3690a9d6..39b2811005 100644 --- a/radio/LMSSDR/sodera_lib.cpp +++ b/radio/LMSSDR/sodera_lib.cpp @@ -87,7 +87,7 @@ typedef struct int64_t tx_count; int64_t rx_count; - openair0_timestamp rx_timestamp; + openair0_timestamp_t rx_timestamp; } sodera_t; @@ -131,7 +131,7 @@ uint16_t SPI_read(LMScomms* dataPort, uint16_t address) return 0; } -static int trx_sodera_start(openair0_device *device) +static int trx_sodera_start(openair0_device_t *device) { sodera_t *s = (sodera_t*)device->priv; @@ -182,7 +182,7 @@ static int trx_sodera_start(openair0_device *device) return 0; } -static void trx_sodera_end(openair0_device *device) +static void trx_sodera_end(openair0_device_t *device) { sodera_t *s = (sodera_t*)device->priv; @@ -193,7 +193,7 @@ static void trx_sodera_end(openair0_device *device) } -static int trx_sodera_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) +static int trx_sodera_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) { sodera_t *s = (sodera_t*)device->priv; @@ -203,7 +203,7 @@ static int trx_sodera_write(openair0_device *device, openair0_timestamp timestam #define DEBUG_READ 1 -static int trx_sodera_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) +static int trx_sodera_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc) { sodera_t *s = (sodera_t*)device->priv; int samples_received=0,i,j; @@ -350,19 +350,18 @@ static bool is_equal(double a, double b) return fabs(a-b) < 1e-6; } -int trx_sodera_set_freq(openair0_device* device, openair0_config_t *openair0_cfg, int dummy) { - +int trx_sodera_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg, int dummy) +{ sodera_t *s = (sodera_t*)device->priv; // s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[0]); // s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[0]); - return(0); - + return (0); } -int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg) { - +int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ sodera_t *s = (sodera_t*)device->priv; static int first_call=1; static double rf_freq,diff; @@ -374,13 +373,11 @@ int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *open // rf_freq=openair0_cfg[0].rx_freq[0]; // s->usrp->set_rx_freq(rx_tune_req); - return(0); - + return (0); } -int trx_sodera_set_gains(openair0_device* device, - openair0_config_t *openair0_cfg) { - +int trx_sodera_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ sodera_t *s = (sodera_t*)device->priv; // s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[0]); @@ -456,20 +453,17 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ } - -int trx_sodera_get_stats(openair0_device* device) { - - return(0); - -} -int trx_sodera_reset_stats(openair0_device* device) { - - return(0); - +int trx_sodera_get_stats(openair0_device_t *device) +{ + return (0); } +int trx_sodera_reset_stats(openair0_device_t *device) +{ + return (0); +} -int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair0_cfg) +int openair0_dev_init_sodera(openair0_device_t *device, openair0_config_t *openair0_cfg) { sodera_t *s=&sodera_state; diff --git a/radio/USRP/usrp_lib.cpp b/radio/USRP/usrp_lib.cpp index dabc6f8947..f224b75354 100644 --- a/radio/USRP/usrp_lib.cpp +++ b/radio/USRP/usrp_lib.cpp @@ -104,7 +104,7 @@ typedef struct { //int first_tx; //int first_rx; //! timestamp of RX packet - openair0_timestamp rx_timestamp; + openair0_timestamp_t rx_timestamp; } usrp_state_t; //void print_notes(void) @@ -145,7 +145,8 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) { return ref_locked; } -static int sync_to_gps(openair0_device *device) { +static int sync_to_gps(openair0_device_t *device) +{ //uhd::set_thread_priority_safe(); //std::string args; //Set up program options @@ -266,7 +267,7 @@ static int sync_to_gps(openair0_device *device) { #define ATR_XX 0x20 //data[5] #define MAN_MASK ATR_MASK ^ 0xFFF // manually controlled pins -static void trx_usrp_start_interdigital_gpio(openair0_device *device, usrp_state_t *s) +static void trx_usrp_start_interdigital_gpio(openair0_device_t *device, usrp_state_t *s) { AssertFatal(device->type == USRP_X400_DEV, "interdigital frontend device for beam management can only be used together with an X400\n"); @@ -280,7 +281,7 @@ static void trx_usrp_start_interdigital_gpio(openair0_device *device, usrp_state s->usrp->set_gpio_attr(s->gpio_bank, "OUT", (1 << 4), 0x1c); } -static void trx_usrp_start_generic_gpio(openair0_device *device, usrp_state_t *s) +static void trx_usrp_start_generic_gpio(openair0_device_t *device, usrp_state_t *s) { // setup GPIO for TDD, GPIO(4) = ATR_RX // set data direction register (DDR) to output @@ -299,7 +300,8 @@ static void trx_usrp_start_generic_gpio(openair0_device *device, usrp_state_t *s /*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error @param device pointer to the device structure specific to the RF hardware target */ -static int trx_usrp_start(openair0_device *device) { +static int trx_usrp_start(openair0_device_t *device) +{ usrp_state_t *s = (usrp_state_t *)device->priv; s->gpio_bank = (char *) "FP0"; //good for B210, X310 and N310 @@ -383,7 +385,8 @@ static void trx_usrp_write_reset(openair0_thread_t *wt); /*! \brief Terminate operation of the USRP transceiver -- free all associated resources * \param device the hardware to use */ -static void trx_usrp_end(openair0_device *device) { +static void trx_usrp_end(openair0_device_t *device) +{ if (device == NULL) return; @@ -423,12 +426,13 @@ static void trx_usrp_end(openair0_device *device) { @param antenna_id index of the antenna if the device has multiple antennas @param flags flags must be set to true if timestamp parameter needs to be applied */ -static int trx_usrp_write(openair0_device *device, - openair0_timestamp timestamp, +static int trx_usrp_write(openair0_device_t *device, + openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, - int flags) { + int flags) +{ int ret=0; usrp_state_t *s = (usrp_state_t *)device->priv; timestamp -= device->openair0_cfg->command_line_sample_advance + device->openair0_cfg->tx_sample_advance; @@ -562,22 +566,23 @@ static int trx_usrp_write(openair0_device *device, @param antenna_id index of the antenna if the device has multiple antennas @param flags flags must be set to true if timestamp parameter needs to be applied */ -void *trx_usrp_write_thread(void * arg){ +void *trx_usrp_write_thread(void * arg) +{ int ret=0; - openair0_device *device=(openair0_device *)arg; + openair0_device_t *device=(openair0_device_t *)arg; openair0_thread_t *write_thread = &device->write_thread; openair0_write_package_t *write_package = write_thread->write_package; usrp_state_t *s; int nsamps2; // aligned to upper 32 or 16 byte boundary int start; - openair0_timestamp timestamp; - void **buff; - int nsamps; - int cc; - signed char first_packet; - signed char last_packet; - int flags_gpio; + openair0_timestamp_t timestamp; + void **buff; + int nsamps; + int cc; + signed char first_packet; + signed char last_packet; + int flags_gpio; printf("trx_usrp_write_thread started on cpu %d\n",sched_getcpu()); while(1){ @@ -659,8 +664,8 @@ void *trx_usrp_write_thread(void * arg){ return NULL; } -int trx_usrp_write_init(openair0_device *device){ - +int trx_usrp_write_init(openair0_device_t *device) +{ //uhd::set_thread_priority_safe(1.0); openair0_thread_t *write_thread = &device->write_thread; printf("initializing tx write thread\n"); @@ -705,7 +710,8 @@ static void trx_usrp_write_reset(openair0_thread_t *wt) { * \param antenna_id Index of antenna for which to receive samples * \returns the number of sample read */ -static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { +static int trx_usrp_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc) +{ usrp_state_t *s = (usrp_state_t *)device->priv; int samples_received=0; int nsamps2; // aligned to upper 32 or 16 byte boundary @@ -817,7 +823,7 @@ static bool is_equal(double a, double b) { } void *freq_thread(void *arg) { - openair0_device *device=(openair0_device *)arg; + openair0_device_t *device=(openair0_device_t *)arg; usrp_state_t *s = (usrp_state_t *)device->priv; uhd::tune_request_t tx_tune_req(device->openair0_cfg[0].tx_freq[0], device->openair0_cfg[0].tune_offset); @@ -833,7 +839,7 @@ void *freq_thread(void *arg) { * \param dummy dummy variable not used * \returns 0 in success */ -int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +int trx_usrp_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { usrp_state_t *s = (usrp_state_t *)device->priv; printf("Setting USRP TX Freq %f, RX Freq %f, tune_offset: %f\n", openair0_cfg[0].tx_freq[0], openair0_cfg[0].rx_freq[0], openair0_cfg[0].tune_offset); @@ -851,7 +857,8 @@ int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg) { +int openair0_set_rx_frequencies(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ usrp_state_t *s = (usrp_state_t *)device->priv; uhd::tune_request_t rx_tune_req(openair0_cfg[0].rx_freq[0], openair0_cfg[0].tune_offset); printf("In openair0_set_rx_frequencies, freq: %f, tune offset: %f\n", @@ -867,8 +874,9 @@ int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *open * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int trx_usrp_set_gains(openair0_device *device, - openair0_config_t *openair0_cfg) { +int trx_usrp_set_gains(openair0_device_t *device, + openair0_config_t *openair0_cfg) +{ usrp_state_t *s = (usrp_state_t *)device->priv; ::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(0); s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[0]); @@ -892,7 +900,8 @@ int trx_usrp_set_gains(openair0_device *device, /*! \brief Stop USRP * \param card refers to the hardware index to use */ -int trx_usrp_stop(openair0_device *device) { +int trx_usrp_stop(openair0_device_t *device) +{ return(0); } @@ -1012,7 +1021,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ * \param device the hardware to use * \returns 0 on success */ -int trx_usrp_get_stats(openair0_device *device) { +int trx_usrp_get_stats(openair0_device_t *device) +{ return(0); } @@ -1020,7 +1030,8 @@ int trx_usrp_get_stats(openair0_device *device) { * \param device the hardware to use * \returns 0 on success */ -int trx_usrp_reset_stats(openair0_device *device) { +int trx_usrp_reset_stats(openair0_device_t *device) +{ return(0); } @@ -1047,7 +1058,8 @@ static void usrp_sync_pps(usrp_state_t *s) } extern "C" { - int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { + int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) + { LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); LOG_I(HW, "openair0_cfg[0].clock_source == '%d' (internal = %d, external = %d)\n", openair0_cfg[0].clock_source,internal,external); usrp_state_t *s ; diff --git a/radio/emulator/rf_emulator.c b/radio/emulator/rf_emulator.c index e73e9bf3d6..7fb2e2979a 100644 --- a/radio/emulator/rf_emulator.c +++ b/radio/emulator/rf_emulator.c @@ -115,7 +115,7 @@ static void *emulator_timing_job(void *arg) /*! \brief Called to start the RF transceiver. Return 0 if OK, < 0 if error * \param device pointer to the device structure specific to the RF hardware target */ -static int emulator_start(openair0_device *device) +static int emulator_start(openair0_device_t *device) { // Start the timing thread and the noise device emulator_state_t *emulator_state = (emulator_state_t *)device->priv; @@ -163,7 +163,7 @@ static int emulator_start(openair0_device *device) * \param device pointer to the device structure specific to the RF hardware target * \returns 0 on success */ -int emulator_get_stats(openair0_device *device) +int emulator_get_stats(openair0_device_t *device) { return (0); } @@ -172,7 +172,7 @@ int emulator_get_stats(openair0_device *device) * \param device pointer to the device structure specific to the RF hardware target * \returns 0 on success */ -int emulator_reset_stats(openair0_device *device) +int emulator_reset_stats(openair0_device_t *device) { return (0); } @@ -180,7 +180,7 @@ int emulator_reset_stats(openair0_device *device) /*! \brief Terminate operation of the RF transceiver -- free all associated resources (if any) * \param pointer to the device structure specific to the RF hardware target */ -static void emulator_end(openair0_device *device) +static void emulator_end(openair0_device_t *device) { // Stop the timing thread and the noise device emulator_state_t *emulator_state = (emulator_state_t *)device->priv; @@ -197,7 +197,7 @@ static void emulator_end(openair0_device *device) /*! \brief Stop RF * \param device pointer to the device structure specific to the RF hardware target */ -int emulator_stop(openair0_device *device) +int emulator_stop(openair0_device_t *device) { return (0); } @@ -207,7 +207,7 @@ int emulator_stop(openair0_device *device) * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int emulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) +int emulator_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { return (0); } @@ -217,12 +217,12 @@ int emulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -int emulator_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +int emulator_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { return (0); } -int emulator_write_init(openair0_device *device) +int emulator_write_init(openair0_device_t *device) { return (0); } @@ -235,7 +235,7 @@ int emulator_write_init(openair0_device *device) * \param nbAnt number of antennas * \param flags flags must be set to true if timestamp parameter needs to be applied */ -static int emulator_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int nbAnt, int flags) +static int emulator_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int nbAnt, int flags) { emulator_state_t *emulator_state = (emulator_state_t *)device->priv; @@ -297,7 +297,7 @@ static void read_noise(void *buff, int nsamps) * \param nbAnt number of antennas * \returns the number of samples read */ -static int emulator_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int nbAnt) +static int emulator_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int nbAnt) { emulator_state_t *emulator_state = (emulator_state_t *)device->priv; @@ -339,7 +339,7 @@ static void emulator_readconfig(emulator_state_t *emulator_state) AssertFatal(ret >= 0, "configuration couldn't be performed\n"); } -int device_init(openair0_device *device, openair0_config_t *openair0_cfg) +int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) { LOG_I(HW, "This is emulator RF that does nothing\n"); diff --git a/radio/fhi_72/oran.h b/radio/fhi_72/oran.h index c79bc88fa3..059d33d79e 100644 --- a/radio/fhi_72/oran.h +++ b/radio/fhi_72/oran.h @@ -28,7 +28,7 @@ void oran_fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp); void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot); -int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); +int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); typedef struct { eth_state_t e; diff --git a/radio/fhi_72/oran_isolate.c b/radio/fhi_72/oran_isolate.c index 9b97b58390..603c12f1da 100644 --- a/radio/fhi_72/oran_isolate.c +++ b/radio/fhi_72/oran_isolate.c @@ -55,7 +55,7 @@ typedef struct { notifiedFIFO_t oran_sync_fifo; -int trx_oran_start(openair0_device *device) +int trx_oran_start(openair0_device_t *device) { printf("ORAN: %s\n", __FUNCTION__); @@ -71,14 +71,14 @@ int trx_oran_start(openair0_device *device) return 0; } -void trx_oran_end(openair0_device *device) +void trx_oran_end(openair0_device_t *device) { printf("ORAN: %s\n", __FUNCTION__); oran_eth_state_t *s = device->priv; xran_close(s->oran_priv); } -int trx_oran_stop(openair0_device *device) +int trx_oran_stop(openair0_device_t *device) { printf("ORAN: %s\n", __FUNCTION__); oran_eth_state_t *s = device->priv; @@ -91,19 +91,19 @@ int trx_oran_stop(openair0_device *device) return (0); } -int trx_oran_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +int trx_oran_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { printf("ORAN: %s\n", __FUNCTION__); return (0); } -int trx_oran_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) +int trx_oran_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { printf("ORAN: %s\n", __FUNCTION__); return (0); } -int trx_oran_get_stats(openair0_device *device) +int trx_oran_get_stats(openair0_device_t *device) { uint64_t total_time, used_time; uint32_t num_core_used, core_used[64]; @@ -114,25 +114,25 @@ int trx_oran_get_stats(openair0_device *device) return (0); } -int trx_oran_reset_stats(openair0_device *device) +int trx_oran_reset_stats(openair0_device_t *device) { printf("ORAN: %s\n", __FUNCTION__); return (0); } -int ethernet_tune(openair0_device *device, unsigned int option, int value) +int ethernet_tune(openair0_device_t *device, unsigned int option, int value) { printf("ORAN: %s\n", __FUNCTION__); return 0; } -int trx_oran_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) +int trx_oran_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) { printf("ORAN: %s\n", __FUNCTION__); return 0; } -int trx_oran_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) +int trx_oran_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc) { printf("ORAN: %s\n", __FUNCTION__); return 0; @@ -160,7 +160,7 @@ char *msg_type(int t) return s[t]; } -int trx_oran_ctlsend(openair0_device *device, void *msg, ssize_t msg_len) +int trx_oran_ctlsend(openair0_device_t *device, void *msg, ssize_t msg_len) { RRU_CONFIG_msg_t *rru_config_msg = msg; oran_eth_state_t *s = device->priv; @@ -174,7 +174,7 @@ int trx_oran_ctlsend(openair0_device *device, void *msg, ssize_t msg_len) return msg_len; } -int trx_oran_ctlrecv(openair0_device *device, void *msg, ssize_t msg_len) +int trx_oran_ctlrecv(openair0_device_t *device, void *msg, ssize_t msg_len) { RRU_CONFIG_msg_t *rru_config_msg = msg; oran_eth_state_t *s = device->priv; @@ -312,7 +312,7 @@ void *get_internal_parameter(char *name) return NULL; } -__attribute__((__visibility__("default"))) int transport_init(openair0_device *device, +__attribute__((__visibility__("default"))) int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params) { diff --git a/radio/iqplayer/iqplayer_lib.c b/radio/iqplayer/iqplayer_lib.c index 2df57c9202..d247ce0eb0 100644 --- a/radio/iqplayer/iqplayer_lib.c +++ b/radio/iqplayer/iqplayer_lib.c @@ -57,7 +57,8 @@ static void busy_wait(uint32_t usecs) { //LOG_I(HW, "Expected: %d Elapsed: %d us\n", usecs, elapsed_usecs); } -static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) { +static void parse_iqfile_header(openair0_device_t *device, iqfile_header_t *iq_fh) +{ char tmp[4]=OAIIQFILE_ID; AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0), "iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n", @@ -69,11 +70,11 @@ static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw); } - /*! \brief Called to start the iqplayer device. Return 0 if OK, < 0 if error @param device pointer to the device structure specific to the RF hardware target */ -static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair0_cfg) { +static int iqplayer_loadfile(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ recplay_state_t *s = device->recplay_state; recplay_conf_t *c = openair0_cfg->recplay_conf; @@ -142,7 +143,7 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair * \param device the hardware to use * \returns 0 on success */ -static int trx_iqplayer_get_stats(openair0_device *device) +static int trx_iqplayer_get_stats(openair0_device_t *device) { LOG_I(HW, "trx_iqplayer_get_stats() called, not implemented\n"); return 0; @@ -152,7 +153,7 @@ static int trx_iqplayer_get_stats(openair0_device *device) * \param device the hardware to use * \returns 0 in success */ -static int trx_iqplayer_reset_stats(openair0_device *device) +static int trx_iqplayer_reset_stats(openair0_device_t *device) { LOG_I(HW, "trx_iqplayer_reset_stats() called, not implemented\n"); return 0; @@ -160,7 +161,7 @@ static int trx_iqplayer_reset_stats(openair0_device *device) /*! \brief Stop operation of the transceiver */ -static int trx_iqplayer_stop(openair0_device *device) +static int trx_iqplayer_stop(openair0_device_t *device) { LOG_I(HW, "trx_iqplayer_stop() called, not implemented\n"); return 0; @@ -171,7 +172,7 @@ static int trx_iqplayer_stop(openair0_device *device) * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -static int trx_iqplayer_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +static int trx_iqplayer_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { LOG_I(HW, "trx_iqplayer_set_freq() called, not implemented\n"); return 0; @@ -182,7 +183,7 @@ static int trx_iqplayer_set_freq(openair0_device *device, openair0_config_t *ope * \param openair0_cfg RF frontend parameters set by application * \returns 0 in success */ -static int trx_iqplayer_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) +static int trx_iqplayer_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { LOG_I(HW, "trx_iqplayer_set_gains() called, not implemented\n"); return 0; @@ -191,14 +192,16 @@ static int trx_iqplayer_set_gains(openair0_device *device, openair0_config_t *op /*! \brief start the oai iq player * \param device, the hardware used */ -static int trx_iqplayer_start(openair0_device *device) { +static int trx_iqplayer_start(openair0_device_t *device) +{ return 0; } /*! \brief Terminate operation of the oai iq player * \param device, the hardware used */ -static void trx_iqplayer_end(openair0_device *device) { +static void trx_iqplayer_end(openair0_device_t *device) +{ if (device == NULL) return; if (device->recplay_state == NULL) @@ -218,7 +221,6 @@ static void trx_iqplayer_end(openair0_device *device) { close(device->recplay_state->fd); device->recplay_state->fd = -1; } - } /*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time, @param device pointer to the device structure specific to the RF hardware target @@ -228,7 +230,8 @@ static void trx_iqplayer_end(openair0_device *device) { @param antenna_id index of the antenna if the device has multiple antennas @param flags flags must be set to true if timestamp parameter needs to be applied */ -static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { +static int trx_iqplayer_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) +{ struct timespec req; req.tv_sec = 0; req.tv_nsec = device->openair0_cfg->recplay_conf->u_sf_write_delay * 1000; @@ -247,7 +250,8 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest * \param antenna_id Index of antenna for which to receive samples * \returns the number of sample read */ -static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { +static int trx_iqplayer_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int cc) +{ recplay_state_t *s = device->recplay_state; static struct timeval tprev; static int read_count = 0; @@ -324,7 +328,8 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes return nsamps; } -int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { +int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ device->openair0_cfg = openair0_cfg; device->trx_start_func = trx_iqplayer_start; device->trx_get_stats_func = trx_iqplayer_get_stats; diff --git a/radio/rfsimulator/simulator.cpp b/radio/rfsimulator/simulator.cpp index ef6be135e6..f89aef02cd 100644 --- a/radio/rfsimulator/simulator.cpp +++ b/radio/rfsimulator/simulator.cpp @@ -141,7 +141,7 @@ typedef c16_t sample_t; // 2*16 bits complex number typedef struct beam_switch_command_t { std::vector beams; - openair0_timestamp timestamp; + openair0_timestamp_t timestamp; } beam_switch_command_t; typedef struct { @@ -157,7 +157,7 @@ typedef struct { typedef struct buffer_s { int conn_sock; - openair0_timestamp lastReceivedTS; + openair0_timestamp_t lastReceivedTS; bool headerMode; bool trashingPacket; samplesBlockHeader_t th; @@ -183,8 +183,8 @@ typedef struct { int listen_sock, epollfd; pthread_mutex_t Sockmutex; unsigned int nb_cnx; - openair0_timestamp nextRxTstamp; - openair0_timestamp lastWroteTS; + openair0_timestamp_t nextRxTstamp; + openair0_timestamp_t lastWroteTS; simuRole role; char *ip; uint16_t port; @@ -218,7 +218,7 @@ typedef struct { * @param nsamps_out output pointer to receive the number of samples until the next beam switch. * @return The beam map (uint64_t) valid for the given timestamp. */ -static std::vector get_beams(beam_state_t *beam_state, openair0_timestamp timestamp, uint32_t nsamps, uint32_t *nsamps_out) +static std::vector get_beams(beam_state_t *beam_state, openair0_timestamp_t timestamp, uint32_t nsamps, uint32_t *nsamps_out) { std::lock_guard lock(beam_state->mutex); std::vector current_beams = beam_state->beams; @@ -284,7 +284,7 @@ static uint64_t beams_to_beam_map(const std::vector &beam_ids) * @param beam_state Pointer to the beam_state_t structure containing the command queue and current beam map. * @param timestamp The timestamp up to which commands should be processed and removed. */ -static void clear_beam_queue(beam_state_t *beam_state, openair0_timestamp timestamp) +static void clear_beam_queue(beam_state_t *beam_state, openair0_timestamp_t timestamp) { std::lock_guard lock(beam_state->mutex); while (!beam_state->cmd_queue.empty()) { @@ -472,7 +472,7 @@ static float get_rx_gain_db(rfsimulator_state_t *rfsimulator, uint rx_beam, uint return rfsimulator->beam_ctrl->beam_gains[rx_beam][tx_beam]; } -static int rfsimulator_set_beams(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp) +static int rfsimulator_set_beams(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp) { rfsimulator_state_t *s = static_cast(device->priv); rfsim_beam_ctrl_t *beam_ctrl = s->beam_ctrl; @@ -484,7 +484,7 @@ static int rfsimulator_set_beams(openair0_device *device, uint64_t beam_map, ope return 0; } -static int rfsimulator_set_beams_vector(openair0_device *device, int* beams, int num_beams, openair0_timestamp timestamp) +static int rfsimulator_set_beams_vector(openair0_device_t *device, int *beams, int num_beams, openair0_timestamp_t timestamp) { rfsimulator_state_t *s = static_cast(device->priv); rfsim_beam_ctrl_t *beam_ctrl = s->beam_ctrl; @@ -769,13 +769,13 @@ static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt static int rfsimu_vtime_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) { rfsimulator_state_t *t = (rfsimulator_state_t *)arg; - const openair0_timestamp ts = t->nextRxTstamp; + const openair0_timestamp_t ts = t->nextRxTstamp; const double sample_rate = t->sample_rate; prnt("%s: vtime measurement: TS %llu sample_rate %.3f\n", __func__, ts, sample_rate); return CMDSTATUS_FOUND; } -static int startServer(openair0_device *device) +static int startServer(openair0_device_t *device) { int sock = -1; struct addrinfo *results = NULL; @@ -885,7 +885,7 @@ static int client_try_connect(const char *host, uint16_t port) return sock; } -static int startClient(openair0_device *device) +static int startClient(openair0_device_t *device) { rfsimulator_state_t *t = static_cast(device->priv); t->role = SIMU_ROLE_CLIENT; @@ -928,7 +928,7 @@ static int startClient(openair0_device *device) } static int rfsimulator_write_internal(rfsimulator_state_t *t, - openair0_timestamp timestamp, + openair0_timestamp_t timestamp, void ***samplesVoid, int nsamps, int nbAnt, @@ -986,8 +986,8 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, return nsamps; } -static int rfsimulator_write_beams(openair0_device *device, - openair0_timestamp timestamp, +static int rfsimulator_write_beams(openair0_device_t *device, + openair0_timestamp_t timestamp, void ***samplesVoid, int nsamps, int nbAnt, @@ -1022,7 +1022,7 @@ static int rfsimulator_write_beams(openair0_device *device, return nsamps_initial; } -static int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) +static int rfsimulator_write(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags) { void **tmp = buff; return rfsimulator_write_beams(device, timestamp, &tmp, nsamps, cc, 1, flags); @@ -1253,7 +1253,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, bool first_time) static void rfsimulator_read_internal(rfsimulator_state_t *t, c16_t **samples, - openair0_timestamp timestamp, + openair0_timestamp_t timestamp, int nsamps, int nbAnt, int rx_beam_id, @@ -1355,8 +1355,8 @@ static void rfsimulator_read_internal(rfsimulator_state_t *t, } } -static int rfsimulator_read_beams(openair0_device *device, - openair0_timestamp *ptimestamp, +static int rfsimulator_read_beams(openair0_device_t *device, + openair0_timestamp_t *ptimestamp, void ***samplesVoid, int nsamps, int nbAnt, @@ -1438,7 +1438,7 @@ static int rfsimulator_read_beams(openair0_device *device, for (int a = 0; a < nbAnt; a++) memset(samplesVoid[beam][a], 0, sampleToByte(nsamps, 1)); - openair0_timestamp timestamp = t->nextRxTstamp; + openair0_timestamp_t timestamp = t->nextRxTstamp; int nsamps_to_process = nsamps; while (nsamps_to_process > 0) { uint32_t nsamps_beam_map; @@ -1488,7 +1488,7 @@ static int rfsimulator_read_beams(openair0_device *device, buffer_t *ptr = &t->buf[sock]; if (ptr->conn_sock != -1 && !ptr->received_packets.empty()) { - openair0_timestamp timestamp_to_free = t->nextRxTstamp - 1; + openair0_timestamp_t timestamp_to_free = t->nextRxTstamp - 1; if (ptr->channel_model) { timestamp_to_free -= (ptr->channel_model->channel_length - 1) + std::max(ptr->channel_model->channel_offset, t->chan_offset); @@ -1502,20 +1502,20 @@ static int rfsimulator_read_beams(openair0_device *device, return nsamps; } -static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, void **samplesVoid, int nsamps, int nbAnt) +static int rfsimulator_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **samplesVoid, int nsamps, int nbAnt) { return rfsimulator_read_beams(device, ptimestamp, &samplesVoid, nsamps, nbAnt, 1); } -static int rfsimulator_get_stats(openair0_device *device) +static int rfsimulator_get_stats(openair0_device_t *device) { return 0; } -static int rfsimulator_reset_stats(openair0_device *device) +static int rfsimulator_reset_stats(openair0_device_t *device) { return 0; } -static void rfsimulator_end(openair0_device *device) +static void rfsimulator_end(openair0_device_t *device) { rfsimulator_state_t *s = static_cast(device->priv); for (int i = 0; i < MAX_FD_RFSIMU; i++) { @@ -1529,7 +1529,8 @@ static void rfsimulator_end(openair0_device *device) close(s->epollfd); free(s); } -static void stopServer(openair0_device *device) + +static void stopServer(openair0_device_t *device) { rfsimulator_state_t *t = (rfsimulator_state_t *)device->priv; DevAssert(t != NULL); @@ -1537,26 +1538,26 @@ static void stopServer(openair0_device *device) rfsimulator_end(device); } -static int rfsimulator_stop(openair0_device *device) +static int rfsimulator_stop(openair0_device_t *device) { return 0; } -static int rfsimulator_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +static int rfsimulator_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { rfsimulator_state_t *s = static_cast(device->priv); s->rx_freq = openair0_cfg->rx_freq[0]; return 0; } -static int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) +static int rfsimulator_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg) { return 0; } -static int rfsimulator_write_init(openair0_device *device) +static int rfsimulator_write_init(openair0_device_t *device) { return 0; } -extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_device *device, openair0_config_t *openair0_cfg) +extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line // --log_config.hw_log_level debug diff --git a/radio/vrtsim/vrtsim.c b/radio/vrtsim/vrtsim.c index 1b2b075bd0..55be9788de 100644 --- a/radio/vrtsim/vrtsim.c +++ b/radio/vrtsim/vrtsim.c @@ -275,7 +275,7 @@ static client_info_t client_read_info(char *descriptor_file) return client_info; } -static int vrtsim_connect(openair0_device *device) +static int vrtsim_connect(openair0_device_t *device) { vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv; @@ -337,7 +337,7 @@ static int vrtsim_connect(openair0_device *device) } static int vrtsim_write_internal(vrtsim_state_t *vrtsim_state, - openair0_timestamp timestamp, + openair0_timestamp_t timestamp, c16_t *samples, int nsamps, int aarx, @@ -366,7 +366,7 @@ static int vrtsim_write_internal(vrtsim_state_t *vrtsim_state, typedef struct { vrtsim_state_t *vrtsim_state; - openair0_timestamp timestamp; + openair0_timestamp_t timestamp; c16_t *samples[MAX_NUM_ANTENNAS_TX]; int nsamps; int nbAnt; @@ -469,7 +469,7 @@ static void perform_channel_modelling(void *arg) } static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state, - openair0_timestamp timestamp, + openair0_timestamp_t timestamp, void **samplesVoid, int nsamps, int nbAnt, @@ -478,7 +478,7 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state, // Sample history for channel impulse response static c16_t saved_samples[MAX_NUM_ANTENNAS_TX][SAVED_SAMPLES_LEN] __attribute__((aligned(32))) = {0}; // Indicates what samples are saves in saved_samples - static openair0_timestamp last_timestamp = 0; + static openair0_timestamp_t last_timestamp = 0; const int batch_size = 4096; AssertFatal(nbAnt <= MAX_NUM_ANTENNAS_TX, "Number of antennas %d exceeds maximum %d\n", nbAnt, MAX_NUM_ANTENNAS_TX); @@ -533,7 +533,12 @@ static int vrtsim_write_with_chanmod(vrtsim_state_t *vrtsim_state, return nsamps; } -static int vrtsim_write(openair0_device *device, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags) +static int vrtsim_write(openair0_device_t *device, + openair0_timestamp_t timestamp, + void **samplesVoid, + int nsamps, + int nbAnt, + int flags) { AssertFatal(nsamps > 0, "Number of samples must be greater than 0\n"); AssertFatal(nbAnt > 0 && nbAnt <= MAX_NUM_ANTENNAS_TX, @@ -548,8 +553,8 @@ static int vrtsim_write(openair0_device *device, openair0_timestamp timestamp, v : vrtsim_write_internal(vrtsim_state, timestamp, (c16_t *)samplesVoid[0], nsamps, 0, flags, 0); } -static int vrtsim_write_beams(openair0_device *device, - openair0_timestamp timestamp, +static int vrtsim_write_beams(openair0_device_t *device, + openair0_timestamp_t timestamp, void ***buff, int nsamps, int nb_antennas_tx, @@ -560,7 +565,7 @@ static int vrtsim_write_beams(openair0_device *device, return nsamps; } -static int vrtsim_read(openair0_device *device, openair0_timestamp *ptimestamp, void **samplesVoid, int nsamps, int nbAnt) +static int vrtsim_read(openair0_device_t *device, openair0_timestamp_t *ptimestamp, void **samplesVoid, int nsamps, int nbAnt) { vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv; if (shm_td_iq_channel_is_aborted(vrtsim_state->channel)) { @@ -599,7 +604,7 @@ static int vrtsim_read(openair0_device *device, openair0_timestamp *ptimestamp, return nsamps; } -static void vrtsim_end(openair0_device *device) +static void vrtsim_end(openair0_device_t *device) { vrtsim_state_t *vrtsim_state = (vrtsim_state_t *)device->priv; if (vrtsim_state->role == ROLE_SERVER && vrtsim_state->run_timing_thread) { @@ -653,33 +658,34 @@ static void vrtsim_end(openair0_device *device) } } -static int vrtsim_stub(openair0_device *device) -{ - return 0; -} -static int vrtsim_stub2(openair0_device *device, openair0_config_t *openair0_cfg) +static int vrtsim_stub(openair0_device_t *device) { return 0; } -static int vrtsim_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) +static int vrtsim_stub2(openair0_device_t *device, openair0_config_t *openair0_cfg) +{ + return 0; +} + +static int vrtsim_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg) { vrtsim_state_t *s = device->priv; s->rx_freq = openair0_cfg->rx_freq[0]; return 0; } -static int vrtsim_set_beams(openair0_device *device, uint64_t beam_map, openair0_timestamp timestamp) +static int vrtsim_set_beams(openair0_device_t *device, uint64_t beam_map, openair0_timestamp_t timestamp) { return 0; } -static int vrtsim_set_beams2(openair0_device *device, int *beam_ids, int num_beams, openair0_timestamp timestamp) +static int vrtsim_set_beams2(openair0_device_t *device, int *beam_ids, int num_beams, openair0_timestamp_t timestamp) { return 0; } -__attribute__((__visibility__("default"))) int device_init(openair0_device *device, openair0_config_t *openair0_cfg) +__attribute__((__visibility__("default"))) int device_init(openair0_device_t *device, openair0_config_t *openair0_cfg) { randominit(); vrtsim_state_t *vrtsim_state = calloc_or_fail(1, sizeof(vrtsim_state_t)); From fef4e7b23e24e1ed9ddb2c9e9d3bf9703d37952a Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 20 Jun 2025 08:28:56 +0000 Subject: [PATCH 02/21] NR UE: move openair0_config_t and openair0_device_t out of PHY_VARS_NR_UE and consistently use UE->rf_map.card --- executables/nr-ue.c | 78 +++++++++++-------- executables/nr-uesoftmodem.c | 35 +++++---- .../nr_dl_channel_estimation.c | 11 ++- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 6 +- .../PHY/NR_UE_ESTIMATION/nr_ue_measurements.c | 35 +++++---- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 5 +- .../PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c | 2 +- openair1/PHY/defs_nr_UE.h | 4 - .../SCHED_NR_UE/phy_procedures_nr_ue_sl.c | 2 +- openair1/SIMULATION/NR_PHY/dlschsim.c | 1 - openair1/SIMULATION/NR_PHY/prachsim.c | 1 - openair1/SIMULATION/NR_PHY/pucchsim.c | 1 - openair1/SIMULATION/NR_PHY/ulschsim.c | 1 - 13 files changed, 100 insertions(+), 82 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 29a59fbc0d..ce406f6e0b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -201,18 +201,24 @@ typedef struct { int rx_offset; } syncData_t; -static int nr_ue_adjust_rx_gain(PHY_VARS_NR_UE *UE, openair0_config_t *cfg0, int gain_change) +extern openair0_config_t openair0_cfg[MAX_CARDS]; +extern openair0_device_t openair0_dev[MAX_CARDS]; + +static int nr_ue_adjust_rx_gain(PHY_VARS_NR_UE *UE, int gain_change) { + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + // Increase the RX gain by the value determined by adjust_rxgain cfg0->rx_gain[0] += gain_change; // Set new RX gain. - int ret_gain = UE->rfdevice.trx_set_gains_func(&UE->rfdevice, cfg0); + int ret_gain = dev0->trx_set_gains_func(dev0, cfg0); // APPLY RX gain again if crossed the MAX RX gain threshold if (ret_gain < 0) { gain_change += ret_gain; cfg0->rx_gain[0] += ret_gain; - ret_gain = UE->rfdevice.trx_set_gains_func(&UE->rfdevice, cfg0); + ret_gain = dev0->trx_set_gains_func(dev0, cfg0); } int applied_rxgain = cfg0->rx_gain[0] - cfg0->rx_gain_offset[0]; @@ -225,7 +231,8 @@ static void UE_synch(void *arg) { syncData_t *syncD = (syncData_t *)arg; PHY_VARS_NR_UE *UE = syncD->UE; UE->is_synchronized = 0; - openair0_config_t *cfg0 = &UE->openair0_cfg[UE->rf_map.card]; + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->target_Nid_cell != -1) { LOG_W(NR_PHY, "Starting re-sync detection for target Nid_cell %i\n", UE->target_Nid_cell); @@ -260,11 +267,11 @@ static void UE_synch(void *arg) { } else { // rerun with new cell parameters and frequency-offset nr_rf_card_config_freq(cfg0, ul_carrier, dl_carrier, freq_offset); - UE->rfdevice.trx_set_freq_func(&UE->rfdevice, cfg0); + dev0->trx_set_freq_func(dev0, cfg0); } if (get_nrUE_params()->agc) { - nr_ue_adjust_rx_gain(UE, cfg0, UE->adjust_rxgain); + nr_ue_adjust_rx_gain(UE, UE->adjust_rxgain); } LOG_I(PHY, @@ -279,7 +286,7 @@ static void UE_synch(void *arg) { } else { int gain_change = 0; if (get_nrUE_params()->agc) - gain_change = nr_ue_adjust_rx_gain(UE, cfg0, INCREASE_IN_RXGAIN); + gain_change = nr_ue_adjust_rx_gain(UE, INCREASE_IN_RXGAIN); if (gain_change) LOG_I(PHY, "synch retry: Rx gain increased \n"); else @@ -324,6 +331,8 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx PHY_VARS_NR_UE *UE = rxtxD->UE; const fapi_nr_config_request_t *cfg = &UE->nrUE_config; const UE_nr_rxtx_proc_t *proc = &rxtxD->proc; + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; NR_DL_FRAME_PARMS *fp = &UE->frame_parms; if (UE->sl_mode == 2) @@ -334,7 +343,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx radio_tx_burst_flag_t flags = TX_BURST_INVALID; if (UE->received_config_request) { - if (UE->openair0_cfg[0].duplex_mode == duplex_mode_FDD || get_softmodem_params()->continuous_tx) { + if (cfg0->duplex_mode == duplex_mode_FDD || get_softmodem_params()->continuous_tx) { flags = TX_BURST_MIDDLE; // In case of Sidelink, USRP write needed only in case transmission // needs to be done in this slot and not based on tdd ULDL configuration. @@ -385,7 +394,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx const int maxWriteBlockSize = get_samples_per_slot(proc->nr_slot_tx, fp); while (writeBlockSize > maxWriteBlockSize) { const int dummyBlockSize = min(writeBlockSize - maxWriteBlockSize, maxWriteBlockSize); - int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags); + int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags); AssertFatal(tmp == dummyBlockSize, ""); writeTimestamp += dummyBlockSize; @@ -408,7 +417,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx writeBlockSize); } - int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags); + int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags); AssertFatal(tmp == writeBlockSize, ""); } @@ -523,10 +532,12 @@ static int handle_sync_req_from_mac(PHY_VARS_NR_UE *UE) ul_CarrierFreq, cfg->dl_frequency, UE->target_Nid_cell); + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; fp->dl_CarrierFreq = dl_CarrierFreq; fp->ul_CarrierFreq = ul_CarrierFreq; - nr_rf_card_config_freq(&UE->openair0_cfg[UE->rf_map.card], ul_CarrierFreq, dl_CarrierFreq, 0); - UE->rfdevice.trx_set_freq_func(&UE->rfdevice, &UE->openair0_cfg[UE->rf_map.card]); + nr_rf_card_config_freq(cfg0, ul_CarrierFreq, dl_CarrierFreq, 0); + dev0->trx_set_freq_func(dev0, cfg0); init_symbol_rotation(fp); } @@ -650,6 +661,7 @@ void UE_dl_processing(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlockSize) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; @@ -660,13 +672,14 @@ void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlo for (int i = 0; i < fp->nb_antennas_tx; i++) dummy_tx[i]=dummy_tx_data[i]; - int tmp = UE->rfdevice.trx_write_func(&UE->rfdevice, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4); + int tmp = dev0->trx_write_func(dev0, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4); AssertFatal(writeBlockSize == tmp, ""); } void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, bool toTrash) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; // two frames for initial sync int num_frames = 2; // In Sidelink worst case SL-SSB can be sent once in 16 frames @@ -688,7 +701,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration ((void *)&UE->common_vars.rxdata[i][0]) + 4 * ((x * fp->samples_per_subframe) + get_samples_slot_timestamp(fp, slot)); int read_block_size = get_samples_per_slot(slot, fp); - int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, rxp, read_block_size, fp->nb_antennas_rx); + int tmp = dev0->trx_read_func(dev0, timestamp, rxp, read_block_size, fp->nb_antennas_rx); UEscopeCopy(UE, ueTimeDomainSamplesBeforeSync, rxp[0], sizeof(c16_t), 1, read_block_size, 0); AssertFatal(read_block_size == tmp, ""); @@ -709,6 +722,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; @@ -718,7 +732,7 @@ static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int int size = rx_offset; while (size > 0) { const int unitTransfer = min(get_samples_per_slot(slot, fp), size); - const int res = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx); + const int res = dev0->trx_read_func(dev0, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx); DevAssert(unitTransfer == res); if (IS_SOFTMODEM_RFSIM) { int ta = UE->timing_advance + UE->timing_advance_ntn; @@ -747,11 +761,13 @@ void *UE_thread(void *arg) { //this thread should be over the processing thread to keep in real time PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; // int tx_enabled = 0; void *rxp[NB_ANTENNAS_RX]; enum stream_status_e stream_status = STREAM_STATUS_UNSYNC; fapi_nr_config_request_t *cfg = &UE->nrUE_config; - int tmp = openair0_device_load(&(UE->rfdevice), &UE->openair0_cfg[0]); + int tmp = openair0_device_load(dev0, cfg0); AssertFatal(tmp == 0, "Could not load the device\n"); NR_DL_FRAME_PARMS *fp = &UE->frame_parms; sl_nr_phy_config_request_t *sl_cfg = NULL; @@ -760,12 +776,12 @@ void *UE_thread(void *arg) sl_cfg = &UE->SL_UE_PHY_PARAMS.sl_config; } - UE->rfdevice.host_type = RAU_HOST; + dev0->host_type = RAU_HOST; UE->is_synchronized = 0; - int tmp2 = UE->rfdevice.trx_start_func(&UE->rfdevice); + int tmp2 = dev0->trx_start_func(dev0); AssertFatal(tmp2 == 0, "Could not start the device\n"); if (usrp_tx_thread == 1) - UE->rfdevice.trx_write_init(&UE->rfdevice); + dev0->trx_write_init(dev0); InitSinLUT(); @@ -846,7 +862,7 @@ void *UE_thread(void *arg) /* For IQ recorder-player we force synchronization to happen in a fixed duration so that the replay runs in sync with recorded samples. */ - const unsigned int sync_in_frames = UE->rfdevice.openair0_cfg->recplay_conf->u_f_sync; + const unsigned int sync_in_frames = cfg0->recplay_conf->u_f_sync; while (trashed_frames != sync_in_frames) { readFrame(UE, &sync_timestamp, duration_rx_to_tx, true); trashed_frames += 2; @@ -887,16 +903,16 @@ void *UE_thread(void *arg) if (stream_status == STREAM_STATUS_UNSYNC) { stream_status = STREAM_STATUS_SYNCING; syncInFrame(UE, &sync_timestamp, duration_rx_to_tx, intialSyncOffset); - openair0_write_reorder_clear_context(&UE->rfdevice); + openair0_write_reorder_clear_context(dev0); shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync LOG_I(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame); // read in first symbol AssertFatal(fp->ofdm_symbol_size + fp->nb_prefix_samples0 - == UE->rfdevice.trx_read_func(&UE->rfdevice, - &sync_timestamp, - (void **)UE->common_vars.rxdata, - fp->ofdm_symbol_size + fp->nb_prefix_samples0, - fp->nb_antennas_rx), + == dev0->trx_read_func(dev0, + &sync_timestamp, + (void **)UE->common_vars.rxdata, + fp->ofdm_symbol_size + fp->nb_prefix_samples0, + fp->nb_antennas_rx), ""); // we have the decoded frame index in the return of the synch process // and we shifted above to the first slot of next frame @@ -997,7 +1013,7 @@ void *UE_thread(void *arg) const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply; openair0_timestamp_t rx_timestamp; - int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); + int tmp = dev0->trx_read_func(dev0, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); metadata meta = {.slot = curMsg.proc.nr_slot_rx, .frame = curMsg.proc.frame_rx}; UEscopeCopyWithMetadata(UE, ueTimeDomainSamples, rxp[0] - firstSymSamp * sizeof(c16_t), sizeof(c16_t), 1, readBlockSize, 0, &meta); AssertFatal(readBlockSize == tmp, ""); @@ -1012,11 +1028,7 @@ void *UE_thread(void *arg) if (first_symbols > 0) { openair0_timestamp_t ignore_timestamp; - int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, - &ignore_timestamp, - (void **)UE->common_vars.rxdata, - first_symbols, - fp->nb_antennas_rx); + int tmp = dev0->trx_read_func(dev0, &ignore_timestamp, (void **)UE->common_vars.rxdata, first_symbols, fp->nb_antennas_rx); AssertFatal(first_symbols == tmp, ""); } else @@ -1029,7 +1041,7 @@ void *UE_thread(void *arg) // Calculate TX deadline, approximately 1 symbol before the first sample should be written const uint64_t samples_diff = writeTimestamp - rx_timestamp - fp->ofdm_symbol_size; - const float deadline_us = samples_diff / UE->rfdevice.openair0_cfg->sample_rate * 1e6; + const float deadline_us = samples_diff / cfg0->sample_rate * 1e6; const uint64_t absolute_deadline_us = current_time.tv_sec * 1e6 + current_time.tv_nsec / 1e3 + deadline_us; // but use current UE->timing_advance value to compute writeBlockSize diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index f1cc659cae..11449fdf32 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -111,6 +111,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t sidelink_frequency[MAX_NUM_CCs][4]; // UE and OAI config variables +openair0_config_t openair0_cfg[MAX_CARDS]; +openair0_device_t openair0_dev[MAX_CARDS]; double cpuf; int create_tasks_nrue(uint32_t ue_nb) { @@ -138,19 +140,16 @@ int create_tasks_nrue(uint32_t ue_nb) { void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { - int CC_id; LOG_W(NR_PHY, "called by: %s:%d %s() Exiting OAI softmodem: %s\n", file, line, function, s ? s : "no msg"); oai_exit = 1; - if (PHY_vars_UE_g && PHY_vars_UE_g[0]) { - for(CC_id=0; CC_idrfdevice.trx_end_func) { - if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func) { - PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); - } - PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); + for (int card = 0; card < MAX_CARDS; card++) { + if (openair0_dev[card].trx_end_func) { + if (openair0_dev[card].trx_get_stats_func) { + openair0_dev[card].trx_get_stats_func(&openair0_dev[card]); } + openair0_dev[card].trx_end_func(&openair0_dev[card]); } } @@ -226,15 +225,14 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ void init_openair0(PHY_VARS_NR_UE *ue) { - int card; int freq_off = 0; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false; if (is_sidelink) frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params; - for (card=0; cardopenair0_cfg[card]; + for (int card = 0; card < MAX_CARDS; card++) { + openair0_config_t *cfg = &openair0_cfg[card]; uint64_t dl_carrier, ul_carrier; cfg->configFilename = NULL; cfg->sample_rate = frame_parms->samples_per_subframe * 1e3; @@ -324,7 +322,9 @@ int main(int argc, char **argv) } //set_softmodem_sighandler(); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); + memset(openair0_cfg, 0, sizeof(openair0_config_t) * MAX_CARDS); + memset(openair0_dev, 0, sizeof(openair0_device_t) * MAX_CARDS); + memset(tx_max_power, 0, sizeof(int) * MAX_NUM_CCs); // initialize logging logInit(); // get options and fill parameters from configuration file @@ -514,14 +514,17 @@ int main(int argc, char **argv) ret = pthread_join(phy_vars->stat_thread, NULL); AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno)); } - if (phy_vars->rfdevice.trx_get_stats_func) - phy_vars->rfdevice.trx_get_stats_func(&phy_vars->rfdevice); - if (phy_vars->rfdevice.trx_end_func) - phy_vars->rfdevice.trx_end_func(&phy_vars->rfdevice); } } } + for (int card = 0; card < MAX_CARDS; card++) { + if (openair0_dev[card].trx_get_stats_func) + openair0_dev[card].trx_get_stats_func(&openair0_dev[card]); + if (openair0_dev[card].trx_end_func) + openair0_dev[card].trx_end_func(&openair0_dev[card]); + } + free_nrLDPC_coding_interface(&nrLDPC_coding_interface); time_manager_finish(); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index dbf9559c4b..a6ff270840 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -46,6 +46,8 @@ #define CH_INTERP 0 #define NO_INTERP 1 +extern openair0_config_t openair0_cfg[MAX_CARDS]; + /* Generic function to find the peak of channel estimation buffer */ void peak_estimator(c16_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val) { @@ -461,12 +463,13 @@ int nr_prs_channel_estimation(uint8_t gNB_id, // adjusting the rx_gains for channel peak power ch_pwr_dbm = 10 * log10(ch_pwr) + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) - dB_fixed(frame_params->ofdm_symbol_size); - prs_meas[rxAnt]->rsrp_dBm = 10 * log10(prs_meas[rxAnt]->rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) - - dB_fixed(ue->frame_parms.ofdm_symbol_size); + prs_meas[rxAnt]->rsrp_dBm = + 10 * log10(prs_meas[rxAnt]->rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) + - dB_fixed(ue->frame_parms.ofdm_symbol_size); // prs measurements prs_meas[rxAnt]->gNB_id = gNB_id; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 4804f41b21..99ef655664 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -154,10 +154,10 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, uint16_t rnti, NR_UE_DLSCH_t dlsch[2]); -int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params, +int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue, + sl_nr_ue_phy_params_t *sl_phy_params, NR_DL_FRAME_PARMS *fp, c16_t rxdataF[][fp->samples_per_slot_wCP], - bool use_SSS, - openair0_config_t *openair0_cfg); + bool use_SSS); /** @}*/ #endif diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index d06f458419..dfcf47735e 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -51,6 +51,8 @@ //#define DEBUG_MEAS_UE //#define DEBUG_RANK_EST +extern openair0_config_t openair0_cfg[MAX_CARDS]; + void nr_ue_measurements(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, int number_rbs, @@ -133,9 +135,10 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, ue->measurements.n0_power_avg_dB = dB_fixed(ue->measurements.n0_power_avg); ue->measurements.wideband_cqi_tot[gNB_id] = ue->measurements.rx_power_tot_dB[gNB_id] - ue->measurements.n0_power_tot_dB; ue->measurements.wideband_cqi_avg[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->measurements.n0_power_avg_dB; - ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) - - dB_fixed(ue->frame_parms.ofdm_symbol_size); + ue->measurements.rx_rssi_dBm[gNB_id] = + ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) + - dB_fixed(ue->frame_parms.ofdm_symbol_size); LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dB (%d dBm/RE), WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", gNB_id, @@ -242,7 +245,7 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue, uint32_t rsrp_avg = nr_ue_calculate_ssb_rsrp(fp, proc, rxdataF, symbol_offset, fp->ssb_start_subcarrier); float rsrp_db_per_re = 10 * log10(rsrp_avg); - openair0_config_t *cfg0 = &ue->openair0_cfg[0]; + openair0_config_t *cfg0 = &openair0_cfg[ue->rf_map.card]; ue->measurements.ssb_rsrp_dBm[ssb_index] = rsrp_db_per_re + 30 - SQ15_SQUARED_NORM_FACTOR_DB - ((int)cfg0->rx_gain[0] - (int)cfg0->rx_gain_offset[0]) @@ -485,9 +488,10 @@ void do_neighboring_cell_measurements(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *u // RSRP measurements neighboring_cell_info->ssb_rsrp = nr_ue_calculate_ssb_rsrp(frame_parms, proc, rxdataF, 0, frame_parms->ssb_start_subcarrier); - neighboring_cell_info->ssb_rsrp_dBm = 10 * log10(neighboring_cell_info->ssb_rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) - - dB_fixed(ue->frame_parms.ofdm_symbol_size); + neighboring_cell_info->ssb_rsrp_dBm = + 10 * log10(neighboring_cell_info->ssb_rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) + - dB_fixed(ue->frame_parms.ofdm_symbol_size); // Send SS measurements to MAC send_ssb_rsrp_meas(ue, proc, neighbor_cell->Nid_cell, neighboring_cell_info->ssb_rsrp_dBm, true, -1, 0.0); @@ -519,8 +523,8 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, const uint8_t k_length = 8; uint8_t l_sss = (ue->symbol_offset + 2) % ue->frame_parms.symbols_per_slot; unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier; - double rx_gain = ue->openair0_cfg[0].rx_gain[0]; - double rx_gain_offset = ue->openair0_cfg[0].rx_gain_offset[0]; + double rx_gain = openair0_cfg[ue->rf_map.card].rx_gain[0]; + double rx_gain_offset = openair0_cfg[ue->rf_map.card].rx_gain_offset[0]; ue->measurements.n0_power_tot = 0; @@ -589,11 +593,11 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, // Measurement units: // - RSRP: W (dBW) // returns RXgain to be adjusted based on target rx power (50db) - received digital power in db/RE -int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params, +int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue, + sl_nr_ue_phy_params_t *sl_phy_params, NR_DL_FRAME_PARMS *fp, c16_t rxdataF[][fp->samples_per_slot_wCP], - bool use_SSS, - openair0_config_t *openair0_cfg) + bool use_SSS) { SL_NR_UE_PSBCH_t *psbch_rx = &sl_phy_params->psbch; uint8_t numsym = (fp->Ncp) ? SL_NR_NUM_SYMBOLS_SSB_EXT_CP : SL_NR_NUM_SYMBOLS_SSB_NORMAL_CP; @@ -626,9 +630,10 @@ int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params, } psbch_rx->rsrp_dB_per_RE = 10 * log10(rsrp / num_re); - psbch_rx->rsrp_dBm_per_RE = psbch_rx->rsrp_dB_per_RE + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - - dB_fixed(fp->ofdm_symbol_size); + psbch_rx->rsrp_dBm_per_RE = + psbch_rx->rsrp_dB_per_RE + 30 - SQ15_SQUARED_NORM_FACTOR_DB + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) + - dB_fixed(fp->ofdm_symbol_size); int adjust_rxgain = TARGET_RX_POWER - psbch_rx->rsrp_dB_per_RE; diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index b2e43b3c16..d8604d4570 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -45,6 +45,8 @@ //#define NR_CSIRS_DEBUG //#define NR_CSIIM_DEBUG +extern openair0_config_t openair0_cfg[MAX_CARDS]; + void nr_det_A_MF_2x2(int32_t *a_mf_00, int32_t *a_mf_01, int32_t *a_mf_10, @@ -237,7 +239,8 @@ static int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue, *rsrp = rsrp_sum/meas_count; *rsrp_dBm = dB_fixed(*rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB - - ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size); + - ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0]) + - dB_fixed(ue->frame_parms.ofdm_symbol_size); #ifdef NR_CSIRS_DEBUG LOG_I(NR_PHY, "RSRP = %i (%i dBm)\n", *rsrp, *rsrp_dBm); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c index 619262c746..321281fcda 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c @@ -501,7 +501,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, sync_params->DFN, sync_params->slot_offset); - UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_ue, frame_parms, rxdataF, false, UE->openair0_cfg); + UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(UE, sl_ue, frame_parms, rxdataF, false); UE->init_sync_frame = sync_params->remaining_frames; result.rx_offset = sync_params->rx_offset; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e04a49c8e4..e46c411e8b 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -344,7 +344,6 @@ typedef struct UE_NR_SCAN_INFO_s { /// Top-level PHY Data Structure for UE typedef struct PHY_VARS_NR_UE_s { - openair0_config_t openair0_cfg[MAX_CARDS]; /// \brief Module ID indicator for this instance uint8_t Mod_id; /// \brief Component carrier ID for this PHY instance @@ -507,9 +506,6 @@ typedef struct PHY_VARS_NR_UE_s { time_stats_t ue_ul_indication_stats; nr_ue_phy_cpu_stat_t phy_cpu_stats; - /// RF and Interface devices per CC - openair0_device_t rfdevice; - /// Phase precompensation flag bool no_phase_pre_comp; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c index 40f3a8256b..dbdaaa4689 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c @@ -229,7 +229,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr sym = (sym == 0) ? 5 : sym + 1; } - ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_phy_params, fp, rxdataF, false, ue->openair0_cfg); + ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(ue, sl_phy_params, fp, rxdataF, false); LOG_D(NR_PHY, " ------ Decode SL-MIB: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_slot_rx); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index d760e2394b..cd952a2ecb 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -67,7 +67,6 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; -openair0_config_t openair0_cfg[MAX_CARDS]; static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 58e6321a0b..26bf44da8c 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -77,7 +77,6 @@ PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; RU_t *ru; double cpuf; -openair0_config_t openair0_cfg[MAX_CARDS]; //uint8_t nfapi_mode=0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index db20b21b8f..88a286f274 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -54,7 +54,6 @@ THREAD_STRUCT thread_struct; PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; -openair0_config_t openair0_cfg[MAX_CARDS]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 3705df3b2c..bbe69b2cba 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -73,7 +73,6 @@ double cpuf; // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; -openair0_config_t openair0_cfg[MAX_CARDS]; void inc_ref_sched_response(int _) { From af4ceea12c7e951f756f1aad2b0a514915f59fd3 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 10:42:11 +0000 Subject: [PATCH 03/21] NR UE: remove global variable rx_gain_off, which has no function The global variable rx_gain_off was always 0.0, as it was not even modified by the NR UE command line parameter --ue-rxgain-off. That command line parameter modified only a parameter in the struct nrUE_params_t, which was not used at all and is removed in this commit, too. Also, the global variable rx_gain_off was just added to rx_total_gain_dB and subtracted from it again in nr_rf_card_config_gain(). So we simplify that function slightly, too. --- executables/nr-softmodem-common.h | 1 - executables/nr-uesoftmodem.c | 7 ++----- executables/nr-uesoftmodem.h | 2 -- openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 4 +--- openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c | 7 +++---- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 8541135bb6..a252a10ca9 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -38,7 +38,6 @@ #define CONFIG_HLP_CALPRACH "UE run normal prach with maximum power, but don't continue random-access\n" #define CONFIG_HLP_NOL2CN "bypass L2 and upper layers\n" #define CONFIG_HLP_UERXG "set UE RX gain\n" -#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n" #define CONFIG_HLP_UETXG "set UE TX gain\n" #define CONFIG_HLP_UENANTR "set UE number of rx antennas\n" #define CONFIG_HLP_UENANTT "set UE number of tx antennas\n" diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 11449fdf32..9b64bea2f1 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -104,8 +104,6 @@ int oai_exit = 0; static int tx_max_power[MAX_NUM_CCs] = {0}; -double rx_gain_off = 0.0; - uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t sidelink_frequency[MAX_NUM_CCs][4]; @@ -191,7 +189,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ NR_DL_FRAME_PARMS *fp = &UE->frame_parms; // Set UE variables - UE->rx_total_gain_dB = (int)nrUE_params.rx_gain + rx_gain_off; + UE->rx_total_gain_dB = (int)nrUE_params.rx_gain; UE->tx_total_gain_dB = (int)nrUE_params.tx_gain; UE->tx_power_max_dBm = nrUE_params.tx_max_power; UE->rf_map.card = 0; @@ -266,8 +264,7 @@ void init_openair0(PHY_VARS_NR_UE *ue) nr_get_carrier_frequencies(PHY_vars_UE_g[0][0], &dl_carrier, &ul_carrier); nr_rf_card_config_freq(cfg, ul_carrier, dl_carrier, freq_off); - - nr_rf_card_config_gain(cfg, rx_gain_off); + nr_rf_card_config_gain(cfg); cfg->configFilename = get_softmodem_params()->rf_config_file; diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index f14594b0dd..f6c30a16c4 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -56,7 +56,6 @@ extern uint16_t ue_id_g; {"reconfig-file", CONFIG_HLP_RE_CFG_FILE, 0, .strptr=&nrUE_params.reconfig_file, .defstrval="./reconfig.raw", TYPE_STRING, 0}, \ {"rbconfig-file", CONFIG_HLP_RB_CFG_FILE, 0, .strptr=&nrUE_params.rbconfig_file, .defstrval="./rbconfig.raw", TYPE_STRING, 0}, \ {"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&nrUE_params.rx_gain, .defdblval=110, TYPE_DOUBLE, 0}, \ - {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&nrUE_params.rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \ {"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&nrUE_params.tx_gain, .defdblval=0, TYPE_DOUBLE, 0}, \ {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, .iptr=&(nrUE_params.nb_antennas_rx), .defuintval=1, TYPE_UINT8, 0}, \ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, .iptr=&(nrUE_params.nb_antennas_tx), .defuintval=1, TYPE_UINT8, 0}, \ @@ -120,7 +119,6 @@ typedef struct { char *uecap_file; double tx_gain; double rx_gain; - double rx_gain_off; int vcdflag; int tx_max_power; int num_ul_actors; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index e47ff37969..c68de8e3b1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -275,10 +275,8 @@ void nr_get_carrier_frequencies_sl(PHY_VARS_NR_UE *ue, /*! \brief This function sets the OAI RF card rx/tx params @param openair0_cfg Pointer OAI config for a specific card - @param rx_gain_off Rx gain offset */ -void nr_rf_card_config_gain(openair0_config_t *openair0_cfg, - double rx_gain_off); +void nr_rf_card_config_gain(openair0_config_t *openair0_cfg); void nr_rf_card_config_freq(openair0_config_t *openair0_cfg, uint64_t ul_Carrier, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c index 436ebfe5e0..73b6e35253 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c @@ -50,9 +50,8 @@ void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64 -void nr_rf_card_config_gain(openair0_config_t *openair0_cfg, - double rx_gain_off){ - +void nr_rf_card_config_gain(openair0_config_t *openair0_cfg) +{ uint8_t mod_id = 0; uint8_t cc_id = 0; PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id]; @@ -65,7 +64,7 @@ void nr_rf_card_config_gain(openair0_config_t *openair0_cfg, if (tx_gain) openair0_cfg->tx_gain[i] = tx_gain; if (rx_gain) - openair0_cfg->rx_gain[i] = rx_gain - rx_gain_off; + openair0_cfg->rx_gain[i] = rx_gain; openair0_cfg->autocal[i] = 1; From 877b8ed0a07667e6725771eb953c89673697baf2 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 10:59:54 +0000 Subject: [PATCH 04/21] remove some unused global variables from nr-softmodem.c and nr-uesoftmodem.c --- executables/nr-softmodem.c | 4 ---- executables/nr-uesoftmodem.c | 3 --- 2 files changed, 7 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index e632180782..479aec465f 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -114,9 +114,6 @@ double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}}; double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}}; #endif -double rx_gain_off = 0.0; - -static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; int chain_offset = 0; int numerology = 0; double cpuf; @@ -527,7 +524,6 @@ int main( int argc, char **argv ) { setvbuf(stderr, NULL, _IONBF, 0); #endif mode = normal_txrx; - memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); logInit(); lock_memory_to_ram(); get_options(uniqCfg); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 9b64bea2f1..17500d23c9 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -102,8 +102,6 @@ int get_node_type() {return -1;} RAN_CONTEXT_t RC; int oai_exit = 0; -static int tx_max_power[MAX_NUM_CCs] = {0}; - uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t sidelink_frequency[MAX_NUM_CCs][4]; @@ -321,7 +319,6 @@ int main(int argc, char **argv) CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); memset(openair0_cfg, 0, sizeof(openair0_config_t) * MAX_CARDS); memset(openair0_dev, 0, sizeof(openair0_device_t) * MAX_CARDS); - memset(tx_max_power, 0, sizeof(int) * MAX_NUM_CCs); // initialize logging logInit(); // get options and fill parameters from configuration file From eed98b2bf93e5c917a0358e788baa2bb2ae94df6 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 11:33:37 +0000 Subject: [PATCH 05/21] NR UE: support nr_get_carrier_frequencies() on constant PHY_VARS_NR_UE --- openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 12 +----------- openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c | 9 +++------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index c68de8e3b1..b0df82c467 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -260,17 +260,7 @@ bool nr_search_ssb_common(nr_ssb_search_params_t *params); @param dl_Carrier Pointer to DL carrier to be set @param ul_Carrier Pointer to UL carrier to be set */ -void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, - uint64_t *dl_Carrier, - uint64_t *ul_Carrier); - -/*! - \brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter - @param ue Pointer to PHY UE - @param sl_Carrier Pointer to SL carrier to be set -*/ -void nr_get_carrier_frequencies_sl(PHY_VARS_NR_UE *ue, - uint64_t *sl_Carrier); +void nr_get_carrier_frequencies(const PHY_VARS_NR_UE *ue, uint64_t *dl_Carrier, uint64_t *ul_Carrier); /*! \brief This function sets the OAI RF card rx/tx params diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c index 73b6e35253..1649c05aef 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c @@ -34,9 +34,9 @@ extern PHY_VARS_NR_UE ***PHY_vars_UE_g; -void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64_t *ul_carrier){ - - NR_DL_FRAME_PARMS *fp = &ue->frame_parms; +void nr_get_carrier_frequencies(const PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64_t *ul_carrier) +{ + const NR_DL_FRAME_PARMS *fp = &ue->frame_parms; if (ue->if_freq!=0) { *dl_carrier = ue->if_freq; *ul_carrier = *dl_carrier + ue->if_freq_off; @@ -47,9 +47,6 @@ void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64 } } - - - void nr_rf_card_config_gain(openair0_config_t *openair0_cfg) { uint8_t mod_id = 0; From 256a54ce6c6f5962437f50950949968f00fc24d4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 11:52:51 +0000 Subject: [PATCH 06/21] NR UE: move initialization of frame_parms->N_RB_DL and frame_parms->ssb_start_subcarrier to nr_init_frame_parms_ue_sa() This harmonizes the implementations of nr_init_frame_parms_ue(), nr_init_frame_parms_ue_sa() and nr_init_frame_parms_ue_sl(). --- executables/nr-uesoftmodem.c | 7 +++---- openair1/PHY/INIT/nr_parms.c | 10 ++++++---- openair1/PHY/INIT/nr_phy_init.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 17500d23c9..6ab006e047 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -211,12 +211,9 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ fp->nb_antennas_rx = nrUE_params.nb_antennas_rx; fp->nb_antennas_tx = nrUE_params.nb_antennas_tx; fp->threequarter_fs = get_softmodem_params()->threequarter_fs; - fp->N_RB_DL = nrUE_params.N_RB_DL; - fp->ssb_start_subcarrier = nrUE_params.ssb_start_subcarrier; fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; - LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d, ssb_start_subcarrier %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs, fp->ssb_start_subcarrier); - + LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d, ofdm_offset_divisor %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs, fp->ofdm_offset_divisor); } void init_openair0(PHY_VARS_NR_UE *ue) @@ -406,6 +403,8 @@ int main(int argc, char **argv) downlink_frequency[CC_id][0], uplink_frequency_offset[CC_id][0], get_softmodem_params()->numerology, + nrUE_params.N_RB_DL, + nrUE_params.ssb_start_subcarrier, nr_band); } else { do { diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index d7ce4a64a4..f50b5ab728 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -525,13 +525,13 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, return 0; } -void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, uint16_t nr_band) { - +void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, int N_RB_DL, int ssb_start_subcarrier, uint16_t nr_band) +{ LOG_I(PHY,"SA init parameters. DL freq %lu UL offset %d SSB numerology %d N_RB_DL %d\n", downlink_frequency, delta_duplex, mu, - frame_parms->N_RB_DL); + N_RB_DL); frame_parms->numerology_index = mu; frame_parms->dl_CarrierFreq = downlink_frequency; @@ -539,6 +539,7 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink if (get_softmodem_params()->sl_mode == 0) { frame_parms->freq_range = get_freq_range_from_freq(frame_parms->dl_CarrierFreq); } + frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = frame_parms->N_RB_DL; frame_parms->nr_band = nr_band; @@ -564,8 +565,9 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink + (frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size); frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe; - LOG_W(PHY, "samples_per_subframe %d/per second %d, wCP %d\n", frame_parms->samples_per_subframe, 1000*frame_parms->samples_per_subframe, frame_parms->samples_per_subframe_wCP); + frame_parms->ssb_start_subcarrier = ssb_start_subcarrier; + LOG_W(PHY, "samples_per_subframe %d/per second %d, wCP %d\n", frame_parms->samples_per_subframe, 1000*frame_parms->samples_per_subframe, frame_parms->samples_per_subframe_wCP); } void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) diff --git a/openair1/PHY/INIT/nr_phy_init.h b/openair1/PHY/INIT/nr_phy_init.h index bfe935d93f..af44571a7b 100644 --- a/openair1/PHY/INIT/nr_phy_init.h +++ b/openair1/PHY/INIT/nr_phy_init.h @@ -28,7 +28,7 @@ int nr_get_ssb_start_symbol(const NR_DL_FRAME_PARMS *fp, uint8_t i_ssb); void nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); -void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band); +void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, int N_RB_DL, int ssb_start_subcarrier, uint16_t nr_band); int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, sl_nr_phy_config_request_t *config, int threequarter_fs, From 90ad9fac1a5e1aaf639ef055eb708ba52d2eb001 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 12:23:39 +0000 Subject: [PATCH 07/21] NR UE: introduce support to define multiple RUs --- CMakeLists.txt | 1 + ci-scripts/conf_files/nrue.uicc.ntn-leo.conf | 15 ++ executables/nr-ue-ru.c | 248 +++++++++++++++++++ executables/nr-ue-ru.h | 37 +++ executables/nr-ue.c | 8 - executables/nr-uesoftmodem.c | 111 ++------- openair1/PHY/defs_nr_UE.h | 16 ++ 7 files changed, 341 insertions(+), 95 deletions(-) create mode 100644 executables/nr-ue-ru.c create mode 100644 executables/nr-ue-ru.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 14d90a4c3b..762080e31b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1872,6 +1872,7 @@ add_executable(nr-uesoftmodem ${OPENAIR_DIR}/executables/nr-uesoftmodem.c ${OPENAIR_DIR}/executables/position_interface.c ${OPENAIR_DIR}/executables/nr-ue.c + ${OPENAIR_DIR}/executables/nr-ue-ru.c ${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR_DIR}/radio/COMMON/common_lib.c ${OPENAIR_DIR}/radio/COMMON/record_player.c diff --git a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf index d8ad297180..9f2787f2d8 100644 --- a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf +++ b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf @@ -14,6 +14,21 @@ position0 = { thread-pool = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" +RUs = ( + { + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + max_rxgain = 114; + sdr_addrs = "type=x300"; + clock_src = "internal"; + time_src = "internal"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + #/* configuration for channel modelisation */ #/* To be included in main config file when */ #/* channel modelisation is used (rfsimulator with chanmod options enabled) */ diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c new file mode 100644 index 0000000000..497bbc309b --- /dev/null +++ b/executables/nr-ue-ru.c @@ -0,0 +1,248 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr-ue-ru.h" +#include "nr-uesoftmodem.h" +#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" + +/* NR UE RU configuration section name */ +#define CONFIG_STRING_NRUE_RU_LIST "RUs" + +#define NRUE_RU_NB_TX "nb_tx" +#define NRUE_RU_NB_RX "nb_rx" +#define NRUE_RU_ATT_TX "att_tx" +#define NRUE_RU_ATT_RX "att_rx" +#define NRUE_RU_MAX_RXGAIN "max_rxgain" +#define NRUE_RU_SDR_ADDRS "sdr_addrs" +#define NRUE_RU_TX_SUBDEV "tx_subdev" +#define NRUE_RU_RX_SUBDEV "rx_subdev" +#define NRUE_RU_CLOCK_SRC "clock_src" +#define NRUE_RU_TIME_SRC "time_src" +#define NRUE_RU_TUNE_OFFSET "tune_offset" +#define NRUE_RU_IF_FREQUENCY "if_freq" +#define NRUE_RU_IF_FREQ_OFFSET "if_offset" + +#define NRUE_RU_SRC_CHECK \ + &(checkedparam_t) \ + { \ + .s3a = { config_checkstr_assign_integer, {"internal", "external", "gpsdo"}, {internal, external, gpsdo}, 3 } \ + } + +/*------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* NR UE RU configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt chkPptr */ +/*------------------------------------------------------------------------------------------------------------------------------------------------*/ +// clang-format off +#define NRUE_RU_PARAMS_DESC { \ + {NRUE_RU_NB_TX, CONFIG_HLP_UENANTT, 0, .uptr=NULL, .defuintval=1, TYPE_UINT, 0, NULL }, \ + {NRUE_RU_NB_RX, CONFIG_HLP_UENANTR, 0, .uptr=NULL, .defuintval=1, TYPE_UINT, 0, NULL }, \ + {NRUE_RU_ATT_TX, NULL, 0, .uptr=NULL, .defuintval=0, TYPE_UINT, 0, NULL }, \ + {NRUE_RU_ATT_RX, NULL, 0, .uptr=NULL, .defuintval=0, TYPE_UINT, 0, NULL }, \ + {NRUE_RU_MAX_RXGAIN, NULL, 0, .iptr=NULL, .defintval=120, TYPE_INT, 0, NULL }, \ + {NRUE_RU_SDR_ADDRS, CONFIG_HLP_USRP_ARGS, 0, .strptr=NULL, .defstrval="type=b200", TYPE_STRING, 0, NULL }, \ + {NRUE_RU_TX_SUBDEV, CONFIG_HLP_TX_SUBDEV, 0, .strptr=NULL, .defstrval="", TYPE_STRING, 0, NULL }, \ + {NRUE_RU_RX_SUBDEV, CONFIG_HLP_RX_SUBDEV, 0, .strptr=NULL, .defstrval="", TYPE_STRING, 0, NULL }, \ + {NRUE_RU_CLOCK_SRC, NULL, 0, .strptr=NULL, .defstrval="internal", TYPE_STRING, 0, NRUE_RU_SRC_CHECK }, \ + {NRUE_RU_TIME_SRC, NULL, 0, .strptr=NULL, .defstrval="internal", TYPE_STRING, 0, NRUE_RU_SRC_CHECK }, \ + {NRUE_RU_TUNE_OFFSET, CONFIG_HLP_TUNE_OFFSET, 0, .dblptr=NULL, .defdblval=0.0, TYPE_DOUBLE, 0, NULL }, \ + {NRUE_RU_IF_FREQUENCY, CONFIG_HLP_IF_FREQ, 0, .u64ptr=NULL, .defint64val=0, TYPE_UINT64, 0, NULL }, \ + {NRUE_RU_IF_FREQ_OFFSET, CONFIG_HLP_IF_FREQ_OFF, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0, NULL }, \ +} +// clang-format on + +static int nrue_ru_count; +static nrUE_RU_params_t *nrue_rus; + +openair0_config_t openair0_cfg[MAX_CARDS]; +openair0_device_t openair0_dev[MAX_CARDS]; + +int nrue_get_ru_count(void) +{ + return nrue_ru_count; +} + +const nrUE_RU_params_t *nrue_get_ru(int ru_id) +{ + AssertFatal(ru_id >= 0 && ru_id < nrue_ru_count, "Invalid RU ID %d! RU count = %d\n", ru_id, nrue_ru_count); + return &nrue_rus[ru_id]; +} + +void nrue_set_ru_params(configmodule_interface_t *cfg) +{ + paramdef_t RUParams[] = NRUE_RU_PARAMS_DESC; + paramlist_def_t RUParamList = {CONFIG_STRING_NRUE_RU_LIST, NULL, 0}; + config_getlist(cfg, &RUParamList, RUParams, sizeofArray(RUParams), NULL); + + if (RUParamList.numelt <= 0) { + nrue_ru_count = 1; + nrue_rus = calloc_or_fail(nrue_ru_count, sizeof(nrUE_RU_params_t)); + nrue_rus[0] = (nrUE_RU_params_t){.nb_tx = get_nrUE_params()->nb_antennas_tx, + .nb_rx = get_nrUE_params()->nb_antennas_rx, + .att_tx = get_nrUE_params()->tx_gain, + .att_rx = 0, + .max_rxgain = get_nrUE_params()->rx_gain, + .sdr_addrs = get_nrUE_params()->usrp_args, + .tx_subdev = get_nrUE_params()->tx_subdev, + .rx_subdev = get_nrUE_params()->rx_subdev, + .clock_source = get_softmodem_params()->clock_source, + .time_source = get_softmodem_params()->timing_source, + .tune_offset = get_softmodem_params()->tune_offset, + .if_frequency = get_nrUE_params()->if_freq, + .if_freq_offset = get_nrUE_params()->if_freq_off}; + return; + } + + nrue_ru_count = RUParamList.numelt; + nrue_rus = calloc_or_fail(nrue_ru_count, sizeof(nrUE_RU_params_t)); + + LOG_W(NR_PHY, "Ignoring command line RU parameters, using the following instead:\n"); + + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + nrue_rus[ru_id].nb_tx = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_NB_TX)->uptr); + nrue_rus[ru_id].nb_rx = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_NB_RX)->uptr); + nrue_rus[ru_id].att_tx = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_ATT_TX)->uptr); + nrue_rus[ru_id].att_rx = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_ATT_RX)->uptr); + nrue_rus[ru_id].max_rxgain = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_MAX_RXGAIN)->iptr); + nrue_rus[ru_id].tune_offset = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_TUNE_OFFSET)->dblptr); + nrue_rus[ru_id].if_frequency = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_IF_FREQUENCY)->u64ptr); + nrue_rus[ru_id].if_freq_offset = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_IF_FREQ_OFFSET)->iptr); + + nrue_rus[ru_id].sdr_addrs = strdup(*(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_SDR_ADDRS)->strptr)); + nrue_rus[ru_id].tx_subdev = strdup(*(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_TX_SUBDEV)->strptr)); + nrue_rus[ru_id].rx_subdev = strdup(*(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_RX_SUBDEV)->strptr)); + + int clock_src_idx = config_paramidx_fromname(RUParams, sizeofArray(RUParams), NRUE_RU_CLOCK_SRC); + AssertFatal(clock_src_idx >= 0, "Index for clock_src config option not found!\n"); + nrue_rus[ru_id].clock_source = config_get_processedint(cfg, &RUParamList.paramarray[ru_id][clock_src_idx]); + + int time_src_idx = config_paramidx_fromname(RUParams, sizeofArray(RUParams), NRUE_RU_TIME_SRC); + AssertFatal(time_src_idx >= 0, "Index for time_src config option not found!\n"); + nrue_rus[ru_id].time_source = config_get_processedint(cfg, &RUParamList.paramarray[ru_id][time_src_idx]); + + LOG_I(NR_PHY, + "RU %d: nb_tx %d, nb_rx %d, att_tx %d, att_rx %d, max_rxgain %d, tune_offset %f, if_frequency %lu, if_freq_offset %d, " + "sdr_addrs \"%s\", tx_subdev \"%s\", rx_subdev \"%s\", clock_source %d, time_source %d\n", + ru_id, + nrue_rus[ru_id].nb_tx, + nrue_rus[ru_id].nb_rx, + nrue_rus[ru_id].att_tx, + nrue_rus[ru_id].att_rx, + nrue_rus[ru_id].max_rxgain, + nrue_rus[ru_id].tune_offset, + nrue_rus[ru_id].if_frequency, + nrue_rus[ru_id].if_freq_offset, + nrue_rus[ru_id].sdr_addrs, + nrue_rus[ru_id].tx_subdev, + nrue_rus[ru_id].rx_subdev, + nrue_rus[ru_id].clock_source, + nrue_rus[ru_id].time_source); + } +} + +void nrue_init_openair0(const PHY_VARS_NR_UE *ue) +{ + int freq_off = 0; + bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false; + + memset(openair0_cfg, 0, sizeof(openair0_config_t) * MAX_CARDS); + memset(openair0_dev, 0, sizeof(openair0_device_t) * MAX_CARDS); + + AssertFatal(MAX_CARDS >= nrue_ru_count, + "Too many RUs allocated (%d)! Maybe increase MAX_CARDS (%d).\n", + nrue_ru_count, + MAX_CARDS); + + const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + if (is_sidelink) + frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params; + + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + openair0_config_t *cfg = &openair0_cfg[ru_id]; + cfg->configFilename = NULL; + cfg->sample_rate = frame_parms->samples_per_subframe * 1e3; + cfg->samples_per_frame = frame_parms->samples_per_frame; + + if (frame_parms->frame_type == TDD) + cfg->duplex_mode = duplex_mode_TDD; + else + cfg->duplex_mode = duplex_mode_FDD; + + cfg->Mod_id = 0; + cfg->num_rb_dl = frame_parms->N_RB_DL; + cfg->tx_num_channels = min(4, frame_parms->nb_antennas_tx); + cfg->rx_num_channels = min(4, frame_parms->nb_antennas_rx); + + LOG_I(PHY, + "HW: Configuring ru_id %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", + ru_id, + cfg->sample_rate, + cfg->tx_num_channels, + cfg->rx_num_channels, + duplex_mode_txt[cfg->duplex_mode]); + + uint64_t dl_carrier, ul_carrier; + if (is_sidelink || nrue_rus[ru_id].if_frequency == 0) { + dl_carrier = frame_parms->dl_CarrierFreq; + ul_carrier = frame_parms->ul_CarrierFreq; + } else { + dl_carrier = nrue_rus[ru_id].if_frequency; + ul_carrier = nrue_rus[ru_id].if_frequency + nrue_rus[ru_id].if_freq_offset; + } + + nr_rf_card_config_freq(cfg, ul_carrier, dl_carrier, freq_off); + nr_rf_card_config_gain(cfg); + + cfg->configFilename = get_softmodem_params()->rf_config_file; + + cfg->sdr_addrs = nrue_rus[ru_id].sdr_addrs; + cfg->tx_subdev = nrue_rus[ru_id].tx_subdev; + cfg->rx_subdev = nrue_rus[ru_id].rx_subdev; + cfg->clock_source = nrue_rus[ru_id].clock_source; + cfg->time_source = nrue_rus[ru_id].time_source; + cfg->tune_offset = nrue_rus[ru_id].tune_offset; + } +} + +void nrue_ru_start(void) +{ + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + openair0_config_t *cfg0 = &openair0_cfg[ru_id]; + openair0_device_t *dev0 = &openair0_dev[ru_id]; + + dev0->host_type = RAU_HOST; + int tmp = openair0_device_load(dev0, cfg0); + AssertFatal(tmp == 0, "Could not load the device %d\n", ru_id); + int tmp2 = dev0->trx_start_func(dev0); + AssertFatal(tmp2 == 0, "Could not start the device %d\n", ru_id); + if (usrp_tx_thread == 1) + dev0->trx_write_init(dev0); + } +} + +void nrue_ru_end(void) +{ + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + if (openair0_dev[ru_id].trx_get_stats_func) + openair0_dev[ru_id].trx_get_stats_func(&openair0_dev[ru_id]); + if (openair0_dev[ru_id].trx_end_func) + openair0_dev[ru_id].trx_end_func(&openair0_dev[ru_id]); + } +} diff --git a/executables/nr-ue-ru.h b/executables/nr-ue-ru.h new file mode 100644 index 0000000000..4f5aee107a --- /dev/null +++ b/executables/nr-ue-ru.h @@ -0,0 +1,37 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NR_UE_RU_H +#define NR_UE_RU_H + +#include "PHY/defs_nr_UE.h" +#include "radio/COMMON/common_lib.h" + +int nrue_get_ru_count(void); +const nrUE_RU_params_t *nrue_get_ru(int ru_id); +void nrue_set_ru_params(configmodule_interface_t *cfg); + +void nrue_init_openair0(const PHY_VARS_NR_UE *ue); + +void nrue_ru_start(void); +void nrue_ru_end(void); + +#endif diff --git a/executables/nr-ue.c b/executables/nr-ue.c index ce406f6e0b..0cae01f266 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -767,8 +767,6 @@ void *UE_thread(void *arg) void *rxp[NB_ANTENNAS_RX]; enum stream_status_e stream_status = STREAM_STATUS_UNSYNC; fapi_nr_config_request_t *cfg = &UE->nrUE_config; - int tmp = openair0_device_load(dev0, cfg0); - AssertFatal(tmp == 0, "Could not load the device\n"); NR_DL_FRAME_PARMS *fp = &UE->frame_parms; sl_nr_phy_config_request_t *sl_cfg = NULL; if (UE->sl_mode == 2) { @@ -776,13 +774,7 @@ void *UE_thread(void *arg) sl_cfg = &UE->SL_UE_PHY_PARAMS.sl_config; } - dev0->host_type = RAU_HOST; UE->is_synchronized = 0; - int tmp2 = dev0->trx_start_func(dev0); - AssertFatal(tmp2 == 0, "Could not start the device\n"); - if (usrp_tx_thread == 1) - dev0->trx_write_init(dev0); - InitSinLUT(); notifiedFIFO_t nf; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 6ab006e047..e05d676396 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -81,6 +81,7 @@ unsigned short config_frames[4] = {2,9,11,13}; // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) #include "PHY/TOOLS/phy_scope_interface.h" #include "PHY/TOOLS/nr_phy_scope.h" +#include "executables/nr-ue-ru.h" #include #include "executables/softmodem-common.h" #include "executables/thread-common.h" @@ -107,8 +108,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t sidelink_frequency[MAX_NUM_CCs][4]; // UE and OAI config variables -openair0_config_t openair0_cfg[MAX_CARDS]; -openair0_device_t openair0_dev[MAX_CARDS]; double cpuf; int create_tasks_nrue(uint32_t ue_nb) { @@ -140,14 +139,7 @@ void exit_function(const char *file, const char *function, const int line, const oai_exit = 1; - for (int card = 0; card < MAX_CARDS; card++) { - if (openair0_dev[card].trx_end_func) { - if (openair0_dev[card].trx_get_stats_func) { - openair0_dev[card].trx_get_stats_func(&openair0_dev[card]); - } - openair0_dev[card].trx_end_func(&openair0_dev[card]); - } - } + nrue_ru_end(); if (assert) { abort(); @@ -183,20 +175,23 @@ static void get_options(configmodule_interface_t *cfg) } // set PHY vars from command line -void set_options(int CC_id, PHY_VARS_NR_UE *UE){ +static void set_options(int CC_id, PHY_VARS_NR_UE *UE, int ru_id) +{ NR_DL_FRAME_PARMS *fp = &UE->frame_parms; + const nrUE_RU_params_t *RU = nrue_get_ru(ru_id); // Set UE variables - UE->rx_total_gain_dB = (int)nrUE_params.rx_gain; - UE->tx_total_gain_dB = (int)nrUE_params.tx_gain; + UE->rx_total_gain_dB = RU->max_rxgain - RU->att_rx; + UE->tx_total_gain_dB = RU->att_tx; + UE->if_freq = RU->if_frequency; + UE->if_freq_off = RU->if_freq_offset; + UE->rf_map.card = ru_id; + UE->rf_map.chain = CC_id; + UE->tx_power_max_dBm = nrUE_params.tx_max_power; - UE->rf_map.card = 0; - UE->rf_map.chain = CC_id + 0; UE->max_ldpc_iterations = nrUE_params.max_ldpc_iterations; UE->UE_scan_carrier = nrUE_params.UE_scan_carrier; UE->UE_fo_compensation = nrUE_params.UE_fo_compensation; - UE->if_freq = nrUE_params.if_freq; - UE->if_freq_off = nrUE_params.if_freq_off; UE->chest_freq = nrUE_params.chest_freq; UE->chest_time = nrUE_params.chest_time; UE->no_timing_correction = nrUE_params.no_timing_correction; @@ -207,71 +202,15 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->chest_freq, UE->chest_time); // Set FP variables + fp->nb_antennas_rx = RU->nb_rx; + fp->nb_antennas_tx = RU->nb_tx; - fp->nb_antennas_rx = nrUE_params.nb_antennas_rx; - fp->nb_antennas_tx = nrUE_params.nb_antennas_tx; - fp->threequarter_fs = get_softmodem_params()->threequarter_fs; - fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; + fp->threequarter_fs = get_softmodem_params()->threequarter_fs; + fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d, ofdm_offset_divisor %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs, fp->ofdm_offset_divisor); } -void init_openair0(PHY_VARS_NR_UE *ue) -{ - int freq_off = 0; - NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false; - if (is_sidelink) - frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params; - - for (int card = 0; card < MAX_CARDS; card++) { - openair0_config_t *cfg = &openair0_cfg[card]; - uint64_t dl_carrier, ul_carrier; - cfg->configFilename = NULL; - cfg->sample_rate = frame_parms->samples_per_subframe * 1e3; - cfg->samples_per_frame = frame_parms->samples_per_frame; - - if (frame_parms->frame_type==TDD) - cfg->duplex_mode = duplex_mode_TDD; - else - cfg->duplex_mode = duplex_mode_FDD; - - cfg->Mod_id = 0; - cfg->num_rb_dl = frame_parms->N_RB_DL; - cfg->clock_source = get_softmodem_params()->clock_source; - cfg->time_source = get_softmodem_params()->timing_source; - cfg->tune_offset = get_softmodem_params()->tune_offset; - cfg->tx_num_channels = min(4, frame_parms->nb_antennas_tx); - cfg->rx_num_channels = min(4, frame_parms->nb_antennas_rx); - - LOG_I(PHY, - "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", - card, - cfg->sample_rate, - cfg->tx_num_channels, - cfg->rx_num_channels, - duplex_mode_txt[cfg->duplex_mode]); - - if (is_sidelink) { - dl_carrier = frame_parms->dl_CarrierFreq; - ul_carrier = frame_parms->ul_CarrierFreq; - } else - nr_get_carrier_frequencies(PHY_vars_UE_g[0][0], &dl_carrier, &ul_carrier); - - nr_rf_card_config_freq(cfg, ul_carrier, dl_carrier, freq_off); - nr_rf_card_config_gain(cfg); - - cfg->configFilename = get_softmodem_params()->rf_config_file; - - if (get_nrUE_params()->usrp_args) - cfg->sdr_addrs = get_nrUE_params()->usrp_args; - if (get_nrUE_params()->tx_subdev) - cfg->tx_subdev = get_nrUE_params()->tx_subdev; - if (get_nrUE_params()->rx_subdev) - cfg->rx_subdev = get_nrUE_params()->rx_subdev; - } -} - // Stupid function addition because UE itti messages queues definition is common with eNB void *rrc_enb_process_msg(void *notUsed) { return NULL; @@ -314,8 +253,6 @@ int main(int argc, char **argv) } //set_softmodem_sighandler(); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - memset(openair0_cfg, 0, sizeof(openair0_config_t) * MAX_CARDS); - memset(openair0_dev, 0, sizeof(openair0_device_t) * MAX_CARDS); // initialize logging logInit(); // get options and fill parameters from configuration file @@ -387,11 +324,14 @@ int main(int argc, char **argv) IS_SOFTMODEM_RFSIM ? TIME_SOURCE_IQ_SAMPLES : TIME_SOURCE_REALTIME); + nrue_set_ru_params(uniqCfg); + + int ru_id = 0; // initialize all UEs to RU 0 for now for (int inst = 0; inst < NB_UE_INST; inst++) { PHY_VARS_NR_UE *UE[MAX_NUM_CCs]; for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { UE[CC_id] = PHY_vars_UE_g[inst][CC_id]; - set_options(CC_id, UE[CC_id]); + set_options(CC_id, UE[CC_id], ru_id); NR_UE_MAC_INST_t *mac = get_mac_inst(inst); init_nr_ue_phy_cpu_stats(&UE[CC_id]->phy_cpu_stats); // set frame config to initial values from command line and assume that the SSB is centered on the grid @@ -449,7 +389,7 @@ int main(int argc, char **argv) get_nrUE_params()->ofdm_offset_divisor); sl_ue_phy_init(UE[CC_id]); } - init_openair0(UE[CC_id]); + nrue_init_openair0(UE[CC_id]); } } @@ -467,6 +407,8 @@ int main(int argc, char **argv) load_module_shlib("imscope_record", NULL, 0, PHY_vars_UE_g[0][0]); } + nrue_ru_start(); + for (int inst = 0; inst < NB_UE_INST; inst++) { LOG_I(PHY,"Intializing UE Threads for instance %d ...\n", inst); init_NR_UE_threads(PHY_vars_UE_g[inst][0]); @@ -511,12 +453,7 @@ int main(int argc, char **argv) } } - for (int card = 0; card < MAX_CARDS; card++) { - if (openair0_dev[card].trx_get_stats_func) - openair0_dev[card].trx_get_stats_func(&openair0_dev[card]); - if (openair0_dev[card].trx_end_func) - openair0_dev[card].trx_end_func(&openair0_dev[card]); - } + nrue_ru_end(); free_nrLDPC_coding_interface(&nrLDPC_coding_interface); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e46c411e8b..2eba24f6d1 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -342,6 +342,22 @@ typedef struct UE_NR_SCAN_INFO_s { int32_t freq_offset_Hz[3][10]; } UE_NR_SCAN_INFO_t; +typedef struct { + unsigned int nb_tx; + unsigned int nb_rx; + unsigned int att_tx; + unsigned int att_rx; + int max_rxgain; + char *sdr_addrs; + char *tx_subdev; + char *rx_subdev; + clock_source_t clock_source; + clock_source_t time_source; + double tune_offset; + uint64_t if_frequency; + int if_freq_offset; +} nrUE_RU_params_t; + /// Top-level PHY Data Structure for UE typedef struct PHY_VARS_NR_UE_s { /// \brief Module ID indicator for this instance From 168f3294918d847ff445d7bc4b99db416de9cfdf Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 14 Jul 2025 15:45:16 +0000 Subject: [PATCH 08/21] NR UE: remove unused array of PHY_VARS_NR_UE pointers --- executables/nr-uesoftmodem.c | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index e05d676396..b6a4e4e14e 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -328,18 +328,17 @@ int main(int argc, char **argv) int ru_id = 0; // initialize all UEs to RU 0 for now for (int inst = 0; inst < NB_UE_INST; inst++) { - PHY_VARS_NR_UE *UE[MAX_NUM_CCs]; for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - UE[CC_id] = PHY_vars_UE_g[inst][CC_id]; - set_options(CC_id, UE[CC_id], ru_id); + PHY_VARS_NR_UE *UE_CC = PHY_vars_UE_g[inst][CC_id]; + set_options(CC_id, UE_CC, ru_id); NR_UE_MAC_INST_t *mac = get_mac_inst(inst); - init_nr_ue_phy_cpu_stats(&UE[CC_id]->phy_cpu_stats); + init_nr_ue_phy_cpu_stats(&UE_CC->phy_cpu_stats); // set frame config to initial values from command line and assume that the SSB is centered on the grid if (IS_SA_MODE(get_softmodem_params()) || get_softmodem_params()->sl_mode) { uint16_t nr_band = get_softmodem_params()->band; mac->nr_band = nr_band; - mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier; - nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms, + mac->ssb_start_subcarrier = UE_CC->frame_parms.ssb_start_subcarrier; + nr_init_frame_parms_ue_sa(&UE_CC->frame_parms, downlink_frequency[CC_id][0], uplink_frequency_offset[CC_id][0], get_softmodem_params()->numerology, @@ -355,41 +354,41 @@ int main(int argc, char **argv) process_msg_rcc_to_mac(NotifiedFifoData(elt), inst); delNotifiedFIFO_elt(elt); } while (true); - fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; - nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, mac->nr_band); + fapi_nr_config_request_t *nrUE_config = &UE_CC->nrUE_config; + nr_init_frame_parms_ue(&UE_CC->frame_parms, nrUE_config, mac->nr_band); } - UE[CC_id]->sl_mode = get_softmodem_params()->sl_mode; - init_actor(&UE[CC_id]->sync_actor, "SYNC_", -1); + UE_CC->sl_mode = get_softmodem_params()->sl_mode; + init_actor(&UE_CC->sync_actor, "SYNC_", -1); if (get_nrUE_params()->num_dl_actors > 0) { - UE[CC_id]->dl_actors = calloc_or_fail(get_nrUE_params()->num_dl_actors, sizeof(*UE[CC_id]->dl_actors)); + UE_CC->dl_actors = calloc_or_fail(get_nrUE_params()->num_dl_actors, sizeof(*UE_CC->dl_actors)); for (int i = 0; i < get_nrUE_params()->num_dl_actors; i++) { - init_actor(&UE[CC_id]->dl_actors[i], "DL_", -1); + init_actor(&UE_CC->dl_actors[i], "DL_", -1); } } if (get_nrUE_params()->num_ul_actors > 0) { - UE[CC_id]->ul_actors = calloc_or_fail(get_nrUE_params()->num_ul_actors, sizeof(*UE[CC_id]->ul_actors)); + UE_CC->ul_actors = calloc_or_fail(get_nrUE_params()->num_ul_actors, sizeof(*UE_CC->ul_actors)); for (int i = 0; i < get_nrUE_params()->num_ul_actors; i++) { - init_actor(&UE[CC_id]->ul_actors[i], "UL_", -1); + init_actor(&UE_CC->ul_actors[i], "UL_", -1); } } - init_nr_ue_vars(UE[CC_id], inst); + init_nr_ue_vars(UE_CC, inst); - if (UE[CC_id]->sl_mode) { - AssertFatal(UE[CC_id]->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n"); + if (UE_CC->sl_mode) { + AssertFatal(UE_CC->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n"); DevAssert(mac->if_module != NULL && mac->if_module->sl_phy_config_request != NULL); nr_sl_phy_config_t *phycfg = &mac->SL_MAC_PARAMS->sl_phy_config; phycfg->sl_config_req.sl_carrier_config.sl_num_rx_ant = get_nrUE_params()->nb_antennas_rx; phycfg->sl_config_req.sl_carrier_config.sl_num_tx_ant = get_nrUE_params()->nb_antennas_tx; mac->if_module->sl_phy_config_request(phycfg); - sl_nr_ue_phy_params_t *sl_phy = &UE[CC_id]->SL_UE_PHY_PARAMS; + sl_nr_ue_phy_params_t *sl_phy = &UE_CC->SL_UE_PHY_PARAMS; nr_init_frame_parms_ue_sl(&sl_phy->sl_frame_params, &sl_phy->sl_config, get_softmodem_params()->threequarter_fs, get_nrUE_params()->ofdm_offset_divisor); - sl_ue_phy_init(UE[CC_id]); + sl_ue_phy_init(UE_CC); } - nrue_init_openair0(UE[CC_id]); + nrue_init_openair0(UE_CC); } } From b495576c831e648f93184b3a277687dce8a6b73b Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 15 Jul 2025 12:43:16 +0000 Subject: [PATCH 09/21] make sure defint64val is set for TYPE_UINT64 configuration parameters --- executables/nr-softmodem.h | 4 ++-- executables/nr-uesoftmodem.h | 4 ++-- executables/softmodem-common.h | 2 +- openair2/ENB_APP/enb_paramdef.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index ecbf5d8759..08bee0d2d8 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -23,8 +23,8 @@ {"t" , CONFIG_HLP_ULMCS_PHYTEST, 0, .uptr=&target_ul_mcs, .defintval=0, TYPE_UINT, 0}, \ {"M" , CONFIG_HLP_DLBW_PHYTEST, 0, .uptr=&target_dl_bw, .defintval=0, TYPE_UINT, 0}, \ {"T" , CONFIG_HLP_ULBW_PHYTEST, 0, .uptr=&target_ul_bw, .defintval=0, TYPE_UINT, 0}, \ - {"D" , CONFIG_HLP_DLBM_PHYTEST, 0, .u64ptr=&dlsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \ - {"U" , CONFIG_HLP_ULBM_PHYTEST, 0, .u64ptr=&ulsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \ + {"D" , CONFIG_HLP_DLBM_PHYTEST, 0, .u64ptr=&dlsch_slot_bitmap, .defint64val=0, TYPE_UINT64, 0}, \ + {"U" , CONFIG_HLP_ULBM_PHYTEST, 0, .u64ptr=&ulsch_slot_bitmap, .defint64val=0, TYPE_UINT64, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, .iptr=&usrp_tx_thread, .defstrval=0, TYPE_INT, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \ } diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index f6c30a16c4..106a870aad 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -64,12 +64,12 @@ extern uint16_t ue_id_g; {"ue-max-power", NULL, 0, .iptr=&(nrUE_params.tx_max_power), .defintval=90, TYPE_INT, 0}, \ {"r" , CONFIG_HLP_PRB_SA, 0, .iptr=&(nrUE_params.N_RB_DL), .defintval=106, TYPE_UINT, 0}, \ {"ssb", CONFIG_HLP_SSC, 0, .iptr=&(nrUE_params.ssb_start_subcarrier), .defintval=516, TYPE_UINT16, 0}, \ - {"if_freq" , CONFIG_HLP_IF_FREQ, 0, .u64ptr=&(nrUE_params.if_freq), .defuintval=0, TYPE_UINT64, 0}, \ + {"if_freq" , CONFIG_HLP_IF_FREQ, 0, .u64ptr=&(nrUE_params.if_freq), .defint64val=0, TYPE_UINT64, 0}, \ {"if_freq_off" , CONFIG_HLP_IF_FREQ_OFF, 0, .iptr=&(nrUE_params.if_freq_off), .defuintval=0, TYPE_INT, 0}, \ {"chest-freq", CONFIG_HLP_CHESTFREQ, 0, .iptr=&(nrUE_params.chest_freq), .defintval=0, TYPE_INT, 0}, \ {"chest-time", CONFIG_HLP_CHESTTIME, 0, .iptr=&(nrUE_params.chest_time), .defintval=0, TYPE_INT, 0}, \ {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, .iptr=&(nrUE_params.no_timing_correction), .defintval=0, TYPE_INT, 0}, \ - {"SLC", CONFIG_HLP_SLF, 0, .u64ptr=&(sidelink_frequency[0][0]), .defuintval=2600000000,TYPE_UINT64,0}, \ + {"SLC", CONFIG_HLP_SLF, 0, .u64ptr=&(sidelink_frequency[0][0]), .defint64val=2600000000,TYPE_UINT64,0}, \ {"num-ues", NULL, 0, .iptr=&(NB_UE_INST), .defuintval=1, TYPE_INT, 0}, \ {"time-sync-P", CONFIG_HLP_TIME_SYNC_P, 0, .dblptr=&(nrUE_params.time_sync_P), .defdblval=0.5, TYPE_DOUBLE, 0}, \ {"time-sync-I", CONFIG_HLP_TIME_SYNC_I, 0, .dblptr=&(nrUE_params.time_sync_I), .defdblval=0.0, TYPE_DOUBLE, 0}, \ diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 4dfa5eb680..fcffabcb86 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -153,7 +153,7 @@ extern int usrp_tx_thread; {"clock-source", CONFIG_HLP_CLK, 0, .uptr=&CLOCK_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, .uptr=&TIMING_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"tune-offset", CONFIG_HLP_TUNE_OFFSET, 0, .dblptr=&TUNE_OFFSET, .defintval=0, TYPE_DOUBLE, 0}, \ - {"C" , CONFIG_HLP_DLF, 0, .u64ptr=&(downlink_frequency[0][0]), .defuintval=0, TYPE_UINT64, 0}, \ + {"C" , CONFIG_HLP_DLF, 0, .u64ptr=&(downlink_frequency[0][0]), .defint64val=0, TYPE_UINT64, 0}, \ {"CO" , CONFIG_HLP_ULF, 0, .iptr=&(uplink_frequency_offset[0][0]), .defintval=0, TYPE_INT, 0}, \ {"a" , CONFIG_HLP_CHOFF, 0, .iptr=&CHAIN_OFFSET, .defintval=0, TYPE_INT, 0}, \ {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, .uptr=&do_forms, .defintval=0, TYPE_UINT, 0}, \ diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 7be234262f..f7afa1ce8b 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -202,7 +202,7 @@ typedef enum { {CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, .uptr=NULL, .defuintval=400, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, .strptr=NULL, .defstrval="no", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, .iptr=NULL, .defintarrayval=DEFBFW, TYPE_INTARRAY, 0}, \ - {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, .u64ptr=NULL, .defuintval=0, TYPE_UINT64, 0}, \ + {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, .u64ptr=NULL, .defint64val=0, TYPE_UINT64, 0}, \ {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_SF_AHEAD, HLP_RU_SF_AHEAD, 0, .iptr=NULL, .defintval=4, TYPE_INT, 0}, \ From dfb217ad0ecd331b48e104d97dc8ab5191dcb54f Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 18 Jul 2025 10:56:09 +0000 Subject: [PATCH 10/21] NR UE: don't use get_softmodem_params()->numerology in MAC, store mac->numerology instead --- executables/nr-ue.c | 4 ++-- executables/nr-uesoftmodem.c | 2 +- executables/nr-uesoftmodem.h | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 13 +++++++++---- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 7 ++++--- openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c | 2 +- 10 files changed, 22 insertions(+), 15 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0cae01f266..16fb246185 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -1111,11 +1111,11 @@ void *UE_thread(void *arg) return NULL; } -void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconfig_file) +void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconfig_file, int numerology) { for (int instance_id = 0; instance_id < nb_inst; instance_id++) { NR_UE_RRC_INST_t* rrc = nr_rrc_init_ue(uecap_file, instance_id, get_nrUE_params()->nb_antennas_tx); - NR_UE_MAC_INST_t *mac = nr_l2_init_ue(instance_id); + NR_UE_MAC_INST_t *mac = nr_l2_init_ue(instance_id, numerology); nr_rrc_set_mac_queue(instance_id, &mac->input_nf); mac->if_module = nr_ue_if_module_init(instance_id); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index b6a4e4e14e..3e5df6f9ca 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -307,7 +307,7 @@ int main(int argc, char **argv) nr_pdcp_layer_init(); nas_init_nrue(NB_UE_INST); - init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file); + init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file, get_softmodem_params()->numerology); // start time manager with some reasonable default for the running mode // (may be overwritten in configuration file or command line) diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 106a870aad..b78142cdd6 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -133,7 +133,7 @@ extern nrUE_params_t *get_nrUE_params(void); // In nr-ue.c extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg); extern void fill_ue_band_info(void); -extern void init_NR_UE(int, char *, char *, char *); +extern void init_NR_UE(int, char *, char *, char *, int); extern void init_NR_UE_threads(PHY_VARS_NR_UE *ue); void *UE_thread(void *arg); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 454a23770e..3047bc0ae7 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -932,7 +932,7 @@ int main(int argc, char **argv) init_nr_ue_transport(UE); - UE_mac = nr_l2_init_ue(0); + UE_mac = nr_l2_init_ue(0, mu); ue_init_config_request(UE_mac, get_slots_per_frame_from_scs(mu)); UE->if_inst = nr_ue_if_module_init(0); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index d7bd25555f..11a9eeff43 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -893,7 +893,7 @@ int main(int argc, char *argv[]) init_nr_ue_transport(UE); //Configure UE - NR_UE_MAC_INST_t* UE_mac = nr_l2_init_ue(0); + NR_UE_MAC_INST_t* UE_mac = nr_l2_init_ue(0, mu); ue_init_config_request(UE_mac, get_slots_per_frame_from_scs(mu)); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index e5a1fb4e1a..aada96566a 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -137,6 +137,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo AssertFatal(frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR, "Field mandatory present for DL in SIB1\n"); mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR; + AssertFatal(mac->numerology == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "DL and SSB subcarrierSpacing must be the same!\n"); int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, mac->frequency_range, frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); @@ -172,6 +173,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL; mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN; + AssertFatal(mac->numerology == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "UL and SSB subcarrierSpacing must be the same!\n"); bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, mac->frequency_range, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); @@ -204,7 +206,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo } } - frame_type_t frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology); + frame_type_t frame_type = get_frame_type(mac->nr_band, mac->numerology); // cell config cfg->cell_config.phy_cell_id = mac->physCellId; cfg->cell_config.frame_duplex_type = frame_type; @@ -212,7 +214,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo // SSB config cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; - cfg->ssb_config.scs_common = get_softmodem_params()->numerology; + cfg->ssb_config.scs_common = mac->numerology; // SSB Table config cfg->ssb_table.ssb_offset_point_a = frequencyInfoDL->offsetToPointA; @@ -231,7 +233,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo } int period_idx = mac->tdd_UL_DL_ConfigurationCommon ? get_tdd_period_idx(mac->tdd_UL_DL_ConfigurationCommon) : 0; - config_frame_structure(get_softmodem_params()->numerology, + config_frame_structure(mac->numerology, mac->tdd_UL_DL_ConfigurationCommon, period_idx, frame_type, @@ -443,14 +445,16 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t // carrier config LOG_D(MAC, "[UE %d] Entering UE Config Common\n", mac->ue_id); + mac->numerology = *scc->ssbSubcarrierSpacing; AssertFatal(scc->downlinkConfigCommon, "Not expecting downlinkConfigCommon to be NULL here\n"); NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; if (frequencyInfoDL) { // NeedM for inter-freq handover mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]; - frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology); + frame_type = get_frame_type(mac->nr_band, mac->numerology); mac->frequency_range = get_freq_range_from_band(mac->nr_band); + AssertFatal(mac->numerology == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "DL and SSB subcarrierSpacing must be the same!\n"); int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, mac->frequency_range, frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); @@ -483,6 +487,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN; + AssertFatal(mac->numerology == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "UL and SSB subcarrierSpacing must be the same!\n"); int bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, mac->frequency_range, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 65bf66505b..0f0532dd4c 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -615,6 +615,7 @@ typedef struct NR_UE_MAC_INST_s { uint16_t nr_band; uint8_t ssb_subcarrier_offset; int ssb_start_subcarrier; + int numerology; NR_SSB_meas_t ssb_measurements[MAX_NB_SSB]; NR_CSIRS_meas_t csirs_measurements; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 69ba897a21..cabe4ae291 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -106,7 +106,7 @@ typedef struct nr_neighbor_cell_info { void nr_rrc_mac_config_req_meas(module_id_t module_id, const nr_neighbor_cell_info_t *neighbor_cells, int num_neighbors); /**\brief initialization NR UE MAC instance(s)*/ -NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst); +NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst, int numerology); /**\brief fetch MAC instance by module_id \param module_id index of MAC instance(s)*/ diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 461d21f3aa..9230294ca6 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -97,7 +97,7 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) // default values as defined in 38.331 sec 9.2.2 // sf80 default for retxBSR_Timer sf10 for periodicBSR_Timer - int mu = mac->current_UL_BWP ? mac->current_UL_BWP->scs : get_softmodem_params()->numerology; + int mu = mac->current_UL_BWP ? mac->current_UL_BWP->scs : mac->numerology; int subframes_per_slot = get_slots_per_frame_from_scs(mu) / 10; nr_timer_setup(&mac->scheduling_info.retxBSR_Timer, 80 * subframes_per_slot, 1); // 1 slot update rate nr_timer_setup(&mac->scheduling_info.periodicBSR_Timer, 10 * subframes_per_slot, 1); // 1 slot update rate @@ -130,7 +130,7 @@ NR_UE_L2_STATE_t nr_ue_get_sync_state(module_id_t mod_id) return mac->state; } -NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id) +NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id, int numerology) { AssertFatal(instance_id < MAX_NUM_NR_UE_INST, "instance_id %d is out of range\n", instance_id); AssertFatal(nr_ue_mac_inst[instance_id] == NULL, "MAC instance %d already initialized\n", instance_id); @@ -138,12 +138,13 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id) NR_UE_MAC_INST_t *mac = nr_ue_mac_inst[instance_id]; mac->ue_id = instance_id; + mac->numerology = numerology; nr_ue_init_mac(mac); int ret = pthread_mutex_init(&mac->if_mutex, NULL); AssertFatal(ret == 0, "Mutex init failed\n"); nr_ue_mac_default_configs(mac); if (IS_SA_MODE(get_softmodem_params())) - ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology)); + ue_init_config_request(mac, get_slots_per_frame_from_scs(numerology)); static bool initialized = false; if (!initialized) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 0e8651a84d..8dbce0032c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -427,7 +427,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl const NR_UE_DL_BWP_t *current_DL_BWP = mac->current_DL_BWP; NR_BWP_Id_t dl_bwp_id = current_DL_BWP ? current_DL_BWP->bwp_id : 0; NR_BWP_PDCCH_t *pdcch_config = &mac->config_BWP_PDCCH[dl_bwp_id]; - int scs = current_DL_BWP ? current_DL_BWP->scs : get_softmodem_params()->numerology; + int scs = current_DL_BWP ? current_DL_BWP->scs : mac->numerology; const int slots_per_frame = get_slots_per_frame_from_scs(scs); if (mac->get_sib1) { int ssb_sc_offset_norm; From bcccfd90b89a241b1de679201a1d24aed23b3b46 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 18 Jul 2025 11:36:01 +0000 Subject: [PATCH 11/21] NR UE: don't use downlink_frequency[cc_idP][0] and uplink_frequency_offset[cc_idP][0] in MAC, store mac->dl_frequency instead --- executables/nr-uesoftmodem.c | 1 + openair2/LAYER2/NR_MAC_UE/config_ue.c | 33 +++++++++++++++++---------- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 3e5df6f9ca..b40901e435 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -338,6 +338,7 @@ int main(int argc, char **argv) uint16_t nr_band = get_softmodem_params()->band; mac->nr_band = nr_band; mac->ssb_start_subcarrier = UE_CC->frame_parms.ssb_start_subcarrier; + mac->dl_frequency = downlink_frequency[CC_id][0]; nr_init_frame_parms_ue_sa(&UE_CC->frame_parms, downlink_frequency[CC_id][0], uplink_frequency_offset[CC_id][0], diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index aada96566a..b3195894a4 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -150,7 +150,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo // Initial cell selection: derive from command-line parameter uint64_t dl_bw_khz = (12 * frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth) * (15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); - cfg->carrier_config.dl_frequency = (downlink_frequency[cc_idP][0]/1000) - (dl_bw_khz>>1); + cfg->carrier_config.dl_frequency = mac->dl_frequency / 1000 - (dl_bw_khz >> 1); LOG_I(NR_MAC, "[UE %d] Initial cell selection: dl_frequency=%u kHz (from command-line, band=%d, scs=%ld)\n", mac->ue_id, @@ -180,19 +180,28 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); /** Only set UL frequency if not already initialized (e.g., from handover reconfigurationWithSync) - * MAC maintains its own frequency state, don't overwrite it with command-line parameter which - * is related to the initial cell selection. */ + * MAC maintains its own frequency state, don't overwrite it with command-line parameter which + * is related to the initial cell selection. */ if (cfg->carrier_config.uplink_frequency == 0) { - // Initial cell selection: derive from DL frequency - LOG_I(NR_MAC, - "Initial cell selection: uplink_frequency=%u kHz (from dl_frequency=%u kHz, uplink_frequency_offset=%u kHz)\n", - cfg->carrier_config.uplink_frequency, - cfg->carrier_config.dl_frequency, - uplink_frequency_offset[cc_idP][0]); - if (frequencyInfoUL->absoluteFrequencyPointA == NULL) + // Initial cell selection: derive from DL frequency or frequencyInfoUL->absoluteFrequencyPointA + if (frequencyInfoUL->absoluteFrequencyPointA == NULL) { cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency; - else - cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency + (uplink_frequency_offset[cc_idP][0] / 1000); + LOG_I(NR_MAC, + "Initial cell selection: uplink_frequency=%u kHz (from dl_frequency=%u kHz)\n", + cfg->carrier_config.uplink_frequency, + cfg->carrier_config.dl_frequency); + } else { + cfg->carrier_config.uplink_frequency = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0]->freqBandIndicatorNR, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoUL->absoluteFrequencyPointA) + / 1000; // freq in kHz + LOG_I(NR_MAC, + "Initial cell selection: uplink_frequency=%u kHz (from absoluteFrequencyPointA=%ld, band=%ld, scs=%ld)\n", + cfg->carrier_config.uplink_frequency, + *frequencyInfoUL->absoluteFrequencyPointA, + *frequencyInfoUL->frequencyBandList->list.array[0]->freqBandIndicatorNR, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); + } } for (int i = 0; i < 5; i++) { diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 0f0532dd4c..11996d8394 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -615,6 +615,7 @@ typedef struct NR_UE_MAC_INST_s { uint16_t nr_band; uint8_t ssb_subcarrier_offset; int ssb_start_subcarrier; + uint64_t dl_frequency; int numerology; NR_SSB_meas_t ssb_measurements[MAX_NB_SSB]; From 0b06d55f5fb7c38ff1c53c56a0d511162a722ae4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 18 Jul 2025 11:47:02 +0000 Subject: [PATCH 12/21] NR UE: introduce support to define multiple cells This feature shall allow in future to simulate an arbitratry number of UEs connected to an other arbitrary number of cells. Therefore each RF-frontend (also called RU) needs to be configured for one specific cell. In case of handover of a UE from one cell to another cell, it needs to switch RUs accordingly (TODO). There has to be a 1-to-1 mapping between RUs and cells. Each UE will be assigned to one of the defined cells. Initially all UEs are assigned to cell 0. --- ci-scripts/conf_files/nrue.uicc.ntn-leo.conf | 12 ++ executables/nr-ue-ru.c | 137 ++++++++++++++++++- executables/nr-ue-ru.h | 9 +- executables/nr-uesoftmodem.c | 97 +++++++++---- openair1/PHY/INIT/nr_parms.c | 11 +- openair1/PHY/INIT/nr_phy_init.h | 2 +- openair1/PHY/defs_nr_UE.h | 12 ++ 7 files changed, 247 insertions(+), 33 deletions(-) diff --git a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf index 9f2787f2d8..96c56e4f80 100644 --- a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf +++ b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf @@ -29,6 +29,18 @@ RUs = ( } ); +cells = ( + { + ru_id = 0; + band = 254; + rf_freq = 2488400000L; + rf_offset = -873500000L; + numerology = 0; + N_RB_DL = 25; + ssb_start = 60; + } +); + #/* configuration for channel modelisation */ #/* To be included in main config file when */ #/* channel modelisation is used (rfsimulator with chanmod options enabled) */ diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index 497bbc309b..c4dcfdf888 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -68,12 +68,116 @@ } // clang-format on +/* NR UE cell configuration section name */ +#define CONFIG_STRING_NRUE_CELL_LIST "cells" + +#define NRUE_CELL_RU_ID "ru_id" +#define NRUE_CELL_BAND "band" +#define NRUE_CELL_RF_FREQUENCY "rf_freq" +#define NRUE_CELL_RF_FREQ_OFFSET "rf_offset" +#define NRUE_CELL_NUMEROLOGY "numerology" +#define NRUE_CELL_N_RB_DL "N_RB_DL" +#define NRUE_CELL_SSB_START "ssb_start" + +/*------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* NR UE cell configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt chkPptr */ +/*------------------------------------------------------------------------------------------------------------------------------------------------*/ +// clang-format off +#define NRUE_CELL_PARAMS_DESC { \ + {NRUE_CELL_RU_ID, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0, NULL }, \ + {NRUE_CELL_BAND, CONFIG_HLP_BAND, 0, .iptr=NULL, .defintval=78, TYPE_INT, 0, NULL }, \ + {NRUE_CELL_RF_FREQUENCY, CONFIG_HLP_DLF, 0, .u64ptr=NULL, .defint64val=0, TYPE_UINT64, 0, NULL }, \ + {NRUE_CELL_RF_FREQ_OFFSET, CONFIG_HLP_ULF, 0, .i64ptr=NULL, .defint64val=0, TYPE_INT64, 0, NULL }, \ + {NRUE_CELL_NUMEROLOGY, CONFIG_HLP_NUMEROLOGY, 0, .iptr=NULL, .defintval=1, TYPE_INT, 0, NULL }, \ + {NRUE_CELL_N_RB_DL, CONFIG_HLP_PRB_SA, 0, .iptr=NULL, .defintval=106, TYPE_INT, 0, NULL }, \ + {NRUE_CELL_SSB_START, CONFIG_HLP_SSC, 0, .iptr=NULL, .defintval=516, TYPE_INT, 0, NULL }, \ +} +// clang-format on + +static int nrue_cell_count; +static nrUE_cell_params_t *nrue_cells; +static NR_DL_FRAME_PARMS *nrue_cell_fp; + static int nrue_ru_count; static nrUE_RU_params_t *nrue_rus; openair0_config_t openair0_cfg[MAX_CARDS]; openair0_device_t openair0_dev[MAX_CARDS]; +int nrue_get_cell_count(void) +{ + return nrue_cell_count; +} + +const nrUE_cell_params_t *nrue_get_cell(int cell_id) +{ + AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); + return &nrue_cells[cell_id]; +} + +NR_DL_FRAME_PARMS *nrue_get_cell_fp(int cell_id) +{ + AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); + return &nrue_cell_fp[cell_id]; +} + +void nrue_set_cell(int cell_id, const nrUE_cell_params_t *cell) +{ + AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); + nrue_cells[cell_id] = *cell; +} + +void nrue_set_cell_params(configmodule_interface_t *cfg) +{ + paramdef_t cellParams[] = NRUE_CELL_PARAMS_DESC; + paramlist_def_t cellParamList = {CONFIG_STRING_NRUE_CELL_LIST, NULL, 0}; + config_getlist(cfg, &cellParamList, cellParams, sizeofArray(cellParams), NULL); + + if (cellParamList.numelt <= 0) { + nrue_cell_count = 1; + nrue_cell_fp = calloc_or_fail(nrue_cell_count, sizeof(NR_DL_FRAME_PARMS)); + nrue_cells = calloc_or_fail(nrue_cell_count, sizeof(nrUE_cell_params_t)); + nrue_cells[0] = (nrUE_cell_params_t){.ru_id = 0, + .band = get_softmodem_params()->band, + .rf_frequency = downlink_frequency[0][0], + .rf_freq_offset = uplink_frequency_offset[0][0], + .numerology = get_softmodem_params()->numerology, + .N_RB_DL = get_nrUE_params()->N_RB_DL, + .ssb_start = get_nrUE_params()->ssb_start_subcarrier, + .used_by_ue = -1}; + return; + } + + nrue_cell_count = cellParamList.numelt; + nrue_cell_fp = calloc_or_fail(nrue_cell_count, sizeof(NR_DL_FRAME_PARMS)); + nrue_cells = calloc_or_fail(nrue_cell_count, sizeof(nrUE_cell_params_t)); + + LOG_W(NR_PHY, "Ignoring command line cell parameters, using the following instead:\n"); + + for (int cell_id = 0; cell_id < nrue_cell_count; cell_id++) { + nrue_cells[cell_id].ru_id = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_RU_ID)->iptr); + nrue_cells[cell_id].band = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_BAND)->iptr); + nrue_cells[cell_id].rf_frequency = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_RF_FREQUENCY)->u64ptr); + nrue_cells[cell_id].rf_freq_offset = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_RF_FREQ_OFFSET)->i64ptr); + nrue_cells[cell_id].numerology = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_NUMEROLOGY)->iptr); + nrue_cells[cell_id].N_RB_DL = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_N_RB_DL)->iptr); + nrue_cells[cell_id].ssb_start = *(gpd(cellParamList.paramarray[cell_id], sizeofArray(cellParams), NRUE_CELL_SSB_START)->iptr); + nrue_cells[cell_id].used_by_ue = -1; + + LOG_I(NR_PHY, + "cell %d: ru_id %d, band %d, DL freq %lu, UL freq_offset %ld, numerology %d, N_RB_DL %d, ssb_start %d\n", + cell_id, + nrue_cells[cell_id].ru_id, + nrue_cells[cell_id].band, + nrue_cells[cell_id].rf_frequency, + nrue_cells[cell_id].rf_freq_offset, + nrue_cells[cell_id].numerology, + nrue_cells[cell_id].N_RB_DL, + nrue_cells[cell_id].ssb_start); + } +} + int nrue_get_ru_count(void) { return nrue_ru_count; @@ -85,6 +189,13 @@ const nrUE_RU_params_t *nrue_get_ru(int ru_id) return &nrue_rus[ru_id]; } +void nrue_set_ru_cell_id(int ru_id, int cell_id) +{ + AssertFatal(ru_id >= 0 && ru_id < nrue_ru_count, "Invalid RU ID %d! RU count = %d\n", ru_id, nrue_ru_count); + AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); + nrue_rus[ru_id].used_by_cell = cell_id; +} + void nrue_set_ru_params(configmodule_interface_t *cfg) { paramdef_t RUParams[] = NRUE_RU_PARAMS_DESC; @@ -106,7 +217,8 @@ void nrue_set_ru_params(configmodule_interface_t *cfg) .time_source = get_softmodem_params()->timing_source, .tune_offset = get_softmodem_params()->tune_offset, .if_frequency = get_nrUE_params()->if_freq, - .if_freq_offset = get_nrUE_params()->if_freq_off}; + .if_freq_offset = get_nrUE_params()->if_freq_off, + .used_by_cell = -1}; return; } @@ -124,6 +236,7 @@ void nrue_set_ru_params(configmodule_interface_t *cfg) nrue_rus[ru_id].tune_offset = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_TUNE_OFFSET)->dblptr); nrue_rus[ru_id].if_frequency = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_IF_FREQUENCY)->u64ptr); nrue_rus[ru_id].if_freq_offset = *(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_IF_FREQ_OFFSET)->iptr); + nrue_rus[ru_id].used_by_cell = -1; nrue_rus[ru_id].sdr_addrs = strdup(*(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_SDR_ADDRS)->strptr)); nrue_rus[ru_id].tx_subdev = strdup(*(gpd(RUParamList.paramarray[ru_id], sizeofArray(RUParams), NRUE_RU_TX_SUBDEV)->strptr)); @@ -157,7 +270,7 @@ void nrue_set_ru_params(configmodule_interface_t *cfg) } } -void nrue_init_openair0(const PHY_VARS_NR_UE *ue) +void nrue_init_openair0(void) { int freq_off = 0; bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false; @@ -170,11 +283,23 @@ void nrue_init_openair0(const PHY_VARS_NR_UE *ue) nrue_ru_count, MAX_CARDS); - const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - if (is_sidelink) - frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params; - for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + int cell_id = nrue_rus[ru_id].used_by_cell; + if (cell_id < 0) { + LOG_W(PHY, "Skipping initialization of RU %d because it is not used by any cell!\n", ru_id); + continue; + } + NR_DL_FRAME_PARMS *frame_parms = &nrue_cell_fp[cell_id]; + if (is_sidelink) { + int UE_id = nrue_cells[cell_id].used_by_ue; + if (UE_id < 0) { + LOG_W(PHY, "Skipping initialization of RU %d because it is not used by any UE!\n", ru_id); + continue; + } + extern PHY_VARS_NR_UE ***PHY_vars_UE_g; + frame_parms = &PHY_vars_UE_g[UE_id][0]->SL_UE_PHY_PARAMS.sl_frame_params; + } + openair0_config_t *cfg = &openair0_cfg[ru_id]; cfg->configFilename = NULL; cfg->sample_rate = frame_parms->samples_per_subframe * 1e3; diff --git a/executables/nr-ue-ru.h b/executables/nr-ue-ru.h index 4f5aee107a..91b86d487b 100644 --- a/executables/nr-ue-ru.h +++ b/executables/nr-ue-ru.h @@ -25,11 +25,18 @@ #include "PHY/defs_nr_UE.h" #include "radio/COMMON/common_lib.h" +int nrue_get_cell_count(void); +const nrUE_cell_params_t *nrue_get_cell(int cell_id); +NR_DL_FRAME_PARMS *nrue_get_cell_fp(int cell_id); +void nrue_set_cell(int cell_id, const nrUE_cell_params_t *cell); +void nrue_set_cell_params(configmodule_interface_t *cfg); + int nrue_get_ru_count(void); const nrUE_RU_params_t *nrue_get_ru(int ru_id); +void nrue_set_ru_cell_id(int ru_id, int cell_id); void nrue_set_ru_params(configmodule_interface_t *cfg); -void nrue_init_openair0(const PHY_VARS_NR_UE *ue); +void nrue_init_openair0(void); void nrue_ru_start(void); void nrue_ru_end(void); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index b40901e435..71c0f8f996 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -175,9 +175,8 @@ static void get_options(configmodule_interface_t *cfg) } // set PHY vars from command line -static void set_options(int CC_id, PHY_VARS_NR_UE *UE, int ru_id) +static void set_UE_options(int CC_id, PHY_VARS_NR_UE *UE, int ru_id) { - NR_DL_FRAME_PARMS *fp = &UE->frame_parms; const nrUE_RU_params_t *RU = nrue_get_ru(ru_id); // Set UE variables @@ -200,6 +199,12 @@ static void set_options(int CC_id, PHY_VARS_NR_UE *UE, int ru_id) LOG_I(PHY,"Set UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, chest-freq %d, chest-time %d\n", UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->chest_freq, UE->chest_time); +} + +static void set_fp_options(int cell_id, int ru_id) +{ + NR_DL_FRAME_PARMS *fp = nrue_get_cell_fp(cell_id); + const nrUE_RU_params_t *RU = nrue_get_ru(ru_id); // Set FP variables fp->nb_antennas_rx = RU->nb_rx; @@ -307,7 +312,14 @@ int main(int argc, char **argv) nr_pdcp_layer_init(); nas_init_nrue(NB_UE_INST); - init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file, get_softmodem_params()->numerology); + nrue_set_ru_params(uniqCfg); + nrue_set_cell_params(uniqCfg); + + init_NR_UE(NB_UE_INST, + get_nrUE_params()->uecap_file, + get_nrUE_params()->reconfig_file, + get_nrUE_params()->rbconfig_file, + nrue_get_cell(0)->numerology); // start time manager with some reasonable default for the running mode // (may be overwritten in configuration file or command line) @@ -324,29 +336,52 @@ int main(int argc, char **argv) IS_SOFTMODEM_RFSIM ? TIME_SOURCE_IQ_SAMPLES : TIME_SOURCE_REALTIME); - nrue_set_ru_params(uniqCfg); + // initialize per-cell frame parameters + for (int cell_id = 0; cell_id < nrue_get_cell_count(); cell_id++) { + int ru_id = nrue_get_cell(cell_id)->ru_id; + AssertFatal(ru_id >= 0 && ru_id < nrue_get_ru_count(), + "Invalid ru_id (%d) for cell %d. Should be >= 0 and < %d\n", + ru_id, + cell_id, + nrue_get_ru_count()); + AssertFatal(nrue_get_ru(ru_id)->used_by_cell == -1, + "RU %d is already used by cell %d and therefore cannot also be used by cell %d\n", + ru_id, + nrue_get_ru(ru_id)->used_by_cell, + cell_id); + nrue_set_ru_cell_id(ru_id, cell_id); - int ru_id = 0; // initialize all UEs to RU 0 for now + set_fp_options(cell_id, ru_id); + if (IS_SA_MODE(get_softmodem_params()) || get_softmodem_params()->sl_mode) + nr_init_frame_parms_ue_sa(nrue_get_cell_fp(cell_id), nrue_get_cell(cell_id)); + } + + int cell_id = 0; for (int inst = 0; inst < NB_UE_INST; inst++) { + NR_UE_MAC_INST_t *mac = get_mac_inst(inst); + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { PHY_VARS_NR_UE *UE_CC = PHY_vars_UE_g[inst][CC_id]; - set_options(CC_id, UE_CC, ru_id); - NR_UE_MAC_INST_t *mac = get_mac_inst(inst); + + AssertFatal(cell_id >= 0 && cell_id < nrue_get_cell_count(), + "There are not enough cell definitions for all UEs! NB_UE_INST = %d, MAX_NUM_CCs = %d, nrue_cell_count = %d\n", + NB_UE_INST, + MAX_NUM_CCs, + nrue_get_cell_count()); + nrUE_cell_params_t cell = *nrue_get_cell(cell_id); + + AssertFatal(cell.used_by_ue == -1, + "Cell %d is already used by UE %d and cannot also be used by UE %d as cells map 1:1 to RUs and RU sharing is not implemented\n", + cell_id, + cell.used_by_ue, + inst); + cell.used_by_ue = inst; + + set_UE_options(CC_id, UE_CC, cell.ru_id); init_nr_ue_phy_cpu_stats(&UE_CC->phy_cpu_stats); - // set frame config to initial values from command line and assume that the SSB is centered on the grid - if (IS_SA_MODE(get_softmodem_params()) || get_softmodem_params()->sl_mode) { - uint16_t nr_band = get_softmodem_params()->band; - mac->nr_band = nr_band; - mac->ssb_start_subcarrier = UE_CC->frame_parms.ssb_start_subcarrier; - mac->dl_frequency = downlink_frequency[CC_id][0]; - nr_init_frame_parms_ue_sa(&UE_CC->frame_parms, - downlink_frequency[CC_id][0], - uplink_frequency_offset[CC_id][0], - get_softmodem_params()->numerology, - nrUE_params.N_RB_DL, - nrUE_params.ssb_start_subcarrier, - nr_band); - } else { + + NR_DL_FRAME_PARMS *fp = nrue_get_cell_fp(cell_id); + if (!IS_SA_MODE(get_softmodem_params()) && !get_softmodem_params()->sl_mode) { do { notifiedFIFO_elt_t *elt = pollNotifiedFIFO(&mac->input_nf); if (!elt) { @@ -356,8 +391,21 @@ int main(int argc, char **argv) delNotifiedFIFO_elt(elt); } while (true); fapi_nr_config_request_t *nrUE_config = &UE_CC->nrUE_config; - nr_init_frame_parms_ue(&UE_CC->frame_parms, nrUE_config, mac->nr_band); + nr_init_frame_parms_ue(fp, nrUE_config, mac->nr_band); + + cell.band = fp->nr_band; + cell.rf_frequency = fp->dl_CarrierFreq; + cell.rf_freq_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; + cell.numerology = fp->numerology_index; + cell.N_RB_DL = fp->N_RB_DL; + cell.ssb_start = fp->ssb_start_subcarrier; } + nrue_set_cell(cell_id, &cell); + + UE_CC->frame_parms = *fp; + mac->nr_band = cell.band; + mac->ssb_start_subcarrier = cell.ssb_start; + mac->dl_frequency = cell.rf_frequency; UE_CC->sl_mode = get_softmodem_params()->sl_mode; init_actor(&UE_CC->sync_actor, "SYNC_", -1); @@ -389,10 +437,13 @@ int main(int argc, char **argv) get_nrUE_params()->ofdm_offset_divisor); sl_ue_phy_init(UE_CC); } - nrue_init_openair0(UE_CC); + + cell_id++; // initially connect each UE and carrier to its own cell } } + nrue_init_openair0(); + lock_memory_to_ram(); if (IS_SOFTMODEM_DOSCOPE) { diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index f50b5ab728..d6043775af 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -525,9 +525,16 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, return 0; } -void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, int N_RB_DL, int ssb_start_subcarrier, uint16_t nr_band) +void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, const nrUE_cell_params_t *cell) { - LOG_I(PHY,"SA init parameters. DL freq %lu UL offset %d SSB numerology %d N_RB_DL %d\n", + const uint64_t downlink_frequency = cell->rf_frequency; + const int64_t delta_duplex = cell->rf_freq_offset; + const uint8_t mu = cell->numerology; + const int N_RB_DL = cell->N_RB_DL; + const int ssb_start_subcarrier = cell->ssb_start; + const uint16_t nr_band = cell->band; + + LOG_I(PHY,"SA init parameters. DL freq %lu UL offset %ld SSB numerology %d N_RB_DL %d\n", downlink_frequency, delta_duplex, mu, diff --git a/openair1/PHY/INIT/nr_phy_init.h b/openair1/PHY/INIT/nr_phy_init.h index af44571a7b..ec4a8de71b 100644 --- a/openair1/PHY/INIT/nr_phy_init.h +++ b/openair1/PHY/INIT/nr_phy_init.h @@ -28,7 +28,7 @@ int nr_get_ssb_start_symbol(const NR_DL_FRAME_PARMS *fp, uint8_t i_ssb); void nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); -void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, int N_RB_DL, int ssb_start_subcarrier, uint16_t nr_band); +void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, const nrUE_cell_params_t *cell); int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, sl_nr_phy_config_request_t *config, int threequarter_fs, diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 2eba24f6d1..8d2dcbd58d 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -356,8 +356,20 @@ typedef struct { double tune_offset; uint64_t if_frequency; int if_freq_offset; + int used_by_cell; } nrUE_RU_params_t; +typedef struct { + int ru_id; + int band; + uint64_t rf_frequency; + int64_t rf_freq_offset; + int numerology; + int N_RB_DL; + int ssb_start; + int used_by_ue; +} nrUE_cell_params_t; + /// Top-level PHY Data Structure for UE typedef struct PHY_VARS_NR_UE_s { /// \brief Module ID indicator for this instance From 6297c4042344d694b0f1aa105b87ed9ef2a0c0a1 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 30 Jul 2025 12:20:04 +0000 Subject: [PATCH 13/21] remove unused variables from struct openair0_config --- openair1/PHY/TOOLS/calibration_test.c | 8 -------- radio/COMMON/common_lib.h | 8 -------- 2 files changed, 16 deletions(-) diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 223c46e9a0..d04492f901 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -110,14 +110,6 @@ int main(int argc, char **argv) { .autocal={0}, //! Configuration file for LMS7002M .configFilename="", - //! remote IP/MAC addr for Ethernet interface - .remote_addr="", - //! remote port number for Ethernet interface - .remote_port=0, - //! local IP/MAC addr for Ethernet interface (eNB/BBU, UE) - .my_addr=0, - //! local port number for Ethernet interface (eNB/BBU, UE) - .my_port=0, //! record player configuration, definition in record_player.h .recplay_mode=0, .recplay_conf=NULL, diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index e5f55fe309..53eb8b475b 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -277,14 +277,6 @@ typedef struct openair0_config { int autocal[8]; //! Configuration file for LMS7002M char *configFilename; - //! remote IP/MAC addr for Ethernet interface - char *remote_addr; - //! remote port number for Ethernet interface - unsigned int remote_port; - //! local IP/MAC addr for Ethernet interface (eNB/BBU, UE) - char *my_addr; - //! local port number for Ethernet interface (eNB/BBU, UE) - unsigned int my_port; //! record player configuration, definition in record_player.h uint32_t recplay_mode; recplay_conf_t *recplay_conf; From 8e18e5b3aae529912ceb43669bde1f44ee7a1c87 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 13 Aug 2025 14:42:04 +0200 Subject: [PATCH 14/21] NR UE: wrap all direct trx_*() function calls in nr_ue_ru_*() functions --- executables/nr-ue-ru.c | 152 +++++++++++++++++++++++++++++++++++ executables/nr-ue-ru.h | 6 ++ executables/nr-ue.c | 94 ++++++---------------- executables/nr-uesoftmodem.h | 2 - radio/COMMON/common_lib.c | 46 +++++++++-- radio/COMMON/common_lib.h | 6 ++ 6 files changed, 228 insertions(+), 78 deletions(-) diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index c4dcfdf888..daedc1b02e 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -371,3 +371,155 @@ void nrue_ru_end(void) openair0_dev[ru_id].trx_end_func(&openair0_dev[ru_id]); } } + +void nrue_ru_set_freq(PHY_VARS_NR_UE *UE, uint64_t ul_carrier, uint64_t dl_carrier, int freq_offset) +{ + int current_cell_id = nrue_rus[UE->rf_map.card].used_by_cell; + NR_DL_FRAME_PARMS *fp0 = &nrue_cell_fp[current_cell_id]; + uint64_t dl_carrier_distance = + fp0->dl_CarrierFreq > dl_carrier ? fp0->dl_CarrierFreq - dl_carrier : dl_carrier - fp0->dl_CarrierFreq; + uint64_t ul_carrier_distance = + fp0->ul_CarrierFreq > ul_carrier ? fp0->ul_CarrierFreq - ul_carrier : ul_carrier - fp0->ul_CarrierFreq; + uint64_t carrier_distance = dl_carrier_distance + ul_carrier_distance; + + for (int ru_id = 0; carrier_distance != 0 && ru_id < nrue_ru_count; ru_id++) { + int cell_id = nrue_rus[ru_id].used_by_cell; + if (cell_id < 0) // skip RUs that have no cell definition + continue; + if (nrue_cells[cell_id].used_by_ue >= 0) // skip cells that are already used by an UE + continue; + + fp0 = &nrue_cell_fp[cell_id]; + uint64_t this_dl_carrier_distance = + fp0->dl_CarrierFreq > dl_carrier ? fp0->dl_CarrierFreq - dl_carrier : dl_carrier - fp0->dl_CarrierFreq; + uint64_t this_ul_carrier_distance = + fp0->ul_CarrierFreq > ul_carrier ? fp0->ul_CarrierFreq - ul_carrier : ul_carrier - fp0->ul_CarrierFreq; + uint64_t this_carrier_distance = this_dl_carrier_distance + this_ul_carrier_distance; + if (this_carrier_distance < carrier_distance) { + UE->rf_map.card = ru_id; + carrier_distance = this_carrier_distance; + } + } + + nrue_cells[current_cell_id].used_by_ue = -1; + current_cell_id = nrue_rus[UE->rf_map.card].used_by_cell; + nrue_cells[current_cell_id].used_by_ue = UE->Mod_id; + + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + nr_rf_card_config_freq(cfg0, ul_carrier, dl_carrier, freq_offset); + dev0->trx_set_freq_func(dev0, cfg0); +} + +int nrue_ru_adjust_rx_gain(PHY_VARS_NR_UE *UE, int gain_change) +{ + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + + // Increase the RX gain by the value determined by adjust_rxgain + cfg0->rx_gain[0] += gain_change; + + // Set new RX gain. + int ret_gain = dev0->trx_set_gains_func(dev0, cfg0); + // APPLY RX gain again if crossed the MAX RX gain threshold + if (ret_gain < 0) { + gain_change += ret_gain; + cfg0->rx_gain[0] += ret_gain; + ret_gain = dev0->trx_set_gains_func(dev0, cfg0); + } + + int applied_rxgain = cfg0->rx_gain[0] - cfg0->rx_gain_offset[0]; + LOG_I(HW, "Rxgain adjusted by %d dB, RX gain: %d dB \n", gain_change, applied_rxgain); + + return gain_change; +} + +int nrue_ru_read(PHY_VARS_NR_UE *UE, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int num_antennas) +{ + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + openair0_timestamp_t tmp_timestamp; + int ret = dev0->trx_read_func(dev0, &tmp_timestamp, buff, nsamps, num_antennas); + if (!dev0->firstTS_initialized) { + dev0->firstTS = tmp_timestamp; + dev0->firstTS_initialized = true; + } + *ptimestamp = tmp_timestamp - dev0->firstTS; + + if (UE->Mod_id != 0) + return ret; + + // UE 0 needs to read from all RUs that are not used by any other UE + + void *tmp_buf[num_antennas]; + uint32_t tmp_samples[nsamps]; + for (int ant = 0; ant < num_antennas; ant++) + tmp_buf[ant] = tmp_samples; + + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + int cell_id = nrue_rus[ru_id].used_by_cell; + if (cell_id < 0) // skip RUs that have no cell definition + continue; + int ue_id = nrue_cells[cell_id].used_by_ue; + if (ue_id >= 0) // skip cells that are already used by an UE + continue; + + dev0 = &openair0_dev[ru_id]; + dev0->trx_read_func(dev0, &tmp_timestamp, tmp_buf, nsamps, num_antennas); + if (!dev0->firstTS_initialized) { + dev0->firstTS = tmp_timestamp; + dev0->firstTS_initialized = true; + } + } + + return ret; +} + +int nrue_ru_write(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **buff, int nsamps, int num_antennas, int flags) +{ + openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + int ret = dev0->trx_write_func(dev0, timestamp + dev0->firstTS, buff, nsamps, num_antennas, flags); + + if (UE->Mod_id != 0) + return ret; + + // UE 0 needs to write to all RUs that are not used by any other UE + + void *tmp_buf[num_antennas]; + uint32_t tmp_samples[nsamps]; + memset(tmp_samples, 0, sizeof(tmp_samples)); + for (int ant = 0; ant < num_antennas; ant++) + tmp_buf[ant] = tmp_samples; + + for (int ru_id = 0; ru_id < nrue_ru_count; ru_id++) { + int cell_id = nrue_rus[ru_id].used_by_cell; + if (cell_id < 0) // skip RUs that have no cell definition + continue; + int ue_id = nrue_cells[cell_id].used_by_ue; + if (ue_id >= 0) // skip cells that are already used by an UE + continue; + + dev0 = &openair0_dev[ru_id]; + dev0->trx_write_func(dev0, timestamp + dev0->firstTS, tmp_buf, nsamps, num_antennas, flags); + } + return ret; +} + +int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, + openair0_device_t *device, + openair0_timestamp_t timestamp, + void **txp, + int nsamps, + int nbAnt, + int flags); + +int nrue_ru_write_reorder(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) +{ + openair0_device_t *device = &openair0_dev[UE->rf_map.card]; + return openair0_write_reorder_common(UE, device, timestamp, txp, nsamps, nbAnt, flags); +} + +void nrue_ru_write_reorder_clear_context(PHY_VARS_NR_UE *UE) +{ + openair0_device_t *device = &openair0_dev[UE->rf_map.card]; + openair0_write_reorder_clear_context(device); +} diff --git a/executables/nr-ue-ru.h b/executables/nr-ue-ru.h index 91b86d487b..9fe3fc3bd9 100644 --- a/executables/nr-ue-ru.h +++ b/executables/nr-ue-ru.h @@ -40,5 +40,11 @@ void nrue_init_openair0(void); void nrue_ru_start(void); void nrue_ru_end(void); +void nrue_ru_set_freq(PHY_VARS_NR_UE *UE, uint64_t ul_carrier, uint64_t dl_carrier, int freq_offset); +int nrue_ru_adjust_rx_gain(PHY_VARS_NR_UE *UE, int gain_change); +int nrue_ru_read(PHY_VARS_NR_UE *UE, openair0_timestamp_t *ptimestamp, void **buff, int nsamps, int num_antennas); +int nrue_ru_write(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **buff, int nsamps, int num_antennas, int flags); +int nrue_ru_write_reorder(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags); +void nrue_ru_write_reorder_clear_context(PHY_VARS_NR_UE *UE); #endif diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 16fb246185..2a7ed2ab0f 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -23,6 +23,7 @@ #define _GNU_SOURCE // For pthread_setname_np #include #include +#include "executables/nr-ue-ru.h" #include "executables/nr-uesoftmodem.h" #include "PHY/INIT/nr_phy_init.h" #include "NR_MAC_UE/mac_proto.h" @@ -201,38 +202,10 @@ typedef struct { int rx_offset; } syncData_t; -extern openair0_config_t openair0_cfg[MAX_CARDS]; -extern openair0_device_t openair0_dev[MAX_CARDS]; - -static int nr_ue_adjust_rx_gain(PHY_VARS_NR_UE *UE, int gain_change) -{ - openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; - - // Increase the RX gain by the value determined by adjust_rxgain - cfg0->rx_gain[0] += gain_change; - - // Set new RX gain. - int ret_gain = dev0->trx_set_gains_func(dev0, cfg0); - // APPLY RX gain again if crossed the MAX RX gain threshold - if (ret_gain < 0) { - gain_change += ret_gain; - cfg0->rx_gain[0] += ret_gain; - ret_gain = dev0->trx_set_gains_func(dev0, cfg0); - } - - int applied_rxgain = cfg0->rx_gain[0] - cfg0->rx_gain_offset[0]; - LOG_I(PHY, "Rxgain adjusted by %d dB, RX gain: %d dB \n", gain_change, applied_rxgain); - - return gain_change; -} - static void UE_synch(void *arg) { syncData_t *syncD = (syncData_t *)arg; PHY_VARS_NR_UE *UE = syncD->UE; UE->is_synchronized = 0; - openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->target_Nid_cell != -1) { LOG_W(NR_PHY, "Starting re-sync detection for target Nid_cell %i\n", UE->target_Nid_cell); @@ -266,27 +239,20 @@ static void UE_synch(void *arg) { UE->freq_offset = freq_offset - UE->dl_Doppler_shift; } else { // rerun with new cell parameters and frequency-offset - nr_rf_card_config_freq(cfg0, ul_carrier, dl_carrier, freq_offset); - dev0->trx_set_freq_func(dev0, cfg0); + nrue_ru_set_freq(UE, ul_carrier, dl_carrier, freq_offset); } if (get_nrUE_params()->agc) { - nr_ue_adjust_rx_gain(UE, UE->adjust_rxgain); + nrue_ru_adjust_rx_gain(UE, UE->adjust_rxgain); } - LOG_I(PHY, - "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %f (DL %f Hz, UL %f Hz)\n", - hw_slot_offset, - freq_offset, - cfg0->rx_gain[0] - cfg0->rx_gain_offset[0], - cfg0->rx_freq[0], - cfg0->tx_freq[0]); + LOG_I(PHY, "Got synch: hw_slot_offset %d, carrier off %d Hz\n", hw_slot_offset, freq_offset); UE->is_synchronized = 1; } else { int gain_change = 0; if (get_nrUE_params()->agc) - gain_change = nr_ue_adjust_rx_gain(UE, INCREASE_IN_RXGAIN); + gain_change = nrue_ru_adjust_rx_gain(UE, INCREASE_IN_RXGAIN); if (gain_change) LOG_I(PHY, "synch retry: Rx gain increased \n"); else @@ -331,8 +297,6 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx PHY_VARS_NR_UE *UE = rxtxD->UE; const fapi_nr_config_request_t *cfg = &UE->nrUE_config; const UE_nr_rxtx_proc_t *proc = &rxtxD->proc; - openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; NR_DL_FRAME_PARMS *fp = &UE->frame_parms; if (UE->sl_mode == 2) @@ -343,7 +307,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx radio_tx_burst_flag_t flags = TX_BURST_INVALID; if (UE->received_config_request) { - if (cfg0->duplex_mode == duplex_mode_FDD || get_softmodem_params()->continuous_tx) { + if (fp->frame_type == FDD || get_softmodem_params()->continuous_tx) { flags = TX_BURST_MIDDLE; // In case of Sidelink, USRP write needed only in case transmission // needs to be done in this slot and not based on tdd ULDL configuration. @@ -394,7 +358,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx const int maxWriteBlockSize = get_samples_per_slot(proc->nr_slot_tx, fp); while (writeBlockSize > maxWriteBlockSize) { const int dummyBlockSize = min(writeBlockSize - maxWriteBlockSize, maxWriteBlockSize); - int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags); + int tmp = nrue_ru_write_reorder(UE, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags); AssertFatal(tmp == dummyBlockSize, ""); writeTimestamp += dummyBlockSize; @@ -417,7 +381,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx writeBlockSize); } - int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags); + int tmp = nrue_ru_write_reorder(UE, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags); AssertFatal(tmp == writeBlockSize, ""); } @@ -532,12 +496,9 @@ static int handle_sync_req_from_mac(PHY_VARS_NR_UE *UE) ul_CarrierFreq, cfg->dl_frequency, UE->target_Nid_cell); - openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + nrue_ru_set_freq(UE, ul_CarrierFreq, dl_CarrierFreq, 0); fp->dl_CarrierFreq = dl_CarrierFreq; fp->ul_CarrierFreq = ul_CarrierFreq; - nr_rf_card_config_freq(cfg0, ul_CarrierFreq, dl_CarrierFreq, 0); - dev0->trx_set_freq_func(dev0, cfg0); init_symbol_rotation(fp); } @@ -661,7 +622,6 @@ void UE_dl_processing(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlockSize) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; @@ -672,14 +632,13 @@ void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlo for (int i = 0; i < fp->nb_antennas_tx; i++) dummy_tx[i]=dummy_tx_data[i]; - int tmp = dev0->trx_write_func(dev0, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4); + int tmp = nrue_ru_write(UE, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4); AssertFatal(writeBlockSize == tmp, ""); } void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, bool toTrash) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; // two frames for initial sync int num_frames = 2; // In Sidelink worst case SL-SSB can be sent once in 16 frames @@ -701,7 +660,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration ((void *)&UE->common_vars.rxdata[i][0]) + 4 * ((x * fp->samples_per_subframe) + get_samples_slot_timestamp(fp, slot)); int read_block_size = get_samples_per_slot(slot, fp); - int tmp = dev0->trx_read_func(dev0, timestamp, rxp, read_block_size, fp->nb_antennas_rx); + int tmp = nrue_ru_read(UE, timestamp, rxp, read_block_size, fp->nb_antennas_rx); UEscopeCopy(UE, ueTimeDomainSamplesBeforeSync, rxp[0], sizeof(c16_t), 1, read_block_size, 0); AssertFatal(read_block_size == tmp, ""); @@ -722,7 +681,6 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset) { NR_DL_FRAME_PARMS *fp = &UE->frame_parms; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; @@ -732,7 +690,7 @@ static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int int size = rx_offset; while (size > 0) { const int unitTransfer = min(get_samples_per_slot(slot, fp), size); - const int res = dev0->trx_read_func(dev0, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx); + const int res = nrue_ru_read(UE, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx); DevAssert(unitTransfer == res); if (IS_SOFTMODEM_RFSIM) { int ta = UE->timing_advance + UE->timing_advance_ntn; @@ -760,9 +718,7 @@ static inline int get_readBlockSize(uint16_t slot, NR_DL_FRAME_PARMS *fp) { void *UE_thread(void *arg) { //this thread should be over the processing thread to keep in real time - PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; - openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; - openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card]; + PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *)arg; // int tx_enabled = 0; void *rxp[NB_ANTENNAS_RX]; enum stream_status_e stream_status = STREAM_STATUS_UNSYNC; @@ -814,7 +770,7 @@ void *UE_thread(void *arg) UE->is_synchronized = 1; } else { //warm up the RF board - int64_t tmp; + openair0_timestamp_t tmp; for (int i = 0; i < 50; i++) readFrame(UE, &tmp, duration_rx_to_tx, true); } @@ -854,6 +810,8 @@ void *UE_thread(void *arg) /* For IQ recorder-player we force synchronization to happen in a fixed duration so that the replay runs in sync with recorded samples. */ + extern openair0_config_t openair0_cfg[MAX_CARDS]; + openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card]; const unsigned int sync_in_frames = cfg0->recplay_conf->u_f_sync; while (trashed_frames != sync_in_frames) { readFrame(UE, &sync_timestamp, duration_rx_to_tx, true); @@ -895,16 +853,16 @@ void *UE_thread(void *arg) if (stream_status == STREAM_STATUS_UNSYNC) { stream_status = STREAM_STATUS_SYNCING; syncInFrame(UE, &sync_timestamp, duration_rx_to_tx, intialSyncOffset); - openair0_write_reorder_clear_context(dev0); + nrue_ru_write_reorder_clear_context(UE); shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync LOG_I(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame); // read in first symbol AssertFatal(fp->ofdm_symbol_size + fp->nb_prefix_samples0 - == dev0->trx_read_func(dev0, - &sync_timestamp, - (void **)UE->common_vars.rxdata, - fp->ofdm_symbol_size + fp->nb_prefix_samples0, - fp->nb_antennas_rx), + == nrue_ru_read(UE, + &sync_timestamp, + (void **)UE->common_vars.rxdata, + fp->ofdm_symbol_size + fp->nb_prefix_samples0, + fp->nb_antennas_rx), ""); // we have the decoded frame index in the return of the synch process // and we shifted above to the first slot of next frame @@ -1005,7 +963,7 @@ void *UE_thread(void *arg) const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply; openair0_timestamp_t rx_timestamp; - int tmp = dev0->trx_read_func(dev0, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); + int tmp = nrue_ru_read(UE, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); metadata meta = {.slot = curMsg.proc.nr_slot_rx, .frame = curMsg.proc.frame_rx}; UEscopeCopyWithMetadata(UE, ueTimeDomainSamples, rxp[0] - firstSymSamp * sizeof(c16_t), sizeof(c16_t), 1, readBlockSize, 0, &meta); AssertFatal(readBlockSize == tmp, ""); @@ -1020,7 +978,7 @@ void *UE_thread(void *arg) if (first_symbols > 0) { openair0_timestamp_t ignore_timestamp; - int tmp = dev0->trx_read_func(dev0, &ignore_timestamp, (void **)UE->common_vars.rxdata, first_symbols, fp->nb_antennas_rx); + int tmp = nrue_ru_read(UE, &ignore_timestamp, (void **)UE->common_vars.rxdata, first_symbols, fp->nb_antennas_rx); AssertFatal(first_symbols == tmp, ""); } else @@ -1033,8 +991,8 @@ void *UE_thread(void *arg) // Calculate TX deadline, approximately 1 symbol before the first sample should be written const uint64_t samples_diff = writeTimestamp - rx_timestamp - fp->ofdm_symbol_size; - const float deadline_us = samples_diff / cfg0->sample_rate * 1e6; - const uint64_t absolute_deadline_us = current_time.tv_sec * 1e6 + current_time.tv_nsec / 1e3 + deadline_us; + const float deadline_us = samples_diff * 1e3 / fp->samples_per_subframe; + const uint64_t absolute_deadline_us = current_time.tv_sec * 1e6 + current_time.tv_nsec * 1e-3 + deadline_us; // but use current UE->timing_advance value to compute writeBlockSize int writeBlockSize = get_samples_per_slot((slot_nr + duration_rx_to_tx) % nb_slot_frame, fp) - iq_shift_to_apply; diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index b78142cdd6..4ae96e9c59 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -129,9 +129,7 @@ extern uint64_t get_nrUE_optmask(void); extern uint64_t set_nrUE_optmask(uint64_t bitmask); extern nrUE_params_t *get_nrUE_params(void); - // In nr-ue.c -extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg); extern void fill_ue_band_info(void); extern void init_NR_UE(int, char *, char *, char *, int); extern void init_NR_UE_threads(PHY_VARS_NR_UE *ue); diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index 104546b795..a7cd226ddc 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -187,7 +187,19 @@ static void writerEnqueue(re_order_t *ctx, openair0_timestamp_t timestamp, void pthread_mutex_unlock(&ctx->mutex_store); } -static void writerProcessWaitingQueue(openair0_device_t *device) +typedef struct PHY_VARS_NR_UE_s PHY_VARS_NR_UE; +__attribute__((weak)) int nrue_ru_write(PHY_VARS_NR_UE *UE, + openair0_timestamp_t timestamp, + void **txp, + int nsamps, + int nbAnt, + int flags) +{ + AssertFatal(0, "this weak function implementation should never be called!\n"); + return 0; +} + +static void writerProcessWaitingQueue(PHY_VARS_NR_UE *UE, openair0_device_t *device) { bool found = false; re_order_t *ctx = &device->reOrder; @@ -209,7 +221,11 @@ static void writerProcessWaitingQueue(openair0_device_t *device) pthread_mutex_unlock(&ctx->mutex_store); found = true; if (flags || IS_SOFTMODEM_RFSIM) { - int wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); + int wroteSamples; + if (UE) + wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags); + else + wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); if (wroteSamples != nsamps) LOG_E(HW, "Failed to write to rf\n"); } @@ -226,7 +242,13 @@ static void writerProcessWaitingQueue(openair0_device_t *device) // but to make zerocopy and agnostic design, we need to make a proper ring buffer with mutex protection // mutex (or atomic flags) will be mandatory because this out order system root cause is there are several writer threads -int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) +int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, + openair0_device_t *device, + openair0_timestamp_t timestamp, + void **txp, + int nsamps, + int nbAnt, + int flags) { int wroteSamples = 0; re_order_t *ctx = &device->reOrder; @@ -240,27 +262,35 @@ int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t times if (pthread_mutex_trylock(&ctx->mutex_write) == 0) { // We have the write exclusivity if (llabs(timestamp - ctx->nextTS) < MAX_GAP) { // We are writing in sequence of the previous write - if (flags || IS_SOFTMODEM_RFSIM) - wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); - else + if (flags || IS_SOFTMODEM_RFSIM) { + if (UE) + wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags); + else + wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); + } else wroteSamples = nsamps; ctx->nextTS = timestamp + nsamps; } else { writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags); } - writerProcessWaitingQueue(device); + writerProcessWaitingQueue(UE, device); pthread_mutex_unlock(&ctx->mutex_write); return wroteSamples ? wroteSamples : nsamps; } writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags); if (pthread_mutex_trylock(&ctx->mutex_write) == 0) { - writerProcessWaitingQueue(device); + writerProcessWaitingQueue(UE, device); pthread_mutex_unlock(&ctx->mutex_write); } return nsamps; } +int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) +{ + return openair0_write_reorder_common(NULL, device, timestamp, txp, nsamps, nbAnt, flags); +} + void openair0_write_reorder_clear_context(openair0_device_t *device) { LOG_I(HW, "received write reorder clear context\n"); diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 53eb8b475b..76c5697c3f 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -419,6 +419,12 @@ struct openair0_device { /* !brief RF frontend parameters set by application */ openair0_config_t *openair0_cfg; + /* !brief timestamp of first read */ + openair0_timestamp_t firstTS; + + /* !brief flag indicating that firstTS was initialized */ + bool firstTS_initialized; + /* !brief ETH params set by application */ eth_params_t *eth_params; //! record player data, definition in record_player.h From fb9e848d5bae8e19798e2d21b6ed01f1b9a9a4d2 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 18 Aug 2025 15:41:33 +0200 Subject: [PATCH 15/21] NR UE: don't allocate unnecessary data buffers When writing dummy data or reading to trash, we don't need to allocate data buffers for each antenna. We can allocate just for one antenna and use this buffer for each antenna. --- executables/nr-ue.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 2a7ed2ab0f..0d1ae421f0 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -627,10 +627,10 @@ void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlo void *dummy_tx[fp->nb_antennas_tx]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers - int16_t dummy_tx_data[fp->nb_antennas_tx][2 * writeBlockSize]; + int16_t dummy_tx_data[2 * writeBlockSize]; memset(dummy_tx_data, 0, sizeof(dummy_tx_data)); for (int i = 0; i < fp->nb_antennas_tx; i++) - dummy_tx[i]=dummy_tx_data[i]; + dummy_tx[i] = dummy_tx_data; int tmp = nrue_ru_write(UE, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4); AssertFatal(writeBlockSize == tmp, ""); @@ -648,9 +648,11 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration } void *rxp[NB_ANTENNAS_RX]; - if (toTrash) - for (int i = 0; i < fp->nb_antennas_rx; i++) - rxp[i] = malloc16(get_samples_per_slot(0, fp) * 4); + if (toTrash) { + rxp[0] = malloc16(get_samples_per_slot(0, fp) * 4); + for (int i = 1; i < fp->nb_antennas_rx; i++) + rxp[i] = rxp[0]; + } for (int x = 0; x < num_frames * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; x++) { // two frames for initial sync for (int slot = 0; slot < fp->slots_per_subframe; slot++) { @@ -674,8 +676,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration } if (toTrash) - for (int i = 0; i < fp->nb_antennas_rx; i++) - free(rxp[i]); + free(rxp[0]); } static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset) From b24052d2dc1cf891cfd647095251e31a5eddbc0c Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 18 Aug 2025 15:45:29 +0200 Subject: [PATCH 16/21] rfsimulator: remove static variable last_TS from function rxAddInput() This static variable creates issues when there are multiple instances of the LEO channel model in use. --- radio/rfsimulator/apply_channelmod.c | 9 +++------ radio/rfsimulator/rfsimulator.h | 2 +- radio/rfsimulator/simulator.cpp | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/radio/rfsimulator/apply_channelmod.c b/radio/rfsimulator/apply_channelmod.c index d1d1042451..4b7f526970 100644 --- a/radio/rfsimulator/apply_channelmod.c +++ b/radio/rfsimulator/apply_channelmod.c @@ -27,9 +27,8 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_config.h" #include "rfsimulator.h" -void update_channel_model(channel_desc_t *channelDesc, uint64_t TS) +void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS) { - static uint64_t last_TS = 0; if ((channelDesc->sat_height > 0) && (channelDesc->enable_dynamic_delay || channelDesc->enable_dynamic_Doppler)) { // model for transparent satellite on circular orbit @@ -137,8 +136,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS) if (channelDesc->enable_dynamic_Doppler) channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_ue_sat / channelDesc->sampling_rate; - if (TS - last_TS >= channelDesc->sampling_rate) { - last_TS = TS; + if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) { LOG_I(HW, "Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n", t, @@ -204,8 +202,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS) if (channelDesc->enable_dynamic_Doppler) channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_sat_ue / channelDesc->sampling_rate; - if (TS - last_TS >= channelDesc->sampling_rate) { - last_TS = TS; + if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) { LOG_I(HW, "Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n", t, diff --git a/radio/rfsimulator/rfsimulator.h b/radio/rfsimulator/rfsimulator.h index 802a2a2e34..71af48ed07 100644 --- a/radio/rfsimulator/rfsimulator.h +++ b/radio/rfsimulator/rfsimulator.h @@ -30,5 +30,5 @@ void rxAddInput(c16_t **input_sig, channel_desc_t *channelDesc, int nbSamples, uint64_t TS); -void update_channel_model(channel_desc_t *channelDesc, uint64_t TS); +void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS); #endif diff --git a/radio/rfsimulator/simulator.cpp b/radio/rfsimulator/simulator.cpp index f89aef02cd..eb49dd6320 100644 --- a/radio/rfsimulator/simulator.cpp +++ b/radio/rfsimulator/simulator.cpp @@ -1426,7 +1426,7 @@ static int rfsimulator_read_beams(openair0_device_t *device, buffer_t *ptr = &t->buf[sock]; if (ptr->conn_sock != -1 && ptr->channel_model != NULL) { - update_channel_model(ptr->channel_model, t->nextRxTstamp); + update_channel_model(ptr->channel_model, nsamps, t->nextRxTstamp); } } From ce83a78271bffb978baab66d526408f93c4f70dd Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 18 Aug 2025 15:48:18 +0200 Subject: [PATCH 17/21] remove unused variables from struct openair0_config --- radio/COMMON/common_lib.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 76c5697c3f..8d6a43beaf 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -282,10 +282,6 @@ typedef struct openair0_config { recplay_conf_t *recplay_conf; //! number of samples per tti unsigned int samples_per_tti; - //! the sample rate for receive. - double rx_sample_rate; - //! the sample rate for transmit. - double tx_sample_rate; //! Flag to indicate this configuration is for NR int nr_flag; //! NR band number From 4d215b5c95bb8b869149ea8d5809b66bc7c0e960 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 23 Jan 2026 18:24:18 +0100 Subject: [PATCH 18/21] rfsimulator: add support for providing different parameters to each instance --- executables/nr-ue-ru.c | 1 + radio/COMMON/common_lib.h | 2 + radio/rfsimulator/simulator.cpp | 104 ++++++++++++++++++++++---------- 3 files changed, 75 insertions(+), 32 deletions(-) diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index daedc1b02e..f439374e5b 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -311,6 +311,7 @@ void nrue_init_openair0(void) cfg->duplex_mode = duplex_mode_FDD; cfg->Mod_id = 0; + cfg->ru_id = ru_id; cfg->num_rb_dl = frame_parms->N_RB_DL; cfg->tx_num_channels = min(4, frame_parms->nb_antennas_tx); cfg->rx_num_channels = min(4, frame_parms->nb_antennas_rx); diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 8d6a43beaf..6dfaf9c57f 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -212,6 +212,8 @@ typedef struct split7_config { typedef struct openair0_config { //! Module ID for this configuration int Mod_id; + //! RU ID of this device + int ru_id; //! duplexing mode duplex_mode_t duplex_mode; //! number of downlink resource blocks diff --git a/radio/rfsimulator/simulator.cpp b/radio/rfsimulator/simulator.cpp index eb49dd6320..876b75249a 100644 --- a/radio/rfsimulator/simulator.cpp +++ b/radio/rfsimulator/simulator.cpp @@ -81,7 +81,19 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole; // #define RFSIMU_SECTION "rfsimulator" +#define RFSIMU_SERVER_ADDR "serveraddr" +#define RFSIMU_SERVER_PORT "serverport" #define RFSIMU_OPTIONS_PARAMNAME "options" +#define RFSIMU_IQFILE "IQfile" +#define RFSIMU_MODELNAME "modelname" +#define RFSIMU_PLOSS "ploss" +#define RFSIMU_FORGETFACT "forgetfact" +#define RFSIMU_OFFSET "offset" +#define RFSIMU_PROP_DELAY "prop_delay" +#define RFSIMU_WAIT_TIMEOUT "wait_timeout" +#define RFSIMU_ENABLE_BEAMS "enable_beams" +#define RFSIMU_NUM_CONCURRENT_BEAMS "num_concurrent_beams" +#define RFSIMU_BEAM_MAP "beam_map" #define RFSIMU_BEAM_GAINS "beam_gains" #define RFSIMU_BEAM_IDS "beam_ids" @@ -98,19 +110,19 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole; /* optname helpstr paramflags XXXptr defXXXval */ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #define RFSIMULATOR_PARAMS_DESC { \ - STRINGPARAM("serveraddr", "\n", simOpt, &rfsimulator->ip, "127.0.0.1"), \ - UINT16PARAM("serverport", "\n", simOpt, &rfsimulator->port, PORT), \ + STRINGPARAM(RFSIMU_SERVER_ADDR, "\n", simOpt, NULL, "127.0.0.1"), \ + UINT16PARAM(RFSIMU_SERVER_PORT, "\n", simOpt, NULL, PORT), \ STRLISTPARAM(RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, simOpt, NULL, NULL), \ - STRINGPARAM("IQfile", "\n", simOpt, &saveF, "/tmp/rfsimulator.iqs"),\ - STRINGPARAM("modelname", "\n", simOpt, &modelname, "AWGN"), \ - DOUBLEPARAM("ploss", "\n", simOpt, &rfsimulator->chan_pathloss, 0), \ - DOUBLEPARAM("forgetfact", "\n", simOpt, &rfsimulator->chan_forgetfact, 0), \ - UINT64PARAM("offset", "\n", simOpt, &rfsimulator->chan_offset, 0L), \ - DOUBLEPARAM("prop_delay", "\n", simOpt, &(rfsimulator->prop_delay_ms), 0.0), \ - INTPARAM("wait_timeout", "\n", simOpt, &rfsimulator->wait_timeout, 1), \ - BOOLPARAM("enable_beams", "\n", simBool,&(beam_ctrl->enable_beams), 0), \ - INTPARAM("num_concurrent_beams", "\n", simOpt, &beam_ctrl->num_concurrent_beams, 1), \ - UINT64PARAM("beam_map", "\n", simOpt, &beam_map, 1), \ + STRINGPARAM(RFSIMU_IQFILE, "\n", simOpt, NULL, "/tmp/rfsimulator.iqs"),\ + STRINGPARAM(RFSIMU_MODELNAME, "\n", simOpt, NULL, "AWGN"), \ + DOUBLEPARAM(RFSIMU_PLOSS, "\n", simOpt, NULL, 0), \ + DOUBLEPARAM(RFSIMU_FORGETFACT, "\n", simOpt, NULL, 0), \ + UINT64PARAM(RFSIMU_OFFSET, "\n", simOpt, NULL, 0L), \ + DOUBLEPARAM(RFSIMU_PROP_DELAY, "\n", simOpt, NULL, 0.0), \ + INTPARAM(RFSIMU_WAIT_TIMEOUT, "\n", simOpt, NULL, 1), \ + BOOLPARAM(RFSIMU_ENABLE_BEAMS, "\n", simBool,NULL, 0), \ + INTPARAM(RFSIMU_NUM_CONCURRENT_BEAMS, "\n", simOpt, NULL, 1), \ + UINT64PARAM(RFSIMU_BEAM_MAP, "\n", simOpt, NULL, 1), \ STRINGPARAM(RFSIMU_BEAM_IDS, "\n", simOpt, NULL, NULL), \ STRINGPARAM(RFSIMU_BEAM_GAINS, "\n", simOpt, NULL, NULL), \ }; @@ -182,6 +194,7 @@ typedef struct { typedef struct { int listen_sock, epollfd; pthread_mutex_t Sockmutex; + int ru_id; unsigned int nb_cnx; openair0_timestamp_t nextRxTstamp; openair0_timestamp_t lastWroteTS; @@ -354,7 +367,7 @@ static buffer_t *allocCirBuf(rfsimulator_state_t *bridge, int sock) sizeofArray(modelname), "rfsimu_channel_%s%d", (bridge->role == SIMU_ROLE_SERVER) ? "ue" : "enB", - bridge->nb_cnx - 1); + (bridge->role == SIMU_ROLE_SERVER) ? bridge->nb_cnx - 1 : bridge->ru_id); ptr->channel_model = find_channel_desc_fromname(modelname); // path_loss in dB if (!ptr->channel_model) { // Use legacy method to find channel model - this will use the same channel model for all clients @@ -520,19 +533,45 @@ static void process_gains(char *str, rfsim_beam_ctrl_t *beam_ctrl) static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { - char *saveF = NULL; - char *modelname = NULL; + configmodule_interface_t *cfg = config_get_if(); + paramdef_t *rfsimuParam; + paramdef_t rfsimuParams[] = RFSIMULATOR_PARAMS_DESC; + paramlist_def_t rfsimuParamList = {RFSIMU_SECTION, NULL, 0}; + int ret = config_getlist(cfg, &rfsimuParamList, rfsimuParams, sizeofArray(rfsimuParams), NULL); + if (ret < 0 || rfsimuParamList.numelt <= 0) { + ret = config_get(cfg, rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_SECTION); + AssertFatal(ret >= 0, "configuration couldn't be performed\n"); + LOG_W(HW, "Warning: rfsimulator parameters should be provided as array elements!\n"); + rfsimuParam = rfsimuParams; + } else { + int ru_id = rfsimulator->ru_id; + AssertFatal(rfsimuParamList.numelt > ru_id, + "no rfsimulator parameters (numelt %d) specified for card %d\n", + rfsimuParamList.numelt, + ru_id); + rfsimuParam = rfsimuParamList.paramarray[ru_id]; + } + + rfsimulator->ip = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_SERVER_ADDR)->strptr)); + rfsimulator->port = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_SERVER_PORT)->u16ptr); + char *saveF = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_IQFILE)->strptr)); +//char *modelname = strdup(*(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_MODELNAME)->strptr)); + rfsimulator->chan_pathloss = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_PLOSS)->dblptr); + rfsimulator->chan_forgetfact = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_FORGETFACT)->dblptr); + rfsimulator->chan_offset = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_OFFSET)->u64ptr); + rfsimulator->prop_delay_ms = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_PROP_DELAY)->dblptr); + rfsimulator->wait_timeout = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_WAIT_TIMEOUT)->iptr); + rfsim_beam_ctrl_t *beam_ctrl = rfsimulator->beam_ctrl; - uint64_t beam_map = 1; - paramdef_t rfsimu_params[] = RFSIMULATOR_PARAMS_DESC; - int p = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_OPTIONS_PARAMNAME); - int ret = config_get(config_get_if(), rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_SECTION); - AssertFatal(ret >= 0, "configuration couldn't be performed\n"); + beam_ctrl->enable_beams = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_ENABLE_BEAMS)->iptr); + beam_ctrl->num_concurrent_beams = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_NUM_CONCURRENT_BEAMS)->iptr); + uint64_t beam_map = *(gpd(rfsimuParam, sizeofArray(rfsimuParams), RFSIMU_BEAM_MAP)->u64ptr); rfsimulator->saveIQfile = -1; - for (int i = 0; i < rfsimu_params[p].numelt; i++) { - if (strcmp(rfsimu_params[p].strlistptr[i], "saviq") == 0) { + int p = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_OPTIONS_PARAMNAME); + for (int i = 0; i < rfsimuParam[p].numelt; i++) { + if (strcmp(rfsimuParam[p].strlistptr[i], "saviq") == 0) { rfsimulator->saveIQfile = open(saveF, O_APPEND | O_CREAT | O_TRUNC | O_WRONLY, 0666); if (rfsimulator->saveIQfile != -1) @@ -543,7 +582,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) } break; - } else if (strcmp(rfsimu_params[p].strlistptr[i], "chanmod") == 0) { + } else if (strcmp(rfsimuParam[p].strlistptr[i], "chanmod") == 0) { init_channelmod(); load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, @@ -552,24 +591,24 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) rfsimulator->tx_bw); rfsimulator->channelmod = true; } else { - fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimu_params[p].strlistptr[i]); + fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimuParam[p].strlistptr[i]); exit(-1); } } - int beam_gains_param_index = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_BEAM_GAINS); - if (rfsimu_params[beam_gains_param_index].strptr) { - process_gains(*rfsimu_params[beam_gains_param_index].strptr, beam_ctrl); + int beam_gains_param_index = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_BEAM_GAINS); + if (rfsimuParam[beam_gains_param_index].strptr) { + process_gains(*rfsimuParam[beam_gains_param_index].strptr, beam_ctrl); } std::vector initial_beams = beam_map_to_beams(beam_map); beam_ctrl->rx.beams = initial_beams; beam_ctrl->tx.beams = initial_beams; - int beam_ids_param_index = config_paramidx_fromname(rfsimu_params, sizeofArray(rfsimu_params), RFSIMU_BEAM_IDS); - if (rfsimu_params[beam_ids_param_index].strptr) { + int beam_ids_param_index = config_paramidx_fromname(rfsimuParams, sizeofArray(rfsimuParams), RFSIMU_BEAM_IDS); + if (rfsimuParam[beam_ids_param_index].strptr) { std::vector beam_ids; - std::stringstream ss(*rfsimu_params[beam_ids_param_index].strptr); + std::stringstream ss(*rfsimuParam[beam_ids_param_index].strptr); std::string token; while (std::getline(ss, token, ',')) { beam_ids.push_back(std::stoi(token)); @@ -1563,6 +1602,7 @@ extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_d // --log_config.hw_log_level debug rfsimulator_state_t *rfsimulator = static_cast(calloc(sizeof(rfsimulator_state_t), 1)); // initialize channel simulation + rfsimulator->ru_id = openair0_cfg->ru_id; rfsimulator->tx_num_channels = openair0_cfg->tx_num_channels; rfsimulator->rx_num_channels = openair0_cfg->rx_num_channels; rfsimulator->sample_rate = openair0_cfg->sample_rate; @@ -1596,8 +1636,8 @@ extern "C" __attribute__((__visibility__("default"))) int device_init(openair0_d } /* let's pretend to be a b2x0 */ device->type = RFSIMULATOR; - openair0_cfg[0].rx_gain[0] = 0; - device->openair0_cfg = &openair0_cfg[0]; + openair0_cfg->rx_gain[0] = 0; + device->openair0_cfg = openair0_cfg; device->priv = rfsimulator; device->trx_write_init = rfsimulator_write_init; device->trx_set_beams = rfsimulator_set_beams; From 3435fcc010ac3a403da4697c9fc06eabded45b1f Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 29 Aug 2025 16:55:54 +0200 Subject: [PATCH 19/21] update documentation and configuration files reflecting the rfsimulator changes --- .../conf_files/enb.band38.25prb.rfsim.conf | 6 +- .../conf_files/enb.band7.100prb.rfsim.conf | 6 +- .../conf_files/enb.band7.25prb.rfsim.conf | 6 +- .../enb.band7.25prb.rfsim.nos1.conf | 6 +- .../conf_files/enb.band7.50prb.rfsim.conf | 6 +- .../enb.band7.tm1.25prb.rfsim.mbms.conf | 6 +- .../gnb-du.sa.band78.106prb.rfsim.conf | 10 +- .../conf_files/gnb-pnf.band66.rfsim.conf | 5 +- .../gnb.band66.106prb.rfsim.phytest-dora.conf | 7 +- .../gnb.band78.106prb.rfsim.phytest-dora.conf | 7 +- ...gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf | 5 +- .../gnb.sa.band254.u0.25prb.rfsim.ntn.conf | 5 +- .../gnb.sa.band257.u3.66prb.rfsim.conf | 6 +- .../gnb.sa.band66.106prb.rfsim.conf | 7 +- .../gnb.sa.band78.106prb.rfsim.conf | 6 +- .../gnb.sa.band78.106prb.rfsim.flexric.conf | 6 +- .../gnb.sa.band78.106prb.rfsim.neighbour.conf | 4 +- .../gnb.sa.band78.106prb.rfsim.prs.conf | 9 +- .../gnb.sa.band78.106prb.rfsim.yaml | 2 +- .../conf_files/gnb.sa.band78.24prb.rfsim.conf | 7 +- .../gnb.sa.band78.273prb.rfsim.2x2.conf | 5 +- .../conf_files/nrue.band78.106prb.prs.conf | 6 + ci-scripts/conf_files/nrue.uicc.conf | 8 +- ci-scripts/conf_files/nrue.uicc.ntn-leo.conf | 7 + ci-scripts/conf_files/nrue.uicc.yaml | 3 + .../gnb.sa.band66.fr1.106PRB.usrpn300.conf | 7 +- .../gnb.sa.band78.fr1.51PRB.usrpb210.conf | 5 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../4g_rfsimulator_fembms/docker-compose.yml | 2 +- .../4g_rfsimulator_mbms/docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../5g_f1_rfsimulator/docker-compose.yaml | 10 +- .../yaml_files/5g_rfsimulator/README.md | 2 +- .../5g_rfsimulator/docker-compose.yaml | 20 +-- .../5g_rfsimulator/local-override-ue-gdb.yaml | 2 +- .../5g_rfsimulator_24prb/docker-compose.yaml | 2 +- .../5g_rfsimulator_2x2/docker-compose.yaml | 2 +- .../5g_rfsimulator_e1/docker-compose.yaml | 6 +- .../docker-compose.yaml | 4 +- .../5g_rfsimulator_flexric/docker-compose.yml | 4 +- .../docker-compose.yaml | 2 +- .../docker-compose.yaml | 2 +- .../5g_rfsimulator_multiue/nrue.uicc.conf | 133 +++++++++++++++++- .../5g_rfsimulator_n2_ho/docker-compose.yaml | 6 +- .../docker-compose.yaml | 2 +- .../docker-compose.yaml | 7 +- .../5g_rfsimulator_prs/docker-compose.yaml | 2 +- .../docker-compose.yaml | 4 +- .../docker-compose.yaml | 4 +- .../docker-compose.yaml | 2 +- common/utils/LOG/DOC/lttng_logs.md | 2 +- common/utils/websrv/DOC/websrvuse.md | 4 +- doc/E1AP/E1-design.md | 2 +- doc/LDPC_XDMA_offload_setup.md | 4 +- doc/NR_SA_Tutorial_OAI_multi_UE.md | 4 +- doc/NR_SA_Tutorial_OAI_nrUE.md | 2 +- doc/RUNMODEM.md | 12 +- doc/RUN_NR_PRS.md | 4 +- doc/data_recording.md | 4 +- doc/handover-tutorial.md | 12 +- doc/nfapi.md | 2 +- openair1/PHY/CODING/DOC/LDPCImplementation.md | 4 +- .../TOOLS/DOC/channel_simulation.md | 8 +- openair2/E2AP/README.md | 4 +- radio/COMMON/common_lib.h | 2 +- radio/rfsimulator/README.md | 56 ++++---- .../PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 8 +- .../gnb-du.sa.band66.25prb.rfsim.pci0.conf | 4 +- .../gnb-du.sa.band66.25prb.rfsim.pci1.conf | 4 +- .../gnb-du.sa.band78.106prb.rfsim.pci0.conf | 4 +- .../gnb-du.sa.band78.106prb.rfsim.pci1.conf | 4 +- .../CONF/gnb-pnf.band78.rfsim.conf | 4 +- .../gnb.sa.band254.ntn.mu1.24prb.rfsim.conf | 5 +- .../gnb.sa.band255.ntn.mu0.25prb.rfsim.conf | 5 +- .../gnb.sa.band256.ntn.mu0.25prb.rfsim.conf | 5 +- .../CONF/gnb.sa.band66.u0.25prb.rfsim.conf | 5 +- .../gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf | 5 +- .../gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf | 5 +- ....sa.band78.fr1.106PRB.usrpb210.redcap.yaml | 11 +- .../gnb.sa.band78.fr1.106PRB.usrpb210.yaml | 11 +- .../CONF/gnb.sa.band78.fr1.189PRB.rfsim.conf | 6 +- 84 files changed, 400 insertions(+), 205 deletions(-) diff --git a/ci-scripts/conf_files/enb.band38.25prb.rfsim.conf b/ci-scripts/conf_files/enb.band38.25prb.rfsim.conf index c98544557b..e92d666f2a 100644 --- a/ci-scripts/conf_files/enb.band38.25prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band38.25prb.rfsim.conf @@ -200,9 +200,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( { diff --git a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf index aa110bbf95..b5fc72c839 100644 --- a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf @@ -233,9 +233,11 @@ RUs = } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf index cc7c74cd35..043fad4cae 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf @@ -233,9 +233,11 @@ RUs = } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf index cc7c74cd35..043fad4cae 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf @@ -233,9 +233,11 @@ RUs = } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf index f55adad153..5c9e7a7f41 100644 --- a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf @@ -233,9 +233,11 @@ RUs = } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf b/ci-scripts/conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf index 4e0b0fa089..5b996ca9a2 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf @@ -362,9 +362,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); THREAD_STRUCT = ( { diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf index fbc6de9b5e..56eef38c0a 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf @@ -197,13 +197,15 @@ RUs = ( } ); -rfsimulator: { -serveraddr = "server"; +rfsimulator = ( + { + serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; - IQfile = "/tmp/rfsimulator.iqs" -} + IQfile = "/tmp/rfsimulator.iqs"; + } +); log_config: { global_log_level = "info"; diff --git a/ci-scripts/conf_files/gnb-pnf.band66.rfsim.conf b/ci-scripts/conf_files/gnb-pnf.band66.rfsim.conf index d61d3032be..785a47022a 100644 --- a/ci-scripts/conf_files/gnb-pnf.band66.rfsim.conf +++ b/ci-scripts/conf_files/gnb-pnf.band66.rfsim.conf @@ -27,14 +27,15 @@ RUs = ({ eNB_instances = [0]; }); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); log_config: { global_log_level = "info"; diff --git a/ci-scripts/conf_files/gnb.band66.106prb.rfsim.phytest-dora.conf b/ci-scripts/conf_files/gnb.band66.106prb.rfsim.phytest-dora.conf index e69fee4722..0c62f664ce 100644 --- a/ci-scripts/conf_files/gnb.band66.106prb.rfsim.phytest-dora.conf +++ b/ci-scripts/conf_files/gnb.band66.106prb.rfsim.phytest-dora.conf @@ -191,10 +191,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; - + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf b/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf index 737ef0aadf..689dc92f2b 100644 --- a/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf +++ b/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf @@ -200,10 +200,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; - + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf index 8d71434f66..73f92960ca 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf @@ -234,14 +234,15 @@ RUs = ( } ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = ("chanmod"); #("saviq"); or/and "chanmod" prop_delay = 20; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); channelmod = { max_chan=10; diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf index b3884a3d31..83e6ec3983 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf @@ -242,14 +242,15 @@ RUs = ( } ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" prop_delay = 238.74; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band257.u3.66prb.rfsim.conf b/ci-scripts/conf_files/gnb.sa.band257.u3.66prb.rfsim.conf index d7c0e1a307..0c1ca120d5 100644 --- a/ci-scripts/conf_files/gnb.sa.band257.u3.66prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb.sa.band257.u3.66prb.rfsim.conf @@ -202,9 +202,11 @@ RUs = ({ eNB_instances = [0]; }); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band66.106prb.rfsim.conf b/ci-scripts/conf_files/gnb.sa.band66.106prb.rfsim.conf index 95384a0ae1..bae2bc15ff 100644 --- a/ci-scripts/conf_files/gnb.sa.band66.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb.sa.band66.106prb.rfsim.conf @@ -205,14 +205,15 @@ RUs = ( ); -rfsimulator : -{ +rfsimulator = ( + { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf index c297e40311..47c16c16d8 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf @@ -208,9 +208,11 @@ RUs = ( ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.flexric.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.flexric.conf index c54af1a4bb..a3f338f719 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.flexric.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.flexric.conf @@ -197,9 +197,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf index 7bfceaf620..d4c7a4e0cd 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf @@ -204,13 +204,15 @@ RUs = ({ }); -rfsimulator: { +rfsimulator = ( +{ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.prs.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.prs.conf index 3b6b591d85..05733fb397 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.prs.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.prs.conf @@ -155,8 +155,8 @@ gNBs = NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; - GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.140"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.140"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -217,14 +217,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.yaml b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.yaml index d67f5f5cc7..c72e2a30ce 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.yaml +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.yaml @@ -168,7 +168,7 @@ RUs: sdr_addrs: serial=XXXXXXX rfsimulator: - serveraddr: server + - serveraddr: server security: # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.24prb.rfsim.conf b/ci-scripts/conf_files/gnb.sa.band78.24prb.rfsim.conf index 7153c90421..ea51e351c5 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.24prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.24prb.rfsim.conf @@ -203,10 +203,11 @@ RUs = ( } ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; - + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/gnb.sa.band78.273prb.rfsim.2x2.conf b/ci-scripts/conf_files/gnb.sa.band78.273prb.rfsim.2x2.conf index cd949fe8d0..b224bb1f69 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.273prb.rfsim.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.273prb.rfsim.2x2.conf @@ -203,14 +203,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/nrue.band78.106prb.prs.conf b/ci-scripts/conf_files/nrue.band78.106prb.prs.conf index 1bf92fd0d6..a2348d75d4 100644 --- a/ci-scripts/conf_files/nrue.band78.106prb.prs.conf +++ b/ci-scripts/conf_files/nrue.band78.106prb.prs.conf @@ -87,3 +87,9 @@ PRSs = ); } ); + +rfsimulator = ( + { + serveraddr = "127.0.0.1"; + } +); diff --git a/ci-scripts/conf_files/nrue.uicc.conf b/ci-scripts/conf_files/nrue.uicc.conf index 5424abe30f..3b5deb5a4c 100644 --- a/ci-scripts/conf_files/nrue.uicc.conf +++ b/ci-scripts/conf_files/nrue.uicc.conf @@ -14,6 +14,12 @@ position0 = { thread-pool = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" +rfsimulator = ( + { + serveraddr = "127.0.0.1"; + } +); + #/* configuration for channel modelisation */ #/* To be included in main config file when */ #/* channel modelisation is used (rfsimulator with chanmod options enabled) */ @@ -40,4 +46,4 @@ channelmod = { ds_tdl = 0; } ); -}; \ No newline at end of file +}; diff --git a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf index 96c56e4f80..5072c5ea4a 100644 --- a/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf +++ b/ci-scripts/conf_files/nrue.uicc.ntn-leo.conf @@ -14,6 +14,13 @@ position0 = { thread-pool = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" +rfsimulator = ( + { + prop_delay = 20; + options = ("chanmod"); + } +); + RUs = ( { nb_tx = 1; diff --git a/ci-scripts/conf_files/nrue.uicc.yaml b/ci-scripts/conf_files/nrue.uicc.yaml index da3b7e7e19..a9ccee51f1 100644 --- a/ci-scripts/conf_files/nrue.uicc.yaml +++ b/ci-scripts/conf_files/nrue.uicc.yaml @@ -7,6 +7,9 @@ uicc0: thread-pool: "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" +rfsimulator: + - serveraddr: "127.0.0.1" + #/* configuration for channel modelisation */ #/* To be included in main config file when */ #/* channel modelisation is used (rfsimulator with chanmod options enabled) */ diff --git a/ci-scripts/conf_files/untested/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/ci-scripts/conf_files/untested/gnb.sa.band66.fr1.106PRB.usrpn300.conf index 36a79087ae..6715202229 100644 --- a/ci-scripts/conf_files/untested/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/untested/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -205,14 +205,15 @@ RUs = ( ); -rfsimulator : -{ +rfsimulator = ( + { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; + } +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/conf_files/untested/gnb.sa.band78.fr1.51PRB.usrpb210.conf b/ci-scripts/conf_files/untested/gnb.sa.band78.fr1.51PRB.usrpb210.conf index 7bdbe7127c..c6a0156162 100644 --- a/ci-scripts/conf_files/untested/gnb.sa.band78.fr1.51PRB.usrpb210.conf +++ b/ci-scripts/conf_files/untested/gnb.sa.band78.fr1.51PRB.usrpb210.conf @@ -200,14 +200,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index 5461f37a10..5dc93ca012 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -208,7 +208,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml index ab07314c91..e7bb4ceeb5 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml @@ -30,7 +30,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index 856428f728..7cb122884f 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -208,7 +208,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 50 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 50 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index 3458c4f11b..6afcdc7265 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -208,7 +208,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 100 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 100 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml index cadb22236a..dbb675c0e1 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml @@ -28,7 +28,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 + USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml index 027644d9a1..e4d12c8dcc 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml @@ -33,7 +33,7 @@ services: TZ: Europe/Paris HOSTNAME: oai_ue0 ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 + USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index 24acd9c676..eb86a31653 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -208,7 +208,7 @@ services: environment: TZ: Europe/Paris ASAN_OPTIONS: detect_leaks=0 - USE_ADDITIONAL_OPTIONS: --rfsim -T -C 2605000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -T -C 2605000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.[0].serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf healthcheck: diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 49dcf0e450..98eb1fb54c 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -130,10 +130,10 @@ services: environment: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time - --rfsimulator.options chanmod + --rfsimulator.[0].options chanmod --telnetsrv --telnetsrv.listenaddr 192.168.71.171 --telnetsrv.shrmod ci - --rfsimulator.serveraddr 192.168.71.181 + --rfsimulator.[0].serveraddr 192.168.71.181 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: - oai-cu @@ -168,7 +168,7 @@ services: --gNBs.[0].servingCellConfigCommon.[0].dl_absoluteFrequencyPointA 642024 --gNBs.[0].servingCellConfigCommon.[0].ssb_PositionsInBurst_Bitmap 3 --MACRLCs.[0].local_n_address 192.168.71.172 - --rfsimulator.serveraddr 192.168.71.181 + --rfsimulator.[0].serveraddr 192.168.71.181 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: - oai-cu @@ -199,8 +199,8 @@ services: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 - --rfsimulator.options chanmod - --rfsimulator.serveraddr server + --rfsimulator.[0].options chanmod + --rfsimulator.[0].serveraddr server --telnetsrv --telnetsrv.shrmod ciUE --telnetsrv.listenaddr 192.168.71.181 --telnetsrv.listenport 8091 --channelmod.modellist_rfsimu_1.[0].model_name rfsimu_channel_ue0 --channelmod.modellist_rfsimu_1.[1].model_name rfsimu_channel_ue1 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 629d0860fd..3d5d1c3583 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -256,7 +256,7 @@ Create the entry for the second UE in `docker-compose.yaml` file as follows: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb devices: diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 97dcce4d49..db9cc3e11e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -123,7 +123,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -150,7 +150,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -177,7 +177,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -204,7 +204,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -231,7 +231,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -258,7 +258,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -285,7 +285,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -312,7 +312,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -339,7 +339,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -366,7 +366,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3319680000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml b/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml index 0b2b60210a..99d97240ad 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml @@ -3,4 +3,4 @@ services: privileged: true stdin_open: true tty: true - command: gdb --args /opt/oai-nr-ue/bin/nr-uesoftmodem -O /opt/oai-nr-ue/etc/nr-ue.conf -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + command: gdb --args /opt/oai-nr-ue/bin/nr-uesoftmodem -O /opt/oai-nr-ue/etc/nr-ue.conf -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time diff --git a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml index b5b9684626..3b41894045 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml @@ -121,7 +121,7 @@ services: - NET_RAW # for ping environment: USE_ADDITIONAL_OPTIONS: --rfsim -r 24 --ssb 24 --numerology 1 -C 3604800000 --uicc0.imsi 208990100001100 - --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time --telnetsrv --telnetsrv.shrmod ciUE --telnetsrv.listenaddr 192.168.71.150 --telnetsrv.listenport 8091 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml index f3482280bd..90a3625b85 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml @@ -124,7 +124,7 @@ services: - NET_RAW # for ping - SYS_NICE environment: - USE_ADDITIONAL_OPTIONS: --rfsim -r 273 --numerology 1 --band 78 -C 3450720000 --ssb 1518 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -r 273 --numerology 1 --band 78 -C 3450720000 --ssb 1518 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index 200a1b6e3a..12ae3d41c6 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -309,7 +309,7 @@ services: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 - --rfsimulator.serveraddr oai-du + --rfsimulator.[0].serveraddr oai-du depends_on: - oai-du networks: @@ -339,7 +339,7 @@ services: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001101 --uicc0.nssai_sst 2 - --rfsimulator.serveraddr 192.168.78.3 + --rfsimulator.[0].serveraddr 192.168.78.3 depends_on: - oai-du2 networks: @@ -369,7 +369,7 @@ services: USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001102 --uicc0.nssai_sst 3 - --rfsimulator.serveraddr 192.168.78.4 + --rfsimulator.[0].serveraddr 192.168.78.4 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du3 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_fdd_phytest/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_fdd_phytest/docker-compose.yaml index 533c5d576c..9bed16bc6e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_fdd_phytest/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_fdd_phytest/docker-compose.yaml @@ -8,7 +8,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --phy-test --rfsim --rfsimulator.wait_timeout 20 --noS1 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --phy-test --rfsim --rfsimulator.[0].wait_timeout 20 --noS1 --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 networks: public_net: @@ -33,7 +33,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --phy-test --rfsim --noS1 --reconfig-file etc/rrc/reconfig.raw --rbconfig-file etc/rrc/rbconfig.raw --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --phy-test --rfsim --noS1 --reconfig-file etc/rrc/reconfig.raw --rbconfig-file etc/rrc/rbconfig.raw --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 devices: - /dev/net/tun:/dev/net/tun diff --git a/ci-scripts/yaml_files/5g_rfsimulator_flexric/docker-compose.yml b/ci-scripts/yaml_files/5g_rfsimulator_flexric/docker-compose.yml index 5bb8d0246d..84f8f4c89e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_flexric/docker-compose.yml +++ b/ci-scripts/yaml_files/5g_rfsimulator_flexric/docker-compose.yml @@ -105,7 +105,7 @@ services: privileged: true container_name: rfsim5g-oai-nr-ue environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 001010000000003 --rfsimulator.serveraddr 192.168.70.151 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 001010000000003 --rfsimulator.[0].serveraddr 192.168.70.151 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -124,7 +124,7 @@ services: privileged: true container_name: rfsim5g-oai-nr-ue2 environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 001010000000004 --rfsimulator.serveraddr 192.168.70.151 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 001010000000004 --rfsimulator.[0].serveraddr 192.168.70.151 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_fr2_66prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_fr2_66prb/docker-compose.yaml index 972dd56010..48fac60f20 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_fr2_66prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_fr2_66prb/docker-compose.yaml @@ -121,7 +121,7 @@ services: - NET_RAW # for ping environment: USE_ADDITIONAL_OPTIONS: --rfsim - --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time -C 27975360000 -r 66 --numerology 3 --ssb 48 --band 257 ASAN_OPTIONS: detect_leaks=0 devices: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_multiue/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_multiue/docker-compose.yaml index b44178a3f5..6dae12a972 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_multiue/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_multiue/docker-compose.yaml @@ -111,7 +111,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time --num-ues 10 + USE_ADDITIONAL_OPTIONS: -E --rfsim --log_config.global_log_options level,nocolor,time --num-ues 10 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf b/ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf index 92ccf9dca2..f0ac4dfff3 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf +++ b/ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf @@ -69,7 +69,136 @@ uicc9 = { nssai_sst=1; } - - thread-pool: "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1" +rfsimulator = ( + { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + }, { + serveraddr = "192.168.71.140"; + } +); + +RUs = ( + { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + } +); + +cells = ( + { + ru_id = 0; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 1; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 2; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 3; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 4; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 5; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 6; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 7; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 8; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 9; + band = 78; + rf_freq = 3319680000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + } +); diff --git a/ci-scripts/yaml_files/5g_rfsimulator_n2_ho/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_n2_ho/docker-compose.yaml index ad171109c7..87fee22e6d 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_n2_ho/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_n2_ho/docker-compose.yaml @@ -149,7 +149,7 @@ services: --gNBs.[0].nr_cellid 0 --telnetsrv --telnetsrv.listenaddr 192.168.71.171 --telnetsrv.shrmod ci - --rfsimulator.serveraddr 192.168.71.190 + --rfsimulator.[0].serveraddr 192.168.71.190 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: - oai-cucp-0 @@ -176,7 +176,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --rfsim --rfsimulator.serveraddr server + USE_ADDITIONAL_OPTIONS: --rfsim --rfsimulator.[0].serveraddr server --band 78 -C 3619200000 -r 106 --numerology 1 --ssb 516 --uicc0.imsi 208990100001100 --log_config.global_log_options level,nocolor,time @@ -259,7 +259,7 @@ services: - ALL environment: USE_ADDITIONAL_OPTIONS: --rfsim - --rfsimulator.serveraddr 192.168.71.190 + --rfsimulator.[0].serveraddr 192.168.71.190 --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_DU_ID 1234 --gNBs.[0].gNB_ID 0xb00 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml index 731b833f08..3ffa8290e9 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml @@ -123,7 +123,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.prop_delay 238.74 --rfsimulator.serveraddr 192.168.71.140 --num-ul-actors 1 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.[0].prop_delay 238.74 --rfsimulator.[0].serveraddr 192.168.71.140 --num-ul-actors 1 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml index a3f8ec2a7e..5cc17ce721 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml @@ -121,13 +121,10 @@ services: - NET_RAW # for ping environment: USE_ADDITIONAL_OPTIONS: - --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 - --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod - --rfsimulator.serveraddr 192.168.71.140 + --rfsim --rfsimulator.[0].serveraddr 192.168.71.140 --time-sync-I 0.1 --ntn-initial-time-drift -46 - --initial-fo 57340 --cont-fo-comp 2 + --initial-fo 57340 --cont-fo-comp 3 --log_config.global_log_options level,nocolor,time - --num-ul-actors 1 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_prs/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_prs/docker-compose.yaml index c6b6c338de..8eb887f3d8 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_prs/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_prs/docker-compose.yaml @@ -36,7 +36,7 @@ services: environment: USE_ADDITIONAL_OPTIONS: --phy-test --rfsim -E --reconfig-file etc/rrc/reconfig.raw --rbconfig-file etc/rrc/rbconfig.raw - --rfsimulator.serveraddr 192.168.71.140 + --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time --telnetsrv --telnetsrv.listenaddr 192.168.71.150 --telnetsrv.listenport 8091 --telnetsrv.shrmod ciUE diff --git a/ci-scripts/yaml_files/5g_rfsimulator_sidelink/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_sidelink/docker-compose.yaml index 5d8de35ac8..e1689da4ef 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_sidelink/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_sidelink/docker-compose.yaml @@ -8,7 +8,7 @@ services: - NET_ADMIN - NET_RAW environment: - USE_ADDITIONAL_OPTIONS: --sl-mode 2 --sync-ref 4 --rfsim --rfsimulator.serveraddr server --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --sl-mode 2 --sync-ref 4 --rfsim --rfsimulator.[0].serveraddr server --log_config.global_log_options level,nocolor,time networks: public_net: ipv4_address: 192.168.71.140 @@ -33,7 +33,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sl-mode 2 --rfsim --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --sl-mode 2 --rfsim --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-nr-ue-1 networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_tdd_dora/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_tdd_dora/docker-compose.yaml index 60484914a6..760c019398 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_tdd_dora/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_tdd_dora/docker-compose.yaml @@ -8,7 +8,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --do-ra --rfsim --rfsimulator.wait_timeout 20 --noS1 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --do-ra --rfsim --rfsimulator.[0].wait_timeout 20 --noS1 --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 networks: public_net: @@ -33,7 +33,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --do-ra --rfsim --noS1 --reconfig-file etc/rrc/reconfig.raw --rbconfig-file etc/rrc/rbconfig.raw --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --do-ra --rfsim --noS1 --reconfig-file etc/rrc/reconfig.raw --rbconfig-file etc/rrc/rbconfig.raw --rfsimulator.[0].serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 devices: - /dev/net/tun:/dev/net/tun diff --git a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml index c4a4e2ebea..3ceddd79b9 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml @@ -149,7 +149,7 @@ services: - NET_RAW # for ping environment: USE_ADDITIONAL_OPTIONS: --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152680000 --CO -400000000 --ssb 48 - --rfsimulator.serveraddr 192.168.71.141 --extra-pdu-id 2 --log_config.global_log_options level,nocolor,time + --rfsimulator.[0].serveraddr 192.168.71.141 --extra-pdu-id 2 --log_config.global_log_options level,nocolor,time --telnetsrv --telnetsrv.shrmod ciUE --telnetsrv.listenaddr 192.168.71.150 --telnetsrv.listenport 8091 ASAN_OPTIONS: detect_leaks=0:detect_odr_violation=0 depends_on: diff --git a/common/utils/LOG/DOC/lttng_logs.md b/common/utils/LOG/DOC/lttng_logs.md index 8918cbffe4..3baa9c04b2 100644 --- a/common/utils/LOG/DOC/lttng_logs.md +++ b/common/utils/LOG/DOC/lttng_logs.md @@ -65,7 +65,7 @@ Note: only LTTng 2.3.8 is supported. 1. **Run gNB:** ```bash - ./$binary_path -O $configuration_file PARALLEL_SINGLE_THREAD --rfsimulator.serveraddr server --rfsim -E + ./$binary_path -O $configuration_file PARALLEL_SINGLE_THREAD --rfsimulator.[0].serveraddr server --rfsim -E ``` ## Verifying Tracepoints diff --git a/common/utils/websrv/DOC/websrvuse.md b/common/utils/websrv/DOC/websrvuse.md index 5e3b4dac21..90b867b207 100644 --- a/common/utils/websrv/DOC/websrvuse.md +++ b/common/utils/websrv/DOC/websrvuse.md @@ -275,9 +275,9 @@ The web server back-end is using the [oai configuration module](Config/Rtusage). ## running the back-end To trigger the back-end use the `--websrv` option, possibly modifying the parameters as explained in the [previous section](./websrvuse.md#web-server-parameters). The two following commands allow starting the oai gNB and the oai 5G UE on the same computer, starting the telnet server and the web interface on both executables. -`./nr-softmodem -O /usr/local/oai/conf/gnb.band78.sa.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server --telnetsrv --telnetsrv.listenstdin --websrv --rfsimulator.options chanmod` +`./nr-softmodem -O /usr/local/oai/conf/gnb.band78.sa.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.[0].serveraddr server --telnetsrv --telnetsrv.listenstdin --websrv --rfsimulator.[0].options chanmod` -`./nr-uesoftmodem -O /usr/local/oai/conf/nrue_sim.conf --numerology 1 -r 106 -C 3649440000 --rfsim --rfsimulator.serveraddr 127.0.0.1 --websrv --telnetsrv --websrv.listenport 8092 --telnetsrv.listenport 8091` +`./nr-uesoftmodem -O /usr/local/oai/conf/nrue_sim.conf --numerology 1 -r 106 -C 3649440000 --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 --websrv --telnetsrv --websrv.listenport 8092 --telnetsrv.listenport 8091` diff --git a/doc/E1AP/E1-design.md b/doc/E1AP/E1-design.md index d9a7131393..c9465e696a 100644 --- a/doc/E1AP/E1-design.md +++ b/doc/E1AP/E1-design.md @@ -162,7 +162,7 @@ You need to use `--rfsim` if you are running the test with rfsimulator. OAI UE: ``` -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 ``` ## 3. Configuration file IP addresses of network functions diff --git a/doc/LDPC_XDMA_offload_setup.md b/doc/LDPC_XDMA_offload_setup.md index e32a414f88..c06c2eef5d 100644 --- a/doc/LDPC_XDMA_offload_setup.md +++ b/doc/LDPC_XDMA_offload_setup.md @@ -149,13 +149,13 @@ Example command using rfsim: ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-uesoftmodem --rfsim -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 1 --ue-nb-ant-rx 1 -O ../../../ci-scripts/conf_files/nrue1.uicc.cluCN.conf --rfsimulator.serveraddr 10.201.1.100 --loader.ldpc.shlibversion _xdma --nrLDPC_coding_xdma.num_threads_prepare 2 +sudo ./nr-uesoftmodem --rfsim -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 1 --ue-nb-ant-rx 1 -O ../../../ci-scripts/conf_files/nrue1.uicc.cluCN.conf --rfsimulator.[0].serveraddr 10.201.1.100 --loader.ldpc.shlibversion _xdma --nrLDPC_coding_xdma.num_threads_prepare 2 ``` or ```bash -sudo ./nr-uesoftmodem --rfsim -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 1 --ue-nb-ant-rx 1 -O ../../../ci-scripts/conf_files/nrue1.uicc.cluCN.conf --rfsimulator.serveraddr 10.201.1.100 +sudo ./nr-uesoftmodem --rfsim -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 1 --ue-nb-ant-rx 1 -O ../../../ci-scripts/conf_files/nrue1.uicc.cluCN.conf --rfsimulator.[0].serveraddr 10.201.1.100 ``` if you have added the configuration to the `.conf` file. diff --git a/doc/NR_SA_Tutorial_OAI_multi_UE.md b/doc/NR_SA_Tutorial_OAI_multi_UE.md index b8dd003e98..435d544606 100644 --- a/doc/NR_SA_Tutorial_OAI_multi_UE.md +++ b/doc/NR_SA_Tutorial_OAI_multi_UE.md @@ -39,7 +39,7 @@ Important notes: 2. After entering the bash environment, run the following command to deploy your first UE ```bash - sudo ./nr-uesoftmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.options chanmod --rfsimulator.serveraddr 10.201.1.100 --telnetsrv --telnetsrv.listenport 9095 + sudo ./nr-uesoftmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.[0].options chanmod --rfsimulator.[0].serveraddr 10.201.1.100 --telnetsrv --telnetsrv.listenport 9095 ``` 3. For the second UE, create the namespace ue2 (`-c2`), then execute shell inside (`-o2`, "open"): @@ -52,7 +52,7 @@ Important notes: 4. After entering the bash environment, run the following command to deploy your second UE: ```bash - sudo ./nr-uesoftmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000002 --rfsimulator.options chanmod --rfsimulator.serveraddr 10.202.1.100 --telnetsrv --telnetsrv.listenport 9096 + sudo ./nr-uesoftmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000002 --rfsimulator.[0].options chanmod --rfsimulator.[0].serveraddr 10.202.1.100 --telnetsrv --telnetsrv.listenport 9096 ``` in the command above, please note that the IMSI and the telnet port changed. diff --git a/doc/NR_SA_Tutorial_OAI_nrUE.md b/doc/NR_SA_Tutorial_OAI_nrUE.md index 3a6a949505..7a16897abf 100644 --- a/doc/NR_SA_Tutorial_OAI_nrUE.md +++ b/doc/NR_SA_Tutorial_OAI_nrUE.md @@ -191,7 +191,7 @@ The UE configuration must match the one of the network's AMF. The nrUE can conne When running the `nr-uesoftmodem`, one can specify the nrUE configuration file using the `-O` option. E.g.: ```bash -sudo ./nr-uesoftmodem --rfsim --rfsimulator.serveraddr 127.0.0.1 -r 106 --numerology 1 --band 78 -C 3619200000 -O ~/nrue.uicc.conf +sudo ./nr-uesoftmodem --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 -r 106 --numerology 1 --band 78 -C 3619200000 -O ~/nrue.uicc.conf ``` The CL option `--uicc0.imsi` can override the IMSI value in the configuration file if necessary (e.g. when running multiple UEs): `--uicc0.imsi 001010000000001`. diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 7660e74adb..401a374a66 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -174,7 +174,7 @@ Therefore either SDR boards and a dedicated NTN channel emulator are required, o As shown on the [rfsimulator page](../radio/rfsimulator/README.md), RFsimulator provides different possibilities. E.g. to perform a simple simulation of a satellite in geostationary orbit (GEO), these parameters should be added to both gNB and UE command lines: ``` ---rfsimulator.prop_delay 238.74 +--rfsimulator.[0].prop_delay 238.74 ``` For simulation of a satellite in low earth orbit (LEO), two channel models have been added to rfsimulator: @@ -210,7 +210,7 @@ This can be done by either providing this line in the conf file in section `rfsi ``` Or by providing this the the command line parameters: ``` ---rfsimulator.options chanmod +--rfsimulator.[0].options chanmod ``` #### gNB @@ -338,7 +338,7 @@ position0 = { So an example NR UE command for FDD, 5MHz BW, 15 kHz SCS, transparent GEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-uesoftmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.prop_delay 238.74 +sudo ./ran_build/build/nr-uesoftmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.[0].prop_delay 238.74 ``` For LEO satellite scenarios, the parameter `--ntn-initial-time-drift` must be provided via command line, as the UE needs this value to compensate for the time drift during initial sync, before SIB19 was received. @@ -356,7 +356,7 @@ For other information on optional NR UE command line options, please refer [here So an example NR UE command for FDD, 5MHz BW, 15 kHz SCS, transparent LEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-uesoftmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod --time-sync-I 0.1 --ntn-initial-time-drift -46 --initial-fo 57340 --cont-fo-comp 2 +sudo ./ran_build/build/nr-uesoftmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --band 254 -C 2488400000 --CO -873500000 -r 25 --numerology 0 --ssb 60 --rfsim --rfsimulator.[0].prop_delay 20 --rfsimulator.[0].options chanmod --time-sync-I 0.1 --ntn-initial-time-drift -46 --initial-fo 57340 --cont-fo-comp 2 ``` ## Specific OAI modes @@ -381,7 +381,7 @@ sudo ./nr-uesoftmodem --phy-test [--reconfig-file ../../../ci-scripts/rrc-files/ In summary: - If you are running on the same machine and launched the 2 executables (`nr-softmodem` and `nr-uesoftmodem`) from the same directory, nothing has to be done. - If you launched the 2 executables from 2 different folders, just point to the location where you launched the `nr-softmodem`: - * `sudo ./nr-uesoftmodem --rfsim --phy-test --reconfig-file /the/path/where/you/launched/nr-softmodem/reconfig-file --rbconfig-file /the/path/where/you/launched/nr-softmodem/rbconfig-file --rfsimulator.serveraddr ` + * `sudo ./nr-uesoftmodem --rfsim --phy-test --reconfig-file /the/path/where/you/launched/nr-softmodem/reconfig-file --rbconfig-file /the/path/where/you/launched/nr-softmodem/rbconfig-file --rfsimulator.[0].serveraddr ` - If you are not running on the same machine, you need to **COPY** the two raw files * `scp usera@machineA:/the/path/where/you/launched/nr-softmodem/r*config.raw userb@machineB:/the/path/where/you/will/launch/nr-uesoftmodem/` * Obviously this operation should be done before launching the `nr-uesoftmodem` executable. @@ -428,7 +428,7 @@ To run using the RFsimulator: ```bash sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --do-ra --rfsim -sudo ./nr-uesoftmodem --do-ra --rfsim --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-uesoftmodem --do-ra --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 ``` Using USRPs: diff --git a/doc/RUN_NR_PRS.md b/doc/RUN_NR_PRS.md index 68c7145fd3..d4bdf38f2c 100644 --- a/doc/RUN_NR_PRS.md +++ b/doc/RUN_NR_PRS.md @@ -101,7 +101,7 @@ If **N310 USRPs** are used, then run above command `without -E option` i.e witho To run using **rfsimulator** with local ETH IF `127.0.0.1`, execute following command: ``` -sudo ./nr-uesoftmodem --rfsim --phy-test --noS1 -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.nr.prs.fr1.106prb.conf --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-uesoftmodem --rfsim --phy-test --noS1 -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.nr.prs.fr1.106prb.conf --rfsimulator.[0].serveraddr 127.0.0.1 ``` ### FR2 test @@ -115,7 +115,7 @@ If RF beamforming module is NOT present, nrUE can still be launched with USRP al To run using **rfsimulator** with local ETH IF `127.0.0.1`, execute following command: ``` -sudo ./nr-uesoftmodem --rfsim --phy-test --noS1 -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.nr.prs.fr2.64prb.conf --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-uesoftmodem --rfsim --phy-test --noS1 -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.nr.prs.fr2.64prb.conf --rfsimulator.[0].serveraddr 127.0.0.1 ``` ### Multiple gNB scenario diff --git a/doc/data_recording.md b/doc/data_recording.md index 8b0469906c..75f4a54bbb 100644 --- a/doc/data_recording.md +++ b/doc/data_recording.md @@ -239,7 +239,7 @@ sudo ./cmake_targets/ran_build/build/nr-softmodem -O ./targets/PROJECTS/GENERIC- ``` Run NR gNB Softmodem in RF Simulation: ``` -sudo ./cmake_targets/ran_build/build/nr-softmodem -O ./targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.sa.fr1.106PRB.1x1.usrpx410_3300MHz.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.serveraddr server --phy-test -d --T_stdout 2 --T_nowait +sudo ./cmake_targets/ran_build/build/nr-softmodem -O ./targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.sa.fr1.106PRB.1x1.usrpx410_3300MHz.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.[0].serveraddr server --phy-test -d --T_stdout 2 --T_nowait ``` > **Note:** User needs to change the name of gNB config file to your gNB config file. @@ -265,7 +265,7 @@ sudo ./cmake_targets/ran_build/build/nr-uesoftmodem --usrp-args "type=x4xx,addr= Run OAI Soft UE in RF Simulation, assume the IP address of gNB server is `192.168.100.2`: ``` -sudo ./cmake_targets/ran_build/build/nr-uesoftmodem --rfsim --rfsimulator.serveraddr 192.168.100.2 --phy-test -O ./targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --reconfig-file /home/user/workarea/rrc_files/reconfig.raw --rbconfig-file /home/user/workarea/rrc_files/rbconfig.raw --T_stdout 2 --T_nowait --T_port 2023 +sudo ./cmake_targets/ran_build/build/nr-uesoftmodem --rfsim --rfsimulator.[0].serveraddr 192.168.100.2 --phy-test -O ./targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf --reconfig-file /home/user/workarea/rrc_files/reconfig.raw --rbconfig-file /home/user/workarea/rrc_files/rbconfig.raw --T_stdout 2 --T_nowait --T_port 2023 ``` ### Step3: Run Data Recording Application Services diff --git a/doc/handover-tutorial.md b/doc/handover-tutorial.md index a4edecd193..58c0808108 100644 --- a/doc/handover-tutorial.md +++ b/doc/handover-tutorial.md @@ -76,7 +76,7 @@ Start the CU including telnet support: Start DU0: - sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf --rfsimulator.[0].serveraddr 127.0.0.1 This will show an error `[HW] connect() to 127.0.0.1:4043 failed, errno(111)`. _This is expected_, because the RFsim server is at the UE (to be @@ -84,7 +84,7 @@ able to serve two RFsim clients, one DU each; see below for more info). Proceed by starting the UE, and let it connect completely (this should make the error go away): - sudo ./nr-uesoftmodem -C 3450720000 -r 106 --numerology 1 --ssb 516 -O --rfsim --rfsimulator.serveraddr server + sudo ./nr-uesoftmodem -C 3450720000 -r 106 --numerology 1 --ssb 516 -O --rfsim --rfsimulator.[0].serveraddr server Note how the RFsimulator roles have been switched, and RFsim server is at the UE side; _this is important_. Replace `` with the UE configuration @@ -93,7 +93,7 @@ matching your core. If you followed the CN and oaiUE tutorials, you can remove Once the UE is connected, start DU1: - sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf --rfsimulator.[0].serveraddr 127.0.0.1 Once DU1 is online, you can trigger a handover by issuing this command @@ -461,13 +461,13 @@ Run the 5G Core Network if not already running. 2. Start the source gNB (gNB-PCI0) e.g. ```sh -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf --telnetsrv --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf --telnetsrv --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 ``` 3. Start the UE e.g. ```sh -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.serveraddr server +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.[0].serveraddr server ``` Ensure the UE successfully registers with the network. @@ -475,7 +475,7 @@ Ensure the UE successfully registers with the network. 4. Start the target gNB (gNB-PCI1) e.g. ```sh -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf --rfsim --telnetsrv --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 6 --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf --rfsim --telnetsrv --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 6 --rfsimulator.[0].serveraddr 127.0.0.1 ``` **Note for same-machine setup:** When running both gNBs on the same machine, diff --git a/doc/nfapi.md b/doc/nfapi.md index 159255f4cf..4929b656f7 100644 --- a/doc/nfapi.md +++ b/doc/nfapi.md @@ -238,7 +238,7 @@ Run cu_stu and ric_stub in separate terminals Run the OAI PNF first, as it is the WLS memory master - sudo NFAPI_TRACE_LEVEL=info ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.2x2.conf --nfapi PNF --rfsim --rfsimulator.serveraddr server + sudo NFAPI_TRACE_LEVEL=info ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.2x2.conf --nfapi PNF --rfsim --rfsimulator.[0].serveraddr server Run the O-DU over GDB diff --git a/openair1/PHY/CODING/DOC/LDPCImplementation.md b/openair1/PHY/CODING/DOC/LDPCImplementation.md index 56e7570de4..d6ea6565fa 100644 --- a/openair1/PHY/CODING/DOC/LDPCImplementation.md +++ b/openair1/PHY/CODING/DOC/LDPCImplementation.md @@ -41,7 +41,7 @@ At runtime, to successfully use LDPC accelerators (e.g., Xilinx T2/Intel ACCs), Please refer to the dedicated documentation at [LDPC_OFFLOAD_SETUP.md](file://../../../../doc/LDPC_OFFLOAD_SETUP.md). ``` -./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --log_config.gtpu_log_level info --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev 01:00.0 --nrLDPC_coding_aal.dpdk_core_list 0-1 +./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.[0].serveraddr server --log_config.gtpu_log_level info --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev 01:00.0 --nrLDPC_coding_aal.dpdk_core_list 0-1 ``` `libldpc_aal.so` has its decoder and its encoder implemented in [nrLDPC_coding_aal.c](file://../nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c). @@ -61,7 +61,7 @@ At runtime, to successfully use the xdma, you need to install vendor specific dr Please refer to the dedicated documentation at [LDPC_XDMA_OFFLOAD_SETUP.md](file://../../../../doc/LDPC_XDMA_OFFLOAD_SETUP.md). ``` -./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --log_config.gtpu_log_level info --loader.ldpc.shlibversion _xdma --nrLDPC_coding_xdma.num_threads_prepare 2 +./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.[0].serveraddr server --log_config.gtpu_log_level info --loader.ldpc.shlibversion _xdma --nrLDPC_coding_xdma.num_threads_prepare 2 ``` `libldpc_xdma.so` has its decoder implemented in [nrLDPC_coding_xdma.c](file://../nrLDPC_coding/nrLDPC_coding_xdma/nrLDPC_coding_xdma.c).\ diff --git a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md index e3e3bd3189..b7380ec422 100644 --- a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md +++ b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md @@ -123,17 +123,17 @@ Please refer to this documentation [telnetusage.md](../../../../common/utils/tel When the `chanmod` option is enabled, the RF channel simulator with a channel modeling function is called. Add the following options to the command line to enable the channel model: ```bash ---rfsimulator.options chanmod +--rfsimulator.[0].options chanmod ``` Example run of OAI RFSIM on the same machine with activation of the channel model via command line: gNB: ```bash -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.options chanmod --telnetsrv +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.[0].options chanmod --telnetsrv ``` UE: ```bash -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.serveraddr 127.0.0.1 --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.options chanmod +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.[0].serveraddr 127.0.0.1 --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.[0].options chanmod ``` where `@include "channelmod_rfsimu.conf"` has been added at the end of `ci-scripts/conf_files/channelmod_rfsimu.conf` which has been copied to `targets/PROJECTS/GENERIC-LTE-EPC/CONF/`. @@ -175,7 +175,7 @@ Example usage, set the offset for the selected model of the selected `modellist` e.g. with the softmodem: ```bash -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.options chanmod --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.[0].options chanmod --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 ``` ## Real time control and monitoring with telnet server diff --git a/openair2/E2AP/README.md b/openair2/E2AP/README.md index 5644d10cb5..3a334aac09 100644 --- a/openair2/E2AP/README.md +++ b/openair2/E2AP/README.md @@ -187,9 +187,9 @@ e2_agent = { ```bash cd /build # for gNB-mono - sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.[0].serveraddr 127.0.0.1 # for CU/DU and CU-CP/CU-UP/DU split - sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3450720000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3450720000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.[0].serveraddr 127.0.0.1 ``` Note: [multi-UE rfsim deployment tutorial](../../doc/NR_SA_Tutorial_OAI_multi_UE.md?ref_type=heads#run-multiple-ues-in-rfsimulator) diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 6dfaf9c57f..d97bec7395 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -56,7 +56,7 @@ #define RAU_REMOTE_THIRDPARTY_RADIO_HEAD 2 #define MAX_WRITE_THREAD_PACKAGE 10 #define MAX_WRITE_THREAD_BUFFER_SIZE 8 -#define MAX_CARDS 8 +#define MAX_CARDS 10 typedef int64_t openair0_timestamp_t; typedef volatile int64_t openair0_vtimestamp_t; diff --git a/radio/rfsimulator/README.md b/radio/rfsimulator/README.md index 298c7ecfda..c05df0fbbd 100644 --- a/radio/rfsimulator/README.md +++ b/radio/rfsimulator/README.md @@ -64,42 +64,44 @@ This is equivalent to using `-w SIMU` when running the `build_oai` script. To use the RF simulator add the `--rfsim` option to the command line. By default the RF simulator device will try to connect to host 127.0.0.1, port 4043, which is usually the behavior for the UE. For the eNB/gNB, you either -have to pass `--rfsimulator.serveraddr server` on the command line, or specify +have to pass `--rfsimulator.[0].serveraddr server` on the command line, or specify the corresponding section in the configuration file. The RF simulator is using the configuration module, and its parameters are defined in a specific section called "rfsimulator". Add the following options to the command line in order to enable different RFSim features: -| CL option | usage | default | -|:--------------------- |:-------------------------------------------------------------------------------|----: | -|`--rfsimulator.serveraddr ` | IPv4v6 address or DNS name to connect to, or `server` to behave as a IPv4v6 TCP server | 127.0.0.1 | -|`--rfsimulator.serverport ` | port number to connect to or to listen on (eNB, which behaves as a tcp server) | 4043 | -|`--rfsimulator.options` | list of comma separated run-time options, two are supported: `chanmod`, `saviq`| all options disabled | -|`--rfsimulator.options saviq` | store IQs to a file for future replay | disabled | -|`--rfsimulator.options chanmod` | enable the channel model | disabled | -|`--rfsimulator.IQfile ` | path to a file to store the IQ samples to (only with `saviq`) | `/tmp/rfsimulator.iqs` | -|`--rfsimulator.prop_delay` | simulated receive-path (gNB: UL, UE: DL) propagation delay in ms | 0 | -|`--rfsimulator.wait_timeout` | wait timeout when no UE is connected | 1 | +| CL option | usage | default | +|:-------------------------------------|:-------------------------------------------------------------------------------|----: | +|`--rfsimulator.[0].serveraddr ` | IPv4v6 address or DNS name to connect to, or `server` to behave as a IPv4v6 TCP server | 127.0.0.1 | +|`--rfsimulator.[0].serverport ` | port number to connect to or to listen on (eNB, which behaves as a tcp server) | 4043 | +|`--rfsimulator.[0].options` | list of comma separated run-time options, two are supported: `chanmod`, `saviq`| all options disabled | +|`--rfsimulator.[0].options saviq` | store IQs to a file for future replay | disabled | +|`--rfsimulator.[0].options chanmod` | enable the channel model | disabled | +|`--rfsimulator.[0].IQfile ` | path to a file to store the IQ samples to (only with `saviq`) | `/tmp/rfsimulator.iqs` | +|`--rfsimulator.[0].prop_delay` | simulated receive-path (gNB: UL, UE: DL) propagation delay in ms | 0 | +|`--rfsimulator.[0].wait_timeout` | wait timeout when no UE is connected | 1 | Please refer to this document [`SIMULATION/TOOLS/DOC/channel_simulation.md`](../../openair1/SIMULATION/TOOLS/DOC/channel_simulation.md) for information about using the RFSimulator options to run the simulator with a channel model. ## 4G case -For the eNB, use a valid configuration file setup for the USRP board tests and start the softmodem with the `--rfsim` and `--rfsimulator.serveraddr server` options. +For the eNB, use a valid configuration file setup for the USRP board tests and start the softmodem with the `--rfsim` and `--rfsimulator.[0].serveraddr server` options. ```bash -sudo ./lte-softmodem -O --rfsim --rfsimulator.serveraddr server +sudo ./lte-softmodem -O --rfsim --rfsimulator.[0].serveraddr server ``` Often, configuration files define the corresponding `rfsimulator` section, in -which case you might omit `--rfsimulator.serveraddr server`. Example: +which case you might omit `--rfsimulator.[0].serveraddr server`. Example: ``` -rfsimulator : { - serveraddr = "server"; -}; +rfsimulator = ( + { + serveraddr = "server"; + } +); ``` For the UE, it should be set to the IP address of the eNB. For instance, if the eNB runs on another host with IP `192.168.2.200`, do ```bash -sudo ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim --rfsimulator.serveraddr 192.168.2.200 +sudo ./lte-uesoftmodem -C 2685000000 -r 50 --rfsim --rfsimulator.[0].serveraddr 192.168.2.200 ``` For running on the same host, only `--rfsim` is necessary. @@ -117,7 +119,7 @@ Similarly as for 4G, first launch the gNB, here in an example for the phytest: run gNB: ```bash - sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --phy-test --rfsim --rfsimulator.serveraddr server + sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --phy-test --rfsim --rfsimulator.[0].serveraddr server ``` where `--gNBs.[0].min_rxtxtime 6` is due to the UE not being able to handle shorter @@ -127,19 +129,19 @@ in the config file. and run UE: ```bash - sudo ./nr-uesoftmodem --rfsim --phy-test --rfsimulator.serveraddr + sudo ./nr-uesoftmodem --rfsim --phy-test --rfsimulator.[0].serveraddr ``` To run OAI RFSimulator for SA mode, gNB: ```bash - sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server + sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.[0].serveraddr server ``` and UE: ```bash - sudo ./nr-uesoftmodem --rfsim --rfsimulator.serveraddr + sudo ./nr-uesoftmodem --rfsim --rfsimulator.[0].serveraddr ``` In the commands for the UE, `TARGET_GNB_IP_ADDRESS` can be 127.0.0.1 if both UE and gNB run on the same machine. @@ -182,7 +184,7 @@ In case of a transparent GEO satellite, the minumum one-way propagation delay (D So, additionally to other parameters, this parameter should be given when executing the gNB and the UE executables: ``` ---rfsimulator.prop_delay 238.74 +--rfsimulator.[0].prop_delay 238.74 ``` Note: @@ -218,8 +220,8 @@ RFsimulator supports beam domain simulation. Several new CLI parameters were added -* `--rfsimulator.enable_beams` : enable beam domain simulation. Should match on server and all clients. -* `--rfsimulator.beam_gains ` : define a matrix of additional pathloss values (in dB) +* `--rfsimulator.[0].enable_beams` : enable beam domain simulation. Should match on server and all clients. +* `--rfsimulator.[0].beam_gains ` : define a matrix of additional pathloss values (in dB) to simulate the effect of different beam combinations in the RF simulator. You provide a comma-separated list of numbers, which forms the first row of a square matrix. The rest of the matrix is filled by projecting these values onto the diagonals, making it symmetric. @@ -236,10 +238,10 @@ these values onto the diagonals, making it symmetric. Using the example above, if gNB is receiving in beam 1 and the UE is transmitting in beam 1, an additional 2 dB pathloss will be applied on top of the pathloss from the channel model (if present). -* `--rfsimulator.beam_map ` : where `` is a `uint64_t` value where each bit is an enabled TX/RX beam. +* `--rfsimulator.[0].beam_map ` : where `` is a `uint64_t` value where each bit is an enabled TX/RX beam. For gNB: Initial beam_map, i.e. which beams gNB transmits/receives before calling beam APIs. For UE: Beam position in beam space in the simulation. The UE is not expected to use the beam APIs for now. -* `--rfsimulator.beam_ids ` : where `` is a comma separated list. Same as above but added for convenience. +* `--rfsimulator.[0].beam_ids ` : where `` is a comma separated list. Same as above but added for convenience. ## Runtime commands diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 0c053aeda2..5b26815a35 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -196,13 +196,15 @@ RUs = ( } ); -rfsimulator: { -serveraddr = "server"; +rfsimulator = ( + { + serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" -} + } +); log_config : { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci0.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci0.conf index 8c200c72fd..f4176d70d3 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci0.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci0.conf @@ -187,13 +187,13 @@ RUs = ({ clock_src = "internal"; }); -rfsimulator: { +rfsimulator = ({ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" -} +}); log_config: { global_log_level = "info"; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci1.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci1.conf index f87cc2bb8c..1154b03968 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci1.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band66.25prb.rfsim.pci1.conf @@ -187,13 +187,13 @@ RUs = ({ clock_src = "internal"; }); -rfsimulator: { +rfsimulator = ({ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" -} +}); log_config: { global_log_level = "info"; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf index 09eb99a6b2..cca51dbf7f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf @@ -185,13 +185,13 @@ RUs = ({ clock_src = "internal"; }); -rfsimulator: { +rfsimulator =({ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" -} +}); log_config: { global_log_level = "info"; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf index d2998de712..0c34ec90f9 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf @@ -185,13 +185,13 @@ RUs = ({ clock_src = "internal"; }); -rfsimulator: { +rfsimulator =({ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs" -} +}); log_config: { global_log_level = "info"; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.conf index 08691c3b62..96c9b3f6ed 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-pnf.band78.rfsim.conf @@ -27,9 +27,9 @@ RUs = ({ max_rxgain = 125; }); -rfsimulator: { +rfsimulator = ({ serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; -}; +}); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band254.ntn.mu1.24prb.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band254.ntn.mu1.24prb.rfsim.conf index 10caa403d3..81344ddee2 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band254.ntn.mu1.24prb.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band254.ntn.mu1.24prb.rfsim.conf @@ -237,14 +237,15 @@ THREAD_STRUCT = ( } ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band255.ntn.mu0.25prb.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band255.ntn.mu0.25prb.rfsim.conf index 1684a375d0..8b98f020b9 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band255.ntn.mu0.25prb.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band255.ntn.mu0.25prb.rfsim.conf @@ -236,14 +236,15 @@ THREAD_STRUCT = ( } ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band256.ntn.mu0.25prb.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band256.ntn.mu0.25prb.rfsim.conf index c20188594d..ec5896abfb 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band256.ntn.mu0.25prb.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band256.ntn.mu0.25prb.rfsim.conf @@ -236,14 +236,15 @@ THREAD_STRUCT = ( } ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.u0.25prb.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.u0.25prb.rfsim.conf index 428b6cb27c..bb06a08d7f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.u0.25prb.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.u0.25prb.rfsim.conf @@ -207,14 +207,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf index b486b52dec..7f22aee70c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci0.rfsim.conf @@ -205,14 +205,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf index c649c8b0f8..ae9b0ea5fc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.pci1.rfsim.conf @@ -205,14 +205,15 @@ RUs = ( ); -rfsimulator : +rfsimulator = ( { serveraddr = "server"; serverport = 4043; options = (); #("saviq"); or/and "chanmod" modelname = "AWGN"; IQfile = "/tmp/rfsimulator.iqs"; -}; +} +); security = { # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml index 725b85a31e..c58c804050 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml @@ -195,11 +195,12 @@ RUs: clock_src: internal rfsimulator: - serveraddr: server - serverport: 4043 - options: [] #("saviq"); or/and "chanmod" - modelname: AWGN - IQfile: /tmp/rfsimulator.iqs + - + serveraddr: server + serverport: 4043 + options: [] #("saviq"); or/and "chanmod" + modelname: AWGN + IQfile: /tmp/rfsimulator.iqs security: # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml index 8608ccd290..3c952ac967 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml @@ -176,11 +176,12 @@ RUs: clock_src: internal rfsimulator: - serveraddr: server - serverport: 4043 - options: [] #("saviq"); or/and "chanmod" - modelname: AWGN - IQfile: /tmp/rfsimulator.iqs + - + serveraddr: server + serverport: 4043 + options: [] #("saviq"); or/and "chanmod" + modelname: AWGN + IQfile: /tmp/rfsimulator.iqs security: # preferred ciphering algorithms diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.189PRB.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.189PRB.rfsim.conf index 22047cf06c..7df8360a8e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.189PRB.rfsim.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.189PRB.rfsim.conf @@ -208,9 +208,11 @@ RUs = ( ); -rfsimulator: { +rfsimulator = ( + { serveraddr = "server"; -}; + } +); security = { # preferred ciphering algorithms From a91838937fa7bcb7cf27acdc51ed710d3ce839f1 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 1 Sep 2025 14:51:07 +0000 Subject: [PATCH 20/21] Add documentation on multiple NR UE RF-frontends to RUNMODEM.md --- doc/RUNMODEM.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 401a374a66..1515172b24 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -140,6 +140,104 @@ You can view all available options by typing: ```shell ./nr-uesoftmodem --help ``` + +### NR UE: Configure multiple RF-frontends (RUs) + +Multiple RF-frontends (also called RUs) can be defined for the nr-uesoftmodem. +Therefore, two sections in the NR UE configuration file are used: +- `RUs` +- `cells` + +The `RUs` section in the NR UE configuration file contains an array of elements, where each element has these properies: + +| Property name | Type | Default value | Description | +| ---------------- | -------------- | ------------- | ------------------------------------ | +| nb_tx | integer | 1 | Number of TX Antennas | +| nb_rx | integer | 1 | Number of RX Antennas | +| att_tx | integer | 0 | TX Attenuation in dB | +| att_rx | integer | 0 | RX Attenuation in dB | +| max_rxgain | integer | 120 | Maximum RX Gain at 0 dB Attenuation | +| sdr_addrs | string | type=b200 | SDR Parameter String | +| tx_subdev | string | | SDR TX Subdevice | +| rx_subdev | string | | SDR RX Subdevice | +| clock_src | string | internal | SDR Clock Source | +| time_src | string | internal | SDR Time Source | +| tune_offset | floating point | 0.0 | SDR Tune Offset in Hz | +| if_freq | integer | 0 | DL Intermediate Frequency in Hz | +| if_offset | integer | 0 | UL Intermediate Frequency Offset in Hz | + +The `cells` section in the NR UE configuration file contains an array of elements, where each element has these properies: + +| Property name | Type | Default value | Description | +| ---------------- | ------- | ------------- | ---------------------------------------- | +| ru_id | integer | 0 | ID of the associated RU from the `RUs` section | +| band | integer | 78 | 5G NR Band | +| rf_freq | integer | 0 | DL Carrier Centre Frequency in Hz | +| rf_offset | integer | 0 | DL Carrier Centre Frequency Offset in Hz | +| numerology | integer | 1 | 5G NR Numerology (ยต) | +| N_RB_DL | integer | 106 | Number of DL Carrier Ressource Blocks | +| ssb_start | integer | 516 | Ressource Element where the SSB Starts | + +There are different scenarios where multiple RF-frontends (also called RUs) are beneficial for the NR UE: + +1. RF-Simulator Inter-Frequency Handover between multiple cells +2. Multiple UEs in one instance, each using their own RF-frontend (RF-Simulator connection) +3. Different Antennas connected to different RF-ports +4. Concurrent connection to multiple carriers (carrier aggregation CA) + +This would be and example configuration for the 1. scenario: + +``` +rfsimulator = ( + { + serveraddr = "127.0.0.2"; + serverport = 4043; + }, { + serveraddr = "127.0.0.3"; + serverport = 4044; + } +); + +RUs = ( + { + nb_tx = 1; + nb_rx = 1; + }, { + nb_tx = 1; + nb_rx = 1; + } +); + +cells = ( + { + ru_id = 0; + band = 78; + rf_freq = 3619200000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + }, { + ru_id = 1; + band = 78; + rf_freq = 3649440000L; + numerology = 1; + N_RB_DL = 106; + ssb_start = 516; + } +); +``` + +An example for the 2. scenario can be found in the file [ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf](../ci-scripts/yaml_files/5g_rfsimulator_multiue/nrue.uicc.conf). + +The 3. scenario is similar to 1., but instead of providing RF-Simulator parameters, actual SDR parameters have to be provided. + +The 4. scenario is not supported, as the NR UE does not implement CA, yet. + +Current Limitations: +- Each RU can be used by only one cell. +- Each RU and cell can be used by only one UE (no RU sharing implemented, yet). +- The sampling rates of all RUs must be the same. + ### Common gNB and NR UE command line options #### Three-quarter sampling From fce8185467e06781d4beee5abd465ee9f8c2426d Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 27 Jan 2026 16:46:02 +0100 Subject: [PATCH 21/21] use function pointer instead of weak function for openair0_write_reorder_common() --- executables/nr-ue-ru.c | 6 ++++-- radio/COMMON/common_lib.c | 26 +++++++++----------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index f439374e5b..11303c2fa6 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -505,7 +505,9 @@ int nrue_ru_write(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **buf return ret; } -int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, +typedef int (*nrue_ru_write_t)(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags); +int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write, + PHY_VARS_NR_UE *UE, openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, @@ -516,7 +518,7 @@ int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, int nrue_ru_write_reorder(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) { openair0_device_t *device = &openair0_dev[UE->rf_map.card]; - return openair0_write_reorder_common(UE, device, timestamp, txp, nsamps, nbAnt, flags); + return openair0_write_reorder_common(nrue_ru_write, UE, device, timestamp, txp, nsamps, nbAnt, flags); } void nrue_ru_write_reorder_clear_context(PHY_VARS_NR_UE *UE) diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index a7cd226ddc..7b70dc20fa 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -188,18 +188,9 @@ static void writerEnqueue(re_order_t *ctx, openair0_timestamp_t timestamp, void } typedef struct PHY_VARS_NR_UE_s PHY_VARS_NR_UE; -__attribute__((weak)) int nrue_ru_write(PHY_VARS_NR_UE *UE, - openair0_timestamp_t timestamp, - void **txp, - int nsamps, - int nbAnt, - int flags) -{ - AssertFatal(0, "this weak function implementation should never be called!\n"); - return 0; -} +typedef int (*nrue_ru_write_t)(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags); -static void writerProcessWaitingQueue(PHY_VARS_NR_UE *UE, openair0_device_t *device) +static void writerProcessWaitingQueue(nrue_ru_write_t nrue_ru_write, PHY_VARS_NR_UE *UE, openair0_device_t *device) { bool found = false; re_order_t *ctx = &device->reOrder; @@ -222,7 +213,7 @@ static void writerProcessWaitingQueue(PHY_VARS_NR_UE *UE, openair0_device_t *dev found = true; if (flags || IS_SOFTMODEM_RFSIM) { int wroteSamples; - if (UE) + if (nrue_ru_write) wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags); else wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); @@ -242,7 +233,8 @@ static void writerProcessWaitingQueue(PHY_VARS_NR_UE *UE, openair0_device_t *dev // but to make zerocopy and agnostic design, we need to make a proper ring buffer with mutex protection // mutex (or atomic flags) will be mandatory because this out order system root cause is there are several writer threads -int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, +int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write, + PHY_VARS_NR_UE *UE, openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, @@ -263,7 +255,7 @@ int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, // We have the write exclusivity if (llabs(timestamp - ctx->nextTS) < MAX_GAP) { // We are writing in sequence of the previous write if (flags || IS_SOFTMODEM_RFSIM) { - if (UE) + if (nrue_ru_write) wroteSamples = nrue_ru_write(UE, timestamp, txp, nsamps, nbAnt, flags); else wroteSamples = device->trx_write_func(device, timestamp, txp, nsamps, nbAnt, flags); @@ -274,13 +266,13 @@ int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, } else { writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags); } - writerProcessWaitingQueue(UE, device); + writerProcessWaitingQueue(nrue_ru_write, UE, device); pthread_mutex_unlock(&ctx->mutex_write); return wroteSamples ? wroteSamples : nsamps; } writerEnqueue(ctx, timestamp, txp, nsamps, nbAnt, flags); if (pthread_mutex_trylock(&ctx->mutex_write) == 0) { - writerProcessWaitingQueue(UE, device); + writerProcessWaitingQueue(nrue_ru_write, UE, device); pthread_mutex_unlock(&ctx->mutex_write); } return nsamps; @@ -288,7 +280,7 @@ int openair0_write_reorder_common(PHY_VARS_NR_UE *UE, int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags) { - return openair0_write_reorder_common(NULL, device, timestamp, txp, nsamps, nbAnt, flags); + return openair0_write_reorder_common(NULL, NULL, device, timestamp, txp, nsamps, nbAnt, flags); } void openair0_write_reorder_clear_context(openair0_device_t *device)