diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e2457630a..2b852dcd0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -917,7 +917,6 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach_common.c ${OPENAIR1_DIR}/PHY/nr_phy_common/src/nr_phy_common_csirs.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_scrambling.c - ${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/refsig.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c ) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 516c94cb46..1bac7e6da7 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -109,8 +109,6 @@ static const unsigned short srs_bandwidth_config[C_SRS_NUMBER][B_SRS_NUMBER][2] /* 63 */ {{272, 1}, {16, 17}, {8, 2}, {4, 2}}, }; -const char *duplex_mode[]={"FDD","TDD"}; - static const uint8_t bit_reverse_table_256[] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, @@ -126,6 +124,36 @@ static const uint8_t bit_reverse_table_256[] = { 0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF}; +simde__m128i byte2bit16_lut[256]; +void init_byte2bit16(void) +{ + for (int s = 0; s < 256; s++) { + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], s & 1, 0); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 1) & 1, 1); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 2) & 1, 2); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 3) & 1, 3); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 4) & 1, 4); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 5) & 1, 5); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 6) & 1, 6); + byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 7) & 1, 7); + } +} + +simde__m128i byte2m128i[256]; +void init_byte2m128i(void) { + + for (int s=0;s<256;s++) { + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*(s&1)),0); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>1)&1)),1); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>2)&1)),2); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>3)&1)),3); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>4)&1)),4); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>5)&1)),5); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>6)&1)),6); + byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>7)&1)),7); + } +} + void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out) { DevAssert(in != NULL); @@ -704,7 +732,7 @@ frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) { int32_t delta_duplex = get_delta_duplex(current_band, scs_index); frame_type_t current_type = delta_duplex == 0 ? TDD : FDD; - LOG_D(NR_MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[current_type], delta_duplex); + LOG_D(NR_MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode_txt[current_type], delta_duplex); return current_type; } diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 1408f271b0..8509aac413 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -183,6 +183,15 @@ uint32_t nr_timer_elapsed_time(const NR_timer_t *timer); int set_default_nta_offset(frequency_range_t freq_range, uint32_t samples_per_subframe); extern const nr_bandentry_t nr_bandtable[]; +extern simde__m128i byte2bit16_lut[256]; +void init_byte2bit16(void); +void init_byte2m128i(void); + +static inline simde__m128i byte2bit16(uint8_t b) +{ + return byte2bit16_lut[b]; +} + static inline int get_num_dmrs(uint16_t dmrs_mask ) { int num_dmrs=0; @@ -262,6 +271,8 @@ unsigned short get_N_b_srs(int c_srs, int b_srs); // Align up to a multiple of 16 #define ALIGN_UP_16(a) ((a + 15) & ~15) +static const char *const duplex_mode_txt[] = {"FDD", "TDD"}; + #ifdef __cplusplus #ifdef min #undef min diff --git a/doc/Doxyfile b/doc/Doxyfile index 023fe84693..22273aaf71 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -2085,7 +2085,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/sss_nr.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/scrambling_luts.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/dmrs_nr.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/refsig_defs_ue.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_REFSIG/ptrs_nr.h \ diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index e14e482b6d..210b5b09a1 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -86,6 +86,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "time_meas.h" #include "utils.h" #include "x2ap_eNB.h" +#include "openair1/SCHED_NR/sched_nr.h" pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; @@ -116,8 +117,7 @@ double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}}; double rx_gain_off = 0.0; static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; -int chain_offset=0; -extern void *udp_eNB_task(void *args_p); +int chain_offset = 0; int emulate_rf = 0; int numerology = 0; double cpuf; @@ -398,9 +398,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) { itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } -//extern void free_transport(PHY_VARS_gNB *); -extern void nr_phy_free_RU(RU_t *); - int stop_L1(module_id_t gnb_id) { RU_t *ru = RC.ru[gnb_id]; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index ca92f30d4f..690e6f3e25 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -91,7 +91,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "pdcp.h" #include "actor.h" -extern const char *duplex_mode[]; THREAD_STRUCT thread_struct; nrUE_params_t nrUE_params = {0}; @@ -270,12 +269,13 @@ void init_openair0() openair0_cfg[card].tx_num_channels = min(4, frame_parms->nb_antennas_tx); openair0_cfg[card].rx_num_channels = min(4, frame_parms->nb_antennas_rx); - LOG_I(PHY, "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", - card, - openair0_cfg[card].sample_rate, - openair0_cfg[card].tx_num_channels, - openair0_cfg[card].rx_num_channels, - duplex_mode[openair0_cfg[card].duplex_mode]); + LOG_I(PHY, + "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n", + card, + openair0_cfg[card].sample_rate, + openair0_cfg[card].tx_num_channels, + openair0_cfg[card].rx_num_channels, + duplex_mode_txt[openair0_cfg[card].duplex_mode]); if (is_sidelink) { dl_carrier = frame_parms->dl_CarrierFreq; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 2e7aaacc21..2d7d1b33cf 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -361,6 +361,8 @@ void configure_rru(void *, void *arg); struct timespec timespec_add(struct timespec lhs, struct timespec rhs); struct timespec timespec_sub(struct timespec lhs, struct timespec rhs); extern uint8_t nfapi_mode; +extern char *parallel_config; +extern char *worker_config; #ifdef __cplusplus } #endif diff --git a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_segment/nrLDPC_coding_segment_encoder.c b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_segment/nrLDPC_coding_segment_encoder.c index 757566b1fc..adf9dd6624 100644 --- a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_segment/nrLDPC_coding_segment_encoder.c +++ b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_segment/nrLDPC_coding_segment_encoder.c @@ -44,8 +44,6 @@ // #define DEBUG_LDPC_ENCODING // #define DEBUG_LDPC_ENCODING_FREE 1 -extern ldpc_interface_t ldpc_interface_segment; - typedef struct ldpc8blocks_args_s { nrLDPC_TB_encoding_parameters_t *nrLDPC_TB_encoding_parameters; encoder_implemparams_t impp; diff --git a/openair1/PHY/CODING/nrLDPC_extern.h b/openair1/PHY/CODING/nrLDPC_extern.h index f93e7eb9aa..a0e10db155 100644 --- a/openair1/PHY/CODING/nrLDPC_extern.h +++ b/openair1/PHY/CODING/nrLDPC_extern.h @@ -32,7 +32,7 @@ typedef struct ldpc_interface_s { } ldpc_interface_t; // Global var to limit the rework of the dirty legacy code -extern ldpc_interface_t ldpc_interface, ldpc_interface_offload; +extern ldpc_interface_t ldpc_interface, ldpc_interface_offload, ldpc_interface_segment; /* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */ int load_LDPClib(char *version, ldpc_interface_t *); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index f3c8d01579..3db1339169 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -129,6 +129,7 @@ void phy_init_nr_gNB(PHY_VARS_gNB *gNB) crcTableInit(); init_byte2m128i(); + init_byte2bit16(); init_pucch2_luts(); nr_init_fde(); // Init array for frequency equalization of transform precoding of PUSCH diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 69d032a4f8..2e6e4a54a6 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -36,12 +36,9 @@ #define I0_SKIP_DC 1 -extern openair0_config_t openair0_cfg[MAX_CARDS]; - int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, const c16_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]) { - int timing_advance = 0; int max_val = 0; diff --git a/openair1/PHY/NR_REFSIG/nr_refsig.h b/openair1/PHY/NR_REFSIG/nr_refsig.h index c79d0b70aa..b0cd9449f0 100644 --- a/openair1/PHY/NR_REFSIG/nr_refsig.h +++ b/openair1/PHY/NR_REFSIG/nr_refsig.h @@ -44,7 +44,6 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms, const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params, const int slot, const csi_mapping_parms_t *phy_csi_parms); -void init_byte2m128i(void); void nr_generate_modulation_table(void); diff --git a/openair1/PHY/NR_REFSIG/scrambling_luts.c b/openair1/PHY/NR_REFSIG/scrambling_luts.c deleted file mode 100644 index f6b1207838..0000000000 --- a/openair1/PHY/NR_REFSIG/scrambling_luts.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 - */ - -/* Lookup tables for 3GPP scrambling/unscrambling */ - -/* Author R. Knopp / EURECOM / OpenAirInterface.org */ - -#include "PHY/impl_defs_nr.h" -#include "PHY/sse_intrin.h" -#include - -simde__m128i byte2m128i[256]; - -void init_byte2m128i(void) { - - for (int s=0;s<256;s++) { - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*(s&1)),0); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>1)&1)),1); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>2)&1)),2); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>3)&1)),3); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>4)&1)),4); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>5)&1)),5); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>6)&1)),6); - byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>7)&1)),7); - } -} - diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c index 0a3717ec70..3f1d988c53 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c @@ -34,8 +34,6 @@ #include "nr_dlsch.h" #include "../../../nfapi/oai_integration/vendor_ext.h" -extern void set_taus_seed(unsigned int seed_type); - void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu) { NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0]; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index ee4874026a..40bae6eac7 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -34,10 +34,7 @@ #include #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h" #include "instrumentation.h" - - -extern openair0_config_t openair0_cfg[]; - +#include "executables/nr-softmodem-common.h" // #define DEBUG_PDSCH // #define DEBUG_PDCCH // #define DEBUG_PBCH(a...) printf(a) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index e5442aab48..4ac5f9e772 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1515,8 +1515,8 @@ uint8_t nr_matrix_inverse(int32_t size, //Convert Q15 to floating point for (int rtx=0;rtx0) {//determin of the symmetric matrix is real part only - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)*(1<<(shift0)))+0.5);// - //((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)*(1<<(shift0)))+0.5);// + ((short *)ad_bc)[i << 1] = (short)((creal(determin_cpx) * (1 << (shift0))) + 0.5); // } else { - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)*(1<<(shift0)))-0.5);// - //((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)*(1<<(shift0)))-0.5);// + ((short *)ad_bc)[i << 1] = (short)((creal(determin_cpx) * (1 << (shift0))) - 0.5); // } - //if (i<4) printf("nr_det_FP= %d+j%d \n",((short*) ad_bc)[i<<1],((short*) ad_bc)[(i<<1)+1]); //Compute Inversion of the H^*H matrix (normalized output divide by determinant) for (int rtx=0;rtx - -extern uint8_t nfapi_mode; - uint8_t get_nr_prach_duration(uint8_t prach_format){ switch(prach_format){ diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 6dffd4ad8c..fbfc9d8389 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -41,8 +41,7 @@ #include "utils.h" #include "openair2/PHY_INTERFACE/queue_t.h" #include "SCHED_NR_UE/phy_sch_processing_time.h" - -extern PHY_VARS_NR_UE ***PHY_vars_UE_g; +#include "openair1/PHY/phy_extern_nr_ue.h" const char *const dl_pdu_type[] = {"DCI", "DLSCH", "RA_DLSCH", "SI_DLSCH", "P_DLSCH", "CSI_RS", "CSI_IM", "TA"}; const char *const ul_pdu_type[] = {"PRACH", "PUCCH", "PUSCH", "SRS"}; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 6daae2907d..f166135fed 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -59,11 +59,6 @@ #include "executables/thread-common.h" #include -extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); -extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw); -extern char *parallel_config; -extern char *worker_config; - RAN_CONTEXT_t RC; void RCconfig_L1(void) { diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h index 1a8a1f98bc..bf060eb820 100644 --- a/openair2/LAYER2/MAC/mac_proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -1235,10 +1235,12 @@ void eNB_Config_Local_DRX(instance_t module_idP, rrc_mac_drx_config_req_t *rrc_m /* from here: prototypes to get rid of compilation warnings: doc to be written by function author */ uint8_t ul_subframe2_k_phich(COMMON_channels_t *cc, sub_frame_t ul_subframe); -#endif /** @}*/ /* MAC ITTI messaging related functions */ /* Main loop of MAC itti message handling */ void *mac_enb_task(void *arg); +uint32_t to_earfcn_DL(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw); +uint32_t to_earfcn_UL(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw); +#endif diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 762cad5106..c7ceeeab8e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -60,8 +60,6 @@ // #define DEBUG_MIB // #define ENABLE_MAC_PAYLOAD_DEBUG 1 // #define DEBUG_RAR -extern uint32_t N_RB_DL; - /* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ static const int sequence_cyclic_shift_1_harq_ack_bit[2] /* HARQ-ACK Value 0 1 */ diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 4927f407d0..c8aa0b2ac1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -62,10 +62,6 @@ #include "nfapi_nr_interface_scf.h" #include "utils.h" -extern RAN_CONTEXT_t RC; -//extern int l2_init_gNB(void); -extern uint8_t nfapi_mode; - c16_t convert_precoder_weight(double complex c_in) { double cr = creal(c_in) * 32768 + 0.5; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 5ac48f1374..f0581cf58e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -46,8 +46,6 @@ #include "openair2/LAYER2/RLC/rlc.h" #include -extern RAN_CONTEXT_t RC; -extern const uint8_t nr_slots_per_frame[5]; // forward declaration of functions used in this file static void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index fb239c48e4..e2fa7d744b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -45,8 +45,6 @@ #include "executables/softmodem-common.h" -extern RAN_CONTEXT_t RC; - static void schedule_ssb(frame_t frame, sub_frame_t slot, NR_ServingCellConfigCommon_t *scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 26cffef6ac..026f93fd43 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -37,10 +37,8 @@ #include "executables/softmodem-common.h" #include "common/utils/nr/nr_common.h" -//#define UL_HARQ_PRINT -extern RAN_CONTEXT_t RC; - -//#define ENABLE_MAC_PAYLOAD_DEBUG 1 +// #define UL_HARQ_PRINT +// #define ENABLE_MAC_PAYLOAD_DEBUG 1 uint32_t target_dl_mcs = 9; uint32_t target_dl_Nl = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ec243fcd86..1ca064b101 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -63,12 +63,9 @@ #include "common/utils/alg/find.h" -//#define DEBUG_DCI - -extern RAN_CONTEXT_t RC; - -// CQI TABLES (10 times the value in 214 to adequately compare with R) -// Table 1 (38.214 5.2.2.1-2) +// #define DEBUG_DCI +// CQI TABLES (10 times the value in 214 to adequately compare with R) +// Table 1 (38.214 5.2.2.1-2) static const uint16_t cqi_table1[16][2] = {{0, 0}, {2, 780}, {2, 1200}, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c index e6935db7ae..cbfac0148d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c @@ -37,10 +37,7 @@ #include #include "PHY/sse_intrin.h" -//#define SRS_DEBUG - -extern RAN_CONTEXT_t RC; - +// #define SRS_DEBUG const uint16_t m_SRS[64] = { 4, 8, 12, 16, 16, 20, 24, 24, 28, 32, 36, 40, 48, 48, 52, 56, 60, 64, 72, 72, 76, 80, 88, 96, 96, 104, 112, 120, 120, 120, 128, 128, 128, 132, 136, 144, 144, 144, 144, 152, 160, 160, 160, 168, 176, 184, 192, 192, 192, 192, 208, 216, 224, 240, 240, 240, 240, 256, 256, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 378565123b..7a14dc7124 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -33,9 +33,6 @@ #include "common/ran_context.h" #include "common/utils/nr/nr_common.h" #include "nfapi/oai_integration/vendor_ext.h" - -extern RAN_CONTEXT_t RC; - static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac, frame_t frame, sub_frame_t slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 3456cc86fd..a8fe8de79c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -72,9 +72,6 @@ #include "time_meas.h" #include "utils.h" -extern RAN_CONTEXT_t RC; - - #define MACSTATSSTRLEN 36256 void *nrmac_stats_thread(void *arg) { diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 64a152f847..bffb064159 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -41,9 +41,6 @@ #include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" #include "openair2/F1AP/f1ap_ids.h" #include "openair3/ocp-gtpu/gtp_itf.h" - -extern RAN_CONTEXT_t RC; - #include #include diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index f23460c994..aac556575d 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -45,22 +45,11 @@ #include "openair2/NR_PHY_INTERFACE/nr_sched_response.h" #include "openair2/PHY_INTERFACE/queue_t.h" #include "utils.h" +#include "nfapi/oai_integration/nfapi_pnf.h" #define MAX_IF_MODULES 100 static NR_IF_Module_t *nr_if_inst[MAX_IF_MODULES]; -extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); -extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); -extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); -extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind); -extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); -extern int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind); -extern int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind); -extern int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind); -extern int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind); -extern int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind); -extern int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind); -extern uint8_t nfapi_mode; static void handle_nr_rach(NR_UL_IND_t *UL_info) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.c b/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.c index 8a6bd3118c..97c5a4e130 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.c @@ -57,7 +57,6 @@ void read_channel_param(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t * pdu, int slot, return; } -extern nr_bler_struct nr_bler_data[NR_NUM_MCS]; float get_bler_val(uint8_t mcs, int sinr) { // 4th col = dropped packets, 5th col = total packets diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index bfe07c86ca..78f05cf56a 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -34,6 +34,7 @@ #include "uper_encoder.h" #include "uper_decoder.h" #include "rrc_defs.h" +#include "rrc_proto.h" #include "rrc_extern.h" #include "assertions.h" #include "common/ran_context.h" @@ -104,23 +105,8 @@ #define NUMBEROF_DRBS_TOBE_ADDED 1 static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size); -extern RAN_CONTEXT_t RC; - -extern eNB_MAC_INST *eNB_mac_inst; -extern UE_MAC_INST *UE_mac_inst; - - mui_t rrc_eNB_mui = 0; -extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); -extern int rrc_eNB_process_security(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, security_capabilities_t *security_capabilities_pP); -extern void process_eNB_security_key(const protocol_ctxt_t *const ctxt_pP, - rrc_eNB_ue_context_t *const ue_context_pP, - uint8_t *security_key_pP); -extern int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, rrc_eNB_ue_context_t *ue_context, unsigned char *buffer, int buffer_size, OCTET_STRING_t *scg_group_config, - OCTET_STRING_t *scg_RB_config); -extern struct rrc_eNB_ue_context_s *get_first_ue_context(eNB_RRC_INST *rrc_instance_pP); - pthread_mutex_t rrc_release_freelist; RRC_release_list_t rrc_release_info; pthread_mutex_t lock_ue_freelist; diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 4ec1b9383d..1124cc8dd9 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -29,6 +29,7 @@ */ #include "rrc_defs.h" +#include "rrc_proto.h" #include "rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "RRC/LTE/MESSAGES/asn1_msg.h" @@ -396,7 +397,9 @@ static e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_inte return INTEGRITY_ALGORITHM_NONE; } -/*! \fn int rrc_eNB_process_security (uint8_t mod_id, uint8_t ue_index, security_capabilities_t *security_capabilities) +/*! \fn int rrc_eNB_process_security(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + security_capabilities_t *security_capabilities_pP) *\brief save and analyze available security algorithms bit mask and select relevant ones. *\param mod_id Instance ID of eNB. *\param ue_index Instance ID of UE in the eNB. diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 1810fbaed2..38ba42b251 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -654,5 +654,16 @@ extern pthread_mutex_t lock_ue_freelist; void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti); void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag); void release_UE_in_freeList(module_id_t mod_id); - +int rrc_eNB_process_security(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + security_capabilities_t *security_capabilities_pP); +void process_eNB_security_key(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t *security_key_pP); +int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, + rrc_eNB_ue_context_t *ue_context, + unsigned char *buffer, + int buffer_size, + OCTET_STRING_t *scg_group_config, + OCTET_STRING_t *scg_RB_config); /** @}*/ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 68a8c49774..b66625e6b2 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -153,8 +153,6 @@ typedef struct xer_sprint_string_s { size_t string_index; } xer_sprint_string_t; -extern RAN_CONTEXT_t RC; - /* * This is a helper function for xer_sprint, which directs all incoming data * into the provided string. diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index b4d33b16f0..fd69a4fafd 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -101,10 +101,6 @@ #include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" #endif -//#define XER_PRINT - -extern RAN_CONTEXT_t RC; - mui_t rrc_gNB_mui = 0; typedef struct deliver_ue_ctxt_release_data_t { diff --git a/openair2/RRC/NR/rrc_gNB_GTPV1U.c b/openair2/RRC/NR/rrc_gNB_GTPV1U.c index 6bf64a27a9..79882d58f3 100644 --- a/openair2/RRC/NR/rrc_gNB_GTPV1U.c +++ b/openair2/RRC/NR/rrc_gNB_GTPV1U.c @@ -36,8 +36,6 @@ #include "rrc_eNB_GTPV1U.h" #include "s1ap_messages_types.h" -extern RAN_CONTEXT_t RC; - int rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(gNB_RRC_UE_t *ue, const gtpv1u_enb_create_tunnel_resp_t *const create_tunnel_resp_pP, uint8_t *inde_list) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 08f83ea5c8..0b1c3012f4 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -87,8 +87,6 @@ #include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" #endif -extern RAN_CONTEXT_t RC; - /* Masks for NGAP Encryption algorithms, NEA0 is always supported (not coded) */ static const uint16_t NGAP_ENCRYPTION_NEA1_MASK = 0x8000; static const uint16_t NGAP_ENCRYPTION_NEA2_MASK = 0x4000; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.h b/openair2/RRC/NR/rrc_gNB_NGAP.h index a4ccaaa41b..22fff8705f 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.h +++ b/openair2/RRC/NR/rrc_gNB_NGAP.h @@ -40,6 +40,8 @@ #include "ngap_messages_types.h" #include "nr_rrc_defs.h" +extern mui_t rrc_gNB_mui; + void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRCSetupComplete_IEs_t *rrcSetupComplete); int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t instance); diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index 22e86c5120..e4c4e8b67e 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -34,9 +34,7 @@ #include "MESSAGES/asn1_msg.h" #include "nr_pdcp/nr_pdcp_oai_api.h" #include "openair3/SECU/key_nas_deriver.h" - -/* declared in rrc_gNB.c: should be cleaned up through helper function? useful? */ -extern mui_t rrc_gNB_mui; +#include "openair2/RRC/NR/rrc_gNB_NGAP.h" typedef enum { HO_CTX_BOTH, HO_CTX_SOURCE, HO_CTX_TARGET } ho_ctx_type_t; static nr_handover_context_t *alloc_ho_ctx(ho_ctx_type_t type) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index 5e9ce65194..f05a173960 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -53,7 +53,6 @@ #define MAX_NAS_UE 4 -extern uint16_t NB_UE_INST; static nr_ue_nas_t nr_ue_nas[MAX_NAS_UE] = {0}; static nr_nas_msg_snssai_t nas_allowed_nssai[8];