Commit 5c23af77 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu Committed by Cedric Roux

Compare version number using MAKE_VERSION macro to provide better SW configuration:

1. Previous SW configuration for different RRC version relies on whether macro Rel10,
   Rel14 defined or not by checking #ifdef Rel14 or #if defined(Rel10) || defined(R14).
   Whenever there is a newer RRC version, e.g. Rel15, it will be very a tedious and
   error-prone job to add defined(Rel15) in every place.

2. Some RRC messages are defined in release 13 instead of release 14, NB-IoT
   feature is one of such example. Our code shall reflect this fact instead of using
   an afterward version number in software configuration.

3. Some RRC messages or some fields of certain RRC messages are added in the middle
   a release, e.g. SystemInformationBlockType1_v1310_IEs_t defined in RRC 13.1.0
   and RRC 9.2.0 made some changes to SIB12 and SIB13 so we have sib12_v920 and
   sib13_v920 fields in SIB12 and SIB13's struct.
   We need a finer grain of control when using ASN1 from different RRC version.

4. S1AP also has this problem that it use UPDATE_RELEASE_9 and UPDATE_RELEASE_10 to
   differentiate between various S1AP version.

This commit propose using MAKE_VERSION(x,y,z) to designate the version number and
modify current conditional compilation accordingly.

