Commit dc30b30b authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'nr_initialsync' of...

Merge branch 'nr_initialsync' of https://gitlab.eurecom.fr/oai/openairinterface5g into nr_initialsync
parents c2aabeaa 1b68a4f2
......@@ -986,6 +986,11 @@ set(SCHED_SRC
)
add_library(SCHED_LIB ${SCHED_SRC})
set(SCHED_NR_SRC
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
)
add_library(SCHED_NR_LIB ${SCHED_NR_SRC})
set(SCHED_SRC_UE
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
......@@ -2204,7 +2209,7 @@ add_executable(nr-softmodem
target_link_libraries (nr-softmodem
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_NR PHY LFDS GTPV1U SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_NR_LIB PHY_NR PHY LFDS GTPV1U SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB}
RRC_LIB S1AP_LIB S1AP_ENB L2
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#include "../defs_NR.h"
#include "PHY/defs.h"
#include "SCHED/defs.h"
#include "PHY/extern.h"
#include "SIMULATION/TOOLS/defs.h"
......@@ -530,9 +530,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL;
}
/*
void install_schedule_handlers(IF_Module_t *if_inst)
{
if_inst->PHY_config_req = phy_config_request;
if_inst->schedule_response = schedule_response;
}
}*/
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#include "../defs_NR.h"
#include "../defs.h"
#include "log.h"
/// Subcarrier spacings in Hz indexed by numerology index
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#include "../defs_NR.h"
#include "PHY/defs.h"
#define NR_PSS_DEBUG
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#include "../defs_NR.h"
#include "PHY/defs.h"
extern short nr_mod_table[MOD_TABLE_SIZE_SHORT];
......
......@@ -142,6 +142,7 @@ static inline void* malloc16_clear( size_t size )
#include "targets/ARCH/COMMON/common_lib.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#if defined(EXMIMO) || defined(OAI_USRP)
//#define NUMBER_OF_eNB_MAX 1
//#define NUMBER_OF_UE_MAX 16
......@@ -164,13 +165,51 @@ static inline void* malloc16_clear( size_t size )
#define MAX_FRAME_NUMBER 0x400
#if 1
typedef struct {
/// EUTRA Band
uint8_t eutra_band;
/// DL carrier frequency
uint32_t dl_CarrierFreq;
/// UL carrier frequency
uint32_t ul_CarrierFreq;
/// TX attenuation
uint32_t att_tx;
/// RX attenuation
uint32_t att_rx;
/// total Number of Resource Block Groups: this is ceil(N_PRB/P)
uint32_t subcarrier_spacing;
/// 3/4 sampling
uint8_t threequarter_fs;
/// Size of FFT
uint16_t ofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot
uint16_t nb_prefix_samples;
/// Number of prefix samples in first symbol of slot
uint16_t nb_prefix_samples0;
/// Carrier offset in FFT buffer for first RE in PRB0
uint16_t first_carrier_offset;
/// Number of OFDM/SC-FDMA symbols in one slot
uint16_t symbols_per_slot;
/// Number of slots per subframe
uint16_t slots_per_subframe;
/// Number of samples in a subframe
uint32_t samples_per_subframe;
/// Number of samples in a radio frame
uint32_t samples_per_frame;
/// Number of samples in a subframe without CP
uint32_t samples_per_subframe_wCP;
/// Number of samples in a radio frame without CP
uint32_t samples_per_frame_wCP;
} NR_DL_FRAME_PARMS;
struct PHY_VARS_gNB_s;
#endif
#define NUMBER_OF_RN_MAX 3
typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t;
#define MCS_COUNT 28
#define MCS_TABLE_LENGTH_MAX 64
......@@ -183,7 +222,6 @@ typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_rela
#define MAX_BANDS_PER_RRU 4
#ifdef OCP_FRAMEWORK
#include <enums.h>
#else
......@@ -211,7 +249,8 @@ typedef enum {
NGFI_RAU_IF4p5, // RAU with NFGI IF4p5
NGFI_RRU_IF5, // NGFI_RRU (NGFI remote radio-unit,IF5)
NGFI_RRU_IF4p5, // NGFI_RRU (NGFI remote radio-unit,IF4p5)
MBP_RRU_IF5 // Mobipass RRU
MBP_RRU_IF5, // Mobipass RRU
gNodeB_3GPP
} node_function_t;
typedef enum {
......@@ -331,6 +370,7 @@ typedef struct RU_proc_t_s {
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_eNBs.
int instance_cnt_eNBs;
int instance_cnt_gNBs;
/// \brief Instance count for rx processing thread.
/// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx;
......@@ -404,6 +444,7 @@ typedef struct RU_proc_t_s {
pthread_cond_t cond_feptx;
/// condition variable for eNB signal
pthread_cond_t cond_eNBs;
pthread_cond_t cond_gNBs;
/// mutex for RU FH
pthread_mutex_t mutex_FH;
/// mutex for RU prach
......@@ -416,6 +457,7 @@ typedef struct RU_proc_t_s {
pthread_mutex_t mutex_synch;
/// mutex for eNB signal
pthread_mutex_t mutex_eNBs;
pthread_mutex_t mutex_gNBs;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for fep RX worker thread
......@@ -706,16 +748,19 @@ typedef struct RU_t_s{
int do_precoding;
/// Frame parameters
LTE_DL_FRAME_PARMS frame_parms;
NR_DL_FRAME_PARMS nr_frame_parms;
///timing offset used in TDD
int N_TA_offset;
/// RF device descriptor
openair0_device rfdevice;
/// HW configuration
openair0_config_t openair0_cfg;
/// Number of eNBs using this RU
/// Number of NBs using this RU
int num_eNB;
/// list of eNBs using this RU
int num_gNB;
/// list of NBs using this RU
struct PHY_VARS_eNB_s *eNB_list[NUMBER_OF_eNB_MAX];
struct PHY_VARS_gNB_s *gNB_list[NUMBER_OF_eNB_MAX];
/// Mapping of antenna ports to RF chain index
openair0_rf_map rf_map;
/// IF device descriptor
......@@ -724,7 +769,7 @@ typedef struct RU_t_s{
if_buffer_t ifbuffer;
/// if prach processing is to be performed in RU
int do_prach;
/// function pointer to synchronous RX fronthaul function (RRU,3GPP_eNB)
/// function pointer to synchronous RX fronthaul function (RRU,3GPP_eNB/3GPP_gNB)
void (*fh_south_in)(struct RU_t_s *ru,int *frame, int *subframe);
/// function pointer to synchronous TX fronthaul function
void (*fh_south_out)(struct RU_t_s *ru);
......@@ -748,16 +793,20 @@ typedef struct RU_t_s{
void (*feptx_ofdm)(struct RU_t_s *ru);
/// function pointer to TX front-end processing routine (PRECODING)
void (*feptx_prec)(struct RU_t_s *ru);
/// function pointer to wakeup routine in lte-enb.
/// function pointer to wakeup routine in lte-enb/nr-gnb.
int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru);
/// function pointer to wakeup routine in lte-enb.
int (*nr_wakeup_rxtx)(struct PHY_VARS_gNB_s *eNB, struct RU_t_s *ru);
/// function pointer to wakeup routine in lte-enb/nr-gnb.
void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
#ifdef Rel14
void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
#ifdef Rel14
/// function pointer to wakeup routine in lte-enb.
void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
#endif
/// function pointer to eNB entry routine
#endif
/// function pointer to NB entry routine
void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string);
void (*gNB_top)(struct PHY_VARS_gNB_s *eNB, int frame_rx, int subframe_rx, char *string);
/// Timing statistics
time_stats_t ofdm_demod_stats;
/// Timing statistics (TX)
......@@ -1672,6 +1721,406 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
return(0);
}
//#include "defs_NR.h"
#if 1 //temp solution to include NR defs
#include "impl_defs_nr.h"
#define MAX_NUM_SUBCARRIER_SPACING 5
#define NR_SYMBOLS_PER_SLOT 14
#define NR_PSS_LENGTH 127
#define NR_SSS_LENGTH 127
#define ONE_OVER_SQRT2_Q15 23170
#define ONE_OVER_TWO_Q15 16384
#define MOD_TABLE_SIZE_SHORT 6
#define MOD_TABLE_BPSK_OFFSET 1
typedef enum {
NR_MU_0=0,
NR_MU_1,
NR_MU_2,
NR_MU_3,
NR_MU_4,
} nr_numerology_index_e;
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
int subframe_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception
int frame_rx;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx;
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} gNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing
typedef struct gNB_proc_t_s {
/// Component Carrier index
uint8_t CC_id;
/// thread index
int thread_index;
/// timestamp received from HW
openair0_timestamp timestamp_rx;
/// timestamp to send to "slave rru"
openair0_timestamp timestamp_tx;
/// subframe to act upon for reception
int subframe_rx;
/// subframe to act upon for PRACH
int subframe_prach;
/// frame to act upon for reception
int frame_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for PRACH
int frame_prach;
/// \internal This variable is protected by \ref mutex_td.
int instance_cnt_td;
/// \internal This variable is protected by \ref mutex_te.
int instance_cnt_te;
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
// instance count for over-the-air gNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx;
/// pthread structure for eNB single processing thread
pthread_t pthread_single;
/// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for single gNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
struct sched_param sched_param_te;
/// scheduling parameters for single eNB thread
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
struct sched_param sched_param_prach;
/// scheduling parameters for asynch_rxtx thread
struct sched_param sched_param_asynch_rxtx;
pthread_cond_t cond_prach;
/// condition variable for asynch RX/TX thread
pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread
pthread_mutex_t mutex_te;
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for RU access to eNB processing (PDSCH/PUSCH)
pthread_mutex_t mutex_RU;
/// mutex for RU access to eNB processing (PRACH)
pthread_mutex_t mutex_RU_PRACH;
/// mutex for RU access to eNB processing (PRACH BR)
pthread_mutex_t mutex_RU_PRACH_br;
/// mask for RUs serving eNB (PDSCH/PUSCH)
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
/// set of scheduling variables RXn-TXnp4 threads
gNB_rxtx_proc_t proc_rxtx[2];
} gNB_proc_t;
typedef struct {
// common measurements
//! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_eNB];
//! estimated noise power (dB)
unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[100];
//! estimated avg noise power per RB (dBm)
short n0_subband_power_tot_dBm[100];
// gNB measurements (per user)
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
//! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_UE_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[NUMBER_OF_UE_MAX][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[NUMBER_OF_UE_MAX][2];
/// Wideband CQI (= SINR)
int wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_UE_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_UE_MAX][100];
/// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB
int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
/// PRACH background noise level
int prach_I0;
} PHY_MEASUREMENTS_gNB;
/// Top-level PHY Data Structure for gNB
typedef struct PHY_VARS_gNB_s {
/// Module ID indicator for this instance
module_id_t Mod_id;
uint8_t CC_id;
uint8_t configured;
gNB_proc_t proc;
int single_thread_flag;
int abstraction_flag;
int num_RU;
RU_t *RU_list[MAX_NUM_RU_PER_eNB];
/// Ethernet parameters for northbound midhaul interface
eth_params_t eth_params_n;
/// Ethernet parameters for fronthaul interface
eth_params_t eth_params;
int rx_total_gain_dB;
int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB);
uint8_t local_flag;
nfapi_config_request_t *gNB_config;
NR_DL_FRAME_PARMS frame_parms;
PHY_MEASUREMENTS_gNB measurements;
IF_Module_t *if_inst;
UL_IND_t UL_INFO;
pthread_mutex_t UL_INFO_mutex;
/// NFAPI RX ULSCH information
nfapi_rx_indication_pdu_t rx_pdu_list[NFAPI_RX_IND_MAX_PDU];
/// NFAPI RX ULSCH CRC information
nfapi_crc_indication_pdu_t crc_pdu_list[NFAPI_CRC_IND_MAX_PDU];
/// NFAPI HARQ information
nfapi_harq_indication_pdu_t harq_pdu_list[NFAPI_HARQ_IND_MAX_PDU];
/// NFAPI SR information
nfapi_sr_indication_pdu_t sr_pdu_list[NFAPI_SR_IND_MAX_PDU];
/// NFAPI CQI information
nfapi_cqi_indication_pdu_t cqi_pdu_list[NFAPI_CQI_IND_MAX_PDU];
/// NFAPI CQI information (raw component)
nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU];
/// NFAPI PRACH information
nfapi_preamble_pdu_t preamble_list[MAX_NUM_RX_PRACH_PREAMBLES];
Sched_Rsp_t Sched_INFO;
LTE_eNB_PDCCH pdcch_vars[2];
LTE_eNB_PHICH phich_vars[2];
NR_gNB_COMMON common_vars;
LTE_eNB_UCI uci_vars[NUMBER_OF_UE_MAX];
LTE_eNB_SRS srs_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PBCH pbch;
LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PRACH prach_vars;
LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
LTE_eNB_DLSCH_t *dlsch_MCH;
LTE_eNB_DLSCH_t *dlsch_PCH;
LTE_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX];
LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX];
uint8_t pbch_configured;
uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
char gNB_generate_rar;
/// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_UE_MAX];
uint32_t max_peak_val;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
/// N0 (used for abstraction)
double N0;
unsigned char first_run_timing_advance[NUMBER_OF_UE_MAX];
unsigned char first_run_I0_measurements;
unsigned char is_secondary_gNB; // primary by default
unsigned char is_init_sync; /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
unsigned char has_valid_precoder; /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from, and this B/F vector is created.
unsigned char PgNB_id; /// id of Primary eNB
/// hold the precoder for NULL beam to the primary user
int **dl_precoder_SgNB[3];
char log2_maxp; /// holds the maximum channel/precoder coefficient
/// if ==0 enables phy only test mode
int mac_enabled;
/// counter to average prach energh over first 100 prach opportunities
int prach_energy_counter;
// PDSCH Varaibles
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX];
// PUSCH Varaibles
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_UE_MAX];
// PUCCH variables
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_UE_MAX];
// UL-POWER-Control
UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_UE_MAX];
// TPC
TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_UE_MAX];
TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_UE_MAX];
// CQI reporting
CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_UE_MAX];
// SRS Variables
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX];
uint8_t ncs_cell[20][7];
// Scheduling Request Config
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_UE_MAX];
// Transmission mode per UE
uint8_t transmission_mode[NUMBER_OF_UE_MAX];
/// cba_last successful reception for each group, used for collision detection
uint8_t cba_last_reception[4];
// Pointers for active physicalConfigDedicated to be applied in current subframe
struct PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX];
uint32_t rb_mask_ul[4];
/// Information regarding TM5
MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX];
/// target_ue_dl_mcs : only for debug purposes
uint32_t target_ue_dl_mcs;
/// target_ue_ul_mcs : only for debug purposes
uint32_t target_ue_ul_mcs;
/// target_ue_dl_rballoc : only for debug purposes
uint32_t ue_dl_rb_alloc;
/// target ul PRBs : only for debug
uint32_t ue_ul_nb_rb;
///check for Total Transmissions
uint32_t check_for_total_transmissions;
///check for MU-MIMO Transmissions
uint32_t check_for_MUMIMO_transmissions;
///check for SU-MIMO Transmissions
uint32_t check_for_SUMIMO_transmissions;
///check for FULL MU-MIMO Transmissions
uint32_t FULL_MUMIMO_transmissions;
/// Counter for total bitrate, bits and throughput in downlink
uint32_t total_dlsch_bitrate;
uint32_t total_transmitted_bits;
uint32_t total_system_throughput;
int hw_timing_advance;
time_stats_t phy_proc;
time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx;
time_stats_t rx_prach;
time_stats_t ofdm_mod_stats;
time_stats_t dlsch_encoding_stats;
time_stats_t dlsch_modulation_stats;
time_stats_t dlsch_scrambling_stats;
time_stats_t dlsch_rate_matching_stats;
time_stats_t dlsch_turbo_encoding_stats;
time_stats_t dlsch_interleaving_stats;
time_stats_t rx_dft_stats;
time_stats_t ulsch_channel_estimation_stats;
time_stats_t ulsch_freq_offset_estimation_stats;
time_stats_t ulsch_decoding_stats;
time_stats_t ulsch_demodulation_stats;
time_stats_t ulsch_rate_unmatching_stats;
time_stats_t ulsch_turbo_decoding_stats;
time_stats_t ulsch_deinterleaving_stats;
time_stats_t ulsch_demultiplexing_stats;
time_stats_t ulsch_llr_stats;
time_stats_t ulsch_tc_init_stats;
time_stats_t ulsch_tc_alpha_stats;
time_stats_t ulsch_tc_beta_stats;
time_stats_t ulsch_tc_gamma_stats;
time_stats_t ulsch_tc_ext_stats;
time_stats_t ulsch_tc_intl1_stats;
time_stats_t ulsch_tc_intl2_stats;
#ifdef LOCALIZATION
/// time state for localization
time_stats_t localization_stats;
#endif
int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10];
int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024];
int32_t pucch1_stats_thres[NUMBER_OF_UE_MAX][10*1024];
int32_t pucch1ab_stats_cnt[NUMBER_OF_UE_MAX][10];
int32_t pucch1ab_stats[NUMBER_OF_UE_MAX][2*10*1024];
int32_t pusch_stats_rb[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_round[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
} PHY_VARS_gNB;
#endif
#include "PHY/INIT/defs.h"
#include "PHY/LTE_REFSIG/defs.h"
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
#ifndef __INIT_DEFS_NR__H__
/*#ifndef __INIT_DEFS_NR__H__
#define __INIT_DEFS_NR__H__
#define _GNU_SOURCE
......@@ -42,7 +42,7 @@
#include "types.h"
#include "defs.h"
#include "assertions.h"
#include "assertions.h"*/
#include "impl_defs_nr.h"
#define MAX_NUM_SUBCARRIER_SPACING 5
......@@ -66,6 +66,7 @@ typedef enum {
NR_MU_4,
} nr_numerology_index_e;
//NR types temporarily placed here
typedef struct {
uint32_t subcarrier_spacing;
/// 3/4 sampling
......@@ -93,187 +94,6 @@ typedef struct {
} NR_DL_FRAME_PARMS;
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
int subframe_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception
int frame_rx;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx;
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} gNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing
typedef struct gNB_proc_t_s {
/// Component Carrier index
uint8_t CC_id;
/// thread index
int thread_index;
/// timestamp received from HW
openair0_timestamp timestamp_rx;
/// timestamp to send to "slave rru"
openair0_timestamp timestamp_tx;
/// subframe to act upon for reception
int subframe_rx;
/// subframe to act upon for PRACH
int subframe_prach;
/// frame to act upon for reception
int frame_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for PRACH
int frame_prach;
/// \internal This variable is protected by \ref mutex_td.
int instance_cnt_td;
/// \internal This variable is protected by \ref mutex_te.
int instance_cnt_te;
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
// instance count for over-the-air gNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx;
/// pthread structure for eNB single processing thread
pthread_t pthread_single;
/// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for parallel turbo-decoder thread
pthread_attr_t attr_td;
/// pthread attributes for parallel turbo-encoder thread
pthread_attr_t attr_te;
/// pthread attributes for single eNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
struct sched_param sched_param_te;
/// scheduling parameters for single eNB thread
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
struct sched_param sched_param_prach;
/// scheduling parameters for asynch_rxtx thread
struct sched_param sched_param_asynch_rxtx;
/// pthread structure for parallel turbo-decoder thread
pthread_t pthread_td;
/// pthread structure for parallel turbo-encoder thread
pthread_t pthread_te;
/// pthread structure for PRACH thread
pthread_t pthread_prach;
/// condition variable for parallel turbo-decoder thread
pthread_cond_t cond_td;
/// condition variable for parallel turbo-encoder thread
pthread_cond_t cond_te;
/// condition variable for PRACH processing thread;
pthread_cond_t cond_prach;
/// condition variable for asynch RX/TX thread
pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread
pthread_mutex_t mutex_te;
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for RU access to eNB processing (PDSCH/PUSCH)
pthread_mutex_t mutex_RU;
/// mutex for RU access to eNB processing (PRACH)
pthread_mutex_t mutex_RU_PRACH;
/// mutex for RU access to eNB processing (PRACH BR)
pthread_mutex_t mutex_RU_PRACH_br;
/// mask for RUs serving eNB (PDSCH/PUSCH)
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
/// parameters for turbo-decoding worker thread
td_params tdp;
/// parameters for turbo-encoding worker thread
te_params tep;
/// set of scheduling variables RXn-TXnp4 threads
gNB_rxtx_proc_t proc_rxtx[2];
} gNB_proc_t;
typedef struct {
// common measurements
//! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_eNB];
//! estimated noise power (dB)
unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[100];
//! estimated avg noise power per RB (dBm)
short n0_subband_power_tot_dBm[100];
// gNB measurements (per user)
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
//! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_UE_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[NUMBER_OF_UE_MAX][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[NUMBER_OF_UE_MAX][2];
/// Wideband CQI (= SINR)
int wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_UE_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_UE_MAX][100];
/// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB
int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
/// PRACH background noise level
int prach_I0;
} PHY_MEASUREMENTS_gNB;
/// Top-level PHY Data Structure for gNB
typedef struct PHY_VARS_gNB_s {
/// Module ID indicator for this instance
......@@ -485,5 +305,184 @@ typedef struct PHY_VARS_gNB_s {
int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
} PHY_VARS_gNB;
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
int subframe_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception
int frame_rx;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx;
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} gNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing
typedef struct gNB_proc_t_s {
/// Component Carrier index
uint8_t CC_id;
/// thread index
int thread_index;
/// timestamp received from HW
openair0_timestamp timestamp_rx;
/// timestamp to send to "slave rru"
openair0_timestamp timestamp_tx;
/// subframe to act upon for reception
int subframe_rx;
/// subframe to act upon for PRACH
int subframe_prach;
/// frame to act upon for reception
int frame_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for PRACH
int frame_prach;
/// \internal This variable is protected by \ref mutex_td.
int instance_cnt_td;
/// \internal This variable is protected by \ref mutex_te.
int instance_cnt_te;
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
// instance count for over-the-air gNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx;
/// pthread structure for eNB single processing thread
pthread_t pthread_single;
/// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for parallel turbo-decoder thread
pthread_attr_t attr_td;
/// pthread attributes for parallel turbo-encoder thread
pthread_attr_t attr_te;
/// pthread attributes for single eNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
struct sched_param sched_param_te;
/// scheduling parameters for single eNB thread
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
struct sched_param sched_param_prach;
/// scheduling parameters for asynch_rxtx thread
struct sched_param sched_param_asynch_rxtx;
/// pthread structure for parallel turbo-decoder thread
pthread_t pthread_td;
/// pthread structure for parallel turbo-encoder thread
pthread_t pthread_te;
/// pthread structure for PRACH thread
pthread_t pthread_prach;
/// condition variable for parallel turbo-decoder thread
pthread_cond_t cond_td;
/// condition variable for parallel turbo-encoder thread
pthread_cond_t cond_te;
/// condition variable for PRACH processing thread;
pthread_cond_t cond_prach;
/// condition variable for asynch RX/TX thread
pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread
pthread_mutex_t mutex_te;
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for RU access to eNB processing (PDSCH/PUSCH)
pthread_mutex_t mutex_RU;
/// mutex for RU access to eNB processing (PRACH)
pthread_mutex_t mutex_RU_PRACH;
/// mutex for RU access to eNB processing (PRACH BR)
pthread_mutex_t mutex_RU_PRACH_br;
/// mask for RUs serving eNB (PDSCH/PUSCH)
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
/// parameters for turbo-decoding worker thread
td_params tdp;
/// parameters for turbo-encoding worker thread
te_params tep;
/// set of scheduling variables RXn-TXnp4 threads
gNB_rxtx_proc_t proc_rxtx[2];
} gNB_proc_t;
typedef struct {
// common measurements
//! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_eNB];
//! estimated noise power (dB)
unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
//! total estimated noise power (linear)
unsigned int n0_power_tot;
//! estimated avg noise power (dB)
unsigned short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[100];
//! estimated avg noise power per RB (dBm)
short n0_subband_power_tot_dBm[100];
// gNB measurements (per user)
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
//! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_UE_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[NUMBER_OF_UE_MAX][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[NUMBER_OF_UE_MAX][2];
/// Wideband CQI (= SINR)
int wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
/// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_UE_MAX];
/// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_UE_MAX][100];
/// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
/// Total Subband CQI and RB
int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
/// PRACH background noise level
int prach_I0;
} PHY_MEASUREMENTS_gNB;
#endif
......@@ -108,8 +108,8 @@ extern double p_qam64[8];
extern double beta1_dlsch[6][MCS_COUNT];
extern double beta2_dlsch[6][MCS_COUNT];
extern char eNB_functions[6][20];
extern char eNB_timing[2][20];
extern char NB_functions[7][20];
extern char NB_timing[2][20];
extern char ru_if_types[MAX_RU_IF_TYPES][20];
extern int16_t unscrambling_lut[65536*16];
......
......@@ -23,8 +23,7 @@
#define __PHY_IMPLEMENTATION_DEFS_NR_H__
#include "impl_defs_lte.h"
//#include "impl_defs_lte.h"
typedef struct {
/// \brief Pointers (dynamic) to the received data in the time domain.
......@@ -42,5 +41,4 @@ typedef struct {
/// - third index: sample [0..]
int32_t **txdataF;
} NR_gNB_COMMON;
#endif
......@@ -139,8 +139,8 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682
#ifdef OCP_FRAMEWORK
#include <enums.h>
#else
char eNB_functions[6][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5",};
char eNB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",};
char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"};
#endif
......
/*
* 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.1 (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
*/
/*
\author R. Knopp, F. Kaltenberger
\company EURECOM
\email knopp@eurecom.fr
*/
#ifndef __openair_SCHED_NR_DEFS_H__
#define __openair_SCHED_NR_DEFS_H__
#include "PHY/defs.h"
#include "PHY_INTERFACE/defs.h"
#include "SCHED/defs.h"
lte_subframe_t nr_subframe_select (nfapi_config_request_t *cfg, unsigned char subframe);
#endif
......@@ -1280,7 +1280,7 @@ void init_eNB_proc(int inst) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB = PHY_vars_eNB_g[inst][CC_id];
LOG_I(PHY,"Initializing eNB %d CC_id %d (%s,%s),\n",inst,CC_id,eNB_functions[eNB->node_function],eNB_timing[eNB->node_timing]);
LOG_I(PHY,"Initializing eNB %d CC_id %d (%s,%s),\n",inst,CC_id,NB_functions[eNB->node_function],NB_timing[eNB->node_timing]);
proc = &eNB->proc;
proc_rxtx = proc->proc_rxtx;
......@@ -1682,7 +1682,7 @@ void init_RAN(RAN_CONTEXT *rc,eNB_func_t node_function[], eNB_timing_t node_timi
eNB->abstraction_flag = 0;
eNB->single_thread_flag = single_thread_flag;
eNB->ts_offset = 0;
LOG_I(PHY,"Initializing eNB %d CC_id %d : (%s,%s)\n",inst,CC_id,eNB_functions[node_function[CC_id]],eNB_timing[node_timing[CC_id]]);
LOG_I(PHY,"Initializing eNB %d CC_id %d : (%s,%s)\n",inst,CC_id,NB_functions[node_function[CC_id]],NB_timing[node_timing[CC_id]]);
switch (node_function[CC_id]) {
case NGFI_RRU_IF5:
......
......@@ -1395,7 +1395,7 @@ static void* ru_thread( void* param ) {
// set default return value
thread_top_init("ru_thread",0,870000,1000000,1000000);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
// Start IF device if any
......@@ -1649,7 +1649,7 @@ void init_RU_proc(RU_t *ru) {
char name[100];
#ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
#endif
proc = &ru->proc;
memset((void*)proc,0,sizeof(RU_proc_t));
......
......@@ -44,7 +44,7 @@
#include "PHY/types.h"
#include "PHY/defs_NR.h"
#include "PHY/defs.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
......@@ -617,14 +617,6 @@ void init_gNB_proc(int inst) {
// pthread_attr_init( &proc->attr_te);
pthread_attr_init( &proc_rxtx[0].attr_rxtx);
pthread_attr_init( &proc_rxtx[1].attr_rxtx);
#ifndef DEADLINE_SCHEDULER
attr0 = &proc_rxtx[0].attr_rxtx;
attr1 = &proc_rxtx[1].attr_rxtx;
attr_prach = &proc->attr_prach;
// attr_td = &proc->attr_td;
// attr_te = &proc->attr_te;
#endif
LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag);
......@@ -686,8 +678,8 @@ void kill_gNB_proc(int inst) {
pthread_cond_signal( &proc->cond_asynch_rxtx );
pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
LOG_D(PHY, "joining pthread_prach\n");
pthread_join( proc->pthread_prach, (void**)&status );
// LOG_D(PHY, "joining pthread_prach\n");
// pthread_join( proc->pthread_prach, (void**)&status );
LOG_I(PHY, "Destroying prach mutex/cond\n");
pthread_mutex_destroy( &proc->mutex_prach );
......@@ -817,7 +809,8 @@ void init_transport(PHY_VARS_gNB *gNB) {
} */
void init_gNB_afterRU(void) {
/// eNB kept in function name for nffapi calls, TO FIX
void init_eNB_afterRU(void) {
int inst,CC_id,ru_id,i,aa;
PHY_VARS_gNB *gNB;
......@@ -835,7 +828,7 @@ void init_gNB_afterRU(void) {
// map antennas and PRACH signals to gNB RX
if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id);
LOG_I(PHY,"Mapping RX ports from %d RUs to gNB %d\n",gNB->num_RU,gNB->Mod_id);
gNB->gNB_config.rf_config.tx_antenna_ports.value = 0;
gNB->gNB_config->rf_config.tx_antenna_ports.value = 0;
//LOG_I(PHY,"Overwriting gNB->prach_vars.rxsigF[0]:%p\n", gNB->prach_vars.rxsigF[0]);
......@@ -844,7 +837,7 @@ void init_gNB_afterRU(void) {
LOG_I(PHY,"gNB->num_RU:%d\n", gNB->num_RU);
for (ru_id=0,aa=0;ru_id<gNB->num_RU;ru_id++) {
gNB->gNB_config.rf_config.tx_antenna_ports.value += gNB->RU_list[ru_id]->nb_rx;
gNB->gNB_config->rf_config.tx_antenna_ports.value += gNB->RU_list[ru_id]->nb_rx;
AssertFatal(gNB->RU_list[ru_id]->common.rxdataF!=NULL,
"RU %d : common.rxdataF is NULL\n",
......@@ -867,29 +860,29 @@ void init_gNB_afterRU(void) {
* In monolithic mode, we come here with nb_antennas_rx == 0
* (not tested in other modes).
*/
if (gNB->gNB_config.rf_config.tx_antenna_ports.value < 1)
if (gNB->gNB_config->rf_config.tx_antenna_ports.value < 1)
{
LOG_I(PHY, "%s() ************* DJP ***** gNB->gNB_config.rf_config.tx_antenna_ports:%d - GOING TO HARD CODE TO 1", __FUNCTION__, gNB->gNB_config.rf_config.tx_antenna_ports.value);
gNB->gNB_config.rf_config.tx_antenna_ports.value = 1;
LOG_I(PHY, "%s() ************* DJP ***** gNB->gNB_config->rf_config.tx_antenna_ports:%d - GOING TO HARD CODE TO 1", __FUNCTION__, gNB->gNB_config->rf_config.tx_antenna_ports.value);
gNB->gNB_config->rf_config.tx_antenna_ports.value = 1;
}
else
{
//LOG_I(PHY," Delete code\n");
}
if (gNB->gNB_config.rf_config.tx_antenna_ports.value < 1)
if (gNB->gNB_config->rf_config.tx_antenna_ports.value < 1)
{
LOG_I(PHY, "%s() ************* DJP ***** gNB->gNB_config.rf_config.tx_antenna_ports:%d - GOING TO HARD CODE TO 1", __FUNCTION__, gNB->gNB_config.rf_config.tx_antenna_ports.value);
gNB->gNB_config.rf_config.tx_antenna_ports.value = 1;
LOG_I(PHY, "%s() ************* DJP ***** gNB->gNB_config->rf_config.tx_antenna_ports:%d - GOING TO HARD CODE TO 1", __FUNCTION__, gNB->gNB_config->rf_config.tx_antenna_ports.value);
gNB->gNB_config->rf_config.tx_antenna_ports.value = 1;
}
else
{
//LOG_I(PHY," Delete code\n");
}
AssertFatal(gNB->gNB_config.rf_config.tx_antenna_ports.value >0,
"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,gNB->gNB_config.rf_config.tx_antenna_ports.value);
LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,gNB->gNB_config.rf_config.tx_antenna_ports.value);
AssertFatal(gNB->gNB_config->rf_config.tx_antenna_ports.value >0,
"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,gNB->gNB_config->rf_config.tx_antenna_ports.value);
LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,gNB->gNB_config->rf_config.tx_antenna_ports.value);
/// Transport init necessary for NR synchro
//init_transport(gNB);
//init_precoding_weights(RC.gNB[inst][CC_id]);
......@@ -901,9 +894,9 @@ void init_gNB_afterRU(void) {
AssertFatal(RC.ru[ru_id]!=NULL,"ru_id %d is null\n",ru_id);
RC.ru[ru_id]->wakeup_rxtx = wakeup_rxtx;
RC.ru[ru_id]->nr_wakeup_rxtx = wakeup_rxtx;
// RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_gNB;
RC.ru[ru_id]->eNB_top = gNB_top;
RC.ru[ru_id]->gNB_top = gNB_top;
}
}
......
......@@ -60,7 +60,7 @@
#include "PHY/types.h"
#include "PHY/defs_NR.h"
#include "PHY/defs.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
......@@ -72,6 +72,7 @@
#include "PHY/extern.h"
#include "SCHED/extern.h"
#include "SCHED_NR/defs.h"
#include "LAYER2/MAC/extern.h"
#include "../../SIMU/USER/init_lte.h"
......@@ -332,14 +333,13 @@ static inline void fh_if4p5_south_out(RU_t *ru) {
// Synchronous if5 from south
void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
NR_DL_FRAME_PARMS *fp = &ru->frame_parms;
//nfapi_config_request_t *cfg
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc;
recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_RRH_GW_UL);
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_subframe*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_subframe)%10;
if (proc->first_rx == 0) {
if (proc->subframe_rx != *subframe){
......@@ -364,7 +364,7 @@ void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
// Synchronous if4p5 from south
void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
NR_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc;
int f,sf;
......@@ -372,13 +372,13 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
uint16_t packet_type;
uint32_t symbol_number=0;
uint32_t symbol_mask_full;
/*
if ((fp->frame_type == TDD) && (subframe_select(fp,*subframe)==SF_S))
symbol_mask_full = (1<<fp->ul_symbols_in_S_subframe)-1;
else
symbol_mask_full = (1<<fp->symbols_per_tti)-1;
AssertFatal(proc->symbol_mask[*subframe]==0,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]);
AssertFatal(proc->symbol_mask[*subframe]==0,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]);*/
do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!!
recv_IF4p5(ru, &f, &sf, &packet_type, &symbol_number);
......@@ -397,8 +397,8 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
//caculate timestamp_rx, timestamp_tx based on frame and subframe
proc->subframe_rx = sf;
proc->frame_rx = f;
proc->timestamp_rx = ((proc->frame_rx * 10) + proc->subframe_rx ) * fp->samples_per_tti ;
// proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
proc->timestamp_rx = ((proc->frame_rx * 10) + proc->subframe_rx ) * fp->samples_per_subframe ;
// proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_subframe);
proc->subframe_tx = (sf+sf_ahead)%10;
proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f;
......@@ -448,17 +448,17 @@ void fh_slave_south_in(RU_t *ru,int *frame,int *subframe) {
void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_MOBIPASS);
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
int offset_mobipass = 40120;
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
proc->subframe_rx = ((proc->timestamp_rx-offset_mobipass)/fp->samples_per_tti)%10;
proc->frame_rx = ((proc->timestamp_rx-offset_mobipass)/(fp->samples_per_tti*10))&1023;
proc->subframe_rx = ((proc->timestamp_rx-offset_mobipass)/fp->samples_per_subframe)%10;
proc->frame_rx = ((proc->timestamp_rx-offset_mobipass)/(fp->samples_per_subframe*10))&1023;
proc->subframe_rx = (proc->timestamp_rx/fp->samples_per_tti)%10;
proc->frame_rx = (proc->timestamp_rx/(10*fp->samples_per_tti))&1023;
proc->subframe_rx = (proc->timestamp_rx/fp->samples_per_subframe)%10;
proc->frame_rx = (proc->timestamp_rx/(10*fp->samples_per_subframe))&1023;
if (proc->first_rx == 1) {
proc->first_rx =2;
......@@ -485,12 +485,12 @@ void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
} // eNodeB_3GPP_BBU
} // gNodeB_3GPP_BBU
// asynchronous inbound if4p5 fronthaul from south
void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc;
uint16_t packet_type;
......@@ -498,7 +498,7 @@ void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) {
uint32_t got_prach_info=0;
symbol_number = 0;
symbol_mask = (1<<fp->symbols_per_tti)-1;
symbol_mask = (1<<(fp->symbols_per_slot * fp->slots_per_subframe))-1;
prach_rx = 0;
do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!!
......@@ -525,12 +525,6 @@ void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) {
}
if (packet_type == IF4p5_PULFFT) symbol_mask &= (~(1<<symbol_number));
else if (packet_type == IF4p5_PRACH) prach_rx &= (~0x1);
#ifdef Rel14
else if (packet_type == IF4p5_PRACH_BR_CE0) prach_rx &= (~0x2);
else if (packet_type == IF4p5_PRACH_BR_CE1) prach_rx &= (~0x4);
else if (packet_type == IF4p5_PRACH_BR_CE2) prach_rx &= (~0x8);
else if (packet_type == IF4p5_PRACH_BR_CE3) prach_rx &= (~0x10);
#endif
} while( (symbol_mask > 0) || (prach_rx >0)); // haven't received all PUSCH symbols and PRACH information
}
......@@ -553,7 +547,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
/// **** incoming IF4p5 from remote RCC/RAU **** ///
symbol_number = 0;
symbol_mask = 0;
symbol_mask_full = (1<<ru->frame_parms.symbols_per_tti)-1;
symbol_mask_full = (1<<(ru->nr_frame_parms.symbols_per_slot* ru->nr_frame_parms.slots_per_subframe))-1;
do {
recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number);
......@@ -569,7 +563,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc;
int subframe_tx,frame_tx;
openair0_timestamp timestamp_tx;
......@@ -577,8 +571,8 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
recv_IF5(ru, &timestamp_tx, *subframe, IF5_RRH_GW_DL);
// printf("Received subframe %d (TS %llu) from RCC\n",subframe_tx,timestamp_tx);
subframe_tx = (timestamp_tx/fp->samples_per_tti)%10;
frame_tx = (timestamp_tx/(fp->samples_per_tti*10))&1023;
subframe_tx = (timestamp_tx/fp->samples_per_subframe)%10;
frame_tx = (timestamp_tx/(fp->samples_per_subframe*10))&1023;
if (proc->first_tx != 0) {
*subframe = subframe_tx;
......@@ -595,7 +589,8 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
nfapi_config_request_t *cfg = ru->gNB_list[0]->gNB_config;
RU_proc_t *proc = &ru->proc;
uint16_t packet_type;
......@@ -605,17 +600,17 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
LOG_D(PHY, "%s(ru:%p frame, subframe)\n", __FUNCTION__, ru);
symbol_number = 0;
symbol_mask = 0;
symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
// symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
do {
recv_IF4p5(ru, &frame_tx, &subframe_tx, &packet_type, &symbol_number);
if ((subframe_select(fp,subframe_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul);
if ((nr_subframe_select(cfg,subframe_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul);
LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n",
*subframe,subframe_select(fp,*subframe),frame_tx,subframe_tx,symbol_number);
*subframe,nr_subframe_select(cfg,*subframe),frame_tx,subframe_tx,symbol_number);
if (proc->first_tx != 0) {
*frame = frame_tx;
*subframe = subframe_tx;
proc->first_tx = 0;
symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
//symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
}
else {
AssertFatal(frame_tx == *frame,
......@@ -629,14 +624,14 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type);
} while (symbol_mask != symbol_mask_full);
if (subframe_select(fp,subframe_tx) == SF_DL) stop_meas(&ru->rx_fhaul);
if (nr_subframe_select(cfg,subframe_tx) == SF_DL) stop_meas(&ru->rx_fhaul);
proc->subframe_tx = subframe_tx;
proc->frame_tx = frame_tx;
if ((frame_tx == 0)&&(subframe_tx == 0)) proc->frame_tx_unwrap += 1024;
proc->timestamp_tx = ((((uint64_t)frame_tx + (uint64_t)proc->frame_tx_unwrap) * 10) + (uint64_t)subframe_tx) * (uint64_t)fp->samples_per_tti;
proc->timestamp_tx = ((((uint64_t)frame_tx + (uint64_t)proc->frame_tx_unwrap) * 10) + (uint64_t)subframe_tx) * (uint64_t)fp->samples_per_subframe;
LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,subframe_tx);
// dump VCD output for first RU in list
......@@ -665,15 +660,15 @@ void fh_if5_north_out(RU_t *ru) {
void fh_if4p5_north_out(RU_t *ru) {
RU_proc_t *proc=&ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
const int subframe = proc->subframe_rx;
//NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
//const int subframe = proc->subframe_rx;
if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, proc->subframe_rx );
/*
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) {
/// **** in TDD during DL send_IF4 of ULTICK to RCC **** ///
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULTICK);
return;
}
}*/
start_meas(&ru->tx_fhaul);
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULFFT);
......@@ -684,14 +679,14 @@ void fh_if4p5_north_out(RU_t *ru) {
void rx_rf(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
void *rxp[ru->nb_rx];
unsigned int rxs;
int i;
openair0_timestamp ts,old_ts;
for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_subframe];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
......@@ -700,34 +695,34 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
&ts,
rxp,
fp->samples_per_tti,
fp->samples_per_subframe,
ru->nb_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
proc->timestamp_rx = ts-ru->ts_offset;
//AssertFatal(rxs == fp->samples_per_tti,
//"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
if (rxs != fp->samples_per_tti) LOG_E(PHY, "rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
//AssertFatal(rxs == fp->samples_per_subframe,
//"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_subframe,rxs);
if (rxs != fp->samples_per_subframe) LOG_E(PHY, "rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_subframe,rxs);
if (proc->first_rx == 1) {
ru->ts_offset = proc->timestamp_rx;
proc->timestamp_rx = 0;
}
else {
if (proc->timestamp_rx - old_ts != fp->samples_per_tti) {
LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_tti,ru->ts_offset);
ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
if (proc->timestamp_rx - old_ts != fp->samples_per_subframe) {
LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_subframe,ru->ts_offset);
ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_subframe);
proc->timestamp_rx = ts-ru->ts_offset;
}
}
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_subframe*10))&1023;
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_subframe)%10;
// synchronize first reception to frame 0 subframe 0
proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti);
proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_subframe);
proc->subframe_tx = (proc->subframe_rx+sf_ahead)%10;
proc->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
......@@ -765,7 +760,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff );
if (rxs != fp->samples_per_tti)
if (rxs != fp->samples_per_subframe)
{
//exit_fun( "problem receiving samples" );
LOG_E(PHY, "problem receiving samples");
......@@ -776,24 +771,25 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
void tx_rf(RU_t *ru) {
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
nfapi_config_request_t *cfg = ru->gNB_list[0]->gNB_config;
void *txp[ru->nb_tx];
unsigned int txs;
int i;
T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(proc->frame_tx), T_INT(proc->subframe_tx),
T_INT(0), T_BUFFER(&ru->common.txdata[0][proc->subframe_tx * fp->samples_per_tti], fp->samples_per_tti * 4));
T_INT(0), T_BUFFER(&ru->common.txdata[0][proc->subframe_tx * fp->samples_per_subframe], fp->samples_per_subframe * 4));
lte_subframe_t SF_type = subframe_select(fp,proc->subframe_tx%10);
lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10);
lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10);
lte_subframe_t SF_type = nr_subframe_select(cfg,proc->subframe_tx%10);
lte_subframe_t prevSF_type = nr_subframe_select(cfg,(proc->subframe_tx+9)%10);
lte_subframe_t nextSF_type = nr_subframe_select(cfg,(proc->subframe_tx+1)%10);
int sf_extension = 0;
if ((SF_type == SF_DL) ||
(SF_type == SF_S)) {
int siglen=fp->samples_per_tti,flags=1;
int siglen=fp->samples_per_subframe,flags=1;
/*
if (SF_type == SF_S) {
siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
flags=3; // end of burst
......@@ -806,16 +802,16 @@ void tx_rf(RU_t *ru) {
sf_extension = ru->N_TA_offset<<1;
}
if ((fp->frame_type == TDD) &&
if ((cfg->subframe_config.duplex_mode == TDD) &&
(SF_type == SF_DL)&&
(prevSF_type == SF_UL) &&
(nextSF_type == SF_UL)) {
flags = 4; // start of burst and end of burst (only one DL SF between two UL)
sf_extension = ru->N_TA_offset<<1;
}
} */
for (i=0; i<ru->nb_tx; i++)
txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension];
txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_subframe)-sf_extension];
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
......@@ -841,9 +837,9 @@ void tx_rf(RU_t *ru) {
/*!
* \brief The Asynchronous RX/TX FH thread of RAU/RCC/eNB/RRU.
* \brief The Asynchronous RX/TX FH thread of RAU/RCC/gNB/RRU.
* This handles the RX FH for an asynchronous RRU/UE
* \param param is a \ref eNB_proc_t structure which contains the info what to process.
* \param param is a \ref gNB_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void* ru_thread_asynch_rxtx( void* param ) {
......@@ -887,7 +883,7 @@ static void* ru_thread_asynch_rxtx( void* param ) {
if (ru->fh_south_asynch_in) ru->fh_south_asynch_in(ru,&frame,&subframe);
// asynchronous receive from north (RRU IF4/IF5)
else if (ru->fh_north_asynch_in) {
if (subframe_select(&ru->frame_parms,subframe)!=SF_UL)
if (nr_subframe_select(ru->gNB_list[0]->gNB_config,subframe)!=SF_UL)
ru->fh_north_asynch_in(ru,&frame,&subframe);
}
else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
......@@ -969,9 +965,9 @@ static void* ru_thread_prach( void* param ) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
if (ru->eNB_list[0]){
if (ru->gNB_list[0]){
prach_procedures(
ru->eNB_list[0]
ru->gNB_list[0]
#ifdef Rel14
,0
#endif
......@@ -1000,40 +996,6 @@ static void* ru_thread_prach( void* param ) {
return &ru_thread_prach_status;
}
#ifdef Rel14
static void* ru_thread_prach_br( void* param ) {
static int ru_thread_prach_status;
RU_t *ru = (RU_t*)param;
RU_proc_t *proc = (RU_proc_t*)&ru->proc;
// set default return value
ru_thread_prach_status = 0;
thread_top_init("ru_thread_prach_br",1,500000L,1000000L,20000000L);
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"ru_prach_thread_br") < 0) break;
rx_prach(NULL,
ru,
NULL,
NULL,
NULL,
proc->frame_prach_br,
0,
1);
if (release_thread(&proc->mutex_prach_br,&proc->instance_cnt_prach_br,"ru_prach_thread_br") < 0) break;
}
LOG_I(PHY, "Exiting RU thread PRACH BR\n");
ru_thread_prach_status = 0;
return &ru_thread_prach_status;
}
#endif
int wakeup_synch(RU_t *ru){
......@@ -1066,11 +1028,11 @@ int wakeup_synch(RU_t *ru){
void do_ru_synch(RU_t *ru) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
RU_proc_t *proc = &ru->proc;
int i;
void *rxp[2],*rxp2[2];
int32_t dummy_rx[ru->nb_rx][fp->samples_per_tti] __attribute__((aligned(32)));
int32_t dummy_rx[ru->nb_rx][fp->samples_per_subframe] __attribute__((aligned(32)));
int rxs;
int ic;
......@@ -1091,9 +1053,9 @@ void do_ru_synch(RU_t *ru) {
rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
&(proc->timestamp_rx),
rxp,
fp->samples_per_tti*10,
fp->samples_per_subframe*10,
ru->nb_rx);
if (rxs != fp->samples_per_tti*10) LOG_E(PHY,"requested %d samples, got %d\n",fp->samples_per_tti*10,rxs);
if (rxs != fp->samples_per_subframe*10) LOG_E(PHY,"requested %d samples, got %d\n",fp->samples_per_subframe*10,rxs);
// wakeup synchronization processing thread
wakeup_synch(ru);
......@@ -1109,7 +1071,7 @@ void do_ru_synch(RU_t *ru) {
rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
&(proc->timestamp_rx),
rxp2,
fp->samples_per_tti,
fp->samples_per_subframe,
ru->nb_rx);
pthread_mutex_lock(&ru->proc.mutex_synch);
ic = ru->proc.instance_cnt_synch;
......@@ -1134,32 +1096,32 @@ void do_ru_synch(RU_t *ru) {
void wakeup_eNBs(RU_t *ru) {
void wakeup_gNBs(RU_t *ru) {
int i;
PHY_VARS_eNB **eNB_list = ru->eNB_list;
PHY_VARS_gNB **gNB_list = ru->gNB_list;
LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top);
LOG_D(PHY,"wakeup_gNBs (num %d) for RU %d ru->gNB_top:%p\n",ru->num_gNB,ru->idx, ru->gNB_top);
if (ru->num_eNB==1 && ru->eNB_top!=0) {
// call eNB function directly
if (ru->num_gNB==1 && ru->gNB_top!=0) {
// call gNB function directly
char string[20];
sprintf(string,"Incoming RU %d",ru->idx);
LOG_D(PHY,"RU %d Call eNB_top\n",ru->idx);
ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string);
LOG_D(PHY,"RU %d Call gNB_top\n",ru->idx);
ru->gNB_top(gNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string);
}
else {
LOG_D(PHY,"ru->num_eNB:%d\n", ru->num_eNB);
LOG_D(PHY,"ru->num_gNB:%d\n", ru->num_gNB);
for (i=0;i<ru->num_eNB;i++)
for (i=0;i<ru->num_gNB;i++)
{
LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->wakeup_rxtx);
LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->nr_wakeup_rxtx);
if (ru->wakeup_rxtx!=0 && ru->wakeup_rxtx(eNB_list[i],ru) < 0)
if (ru->nr_wakeup_rxtx!=0 && ru->nr_wakeup_rxtx(gNB_list[i],ru) < 0)
{
LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
LOG_E(PHY,"could not wakeup gNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
}
}
}
......@@ -1182,10 +1144,10 @@ static inline int wakeup_prach_ru(RU_t *ru) {
ru->proc.frame_prach = ru->proc.frame_rx;
ru->proc.subframe_prach = ru->proc.subframe_rx;
// DJP - think prach_procedures() is looking at eNB frame_prach
if (ru->eNB_list[0]) {
ru->eNB_list[0]->proc.frame_prach = ru->proc.frame_rx;
ru->eNB_list[0]->proc.subframe_prach = ru->proc.subframe_rx;
// DJP - think prach_procedures() is looking at gNB frame_prach
if (ru->gNB_list[0]) {
ru->gNB_list[0]->proc.frame_prach = ru->proc.frame_rx;
ru->gNB_list[0]->proc.subframe_prach = ru->proc.subframe_rx;
}
LOG_I(PHY,"RU %d: waking up PRACH thread\n",ru->idx);
// the thread can now be woken up
......@@ -1197,44 +1159,17 @@ static inline int wakeup_prach_ru(RU_t *ru) {
return(0);
}
#ifdef Rel14
static inline int wakeup_prach_ru_br(RU_t *ru) {
struct timespec wait;
wait.tv_sec=0;
wait.tv_nsec=5000000L;
if (pthread_mutex_timedlock(&ru->proc.mutex_prach_br,&wait) !=0) {
LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for RU prach thread BR (IC %d)\n", ru->proc.instance_cnt_prach_br);
exit_fun( "error locking mutex_rxtx" );
return(-1);
}
if (ru->proc.instance_cnt_prach_br==-1) {
++ru->proc.instance_cnt_prach_br;
ru->proc.frame_prach_br = ru->proc.frame_rx;
ru->proc.subframe_prach_br = ru->proc.subframe_rx;
LOG_D(PHY,"RU %d: waking up PRACH thread\n",ru->idx);
// the thread can now be woken up
AssertFatal(pthread_cond_signal(&ru->proc.cond_prach_br) == 0, "ERROR pthread_cond_signal for RU prach thread BR\n");
}
else LOG_W(PHY,"RU prach thread busy, skipping\n");
pthread_mutex_unlock( &ru->proc.mutex_prach_br );
return(0);
}
#endif
// this is for RU with local RF unit
void fill_rf_config(RU_t *ru, char *rf_config_file) {
int i;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
nfapi_config_request_t *gNB_config = ru->gNB_list[0]->gNB_config; //tmp index
openair0_config_t *cfg = &ru->openair0_cfg;
int N_RB = gNB_config->rf_config.dl_channel_bandwidth.value;
if(fp->N_RB_DL == 100) {
if(N_RB == 100) {
if (fp->threequarter_fs) {
cfg->sample_rate=23.04e6;
cfg->samples_per_frame = 230400;
......@@ -1247,31 +1182,31 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->tx_bw = 10e6;
cfg->rx_bw = 10e6;
}
} else if(fp->N_RB_DL == 50) {
} else if(N_RB == 50) {
cfg->sample_rate=15.36e6;
cfg->samples_per_frame = 153600;
cfg->tx_bw = 5e6;
cfg->rx_bw = 5e6;
} else if (fp->N_RB_DL == 25) {
} else if (N_RB == 25) {
cfg->sample_rate=7.68e6;
cfg->samples_per_frame = 76800;
cfg->tx_bw = 2.5e6;
cfg->rx_bw = 2.5e6;
} else if (fp->N_RB_DL == 6) {
} else if (N_RB == 6) {
cfg->sample_rate=1.92e6;
cfg->samples_per_frame = 19200;
cfg->tx_bw = 1.5e6;
cfg->rx_bw = 1.5e6;
}
else AssertFatal(1==0,"Unknown N_RB_DL %d\n",fp->N_RB_DL);
else AssertFatal(1==0,"Unknown N_RB %d\n",N_RB);
if (fp->frame_type==TDD)
if (gNB_config->subframe_config.duplex_mode.value==TDD)
cfg->duplex_mode = duplex_mode_TDD;
else //FDD
cfg->duplex_mode = duplex_mode_FDD;
cfg->Mod_id = 0;
cfg->num_rb_dl=fp->N_RB_DL;
cfg->num_rb_dl=N_RB;
cfg->tx_num_channels=ru->nb_tx;
cfg->rx_num_channels=ru->nb_rx;
......@@ -1303,10 +1238,11 @@ int setup_RU_buffers(RU_t *ru) {
//uint16_t N_TA_offset = 0;
LTE_DL_FRAME_PARMS *frame_parms;
NR_DL_FRAME_PARMS *frame_parms;
//nfapi_config_request_t *gNB_config = ru->gNB_list[0]->gNB_config; //tmp index
if (ru) {
frame_parms = &ru->frame_parms;
frame_parms = &ru->nr_frame_parms;
printf("setup_RU_buffers: frame_parms = %p\n",frame_parms);
} else {
printf("RU[%d] not initialized\n", ru->idx);
......@@ -1314,11 +1250,11 @@ int setup_RU_buffers(RU_t *ru) {
}
if (frame_parms->frame_type == TDD) {
/* if (frame_parms->frame_type == TDD) {
if (frame_parms->N_RB_DL == 100) ru->N_TA_offset = 624;
else if (frame_parms->N_RB_DL == 50) ru->N_TA_offset = 624/2;
else if (frame_parms->N_RB_DL == 25) ru->N_TA_offset = 624/4;
}
} */
if (ru->openair0_cfg.mmapped_dma == 1) {
// replace RX signal buffers with mmaped HW versions
......@@ -1385,7 +1321,7 @@ static void* ru_thread( void* param ) {
RU_t *ru = (RU_t*)param;
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
int ret;
int subframe =9;
int frame =1023;
......@@ -1397,7 +1333,7 @@ static void* ru_thread( void* param ) {
// set default return value
thread_top_init("ru_thread",0,870000,1000000,1000000);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
// Start IF device if any
......@@ -1410,7 +1346,7 @@ static void* ru_thread( void* param ) {
}
if (ru->if_south == LOCAL_RF) { // configure RF parameters only
fill_rf_config(ru,ru->rf_config_file);
init_frame_parms(&ru->frame_parms,1);
nr_init_frame_parms(ru->gNB_list[0]->gNB_config, fp);
phy_init_RU(ru);
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
......@@ -1472,27 +1408,21 @@ static void* ru_thread( void* param ) {
if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&subframe);
else AssertFatal(1==0, "No fronthaul interface at south port");
/*
LOG_D(PHY,"AFTER fh_south_in - SFN/SF:%d%d RU->proc[RX:%d%d TX:%d%d] RC.eNB[0][0]:[RX:%d%d TX(SFN):%d]\n",
LOG_D(PHY,"AFTER fh_south_in - SFN/SF:%d%d RU->proc[RX:%d%d TX:%d%d] RC.gNB[0][0]:[RX:%d%d TX(SFN):%d]\n",
frame,subframe,
proc->frame_rx,proc->subframe_rx,
proc->frame_tx,proc->subframe_tx,
RC.eNB[0][0]->proc.frame_rx,RC.eNB[0][0]->proc.subframe_rx,
RC.eNB[0][0]->proc.frame_tx);
RC.gNB[0][0]->proc.frame_rx,RC.gNB[0][0]->proc.subframe_rx,
RC.gNB[0][0]->proc.frame_tx);
LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
ru->do_prach,
is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx),
proc->frame_rx,proc->subframe_rx);
*/
if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) {
wakeup_prach_ru(ru);
}
#ifdef Rel14
else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) {
wakeup_prach_ru_br(ru);
}
#endif
// adjust for timing offset between RU
if (ru->idx!=0) proc->frame_tx = (proc->frame_tx+proc->frame_offset)&1023;
......@@ -1505,11 +1435,11 @@ static void* ru_thread( void* param ) {
// If this proc is to provide synchronization, do so
wakeup_slaves(proc);
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_eNBs(ru);
// wakeup all gNB processes waiting for this RU
if (ru->num_gNB>0) wakeup_gNBs(ru);
// wait until eNBs are finished subframe RX n and TX n+sf_ahead
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
// wait until gNBs are finished subframe RX n and TX n+sf_ahead
wait_on_condition(&proc->mutex_gNBs,&proc->cond_gNBs,&proc->instance_cnt_gNBs,"ru_thread");
// do TX front-end processing if needed (precoding and/or IDFTs)
......@@ -1536,13 +1466,12 @@ static void* ru_thread( void* param ) {
return &ru_thread_status;
}
/*
// This thread run the initial synchronization like a UE
void *ru_thread_synch(void *arg) {
RU_t *ru = (RU_t*)arg;
LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
NR_DL_FRAME_PARMS *fp=&ru->nr_frame_parms;
int32_t sync_pos,sync_pos2;
uint32_t peak_val;
uint32_t sync_corr[307200] __attribute__((aligned(32)));
......@@ -1554,7 +1483,7 @@ void *ru_thread_synch(void *arg) {
wait_sync("ru_thread_synch");
// initialize variables for PSS detection
lte_sync_time_init(&ru->frame_parms);
lte_sync_time_init(&ru->nr_frame_parms);
while (!oai_exit) {
......@@ -1566,9 +1495,9 @@ void *ru_thread_synch(void *arg) {
// run intial synch like UE
LOG_I(PHY,"Running initial synchronization\n");
sync_pos = lte_sync_time_eNB(ru->common.rxdata,
sync_pos = lte_sync_time_gNB(ru->common.rxdata,
fp,
fp->samples_per_tti*5,
fp->samples_per_subframe*5,
&peak_val,
sync_corr);
LOG_I(PHY,"RU synch: %d, val %d\n",sync_pos,peak_val);
......@@ -1577,17 +1506,17 @@ void *ru_thread_synch(void *arg) {
if (sync_pos >= fp->nb_prefix_samples)
sync_pos2 = sync_pos - fp->nb_prefix_samples;
else
sync_pos2 = sync_pos + (fp->samples_per_tti*10) - fp->nb_prefix_samples;
sync_pos2 = sync_pos + (fp->samples_per_subframe*10) - fp->nb_prefix_samples;
if (fp->frame_type == FDD) {
// PSS is hypothesized in last symbol of first slot in Frame
int sync_pos_slot = (fp->samples_per_tti>>1) - fp->ofdm_symbol_size - fp->nb_prefix_samples;
int sync_pos_slot = (fp->samples_per_subframe>>1) - fp->ofdm_symbol_size - fp->nb_prefix_samples;
if (sync_pos2 >= sync_pos_slot)
ru->rx_offset = sync_pos2 - sync_pos_slot;
else
ru->rx_offset = (fp->samples_per_tti*10) + sync_pos2 - sync_pos_slot;
ru->rx_offset = (fp->samples_per_subframe*10) + sync_pos2 - sync_pos_slot;
}
else {
......@@ -1595,14 +1524,13 @@ void *ru_thread_synch(void *arg) {
LOG_I(PHY,"Estimated sync_pos %d, peak_val %d => timing offset %d\n",sync_pos,peak_val,ru->rx_offset);
/*
if ((peak_val > 300000) && (sync_pos > 0)) {
// if (sync_pos++ > 3) {
write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2);
write_output("ru_rx.m","rxs",(void*)ru->ru_time.rxdata[0][0],fp->samples_per_tti*10,1,1);
write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_subframe*5,1,2);
write_output("ru_rx.m","rxs",(void*)ru->ru_time.rxdata[0][0],fp->samples_per_subframe*10,1,1);
exit(-1);
}
*/
ru->in_synch=1;
}
}
......@@ -1614,10 +1542,9 @@ void *ru_thread_synch(void *arg) {
return &ru_thread_synch_status;
}
*/
int start_if(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB) {
int start_if(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB) {
return(ru->ifdevice.trx_start_func(&ru->ifdevice));
}
......@@ -1651,7 +1578,7 @@ void init_RU_proc(RU_t *ru) {
char name[100];
#ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
#endif
proc = &ru->proc;
memset((void*)proc,0,sizeof(RU_proc_t));
......@@ -1673,13 +1600,13 @@ void init_RU_proc(RU_t *ru) {
pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL);
pthread_mutex_init( &proc->mutex_synch,NULL);
pthread_mutex_init( &proc->mutex_FH,NULL);
pthread_mutex_init( &proc->mutex_eNBs, NULL);
pthread_mutex_init( &proc->mutex_gNBs, NULL);
pthread_cond_init( &proc->cond_prach, NULL);
pthread_cond_init( &proc->cond_FH, NULL);
pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
pthread_cond_init( &proc->cond_synch,NULL);
pthread_cond_init( &proc->cond_eNBs, NULL);
pthread_cond_init( &proc->cond_gNBs, NULL);
pthread_attr_init( &proc->attr_FH);
pthread_attr_init( &proc->attr_prach);
......@@ -1687,31 +1614,20 @@ void init_RU_proc(RU_t *ru) {
pthread_attr_init( &proc->attr_asynch_rxtx);
pthread_attr_init( &proc->attr_fep);
#ifdef Rel14
proc->instance_cnt_prach_br = -1;
pthread_mutex_init( &proc->mutex_prach_br, NULL);
pthread_cond_init( &proc->cond_prach_br, NULL);
pthread_attr_init( &proc->attr_prach_br);
#endif
#ifndef DEADLINE_SCHEDULER
attr_FH = &proc->attr_FH;
attr_prach = &proc->attr_prach;
attr_synch = &proc->attr_synch;
attr_asynch = &proc->attr_asynch_rxtx;
#ifdef Rel14
attr_prach_br = &proc->attr_prach_br;
#endif
#endif
pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru );
if (ru->function == NGFI_RRU_IF4p5) {
pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru );
#ifdef Rel14
pthread_create( &proc->pthread_prach_br, attr_prach_br, ru_thread_prach_br, (void*)ru );
#endif
if (ru->is_slave == 1) pthread_create( &proc->pthread_synch, attr_synch, ru_thread_synch, (void*)ru);
///tmp deactivation of synch thread
// if (ru->is_slave == 1) pthread_create( &proc->pthread_synch, attr_synch, ru_thread_synch, (void*)ru);
if ((ru->if_timing == synch_to_other) ||
......@@ -1722,7 +1638,7 @@ void init_RU_proc(RU_t *ru) {
pthread_setname_np( proc->pthread_FH, name );
}
else if (ru->function == eNodeB_3GPP && ru->if_south == LOCAL_RF) { // DJP - need something else to distinguish between monolithic and PNF
else if (ru->function == gNodeB_3GPP && ru->if_south == LOCAL_RF) { // DJP - need something else to distinguish between monolithic and PNF
LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__);
pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru );
}
......@@ -1750,22 +1666,15 @@ void kill_RU_proc(int inst)
pthread_mutex_unlock(&proc->mutex_prach);
pthread_cond_signal(&proc->cond_prach);
#ifdef Rel14
pthread_mutex_lock(&proc->mutex_prach_br);
proc->instance_cnt_prach_br = 0;
pthread_mutex_unlock(&proc->mutex_prach_br);
pthread_cond_signal(&proc->cond_prach_br);
#endif
pthread_mutex_lock(&proc->mutex_synch);
proc->instance_cnt_synch = 0;
pthread_mutex_unlock(&proc->mutex_synch);
pthread_cond_signal(&proc->cond_synch);
pthread_mutex_lock(&proc->mutex_eNBs);
proc->instance_cnt_eNBs = 0;
pthread_mutex_unlock(&proc->mutex_eNBs);
pthread_cond_signal(&proc->cond_eNBs);
pthread_mutex_lock(&proc->mutex_gNBs);
proc->instance_cnt_gNBs = 0;
pthread_mutex_unlock(&proc->mutex_gNBs);
pthread_cond_signal(&proc->cond_gNBs);
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
proc->instance_cnt_asynch_rxtx = 0;
......@@ -1777,10 +1686,7 @@ void kill_RU_proc(int inst)
if (ru->function == NGFI_RRU_IF4p5) {
LOG_D(PHY, "Joining pthread_prach\n");
pthread_join(proc->pthread_prach, NULL);
#ifdef Rel14
LOG_D(PHY, "Joining pthread_prach_br\n");
pthread_join(proc->pthread_prach_br, NULL);
#endif
if (ru->is_slave) {
LOG_D(PHY, "Joining pthread_\n");
pthread_join(proc->pthread_synch, NULL);
......@@ -1824,13 +1730,13 @@ void kill_RU_proc(int inst)
pthread_mutex_destroy(&proc->mutex_asynch_rxtx);
pthread_mutex_destroy(&proc->mutex_synch);
pthread_mutex_destroy(&proc->mutex_FH);
pthread_mutex_destroy(&proc->mutex_eNBs);
pthread_mutex_destroy(&proc->mutex_gNBs);
pthread_cond_destroy(&proc->cond_prach);
pthread_cond_destroy(&proc->cond_FH);
pthread_cond_destroy(&proc->cond_asynch_rxtx);
pthread_cond_destroy(&proc->cond_synch);
pthread_cond_destroy(&proc->cond_eNBs);
pthread_cond_destroy(&proc->cond_gNBs);
pthread_attr_destroy(&proc->attr_FH);
pthread_attr_destroy(&proc->attr_prach);
......@@ -1838,11 +1744,6 @@ void kill_RU_proc(int inst)
pthread_attr_destroy(&proc->attr_asynch_rxtx);
pthread_attr_destroy(&proc->attr_fep);
#ifdef Rel14
pthread_mutex_destroy(&proc->mutex_prach_br);
pthread_cond_destroy(&proc->cond_prach_br);
pthread_attr_destroy(&proc->attr_prach_br);
#endif
}
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
......@@ -1852,17 +1753,17 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
int i;
int found_band=0;
LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->frame_parms.eutra_band);
LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms.eutra_band);
for (i=0;i<cap->num_bands;i++) {
LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx);
if (ru->frame_parms.eutra_band == cap->band_list[i]) {
if (ru->nr_frame_parms.eutra_band == cap->band_list[i]) {
found_band=1;
break;
}
}
if (found_band == 0) {
LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->frame_parms.eutra_band,ru->idx);
LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->nr_frame_parms.eutra_band,ru->idx);
return(-1);
}
......@@ -1900,6 +1801,7 @@ void configure_ru(int idx,
RU_t *ru = RC.ru[idx];
RRU_config_t *config = (RRU_config_t *)arg;
RRU_capabilities_t *capabilities = (RRU_capabilities_t*)arg;
nfapi_config_request_t *gNB_config = ru->gNB_list[0]->gNB_config;
int ret;
LOG_I(PHY, "Received capabilities from RRU %d\n",idx);
......@@ -1914,37 +1816,27 @@ void configure_ru(int idx,
ru->nb_rx = capabilities->nb_rx[0];
// Pass configuration to RRU
LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms.eutra_band);
LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms.eutra_band);
// wait for configuration
config->FH_fmt = ru->if_south;
config->num_bands = 1;
config->band_list[0] = ru->frame_parms.eutra_band;
config->tx_freq[0] = ru->frame_parms.dl_CarrierFreq;
config->rx_freq[0] = ru->frame_parms.ul_CarrierFreq;
config->tdd_config[0] = ru->frame_parms.tdd_config;
config->tdd_config_S[0] = ru->frame_parms.tdd_config_S;
config->band_list[0] = ru->nr_frame_parms.eutra_band;
config->tx_freq[0] = ru->nr_frame_parms.dl_CarrierFreq;
config->rx_freq[0] = ru->nr_frame_parms.ul_CarrierFreq;
//config->tdd_config[0] = ru->nr_frame_parms.tdd_config;
//config->tdd_config_S[0] = ru->nr_frame_parms.tdd_config_S;
config->att_tx[0] = ru->att_tx;
config->att_rx[0] = ru->att_rx;
config->N_RB_DL[0] = ru->frame_parms.N_RB_DL;
config->N_RB_UL[0] = ru->frame_parms.N_RB_UL;
config->threequarter_fs[0] = ru->frame_parms.threequarter_fs;
if (ru->if_south==REMOTE_IF4p5) {
config->prach_FreqOffset[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
config->prach_ConfigIndex[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
config->N_RB_DL[0] = gNB_config->rf_config.dl_channel_bandwidth.value;
config->N_RB_UL[0] = gNB_config->rf_config.ul_channel_bandwidth.value;
config->threequarter_fs[0] = ru->nr_frame_parms.threequarter_fs;
/* if (ru->if_south==REMOTE_IF4p5) {
config->prach_FreqOffset[0] = ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
config->prach_ConfigIndex[0] = ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
LOG_I(PHY,"REMOTE_IF4p5: prach_FrequOffset %d, prach_ConfigIndex %d\n",
config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);
#ifdef Rel14
int i;
for (i=0;i<4;i++) {
config->emtc_prach_CElevel_enable[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
config->emtc_prach_FreqOffset[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
config->emtc_prach_ConfigIndex[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i];
}
#endif
}
config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);*/
init_frame_parms(&ru->frame_parms,1);
nr_init_frame_parms(ru->gNB_list[0]->gNB_config, &ru->nr_frame_parms);
phy_init_RU(ru);
}
......@@ -1953,41 +1845,36 @@ void configure_rru(int idx,
RRU_config_t *config = (RRU_config_t *)arg;
RU_t *ru = RC.ru[idx];
ru->frame_parms.eutra_band = config->band_list[0];
ru->frame_parms.dl_CarrierFreq = config->tx_freq[0];
ru->frame_parms.ul_CarrierFreq = config->rx_freq[0];
if (ru->frame_parms.dl_CarrierFreq == ru->frame_parms.ul_CarrierFreq) {
ru->frame_parms.frame_type = TDD;
ru->frame_parms.tdd_config = config->tdd_config[0];
ru->frame_parms.tdd_config_S = config->tdd_config_S[0];
nfapi_config_request_t *gNB_config = ru->gNB_list[0]->gNB_config;
ru->nr_frame_parms.eutra_band = config->band_list[0];
ru->nr_frame_parms.dl_CarrierFreq = config->tx_freq[0];
ru->nr_frame_parms.ul_CarrierFreq = config->rx_freq[0];
if (ru->nr_frame_parms.dl_CarrierFreq == ru->nr_frame_parms.ul_CarrierFreq) {
gNB_config->subframe_config.duplex_mode.value = TDD;
//ru->nr_frame_parms.tdd_config = config->tdd_config[0];
//ru->nr_frame_parms.tdd_config_S = config->tdd_config_S[0];
}
else
ru->frame_parms.frame_type = FDD;
gNB_config->subframe_config.duplex_mode.value = FDD;
ru->att_tx = config->att_tx[0];
ru->att_rx = config->att_rx[0];
ru->frame_parms.N_RB_DL = config->N_RB_DL[0];
ru->frame_parms.N_RB_UL = config->N_RB_UL[0];
ru->frame_parms.threequarter_fs = config->threequarter_fs[0];
ru->frame_parms.pdsch_config_common.referenceSignalPower = ru->max_pdschReferenceSignalPower-config->att_tx[0];
gNB_config->rf_config.dl_channel_bandwidth.value = config->N_RB_DL[0];
gNB_config->rf_config.ul_channel_bandwidth.value = config->N_RB_UL[0];
ru->nr_frame_parms.threequarter_fs = config->threequarter_fs[0];
//ru->nr_frame_parms.pdsch_config_common.referenceSignalPower = ru->max_pdschReferenceSignalPower-config->att_tx[0];
if (ru->function==NGFI_RRU_IF4p5) {
ru->frame_parms.att_rx = ru->att_rx;
ru->frame_parms.att_tx = ru->att_tx;
ru->nr_frame_parms.att_rx = ru->att_rx;
ru->nr_frame_parms.att_tx = ru->att_tx;
/*
LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n",
config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx);
ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = config->prach_FreqOffset[0];
ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0];
#ifdef Rel14
for (int i=0;i<4;i++) {
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] = config->emtc_prach_CElevel_enable[0][i];
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i] = config->emtc_prach_FreqOffset[0][i];
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i] = config->emtc_prach_ConfigIndex[0][i];
}
#endif
ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = config->prach_FreqOffset[0];
ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; */
}
init_frame_parms(&ru->frame_parms,1);
nr_init_frame_parms(ru->gNB_list[0]->gNB_config, &ru->nr_frame_parms);
fill_rf_config(ru,ru->rf_config_file);
......@@ -1996,17 +1883,18 @@ void configure_rru(int idx,
}
void init_precoding_weights(PHY_VARS_eNB *eNB) {
/*
void init_precoding_weights(PHY_VARS_gNB *gNB) {
int layer,ru_id,aa,re,ue,tb;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
LTE_DL_FRAME_PARMS *fp=&gNB->frame_parms;
RU_t *ru;
LTE_eNB_DLSCH_t *dlsch;
LTE_gNB_DLSCH_t *dlsch;
// init precoding weigths
for (ue=0;ue<NUMBER_OF_UE_MAX;ue++) {
for (tb=0;tb<2;tb++) {
dlsch = eNB->dlsch[ue][tb];
dlsch = gNB->dlsch[ue][tb];
for (layer=0; layer<4; layer++) {
int nb_tx=0;
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
......@@ -2024,14 +1912,14 @@ void init_precoding_weights(PHY_VARS_eNB *eNB) {
}
}
}
}
}*/
void set_function_spec_param(RU_t *ru)
{
int ret;
switch (ru->if_south) {
case LOCAL_RF: // this is an RU with integrated RF (RRU, eNB)
case LOCAL_RF: // this is an RU with integrated RF (RRU, gNB)
if (ru->function == NGFI_RRU_IF5) { // IF5 RRU
ru->do_prach = 0; // no prach processing in RU
ru->fh_north_in = NULL; // no shynchronous incoming fronthaul from north
......@@ -2083,7 +1971,7 @@ void set_function_spec_param(RU_t *ru)
}
malloc_IF4p5_buffer(ru);
}
else if (ru->function == eNodeB_3GPP) {
else if (ru->function == gNodeB_3GPP) {
ru->do_prach = 0; // no prach processing in RU
ru->feprx = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread; // RX DFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft and precoding
......@@ -2099,7 +1987,7 @@ void set_function_spec_param(RU_t *ru)
ru->stop_rf = stop_rf;
printf("configuring ru_id %d (start_rf %p)\n", ru->idx, start_rf);
/*
if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
if (ru->function == gNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1);
phy_init_RU(ru);
......@@ -2182,7 +2070,7 @@ void init_RU(char *rf_config_file) {
int ru_id;
RU_t *ru;
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
PHY_VARS_gNB *gNB0= (PHY_VARS_gNB *)NULL;
int i;
int CC_id;
......@@ -2198,7 +2086,7 @@ void init_RU(char *rf_config_file) {
if (RC.nb_CC != 0)
for (i=0;i<RC.nb_L1_inst;i++)
for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.eNB[i][CC_id]->num_RU=0;
for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.gNB[i][CC_id]->num_RU=0;
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
......@@ -2207,19 +2095,19 @@ void init_RU(char *rf_config_file) {
ru->rf_config_file = rf_config_file;
ru->idx = ru_id;
ru->ts_offset = 0;
// use eNB_list[0] as a reference for RU frame parameters
// use gNB_list[0] as a reference for RU frame parameters
// NOTE: multiple CC_id are not handled here yet!
if (ru->num_eNB > 0) {
LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
if (ru->num_gNB > 0) {
LOG_D(PHY, "%s() RC.ru[%d].num_gNB:%d ru->gNB_list[0]:%p RC.gNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_gNB, ru->gNB_list[0], RC.gNB[0][0], ru->rf_config_file);
if (ru->eNB_list[0] == 0)
if (ru->gNB_list[0] == 0)
{
LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__);
ru->eNB_list[0] = RC.eNB[0][0];
ru->num_eNB=1;
LOG_E(PHY,"%s() DJP - ru->gNB_list ru->num_gNB are not initialized - so do it manually\n", __FUNCTION__);
ru->gNB_list[0] = RC.gNB[0][0];
ru->num_gNB=1;
//
// DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU
// DJP - feptx_prec() / feptx_ofdm() parses the gNB_list (based on num_gNB) and copies the txdata_F to txdata in RU
//
}
else
......@@ -2227,27 +2115,27 @@ void init_RU(char *rf_config_file) {
LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__);
}
}
eNB0 = ru->eNB_list[0];
gNB0 = ru->gNB_list[0];
LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
LOG_D(PHY, "eNB0:%p\n", eNB0);
if (eNB0)
LOG_D(PHY, "gNB0:%p\n", gNB0);
if (gNB0)
{
if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
AssertFatal(eNB0!=NULL,"eNB0 is null!\n");
AssertFatal(gNB0!=NULL,"gNB0 is null!\n");
if (eNB0) {
LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
if (gNB0) {
LOG_I(PHY,"Copying frame parms from gNB %d to ru %d\n",gNB0->Mod_id,ru->idx);
memcpy((void*)&ru->nr_frame_parms,(void*)&gNB0->frame_parms,sizeof(NR_DL_FRAME_PARMS));
// attach all RU to all eNBs in its list/
LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU);
for (i=0;i<ru->num_eNB;i++) {
eNB0 = ru->eNB_list[i];
eNB0->RU_list[eNB0->num_RU++] = ru;
// attach all RU to all gNBs in its list/
LOG_D(PHY,"ru->num_gNB:%d gNB0->num_RU:%d\n", ru->num_gNB, gNB0->num_RU);
for (i=0;i<ru->num_gNB;i++) {
gNB0 = ru->gNB_list[i];
gNB0->RU_list[gNB0->num_RU++] = ru;
}
}
}
// LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
// LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],gNB_timing[ru->if_timing],ru->function);
set_function_spec_param(ru);
LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
......@@ -2259,7 +2147,7 @@ void init_RU(char *rf_config_file) {
} // for ru_id
// sleep(1);
LOG_D(HW,"[lte-softmodem.c] RU threads created\n");
LOG_D(HW,"[nr-softmodem.c] RU threads created\n");
}
......@@ -2311,17 +2199,17 @@ void RCconfig_RU(void) {
RC.ru[j]->if_timing = synch_to_ext_device;
if (RC.nb_L1_inst >0)
RC.ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
RC.ru[j]->num_gNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
else
RC.ru[j]->num_eNB = 0;
for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
RC.ru[j]->num_gNB = 0;
for (i=0;i<RC.ru[j]->num_gNB;i++) RC.ru[j]->gNB_list[i] = RC.gNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
RC.ru[j]->if_south = LOCAL_RF;
RC.ru[j]->function = eNodeB_3GPP;
printf("Setting function for RU %d to eNodeB_3GPP\n",j);
RC.ru[j]->function = gNodeB_3GPP;
printf("Setting function for RU %d to gNodeB_3GPP\n",j);
}
else {
RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
......
......@@ -72,7 +72,7 @@ int main( int argc, char **argv )
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
#include "PHY/types.h"
#include "PHY/defs_NR.h"
#include "PHY/defs.h"
#include "PHY/vars.h"
#include "SCHED/vars.h"
#include "LAYER2/MAC/vars.h"
......@@ -227,7 +227,7 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
///extern void init_eNB_afterRU(void);
extern void init_eNB_afterRU(void);
int transmission_mode=1;
......@@ -689,8 +689,8 @@ void init_openair0(void) {
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
RC.eNB[0][0]->frame_parms.nb_antennas_tx ,
RC.eNB[0][0]->frame_parms.nb_antennas_rx );
RC.gNB[0][0]->gNB_config->rf_config.tx_antenna_ports.value,
RC.gNB[0][0]->gNB_config->rf_config.tx_antenna_ports.value );
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=config[0]->rf_config.dl_channel_bandwidth.value;
......@@ -698,8 +698,8 @@ void init_openair0(void) {
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].tx_num_channels=min(2,RC.eNB[0][0]->frame_parms.nb_antennas_tx );
openair0_cfg[card].rx_num_channels=min(2,RC.eNB[0][0]->frame_parms.nb_antennas_rx );
openair0_cfg[card].tx_num_channels=min(2,RC.gNB[0][0]->gNB_config->rf_config.tx_antenna_ports.value );
openair0_cfg[card].rx_num_channels=min(2,RC.gNB[0][0]->gNB_config->rf_config.tx_antenna_ports.value );
for (i=0; i<4; i++) {
......@@ -715,7 +715,7 @@ void init_openair0(void) {
openair0_cfg[card].autocal[i] = 1;
openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
openair0_cfg[card].rx_gain[i] = RC.eNB[0][0]->rx_total_gain_dB;
openair0_cfg[card].rx_gain[i] = RC.gNB[0][0]->rx_total_gain_dB;
openair0_cfg[card].configFilename = rf_config_file;
......@@ -759,7 +759,7 @@ void wait_gNBs(void) {
printf("RC.nb_L1_CC[%d]:%d\n", i, RC.nb_L1_CC[i]);
for (j=0;j<RC.nb_L1_CC[i];j++) {
if (RC.eNB[i][j]->configured==0) { ///gNB
if (RC.gNB[i][j]->configured==0) {
waiting=1;
break;
}
......@@ -786,7 +786,7 @@ extern void phy_free_RU(RU_t*);
int stop_L1L2(module_id_t gnb_id)
{
LOG_W(ENB_APP, "stopping lte-softmodem\n");
LOG_W(ENB_APP, "stopping nr-softmodem\n");
oai_exit = 1;
if (!RC.ru) {
......@@ -816,13 +816,13 @@ int stop_L1L2(module_id_t gnb_id)
/* these tasks need to pick up new configuration */
terminate_task(TASK_RRC_ENB, gnb_id);
terminate_task(TASK_L2L1, gnb_id);
LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", gnb_id);
LOG_I(ENB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id);
kill_gNB_proc(gnb_id);
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", gnb_id);
kill_RU_proc(gnb_id);
oai_exit = 0;
for (int cc_id = 0; cc_id < RC.nb_CC[gnb_id]; cc_id++) {
//free_transport(RC.eNB[gnb_id][cc_id]);
//free_transport(RC.gNB[gnb_id][cc_id]);
phy_free_nr_gNB(RC.gNB[gnb_id][cc_id]);
}
phy_free_RU(RC.ru[gnb_id]);
......@@ -850,7 +850,7 @@ int restart_L1L2(module_id_t gnb_id)
RC.ru_mask |= (1 << ru->idx);
/* copy the changed frame parameters to the RU */
/* TODO this should be done for all RUs associated to this eNB */
/* TODO this should be done for all RUs associated to this gNB */
memcpy(&ru->frame_parms, &RC.gNB[gnb_id][0]->frame_parms, sizeof(NR_DL_FRAME_PARMS));
set_function_spec_param(RC.ru[gnb_id]);
......@@ -876,7 +876,7 @@ int restart_L1L2(module_id_t gnb_id)
/* TODO XForms might need to be restarted, but it is currently (09/02/18)
* broken, so we cannot test it */
wait_eNBs();
wait_gNBs();
init_RU_proc(ru);
ru->rf_map.card = 0;
ru->rf_map.chain = 0; /* CC_id + chain_offset;*/
......@@ -961,7 +961,7 @@ int main( int argc, char **argv )
if (ouput_vcd) {
VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_gNB.vcd");
}
if (opp_enabled ==1) {
......@@ -1173,11 +1173,11 @@ int main( int argc, char **argv )
printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
if (RC.nb_L1_inst > 0) {
printf("Initializing gNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync);
init_eNB(single_thread_flag,wait_for_sync);
init_gNB(single_thread_flag,wait_for_sync);
}
printf("wait_gNBs()\n");
wait_eNBs();
wait_gNBs();
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
if (RC.nb_RU >0) {
......@@ -1200,7 +1200,7 @@ int main( int argc, char **argv )
printf("ALL RUs READY!\n");
printf("RC.nb_RU:%d\n", RC.nb_RU);
// once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
printf("ALL RUs ready - init eNBs\n");
printf("ALL RUs ready - init gNBs\n");
if (nfapi_mode != 1 && nfapi_mode != 2)
{
......@@ -1209,10 +1209,10 @@ int main( int argc, char **argv )
}
else
{
printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n");
printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
}
printf("ALL RUs ready - ALL eNBs ready\n");
printf("ALL RUs ready - ALL gNBs ready\n");
// connect the TX/RX buffers
......@@ -1278,7 +1278,7 @@ int main( int argc, char **argv )
* threads have been stopped (they partially use the same memory) */
for (int inst = 0; inst < NB_gNB_INST; inst++) {
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
free_transport(RC.gNB[inst][cc_id]);
//free_transport(RC.gNB[inst][cc_id]);
phy_free_nr_gNB(RC.gNB[inst][cc_id]);
}
}
......
......@@ -252,8 +252,6 @@ extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern void init_fep_thread(PHY_VARS_gNB *, pthread_attr_t *);
extern void init_td_thread(PHY_VARS_gNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_gNB *, pthread_attr_t *);
void init_gNB_afterRU(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment