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) ...@@ -113,6 +113,14 @@ macro(add_list_string_option name val helpstr)
add_definitions("-D${name}=\"${value}\"") add_definitions("-D${name}=\"${value}\"")
endif() endif()
endmacro(add_list_string_option) 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 # compilation flags
############################################# #############################################
...@@ -162,7 +170,7 @@ set(CMAKE_C_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 ") "${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! # add autotools definitions that were maybe used!
set(CMAKE_C_FLAGS 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 set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 " "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
...@@ -284,16 +292,21 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) ...@@ -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") add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8") 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) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA") 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) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10") 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) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
else() else()
make_version(RRC_VERSION 14 3 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8") endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
add_definitions(-DRRC_VERSION=${RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION}) set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call}) if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" ) message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call}) endif(NOT EXISTS ${asn1c_call})
...@@ -332,18 +345,20 @@ add_custom_command ( ...@@ -332,18 +345,20 @@ add_custom_command (
# Same limitation as described in RRC: unknown generated file list # Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time # 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) set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
if (${S1AP_VERSION} STREQUAL "R10") if (${S1AP_RELEASE} STREQUAL "R8")
set (ASN1RELDIR R10.5) make_version(S1AP_VERSION 8 10 0)
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")
set (ASN1RELDIR R8.10) 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_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn ${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
...@@ -351,7 +366,7 @@ set(S1AP_ASN_FILES ...@@ -351,7 +366,7 @@ set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-IEs.asn ${S1AP_ASN_DIR}/S1AP-IEs.asn
${S1AP_ASN_DIR}/S1AP-PDU.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}") #message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
RESULT_VARIABLE ret) RESULT_VARIABLE ret)
...@@ -363,7 +378,7 @@ execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1A ...@@ -363,7 +378,7 @@ execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1A
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error") message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0) 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) RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error") message(FATAL_ERROR "${fix_asn1c_call}: error")
...@@ -384,7 +399,7 @@ add_custom_command ( ...@@ -384,7 +399,7 @@ add_custom_command (
OUTPUT ${S1AP_OAI_generated} OUTPUT ${S1AP_OAI_generated}
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} 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 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} DEPENDS ${S1AP_ASN_FILES}
) )
add_library(S1AP_LIB add_library(S1AP_LIB
...@@ -418,13 +433,16 @@ add_library(S1AP_ENB ...@@ -418,13 +433,16 @@ add_library(S1AP_ENB
# Same limitation as described in RRC/S1AP: unknown generated file list # Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time # 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) set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11") if (${X2AP_RELEASE} STREQUAL "R10")
set (ASN1RELDIR R11.2) make_version(S1AP_VERSION 10 0 0)
elseif (${X2AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R.UNKNOWN) 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_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(X2AP_ASN_FILES set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn ${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
...@@ -434,7 +452,7 @@ set(X2AP_ASN_FILES ...@@ -434,7 +452,7 @@ set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-Containers.asn ${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}") #message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES} execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
RESULT_VARIABLE ret) RESULT_VARIABLE ret)
...@@ -446,7 +464,7 @@ execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2 ...@@ -446,7 +464,7 @@ execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error") message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0) 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) RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error") message(FATAL_ERROR "${fix_asn1c_call}: error")
...@@ -467,7 +485,7 @@ add_custom_command ( ...@@ -467,7 +485,7 @@ add_custom_command (
OUTPUT ${X2AP_OAI_generated} OUTPUT ${X2AP_OAI_generated}
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES} 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 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} DEPENDS ${X2AP_ASN_FILES}
) )
...@@ -2350,7 +2368,7 @@ endforeach() ...@@ -2350,7 +2368,7 @@ endforeach()
# castxml doesn't work with c11 (gcc 5 default) # castxml doesn't work with c11 (gcc 5 default)
# force castxml and clang compilation with gnu89 standard # force castxml and clang compilation with gnu89 standard
# we can't use cXX standard as pthread_rwlock_t is gnu 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) set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
if(EXISTS /usr/bin/gccxml) if(EXISTS /usr/bin/gccxml)
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H}) set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "PHICH-Config.h" #include "PHICH-Config.h"
#include "MBSFN-SubframeConfigList.h" #include "MBSFN-SubframeConfigList.h"
#include "MobilityControlInfo.h" #include "MobilityControlInfo.h"
#if defined(Rel10) || defined(Rel14) #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
#include "SCellToAddMod-r10.h" #include "SCellToAddMod-r10.h"
#endif #endif
/** @addtogroup _PHY_STRUCTURES_ /** @addtogroup _PHY_STRUCTURES_
...@@ -349,7 +349,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp, ...@@ -349,7 +349,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
uint32_t perfect_ce); 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, void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint8_t eNB_index, uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10, SCellToAddMod_r10_t *sCellToAddMod_r10,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
//#include "TDD-Config.h" //#include "TDD-Config.h"
//#include "MBSFN-SubframeConfigList.h" //#include "MBSFN-SubframeConfigList.h"
//#include "MobilityControlInfo.h" //#include "MobilityControlInfo.h"
//#if defined(Rel10) || defined(Rel14) //#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//#include "SCellToAddMod-r10.h" //#include "SCellToAddMod-r10.h"
//#endif //#endif
......
...@@ -179,7 +179,7 @@ void phy_config_request(PHY_Config_t *phy_config) { ...@@ -179,7 +179,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
fp->frame_type, fp->frame_type,
RC.eNB[Mod_id][CC_id]->X_u); 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.prach_Config_enabled=1;
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value; 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, ...@@ -750,7 +750,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars; LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_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; LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
#endif #endif
int i, UE_id; int i, UE_id;
...@@ -846,7 +846,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -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_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*));
// PRACH BR // 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) ); prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) );
// assume maximum of 64 RX antennas for PRACH receiver // assume maximum of 64 RX antennas for PRACH receiver
...@@ -914,7 +914,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) ...@@ -914,7 +914,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars; LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_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; LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
#endif #endif
int i, UE_id; int i, UE_id;
...@@ -947,7 +947,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) ...@@ -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]); for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
free_and_zero(prach_vars->prach_ifft[0]); 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 (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]); 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]); free_and_zero(prach_vars_br->prach_ifft[ce_level]);
......
...@@ -99,7 +99,7 @@ int phy_init_RU(RU_t *ru) { ...@@ -99,7 +99,7 @@ int phy_init_RU(RU_t *ru) {
for (i=0; i<ru->nb_rx; i++) { 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) ); 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]); 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++) { 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) ); 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]); 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) ...@@ -177,7 +177,7 @@ void phy_free_RU(RU_t *ru)
for (i = 0; i < ru->nb_rx; i++) { for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[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]); for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
#endif #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 ...@@ -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, void phy_config_dedicated_scell_ue(uint8_t Mod_id,
uint8_t eNB_index, uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10, SCellToAddMod_r10_t *sCellToAddMod_r10,
......
...@@ -219,7 +219,7 @@ uint8_t *generate_dci0(uint8_t *dci, ...@@ -219,7 +219,7 @@ uint8_t *generate_dci0(uint8_t *dci,
(aggregation_level==2) || (aggregation_level==2) ||
(aggregation_level==4) || (aggregation_level==4) ||
(aggregation_level==8) (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==16) ||
(aggregation_level==24) || (aggregation_level==24) ||
......
...@@ -254,7 +254,7 @@ typedef struct { ...@@ -254,7 +254,7 @@ typedef struct {
uint8_t decode_phich; uint8_t decode_phich;
} LTE_UL_UE_HARQ_t; } LTE_UL_UE_HARQ_t;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
typedef enum { typedef enum {
CEmodeA = 0, CEmodeA = 0,
CEmodeB = 1 CEmodeB = 1
...@@ -302,7 +302,7 @@ typedef struct { ...@@ -302,7 +302,7 @@ typedef struct {
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b; 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 /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag; uint8_t sib1_br_flag;
/// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling /// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling
...@@ -534,7 +534,7 @@ typedef enum { ...@@ -534,7 +534,7 @@ typedef enum {
HARQ_SR_CQI HARQ_SR_CQI
} UCI_type_t; } UCI_type_t;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
typedef enum { typedef enum {
NOCE, NOCE,
CEMODEA, CEMODEA,
...@@ -572,7 +572,7 @@ typedef struct { ...@@ -572,7 +572,7 @@ typedef struct {
uint8_t tdd_bundling; uint8_t tdd_bundling;
/// Received Energy /// Received Energy
uint32_t stat; uint32_t stat;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// non BL/CE, CEmodeA, CEmodeB /// non BL/CE, CEmodeA, CEmodeB
UE_type_t ue_type; UE_type_t ue_type;
/// Indicates the symbols that are left empty due to eMTC retuning. /// Indicates the symbols that are left empty due to eMTC retuning.
......
...@@ -87,7 +87,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -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); 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 // Rule for accumulation of subframes for BL/CE UEs
uint8_t Nacc=4; uint8_t Nacc=4;
uint16_t j0,j,idelta; uint16_t j0,j,idelta;
...@@ -110,7 +110,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -110,7 +110,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
// reset = 1; // reset = 1;
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
if (mbsfn_flag == 0) { if (mbsfn_flag == 0) {
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (dlsch->i0 != 0xFFFF) { if (dlsch->i0 != 0xFFFF) {
// rule for BL/CE UEs from Section 6.3.1 in 36.211 // 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; 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, ...@@ -124,7 +124,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
} }
#ifdef DEBUG_SCRAMBLING #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); 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 #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); 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 @@ ...@@ -46,7 +46,7 @@
//#define DEBUG_DCI_DECODING 1 //#define DEBUG_DCI_DECODING 1
//#define DEBUG_PHY //#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) { 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) { ...@@ -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 **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF; int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF; 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; int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
#endif #endif
void *tx_buffer = ru->ifbuffer.tx[subframe&1]; 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) { ...@@ -221,7 +221,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
int16_t *rxF; int16_t *rxF;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (packet_type > IF4p5_PRACH) if (packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0]; rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0];
else else
...@@ -262,7 +262,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint ...@@ -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 **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF; int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF; 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; int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
#endif #endif
void *rx_buffer = ru->ifbuffer.rx; 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 ...@@ -359,7 +359,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
int16_t *rxF; int16_t *rxF;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (*packet_type > IF4p5_PRACH) if (*packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][0][0]; rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][0][0];
else else
......
...@@ -586,7 +586,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su ...@@ -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; 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); int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int i; int i;
for (i=0;i<4;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 ...@@ -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; //__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
#ifndef Rel14 #if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
#define rx_prach0 rx_prach #define rx_prach0 rx_prach
#endif #endif
...@@ -1100,7 +1100,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1100,7 +1100,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t *max_preamble_delay, uint16_t *max_preamble_delay,
uint16_t Nf, uint16_t Nf,
uint8_t tdd_mapindex uint8_t tdd_mapindex
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,uint8_t br_flag, ,uint8_t br_flag,
uint8_t ce_level uint8_t ce_level
#endif #endif
...@@ -1150,7 +1150,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1150,7 +1150,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32))); int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
int32_t *prach_ifft=(int32_t*)NULL; int32_t *prach_ifft=(int32_t*)NULL;
int32_t **prach_ifftp=(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; int prach_ifft_cnt=0;
#endif #endif
#ifdef PRACH_DEBUG #ifdef PRACH_DEBUG
...@@ -1169,7 +1169,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1169,7 +1169,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
frame_type = fp->frame_type; frame_type = fp->frame_type;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) { if (br_flag == 1) {
AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1, AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1,
"emtc prach_Config is not enabled\n"); "emtc prach_Config is not enabled\n");
...@@ -1204,7 +1204,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1204,7 +1204,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t N_ZC = (prach_fmt <4)?839:139; uint16_t N_ZC = (prach_fmt <4)?839:139;
if (eNB) { if (eNB) {
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) { if (br_flag == 1) {
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level]; prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
#ifdef PRACH_DEBUG #ifdef PRACH_DEBUG
...@@ -1238,7 +1238,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1238,7 +1238,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
} }
} }
else { else {
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) { if (br_flag == 1) {
#ifdef PRACH_DEBUG #ifdef PRACH_DEBUG
frame = ru->proc.frame_prach_br; frame = ru->proc.frame_prach_br;
...@@ -1501,7 +1501,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1501,7 +1501,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) { if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) {
/// **** send_IF4 of rxsigF to RAU **** /// /// **** 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); if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level);
else else
...@@ -1644,7 +1644,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1644,7 +1644,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
if (new_dft == 1) { if (new_dft == 1) {
new_dft = 0; new_dft = 0;
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag == 1) { if (br_flag == 1) {
Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx]; Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx];
prach_ifft = prach_ifftp[prach_ifft_cnt++]; prach_ifft = prach_ifftp[prach_ifft_cnt++];
...@@ -1701,7 +1701,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, ...@@ -1701,7 +1701,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
} // new dft } // new dft
// check energy in nth time shift, for // check energy in nth time shift, for
#ifdef Rel14 #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if ((br_flag==0) || if ((br_flag==0) ||
(eNB->prach_vars_br.repetition_number[ce_level]== (eNB->prach_vars_br.repetition_number[ce_level]==
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[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, ...@@ -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,