Note: 2018/04/16, Modified based on Cedric's comment.
parent 184d51c6
......@@ -113,6 +113,14 @@ macro(add_list_string_option name val helpstr)
add_definitions("-D${name}=\"${value}\"")
endif()
endmacro(add_list_string_option)
function(make_version VERSION_VALUE)
math(EXPR RESULT "0")
foreach (ARG ${ARGN})
math(EXPR RESULT "${RESULT} * 16 + ${ARG}")
endforeach()
set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
endfunction()
####################################################
# compilation flags
#############################################
......@@ -162,7 +170,7 @@ set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
# add autotools definitions that were maybe used!
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP"
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
......@@ -284,16 +292,21 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
make_version(RRC_VERSION 8 6 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
make_version(RRC_VERSION 10 2 0)
add_definitions(-DCBA)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
make_version(RRC_VERSION 10 2 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
else()
make_version(RRC_VERSION 14 3 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION})
add_definitions(-DRRC_VERSION=${RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call})
......@@ -332,18 +345,20 @@ add_custom_command (
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10)
add_list1_option(S1AP_RELEASE R10 "S1AP ASN.1 grammar version" R8 R9 R10)
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
if (${S1AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R10.5)
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10")
elseif (${S1AP_VERSION} STREQUAL "R9")
set (ASN1RELDIR R9.8)
add_definitions("-DUPDATE_RELEASE_9")
else(${S1AP_VERSION} STREQUAL "R8")
if (${S1AP_RELEASE} STREQUAL "R8")
make_version(S1AP_VERSION 8 10 0)
set (ASN1RELDIR R8.10)
endif(${S1AP_VERSION} STREQUAL "R10")
elseif (${S1AP_RELEASE} STREQUAL "R9")
make_version(S1AP_VERSION 9 8 0)
set (ASN1RELDIR R9.8)
elseif (${S1AP_RELEASE} STREQUAL "R10")
make_version(S1AP_VERSION 10 5 0)
set (ASN1RELDIR R10.5)
endif(${S1AP_RELEASE} STREQUAL "R8")
add_definitions(-DS1AP_VERSION=${S1AP_VERSION})
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
......@@ -351,7 +366,7 @@ set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-IEs.asn
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR})
#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
RESULT_VARIABLE ret)
......@@ -363,7 +378,7 @@ execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1A
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
......@@ -384,7 +399,7 @@ add_custom_command (
OUTPUT ${S1AP_OAI_generated}
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
DEPENDS ${S1AP_ASN_FILES}
)
add_library(S1AP_LIB
......@@ -418,13 +433,16 @@ add_library(S1AP_ENB
# Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11)
add_list1_option(X2AP_RELEASE R11 "X2AP ASN.1 grammar version" R10 R11)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11")
set (ASN1RELDIR R11.2)
elseif (${X2AP_VERSION} STREQUAL "R10")
if (${X2AP_RELEASE} STREQUAL "R10")
make_version(S1AP_VERSION 10 0 0)
set (ASN1RELDIR R.UNKNOWN)
endif(${X2AP_VERSION} STREQUAL "R11")
elseif (${X2AP_RELEASE} STREQUAL "R11")
make_version(S1AP_VERSION 11 2 0)
set (ASN1RELDIR R11.2)
endif(${X2AP_RELEASE} STREQUAL "R10")
add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
......@@ -434,7 +452,7 @@ set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-Containers.asn
)
set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR})
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
RESULT_VARIABLE ret)
......@@ -446,7 +464,7 @@ execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_RELEASE}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
......@@ -467,7 +485,7 @@ add_custom_command (
OUTPUT ${X2AP_OAI_generated}
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_RELEASE}
DEPENDS ${X2AP_ASN_FILES}
)
......@@ -2350,7 +2368,7 @@ endforeach()
# castxml doesn't work with c11 (gcc 5 default)
# force castxml and clang compilation with gnu89 standard
# we can't use cXX standard as pthread_rwlock_t is gnu standard
list(APPEND itti_compiler_options "-std=gnu89")
list(APPEND itti_compiler_options "-std=gnu89;-D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
if(EXISTS /usr/bin/gccxml)
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
......
......@@ -32,7 +32,7 @@
#include "PHICH-Config.h"
#include "MBSFN-SubframeConfigList.h"
#include "MobilityControlInfo.h"
#if defined(Rel10) || defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
#include "SCellToAddMod-r10.h"
#endif
/** @addtogroup _PHY_STRUCTURES_
......@@ -349,7 +349,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
uint32_t perfect_ce);
#if defined(Rel10) || defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10,
......
......@@ -33,7 +33,7 @@
//#include "TDD-Config.h"
//#include "MBSFN-SubframeConfigList.h"
//#include "MobilityControlInfo.h"
//#if defined(Rel10) || defined(Rel14)
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//#include "SCellToAddMod-r10.h"
//#endif
......
......@@ -179,7 +179,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
fp->prach_emtc_config_common.prach_Config_enabled=1;
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
......@@ -750,7 +750,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
#endif
int i, UE_id;
......@@ -846,7 +846,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
prach_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*));
// PRACH BR
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) );
// assume maximum of 64 RX antennas for PRACH receiver
......@@ -914,7 +914,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
#endif
int i, UE_id;
......@@ -947,7 +947,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
free_and_zero(prach_vars->prach_ifft[0]);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
for (int ce_level = 0; ce_level < 4; ce_level++) {
for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
free_and_zero(prach_vars_br->prach_ifft[ce_level]);
......
......@@ -99,7 +99,7 @@ int phy_init_RU(RU_t *ru) {
for (i=0; i<ru->nb_rx; i++) {
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
for (j=0;j<4;j++) {
ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
......@@ -177,7 +177,7 @@ void phy_free_RU(RU_t *ru)
for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[i]);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
#endif
}
......
......@@ -340,7 +340,7 @@ void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n
}
#if defined(Rel10) || defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10,
......
......@@ -219,7 +219,7 @@ uint8_t *generate_dci0(uint8_t *dci,
(aggregation_level==2) ||
(aggregation_level==4) ||
(aggregation_level==8)
#ifdef Rel14 // Added for EPDCCH/MPDCCH
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH
||
(aggregation_level==16) ||
(aggregation_level==24) ||
......
......@@ -254,7 +254,7 @@ typedef struct {
uint8_t decode_phich;
} LTE_UL_UE_HARQ_t;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
typedef enum {
CEmodeA = 0,
CEmodeB = 1
......@@ -302,7 +302,7 @@ typedef struct {
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag;
/// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling
......@@ -534,7 +534,7 @@ typedef enum {
HARQ_SR_CQI
} UCI_type_t;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
typedef enum {
NOCE,
CEMODEA,
......@@ -572,7 +572,7 @@ typedef struct {
uint8_t tdd_bundling;
/// Received Energy
uint32_t stat;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// non BL/CE, CEmodeA, CEmodeB
UE_type_t ue_type;
/// Indicates the symbols that are left empty due to eMTC retuning.
......
......@@ -87,7 +87,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
// Rule for accumulation of subframes for BL/CE UEs
uint8_t Nacc=4;
uint16_t j0,j,idelta;
......@@ -110,7 +110,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
// reset = 1;
// x1 is set in lte_gold_generic
if (mbsfn_flag == 0) {
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (dlsch->i0 != 0xFFFF) {
// rule for BL/CE UEs from Section 6.3.1 in 36.211
x2= (dlsch->rnti<<14) + (q<<13) + ((((j0+j)*Nacc)%10)<<9) + frame_parms->Nid_cell;
......@@ -124,7 +124,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
}
#ifdef DEBUG_SCRAMBLING
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
#else
printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
......
......@@ -46,7 +46,7 @@
//#define DEBUG_DCI_DECODING 1
//#define DEBUG_PHY
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) {
}
......
......@@ -47,7 +47,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
int32_t **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
#endif
void *tx_buffer = ru->ifbuffer.tx[subframe&1];
......@@ -221,7 +221,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
int16_t *rxF;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0];
else
......@@ -262,7 +262,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
int32_t **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
#endif
void *rx_buffer = ru->ifbuffer.rx;
......@@ -359,7 +359,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
int16_t *rxF;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (*packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][0][0];
else
......
......@@ -586,7 +586,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int i;
for (i=0;i<4;i++) {
......@@ -1089,7 +1089,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
}
//__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
#ifndef Rel14
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
#define rx_prach0 rx_prach
#endif
......@@ -1100,7 +1100,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t *max_preamble_delay,
uint16_t Nf,
uint8_t tdd_mapindex
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,uint8_t br_flag,
uint8_t ce_level
#endif
......@@ -1150,7 +1150,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
int32_t *prach_ifft=(int32_t*)NULL;
int32_t **prach_ifftp=(int32_t **)NULL;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int prach_ifft_cnt=0;
#endif
#ifdef PRACH_DEBUG
......@@ -1169,7 +1169,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
frame_type = fp->frame_type;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) {
AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1,
"emtc prach_Config is not enabled\n");
......@@ -1204,7 +1204,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t N_ZC = (prach_fmt <4)?839:139;
if (eNB) {
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) {
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
#ifdef PRACH_DEBUG
......@@ -1238,7 +1238,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
}
else {
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) {
#ifdef PRACH_DEBUG
frame = ru->proc.frame_prach_br;
......@@ -1501,7 +1501,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) {
/// **** send_IF4 of rxsigF to RAU **** ///
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level);
else
......@@ -1644,7 +1644,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (new_dft == 1) {
new_dft = 0;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) {
Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx];
prach_ifft = prach_ifftp[prach_ifft_cnt++];
......@@ -1701,7 +1701,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
} // new dft
// check energy in nth time shift, for
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if ((br_flag==0) ||
(eNB->prach_vars_br.repetition_number[ce_level]==
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]))
......@@ -1768,7 +1768,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
void rx_prach(PHY_VARS_eNB *eNB,
RU_t *ru,
......@@ -1810,7 +1810,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
}
}
#endif /* Rel14 */
#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */
void init_prach_tables(int N_ZC)
{
......
......@@ -507,7 +507,7 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]);
#if defined(Rel10) || defined(Rel14)
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
int i=0;
//len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", ue->dlsch_mch_received[0]);
......
......@@ -2183,7 +2183,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t Nf, uint8_t tdd_mapindex
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,
uint8_t br_flag
#endif
......
......@@ -316,7 +316,7 @@ typedef struct RU_proc_t_s {
int subframe_tx;
/// subframe to act upon for reception of prach
int subframe_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// subframe to act upon for reception of prach BL/CE UEs
int subframe_prach_br;
#endif
......@@ -328,7 +328,7 @@ typedef struct RU_proc_t_s {
int frame_tx_unwrap;
/// frame to act upon for reception of prach
int frame_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// frame to act upon for reception of prach
int frame_prach_br;
#endif
......@@ -340,7 +340,7 @@ typedef struct RU_proc_t_s {
int instance_cnt_FH1;
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach_br;
#endif
......@@ -362,7 +362,7 @@ typedef struct RU_proc_t_s {
pthread_t pthread_FH1;
/// pthread structure for RU prach processing thread
pthread_t pthread_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// pthread structure for RU prach processing thread BL/CE UEs
pthread_t pthread_prach_br;
#endif
......@@ -385,7 +385,7 @@ typedef struct RU_proc_t_s {
pthread_attr_t attr_FH1;
/// pthread attributes for RU prach
pthread_attr_t attr_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// pthread attributes for RU prach BL/CE UEs
pthread_attr_t attr_prach_br;
#endif
......@@ -404,7 +404,7 @@ typedef struct RU_proc_t_s {
struct sched_param sched_param_FH1;
/// scheduling parameters for RU prach thread
struct sched_param sched_param_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// scheduling parameters for RU prach thread BL/CE UEs
struct sched_param sched_param_prach_br;
#endif
......@@ -417,7 +417,7 @@ typedef struct RU_proc_t_s {
pthread_cond_t cond_FH1;
/// condition variable for RU prach thread
pthread_cond_t cond_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// condition variable for RU prach thread BL/CE UEs
pthread_cond_t cond_prach_br;
#endif
......@@ -438,7 +438,7 @@ typedef struct RU_proc_t_s {
pthread_mutex_t mutex_FH1;
/// mutex for RU prach
pthread_mutex_t mutex_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// mutex for RU prach BL/CE UEs
pthread_mutex_t mutex_prach_br;
#endif
......@@ -479,7 +479,7 @@ typedef struct eNB_proc_t_s {
int subframe_rx;
/// subframe to act upon for PRACH
int subframe_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// subframe to act upon for reception of prach BL/CE UEs
int subframe_prach_br;
#endif
......@@ -489,7 +489,7 @@ typedef struct eNB_proc_t_s {
int frame_tx;
/// frame to act upon for PRACH
int frame_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// frame to act upon for PRACH BL/CE UEs
int frame_prach_br;
#endif
......@@ -499,7 +499,7 @@ typedef struct eNB_proc_t_s {
//int instance_cnt_te[3];
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// \internal This variable is protected by \ref mutex_prach for BL/CE UEs.
int instance_cnt_prach_br;
#endif
......@@ -523,7 +523,7 @@ typedef struct eNB_proc_t_s {
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// pthread attributes for prach processing thread BL/CE UEs
pthread_attr_t attr_prach_br;
#endif
......@@ -537,7 +537,7 @@ typedef struct eNB_proc_t_s {
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
struct sched_param sched_param_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// scheduling parameters for prach thread
struct sched_param sched_param_prach_br;
#endif
......@@ -549,7 +549,7 @@ typedef struct eNB_proc_t_s {
//pthread_t pthread_te[3];
/// pthread structure for PRACH thread
pthread_t pthread_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// pthread structure for PRACH thread BL/CE UEs
pthread_t pthread_prach_br;
#endif
......@@ -559,7 +559,7 @@ typedef struct eNB_proc_t_s {
//pthread_cond_t cond_te[3];
/// condition variable for PRACH processing thread;
pthread_cond_t cond_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// condition variable for PRACH processing thread BL/CE UEs;
pthread_cond_t cond_prach_br;
#endif
......@@ -571,7 +571,7 @@ typedef struct eNB_proc_t_s {
//pthread_mutex_t mutex_te[3];
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// mutex for PRACH thread for BL/CE UEs
pthread_mutex_t mutex_prach_br;
#endif
......@@ -587,7 +587,7 @@ typedef struct eNB_proc_t_s {
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach_br;
#endif
......@@ -792,7 +792,7 @@ typedef struct RU_t_s{
int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru);
/// function pointer to wakeup routine in lte-enb.
void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// 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
......@@ -1025,14 +1025,14 @@ typedef struct PHY_VARS_eNB_s {
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];
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// NFAPI PRACH information BL/CE UEs
nfapi_preamble_pdu_t preamble_list_br[MAX_NUM_RX_PRACH_PREAMBLES];
#endif
Sched_Rsp_t Sched_INFO;
LTE_eNB_PDCCH pdcch_vars[2];
LTE_eNB_PHICH phich_vars[2];
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
LTE_eNB_EPDCCH epdcch_vars[2];
LTE_eNB_MPDCCH mpdcch_vars[2];
LTE_eNB_PRACH prach_vars_br;
......@@ -1064,7 +1064,7 @@ typedef struct PHY_VARS_eNB_s {
uint32_t lte_gold_mbsfn_table[10][3][42];
uint32_t X_u[64][839];
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t X_u_br[4][64][839];
#endif
uint8_t pbch_configured;
......@@ -1642,7 +1642,7 @@ typedef struct RRU_config_s {
int prach_FreqOffset[MAX_BANDS_PER_RRU];
/// prach_ConfigIndex for IF4p5
int prach_ConfigIndex[MAX_BANDS_PER_RRU];
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4];
/// emtc_prach_FreqOffset for IF4p5 per CE Level
int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4];
......
......@@ -427,7 +427,7 @@ typedef struct eNB_proc_NB_IoT_t_s {
int RU_mask;
/// mask for RUs serving nbiot (PRACH)
int RU_mask_prach;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach_br;
#endif
......
......@@ -118,7 +118,7 @@ typedef struct {
PRACH_CONFIG_INFO prach_ConfigInfo;
} PRACH_CONFIG_COMMON;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// PRACH-eMTC-Config from 36.331 RRC spec
typedef struct {
......@@ -151,7 +151,7 @@ typedef struct {
/// prach_Config_enabled=1 means enabled. \vr{[0..1]}
uint8_t prach_Config_enabled;
/// PRACH Configuration Information
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
PRACH_eMTC_CONFIG_INFO prach_ConfigInfo;
#endif
} PRACH_eMTC_CONFIG_COMMON;
......@@ -603,7 +603,7 @@ typedef struct {
uint8_t nb_antenna_ports_eNB;
/// PRACH_CONFIG
PRACH_CONFIG_COMMON prach_config_common;
#ifdef Rel14
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// PRACH_eMTC_CONFIG
PRACH_eMTC_CONFIG_COMMON prach_emtc_config_common;</